Files
ss-tools/specs/038-dashboard-scenario-model/contracts/modules.md
busya 31b9a19a0c chore: commit remaining workspace updates
Agent:
- lifecycle: run tracking, middleware hardening, langgraph setup
- tests: agent lifecycle + langgraph setup coverage

Backend:
- async_job_runner: resilience hardening, tests
- agent_conversations: run lifecycle integration
- translate: scheduler + orchestrator SQL adjustments
- schemas/services: agent_lifecycle model extensions

Frontend:
- TaskDrawer: UX improvements
- TaskLogPanel/Viewer: safety hardening, i18n (en/ru)
- FilterBar: report filters contract + tests
- Reports page: layout adjustments

Specs:
- 036-agent-test-stabilization: runs contract, modules, events
- 037-superset-baseline-engine: catalog schema, testing API, modules
- 038-dashboard-scenario-model: scenario schema, capture profile, modules
- 039-dashboard-scenario-ui: screen models, release verification UX, modules
- dashboard-verification-usecases: new cross-cutting spec
2026-07-17 19:11:09 +03:00

10 KiB
Raw Blame History

#region DashboardScenarioModel.Modules [C:5] [TYPE ADR] [SEMANTICS contracts,scenario,graph,validator,compiler] @BRIEF C3+ contracts for checklist mapping, deterministic graph compilation, validation, resolution, serialization, and safe draft packs. @RELATION DEPENDS_ON -> [DashboardScenarioModel.DataModel] @RELATION DEPENDS_ON -> [DashboardScenarioModel.ChecklistCatalog] @RELATION DEPENDS_ON -> [SupersetBaselineEngine.Modules] @RELATION DEPENDS_ON -> [AgentRuns.Artifacts.Register]

#region ScenarioGraph.Api [C:4] [TYPE Module] [SEMANTICS scenario,api,compile,validate]

@defgroup ScenarioGraph REST surface for compile, validate, resolve, and draft-pack operations.

@LAYER API

@RELATION DEPENDS_ON -> [ScenarioGraph.Compiler]

@RELATION DEPENDS_ON -> [ScenarioGraph.Validator]

@RELATION DEPENDS_ON -> [ScenarioGraph.Resolver]

@RELATION DEPENDS_ON -> [ScenarioGraph.PackCompiler]

@INVARIANT Request schemas forbid executable code, SQL, raw baseline values, and local paths.

#endregion ScenarioGraph.Api

#region ScenarioGraph.Catalog.Load [C:4] [TYPE Function] [SEMANTICS scenario,checklist,catalog,version]

@ingroup ScenarioGraph

@BRIEF Load the versioned 19-case declarative catalog and validate ids/capability/template references.

@PRE Bundled catalog version is supported.

@POST Returns exactly B01B09, C01C07, T01T03 in stable order.

@SIDE_EFFECT Bounded package-resource read.

@DATA_CONTRACT CatalogResource -> ChecklistCase[19]

@INVARIANT Historic PDF outcomes are source notes, not expected values.

@TEST_EDGE missing_case -> startup/catalog validation failure.

@TEST_EDGE sql_template_for_technical_case -> rejected.

#endregion ScenarioGraph.Catalog.Load

#region ScenarioGraph.CapabilityMapper.Map [C:5] [TYPE Function] [SEMANTICS scenario,capability,mapping,coverage]

@ingroup ScenarioGraph

@BRIEF Classify every checklist case for a dashboard and select one allowed step template.

@PRE Query model, baseline summary, and capability registry validate.

@POST Every catalog case is automated, human_checkpoint, unsupported, or needs_context with rationale.

@SIDE_EFFECT None.

@DATA_CONTRACT ChecklistCase[] + DashboardCapabilities -> CapabilityMapping[]

@INVARIANT No case is dropped and no tool is selected outside its registered capabilities.

@TEST_EDGE xlsx_unavailable -> C04C06 manual/unsupported with rationale.

@TEST_EDGE technical_without_dataset_fields -> human checkpoint, no SQL.

#endregion ScenarioGraph.CapabilityMapper.Map

#region ScenarioGraph.Compiler.Compile [C:5] [TYPE Function] [SEMANTICS scenario,compiler,deterministic,dag]

@ingroup ScenarioGraph

