Add Policy DSL Validator, Schema Exporter, and Simulation Smoke tools
- Implemented PolicyDslValidator with command-line options for strict mode and JSON output. - Created PolicySchemaExporter to generate JSON schemas for policy-related models. - Developed PolicySimulationSmoke tool to validate policy simulations against expected outcomes. - Added project files and necessary dependencies for each tool. - Ensured proper error handling and usage instructions across tools.
This commit is contained in:
@@ -232,6 +232,101 @@ Images are deduplicated and sorted by digest. Label keys are normalised to lower
|
||||
```
|
||||
|
||||
Metadata keys are lowercased, first‑writer wins (duplicates with different casing are ignored), and optional IDs (`scheduleId`, `runId`) are trimmed when empty. Use the canonical serializer when emitting events so audit digests remain reproducible.
|
||||
|
||||
#### 3.1.5 Run Summary (`run_summaries`)
|
||||
|
||||
Materialized view powering the Scheduler UI dashboards. Stores the latest roll-up per schedule/tenant, enabling quick “last run” banners and sparkline counters without scanning the full `runs` collection.
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"tenantId": "tenant-alpha",
|
||||
"scheduleId": "sch_20251018a",
|
||||
"updatedAt": "2025-10-18T22:10:10Z",
|
||||
"lastRun": {
|
||||
"runId": "run_20251018_0001",
|
||||
"trigger": "feedser",
|
||||
"state": "completed",
|
||||
"createdAt": "2025-10-18T22:03:14Z",
|
||||
"startedAt": "2025-10-18T22:03:20Z",
|
||||
"finishedAt": "2025-10-18T22:08:45Z",
|
||||
"stats": {
|
||||
"candidates": 1280,
|
||||
"deduped": 910,
|
||||
"queued": 0,
|
||||
"completed": 910,
|
||||
"deltas": 42,
|
||||
"newCriticals": 7,
|
||||
"newHigh": 11,
|
||||
"newMedium": 18,
|
||||
"newLow": 6
|
||||
},
|
||||
"error": null
|
||||
},
|
||||
"recent": [
|
||||
{
|
||||
"runId": "run_20251018_0001",
|
||||
"trigger": "feedser",
|
||||
"state": "completed",
|
||||
"createdAt": "2025-10-18T22:03:14Z",
|
||||
"startedAt": "2025-10-18T22:03:20Z",
|
||||
"finishedAt": "2025-10-18T22:08:45Z",
|
||||
"stats": {
|
||||
"candidates": 1280,
|
||||
"deduped": 910,
|
||||
"queued": 0,
|
||||
"completed": 910,
|
||||
"deltas": 42,
|
||||
"newCriticals": 7,
|
||||
"newHigh": 11,
|
||||
"newMedium": 18,
|
||||
"newLow": 6
|
||||
},
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"runId": "run_20251017_0003",
|
||||
"trigger": "cron",
|
||||
"state": "error",
|
||||
"createdAt": "2025-10-17T22:01:02Z",
|
||||
"startedAt": "2025-10-17T22:01:08Z",
|
||||
"finishedAt": "2025-10-17T22:04:11Z",
|
||||
"stats": {
|
||||
"candidates": 1040,
|
||||
"deduped": 812,
|
||||
"queued": 0,
|
||||
"completed": 640,
|
||||
"deltas": 18,
|
||||
"newCriticals": 2,
|
||||
"newHigh": 4,
|
||||
"newMedium": 7,
|
||||
"newLow": 3
|
||||
},
|
||||
"error": "scanner timeout"
|
||||
}
|
||||
],
|
||||
"counters": {
|
||||
"total": 3,
|
||||
"planning": 0,
|
||||
"queued": 0,
|
||||
"running": 0,
|
||||
"completed": 1,
|
||||
"error": 1,
|
||||
"cancelled": 1,
|
||||
"totalDeltas": 60,
|
||||
"totalNewCriticals": 9,
|
||||
"totalNewHigh": 15,
|
||||
"totalNewMedium": 25,
|
||||
"totalNewLow": 9
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `_id` combines `tenantId` and `scheduleId` (`tenant:schedule`).
|
||||
- `recent` contains the 20 most recent runs ordered by `createdAt` (UTC). Updates replace the existing entry for a run to respect state transitions.
|
||||
- `counters` aggregate over the retained window (20 runs) for quick trend indicators. Totals are recomputed after every update.
|
||||
- Schedulers should call the projection service after every run state change so the cache mirrors planner/runner progress.
|
||||
|
||||
Sample file: `samples/api/scheduler/run-summary.json`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user