Files
ss-tools/specs/038-dashboard-scenario-model/contracts/openapi.yaml

679 lines
27 KiB
YAML

openapi: "3.1.0"
info:
title: Dashboard Scenario Compiler API
version: "1.0.0"
description: >
OpenAPI 3.1 contract for feature 038 — deterministic ScenarioGraph compile,
validate, resolve, draft-pack (authoring-only). Runtime capture/VLM/disposition
are owned by 044 (see 044/contracts/openapi.yaml). 038 emits scenario_key + content_hash;
scenario_id (UUID) and revision_id (UUID) are assigned by 042 at Save.
servers:
- url: /api/dashboard-testing
description: superset-tools API gateway
tags:
- name: scenario
description: ScenarioGraph compile, validate, resolve, draft-pack
paths:
/scenarios/compile:
post:
operationId: compileDashboardScenario
tags: [scenario]
summary: Deterministically compile a dashboard goal into a ScenarioGraph
description: |
Combines bounded agent intent (objective, selected case ids) with the
dashboard query model, checklist catalog, baseline summary, capability
model, and parameters to produce a byte-stable DashboardTestScenario.
Requires [scenario.compile] role.
security:
- BearerAuth: [scenario.compile]
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CompileRequest"
examples:
valid:
$ref: "#/components/examples/CompileRequestValid"
responses:
"200":
description: Deterministic scenario plus validation summary
content:
application/json:
schema:
$ref: "#/components/schemas/ScenarioResponse"
examples:
compiled:
$ref: "#/components/examples/ScenarioResponseCompiled"
"401":
$ref: "#/components/responses/UnauthorizedError"
"403":
$ref: "#/components/responses/ForbiddenError"
"422":
$ref: "#/components/responses/ValidationError"
"429":
$ref: "#/components/responses/RateLimitError"
"500":
$ref: "#/components/responses/InternalError"
/scenarios/validate:
post:
operationId: validateDashboardScenario
tags: [scenario]
summary: Validate a candidate ScenarioGraph and return all findings
description: |
Pure validation of a candidate graph: schema, DAG, refs, parameters,
baselines, tools, SQL compilation, safety and checklist coverage.
SQL is allowed only as validated immutable SqlEvidenceSpec; arbitrary code remains forbidden.
security:
- BearerAuth: [scenario.compile]
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ScenarioGraphInput"
responses:
"200":
description: Complete validation findings
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationResult"
"401":
$ref: "#/components/responses/UnauthorizedError"
"422":
$ref: "#/components/responses/ValidationError"
"500":
$ref: "#/components/responses/InternalError"
/scenarios/{scenarioId}/resolve:
post:
operationId: resolveDashboardScenario
tags: [scenario]
summary: Apply typed parameter/selector/manual resolutions as a new compiled definition
description: |
Applies declared resolutions to an unresolved graph and emits a new
content_hash (immutable content lineage). Stale base content_hash is
rejected (409) — never silently merged.
security:
- BearerAuth: [scenario.resolve]
parameters:
- name: scenarioId
in: path
required: true
schema: { type: string }
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ResolveRequest"
responses:
"200":
description: New immutable revision
content:
application/json:
schema:
$ref: "#/components/schemas/ScenarioResponse"
"401":
$ref: "#/components/responses/UnauthorizedError"
"403":
$ref: "#/components/responses/ForbiddenError"
"409":
$ref: "#/components/responses/StaleRevisionError"
"422":
$ref: "#/components/responses/ValidationError"
"500":
$ref: "#/components/responses/InternalError"
/scenarios/{scenarioId}/draft-pack:
post:
operationId: compileScenarioDraftPack
tags: [scenario]
summary: Generate a preview_only or save_eligible draft pack from versioned templates
description: |
Compiles a valid graph through registered versioned templates. Any
validation error, NEEDS_SELECTOR, forbidden action, or unresolved
baseline makes the pack preview_only. Unbound required ParameterDefinitions
are run-preflight inputs and do not block saving. Save-eligible packs are
registered as 036 drafts. Idempotent per content_hash.
security:
- BearerAuth: [scenario.draft]
parameters:
- name: scenarioId
in: path
required: true
schema: { type: string }
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/DraftPackRequest"
responses:
"201":
description: Draft pack registered via feature 036
content:
application/json:
schema:
$ref: "#/components/schemas/DraftPack"
"200":
description: Idempotent replay — existing DraftPack for the same revision hash
content:
application/json:
schema:
$ref: "#/components/schemas/DraftPack"
"401":
$ref: "#/components/responses/UnauthorizedError"
"403":
$ref: "#/components/responses/ForbiddenError"
"409":
$ref: "#/components/responses/StaleRevisionError"
"422":
$ref: "#/components/responses/ValidationError"
"500":
$ref: "#/components/responses/InternalError"
/scenarios/{scenarioId}/capture:
post:
operationId: captureScenarioScreenshot
tags: [scenario]
deprecated: true
parameters: [{ name: scenarioId, in: path, required: true, schema: { type: string } }]
summary: MOVED TO 044 — runtime capture is owned by ScenarioExecution
description: |
Deprecated. 038 defines ScreenshotCaptureSpec only; runtime capture,
VLM, and disposition live in 044 (044/contracts/openapi.yaml),
targeting /scenario-runs/{run_id}/steps/{logical_step_id}/capture with
artifacts owner_type=scenario_run. This path is retained only for
backward compatibility of the authoring prototype and is not the
execution path.
responses:
"410":
$ref: "#/components/responses/Gone"
/scenarios/{scenarioId}/vlm:
post:
operationId: analyzeScenarioScreenshot
tags: [scenario]
deprecated: true
parameters: [{ name: scenarioId, in: path, required: true, schema: { type: string } }]
summary: MOVED TO 044 — runtime VLM is owned by ScenarioExecution
description: |
Deprecated. 038 defines VlmAnalysisSpec only; runtime VLM submission
and VlmFinding[] live in 044 (reusing Plugin.Service.LLMClient via
Services.LlmProvider.LLMProviderService).
responses:
"410":
$ref: "#/components/responses/Gone"
/scenarios/{scenarioId}/disposition:
post:
operationId: disposeVlmFindings
tags: [scenario]
deprecated: true
parameters: [{ name: scenarioId, in: path, required: true, schema: { type: string } }]
summary: MOVED TO 044 — human checkpoint disposition is owned by ScenarioExecution
description: |
Deprecated. 038 no longer owns human disposition; it is a 044
HumanCheckpoint (confirm | false_positive | inconclusive), distinct
from the 036 ActionApprovalGate.
responses:
"410":
$ref: "#/components/responses/Gone"
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: |
superset-tools JWT. Roles encoded in `roles` claim.
Required scopes: scenario.compile, scenario.resolve, scenario.draft,
scenario.execute (per ADR-0005 RBAC).
schemas:
ErrorEnvelope:
type: object
required: [error]
properties:
error:
type: object
required: [code, detail]
properties:
code: { type: string, example: "VALIDATION_ERROR" }
detail: { type: string }
fields:
type: object
additionalProperties: { type: string }
description: Per-field validation errors (422 only)
retry_after:
type: integer
description: Seconds until retry is allowed (429 only)
SuccessEnvelope:
type: object
required: [data]
properties:
data: {}
meta:
type: object
properties:
content_hash: { type: string }
CompileRequest:
type: object
additionalProperties: false
required: [objective, query_model, checklist_catalog_version, baseline_version, capabilities, parameters, change_request_context]
properties:
provenance:
type: object
description: Optional; compiler must not require an AgentRun.
properties:
source_type: { enum: [agent_run, editor, migration, api] }
source_id: { type: [string, "null"] }
objective:
type: object
required: [goal, selected_case_ids]
properties:
goal: { type: string, maxLength: 2000 }
selected_case_ids: { type: array, items: { type: string } }
rationale: { type: [string, "null"], maxLength: 4000 }
query_model: { type: object }
checklist_catalog_version: { const: 1 }
baseline_version: { type: string }
capabilities: { type: object }
parameters: { type: object }
change_request_context: { $ref: "#/components/schemas/ChangeRequestContext" }
ChangeRequestContext:
type: object
additionalProperties: false
required: [request_id, objective, acceptance_criteria]
properties:
request_id: { type: string }
objective: { type: string }
affected_dashboards: { type: array, items: { type: string } }
added_fields: { type: array, items: { type: string } }
removed_fields: { type: array, items: { type: string } }
renamed_fields: { type: array, items: { type: object } }
technical_details: { type: string }
requested_tables_charts: { type: array, items: { type: string } }
expected_business_behavior: { type: string }
related_dashboards: { type: array, items: { type: string } }
source_relations: { type: array, items: { type: string } }
acceptance_criteria: { type: array, minItems: 1, items: { type: string } }
control_totals: { type: object }
ScenarioGraphInput:
type: object
description: Candidate immutable Verification Program. SQL is allowed only as a validated SqlEvidenceSpec; arbitrary code, raw metric truth and unsafe paths are forbidden.
additionalProperties: false
required: [schema_version, scenario_key, dashboard_context, objective, verification_program, phases, steps]
properties:
schema_version: { type: integer }
scenario_key: { type: string }
dashboard_context: { type: object }
objective: { type: object }
change_request_context: { $ref: "#/components/schemas/ChangeRequestContext" }
verification_program: { $ref: "#/components/schemas/VerificationProgram" }
phases: { type: array, items: { type: string } }
steps: { type: array, items: { type: object } }
ScenarioResponse:
type: object
required: [scenario, validation]
properties:
scenario: { type: object }
validation: { $ref: "#/components/schemas/ValidationResult" }
VerificationProgram:
type: object
required: [navigation_program, evidence_program, transformation_program, assertion_program, semantic_evaluation_program]
properties:
navigation_program: { type: array, items: { type: object } }
evidence_program: { type: array, items: { oneOf: [{ type: object }, { $ref: "#/components/schemas/SqlEvidenceSpec" }] } }
transformation_program: { type: array, items: { $ref: "#/components/schemas/TransformSpec" } }
assertion_program: { type: array, items: { $ref: "#/components/schemas/ComparisonSpec" } }
semantic_evaluation_program: { type: array, items: { $ref: "#/components/schemas/AgentEvaluationSpec" } }
SqlEvidenceSpec:
type: object
required: [snippet_id, logical_step_id, connection_ref, database_identity, sql_template, sql_hash, parameter_definitions, expected_output_schema, relation_refs, execution_limits, generation_provenance, validation_result]
properties:
snippet_id: { type: string }
logical_step_id: { type: string }
connection_ref: { type: string }
database_identity: { type: string }
sql_template: { type: string, description: "Read-only saved template; immutable after revision save" }
sql_hash: { type: string, pattern: "^[a-f0-9]{64}$" }
parameter_definitions: { type: array, items: { type: object } }
expected_output_schema: { type: object }
relation_refs: { type: array, items: { type: string } }
execution_limits: { type: object, required: [timeout_ms, max_rows, max_bytes, max_complexity] }
generation_provenance: { type: object }
validation_result: { type: object, required: [valid] }
TransformSpec:
type: object
required: [logical_step_id, version, operations]
properties:
logical_step_id: { type: string }
version: { type: string }
operations: { type: array, items: { type: object, properties: { op: { type: string, enum: [select, filter, rename, cast, join, group_by, sum, count, distinct, coalesce, normalize_string, normalize_date, difference, ratio, tolerance_compare] } } } }
ComparisonSpec:
type: object
required: [logical_step_id, kind, left_ref, right_ref]
properties:
logical_step_id: { type: string }
kind: { type: string, enum: [numeric_equality, numeric_tolerance, row_comparison, column_comparison, aggregate_comparison, set_equality, field_mapping, null_fill_check, cross_dashboard] }
left_ref: { type: string }
right_ref: { type: string }
tolerance: { type: number }
field_mapping: { type: object }
AgentEvaluationSpec:
type: object
required: [spec_id, logical_step_id, provider_id, model_id, prompt_template_id, prompt_template_version, prompt_template_hash, input_manifest, evidence_refs, tool_allowlist, output_schema, decision_policy_id]
properties:
spec_id: { type: string }
logical_step_id: { type: string }
provider_id: { type: string }
model_id: { type: string }
prompt_template_id: { type: string }
prompt_template_version: { type: string }
prompt_template_hash: { type: string, pattern: "^[a-f0-9]{64}$" }
input_manifest: { type: object }
evidence_refs: { type: array, items: { type: string } }
tool_allowlist: { type: array, items: { type: string } }
output_schema: { type: object }
decision_policy_id: { type: string }
ValidationResult:
type: object
required: [valid, errors, warnings, blockers, coverage, topological_order, graph_hash]
properties:
valid: { type: boolean }
errors: { type: array, items: { type: object } }
warnings: { type: array, items: { type: object } }
blockers: { type: array, items: { type: object } }
coverage: { type: array, items: { type: object } }
topological_order: { type: array, items: { type: string } }
unresolved_parameters: { type: array, items: { type: string } }
unresolved_selectors: { type: array, items: { type: string } }
unresolved_baselines: { type: array, items: { type: string } }
graph_hash: { type: string }
sql_compilation_results: { type: array, items: { type: object } }
verification_program_valid: { type: boolean }
ResolveRequest:
type: object
additionalProperties: false
required: [base_content_hash, changes]
properties:
base_content_hash: { type: string, pattern: "^[a-f0-9]{64}$" }
changes:
type: array
items:
type: object
required: [kind, target, value]
properties:
kind: { enum: [parameter_definition, selector, manual_conversion, remove_step] }
target: { type: string }
value: {}
reason: { type: [string, "null"] }
DraftPackRequest:
type: object
additionalProperties: false
required: [content_hash]
properties:
content_hash: { type: string, pattern: "^[a-f0-9]{64}$" }
provenance:
type: object
properties:
source_type: { enum: [agent_run, editor, migration, api] }
source_id: { type: [string, "null"] }
DraftPack:
type: object
required: [scenario_key, content_hash, template_version, status, manifest, artifacts, validation_summary, warnings]
properties:
scenario_key: { type: string }
content_hash: { type: string }
template_version: { type: string }
status: { enum: [preview_only, save_eligible] }
manifest: { type: object }
artifacts: { type: array, items: { type: object } }
validation_summary: { $ref: "#/components/schemas/ValidationResult" }
warnings: { type: array, items: { type: object } }
CaptureRequest:
type: object
additionalProperties: false
required: [logical_step_id, capture_spec]
deprecated: true
description: Runtime capture moved to 044.
properties:
logical_step_id: { type: string }
capture_spec: { $ref: "#/components/schemas/CaptureSpec" }
provenance:
type: object
properties:
source_type: { enum: [agent_run, editor, migration, api] }
source_id: { type: [string, "null"] }
CaptureSpec:
type: object
required: [target, viewport, readiness, method]
properties:
target: { type: string, enum: [tab, viewport] }
tab_identifier: { type: [string, "null"] }
viewport:
type: object
required: [width, height]
properties:
width: { type: integer }
height: { type: integer }
readiness: { type: string, enum: [canvas_stabilized, network_idle, fixed_wait] }
readiness_timeout_ms: { type: integer, default: 15000 }
mask_selectors: { type: array, items: { type: string } }
method: { type: string, enum: [cdp, full_page, region] }
CaptureResponse:
type: object
required: [artifact_refs]
properties:
artifact_refs:
type: array
items:
type: object
required: [artifact_id, kind, masked]
properties:
artifact_id: { type: string, format: uuid }
kind: { type: string }
masked: { type: boolean }
VlmRequest:
type: object
additionalProperties: false
required: [logical_step_id, artifact_id, analysis]
deprecated: true
description: Runtime VLM moved to 044.
properties:
logical_step_id: { type: string }
artifact_id: { type: string, format: uuid }
analysis:
type: object
required: [profile_id, provider_id, model_id, prompt_template_id, prompt_version, prompt_template_hash]
properties:
profile_id: { type: string }
provider_id: { type: string }
model_id: { type: string }
prompt_template_id: { type: string }
prompt_version: { type: string }
prompt_template_hash: { type: string, pattern: "^[a-f0-9]{64}$" }
confidence_threshold: { type: number, minimum: 0, maximum: 1, default: 0.7 }
VlmResponse:
type: object
required: [findings]
properties:
findings:
type: array
items: { $ref: "#/components/schemas/VlmFinding" }
VlmFinding:
type: object
required: [finding_id, source_artifact_id, severity, code, confidence, description, disposition, model_provenance]
properties:
finding_id: { type: string }
source_artifact_id: { type: string, format: uuid }
severity: { type: string, enum: [info, warning, error] }
code: { type: string }
region:
type: object
properties:
selector: { type: string }
bounds: { type: object }
confidence: { type: number, minimum: 0, maximum: 1 }
description: { type: string, maxLength: 1000 }
disposition: { type: string, enum: [unresolved, confirmed, false_positive, inconclusive] }
disposition_comment: { type: [string, "null"], maxLength: 2000 }
model_provenance:
type: object
required: [model_id, prompt_version, prompt_template_hash, analyzed_at]
properties:
model_id: { type: string }
prompt_version: { type: string }
prompt_template_hash: { type: string, pattern: "^[a-f0-9]{64}$" }
analyzed_at: { type: string, format: date-time }
DispositionRequest:
type: object
additionalProperties: false
required: [logical_step_id, dispositions]
deprecated: true
description: "Human checkpoint disposition moved to 044 (HumanCheckpoint: confirm | false_positive | inconclusive)."
properties:
logical_step_id: { type: string }
dispositions:
type: array
items:
type: object
required: [finding_id, decision]
properties:
finding_id: { type: string }
decision: { enum: [confirm, false_positive, inconclusive] }
comment: { type: [string, "null"], maxLength: 2000 }
DispositionResponse:
type: object
required: [step]
properties:
step: { type: object }
responses:
UnauthorizedError:
description: Missing or invalid authentication
content:
application/json:
schema: { $ref: "#/components/schemas/ErrorEnvelope" }
example:
error: { code: "UNAUTHORIZED", detail: "Authentication required" }
ForbiddenError:
description: Insufficient permissions
content:
application/json:
schema: { $ref: "#/components/schemas/ErrorEnvelope" }
example:
error: { code: "FORBIDDEN", detail: "Requires role: scenario.compile" }
ValidationError:
description: Request validation failed
content:
application/json:
schema: { $ref: "#/components/schemas/ErrorEnvelope" }
example:
error: { code: "VALIDATION_ERROR", detail: "Request validation failed", fields: { objective: "goal is required" } }
StaleRevisionError:
description: Base revision is stale or already resolved
content:
application/json:
schema: { $ref: "#/components/schemas/ErrorEnvelope" }
example:
error: { code: "STALE_REVISION", detail: "Base revision b2c3… no longer current. Recompile from latest." }
StalePromptError:
description: VLM prompt template is stale
content:
application/json:
schema: { $ref: "#/components/schemas/ErrorEnvelope" }
example:
error: { code: "STALE_PROMPT", detail: "Prompt template v1 hash mismatch. Update to current template." }
Gone:
description: Runtime operation moved to 044
content:
application/json:
schema: { $ref: "#/components/schemas/ErrorEnvelope" }
example:
error: { code: "MOVED_TO_044", detail: "Runtime capture/VLM/disposition is owned by 044 ScenarioExecution." }
DoubleDispositionError:
description: Finding already disposed
content:
application/json:
schema: { $ref: "#/components/schemas/ErrorEnvelope" }
example:
error: { code: "DOUBLE_DISPOSITION", detail: "Finding f-001 already confirmed" }
RateLimitError:
description: Too many requests
headers:
Retry-After:
schema: { type: integer }
description: Seconds until next request is allowed
content:
application/json:
schema: { $ref: "#/components/schemas/ErrorEnvelope" }
example:
error: { code: "RATE_LIMITED", detail: "Too many requests. Retry after 30 seconds.", retry_after: 30 }
InternalError:
description: Unexpected server error
content:
application/json:
schema: { $ref: "#/components/schemas/ErrorEnvelope" }
example:
error: { code: "INTERNAL_ERROR", detail: "An unexpected error occurred" }
examples:
CompileRequestValid:
summary: Compile filters/metric/XLSX scenario
value:
provenance:
source_type: agent_run
source_id: "550e8400-e29b-41d4-a716-446655440000"
objective:
goal: "Verify filters, metric, XLSX export, and baseline"
selected_case_ids: ["B01", "C04", "C05"]
rationale: "Release candidate covers filter and export regressions"
query_model: { dashboard_key: "fi-0080" }
checklist_catalog_version: 1
baseline_version: "2026-07-01"
capabilities: { native_filters: true, text_filter: true, table_filter: true, pagination: true, row_edit: true, bulk_edit: true, persistence_refresh: true, time_rollover: false, xlsx_export: true, cross_dashboard: false, superset_metric: true, dataset_field_read: true, screenshot: true, repository_write: true }
parameters: { test_date: { type: "date" }, counterparty: { type: "string" } }
ScenarioResponseCompiled:
summary: Compiled 18-step scenario
value:
scenario:
scenario_key: "fi-0080_verify-filters-metric-xlsx"
content_hash: "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3"
phases: ["setup", "interact", "observe", "assert", "evidence", "report"]
steps: [{ logical_step_id: "4b7c…", step_key: "phase-1-B01-open_dashboard", tool: "browser", action: "open_dashboard" }]
validation:
valid: true
errors: []
warnings: [{ code: "STALE_BASELINE", detail: "baseline 2026-06-15 superseded by 2026-07-01", logical_step_id: "4b7c0000-0000-0000-0000-000000000005" }]
blockers: []
coverage: [{ case_id: "B01", classification: "automated" }, { case_id: "C04", classification: "automated" }, { case_id: "C05", classification: "automated" }]
topological_order: ["phase-1-B01-open_dashboard", "phase-2-B01-apply_filters"]
graph_hash: "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3"