@BRIEF Compile canonical inputs and mappings into a stable dashboard-specific DAG.

@PRE Intent, query model, catalog, baseline summary, and parameters have valid fingerprints.

@POST Same canonical inputs/compiler version yield byte-identical graph and stable ids/order.

@SIDE_EFFECT None.

@DATA_CONTRACT CompileScenarioRequest -> DashboardTestScenario

@INVARIANT Steps consume only context/parameter/baseline/earlier-step refs.

@TEST_INVARIANT Deterministic_Graph -> VERIFIED_BY: repeated_compile, shuffled_input_order.

@TEST_EDGE missing_selector -> NEEDS_SELECTOR step and save blocker.

@TEST_EDGE missing_baseline -> NEEDS_BASELINE; no embedded numeric truth.

@RATIONALE Rule/template compilation makes the agent a planner/explainer, not an executable-code generator.

@REJECTED LLM-generated ids/dependencies/code — non-deterministic and unsafe.

#endregion ScenarioGraph.Compiler.Compile

#region ScenarioGraph.Validator.Validate [C:5] [TYPE Function] [SEMANTICS scenario,validator,graph,safety]

@ingroup ScenarioGraph

@BRIEF Return complete deterministic findings for schema, DAG, refs, parameters, baselines, tools, safety, and coverage.

@PRE Candidate graph parses against supported schema version.

@POST Valid is true only with zero errors/blockers; findings are stably ordered and actionable.

@SIDE_EFFECT None.

@DATA_CONTRACT DashboardTestScenario -> ScenarioValidationResult

@INVARIANT Cycles, missing/duplicate refs, unregistered tools, SQL, raw metric truth, and path traversal block compilation.

@TEST_EDGE cycle -> error contains cycle path.

@TEST_EDGE duplicate_output -> both producer ids reported.

@TEST_EDGE raw_metric_expected -> forbidden baseline literal error.

@TEST_EDGE unreachable_step -> warning/error according to required coverage.

#endregion ScenarioGraph.Validator.Validate

#region ScenarioGraph.Resolver.Resolve [C:4] [TYPE Function] [SEMANTICS scenario,resolve,parameter,revision]

@ingroup ScenarioGraph

@BRIEF Apply typed parameter/selector/manual resolutions and emit an immutable scenario revision.

@PRE Base revision hash matches; changes target declared unresolved items.

@POST Unrelated step ids/order remain unchanged; new parent/revision hashes link revisions.

@SIDE_EFFECT None.

@DATA_CONTRACT ResolveScenarioRequest + BaseScenario -> DashboardTestScenario

@TEST_EDGE stale_base_revision -> 409.

@TEST_EDGE invalid_parameter_type -> 422.

@TEST_EDGE unrelated_graph_change -> invariant failure.

#endregion ScenarioGraph.Resolver.Resolve

#region ScenarioGraph.Serializer.Canonical [C:4] [TYPE Function] [SEMANTICS scenario,serialize,json,yaml]

@ingroup ScenarioGraph

@BRIEF Serialize graph to canonical JSON/YAML and compute revision hash.

@POST Key/order/decimal/date/newline rules are stable across runs; JSON and YAML represent equal domain data.

@SIDE_EFFECT None.

@DATA_CONTRACT DashboardTestScenario -> CanonicalBytes + SHA256

@TEST_EDGE shuffled_dicts -> identical bytes.

@TEST_EDGE timestamp_display_field -> excluded from revision identity.

#endregion ScenarioGraph.Serializer.Canonical

#region ScenarioGraph.PackCompiler.Generate [C:5] [TYPE Function] [SEMANTICS scenario,artifact,template,draft]

@ingroup ScenarioGraph

@BRIEF Generate a preview-only or save-eligible draft pack using registered versioned templates.

@PRE Scenario validation result available; template ids registered; target paths safe.

@POST Outputs match ArtifactPlan, contain no LLM executable bodies, and are registered as 036 drafts.

@SIDE_EFFECT Renders bounded templates and calls AgentRuns.Artifacts.Register.

@DATA_CONTRACT DashboardTestScenario + ValidationResult -> DraftPack

@INVARIANT Errors/unresolved required inputs make pack preview_only; direct code/path input is impossible.

@TEST_INVARIANT No_LLM_To_Code -> VERIFIED_BY: injected_code_field, template_registry_only.

@TEST_EDGE unknown_template -> blocked.

@TEST_EDGE path_traversal -> blocked before artifact registration.

@RATIONALE Versioned templates make generated behavior reviewable and reproducible.

@REJECTED Generate arbitrary Playwright/Python code then scan it — scanners cannot prove semantic safety.

#endregion ScenarioGraph.PackCompiler.Generate

#region ScenarioGraph.Capture.Dispatch [C:4] [TYPE Function] [SEMANTICS scenario,capture,screenshot,browser]

@ingroup ScenarioGraph

@BRIEF Execute screenshot capture steps through the 036 Evidence.Adapter bridge.

@PRE CaptureSpec is valid; dashboard and environment are accessible.

@POST ScreenshotEvidence DraftArtifact registered; evidence_captured event emitted.

@SIDE_EFFECT Browser capture via existing ScreenshotService; draft storage via AgentRuns.Artifacts.Register.

@DATA_CONTRACT ScreenshotCaptureSpec + AgentRun -> DraftArtifactRef[]

@RELATION DEPENDS_ON -> [AgentRuns.Evidence.Adapter]

@INVARIANT Step output refs link to artifact ids, not filesystem paths.

@TEST_EDGE capture_timeout -> step marked inconclusive; no artifact registered.

@TEST_EDGE masking_applied -> two artifacts: original + masked; step output refs masked.

#endregion ScenarioGraph.Capture.Dispatch

#region ScenarioGraph.Vlm.Analyze [C:4] [TYPE Function] [SEMANTICS scenario,vlm,analysis,finding]

@ingroup ScenarioGraph

@BRIEF Submit a masked screenshot to a configured VLM provider and return typed findings.

@PRE Screenshot artifact is valid (not invalid); VlmAnalysis profile is registered and current.

@POST Returns typed VlmFinding[] with model/prompt provenance; raw response stored under redaction.

@SIDE_EFFECT External VLM API call; raw response persisted as separate DraftArtifact.

@DATA_CONTRACT DraftArtifactRef + VlmAnalysis -> VlmFinding[]

@INVARIANT VLM findings are advisory observations, not deterministic assertions; they must not alter metric baseline truth.

@INVARIANT Prompt template version and hash are recorded per analysis; stale prompts block analysis.

@TEST_EDGE stale_prompt -> 422 with STALE_PROMPT code.

@TEST_EDGE vlm_timeout -> step inconclusive; existing findings retained.

@TEST_EDGE empty_response -> findings array empty; step status inconclusive with reason.

@RATIONALE Typed findings make VLM output auditable and reviewable; raw text would require parsing and is not reproducible.

@REJECTED Embedding VLM findings directly as assertion results — they are observations for human review, not deterministic pass/fail.

#endregion ScenarioGraph.Vlm.Analyze

#region ScenarioGraph.Human.Disposition [C:3] [TYPE Function] [SEMANTICS scenario,human,checkpoint,disposition]

@ingroup ScenarioGraph

@BRIEF Record human disposition on one or more VLM findings.

@PRE Human checkpoint step is active; finding ids are unresolved.

@POST Each finding disposition is set exactly once; step transitions according to policy.

@SIDE_EFFECT Audit record of disposition decision.

@DATA_CONTRACT HumanDispositionRequest -> ScenarioStep (updated)

@TEST_EDGE double_disposition -> 409.

@TEST_EDGE disposition_blank -> accepted for dismiss/inconclusive; confirm requires non-blank comment.

@INVARIANT Disposition never alters the scenario graph structure or step ordering.

#endregion ScenarioGraph.Human.Disposition

#region AgentChat.Tools.ScenarioGraph [C:4] [TYPE Module] [SEMANTICS scenario,agent,tools,compiler]

@defgroup ScenarioGraph Thin agent tools that submit bounded intent and display compiler/validator results.

@RELATION DEPENDS_ON -> [ScenarioGraph.Api]

@INVARIANT Agent cannot submit executable code, custom tool categories, raw expected metrics, or artifact paths.

#endregion AgentChat.Tools.ScenarioGraph

#endregion DashboardScenarioModel.Modules