Files
ss-tools/specs/036-agent-test-stabilization/contracts/agent-pipeline.md

2.9 KiB

#region AgentTestStabilization.AgentPipeline [C:4] [TYPE ADR] [SEMANTICS contracts,agent-run,pipeline,tools] @BRIEF Agent-side tracker, context validation, scenario tool filtering, and verification trigger contracts. @RELATION DEPENDS_ON -> [AgentTestStabilization.DataModel] @RELATION DEPENDS_ON -> [AgentRuns.Api]

#region AgentRuns.Tracker [C:4] [TYPE Module] [SEMANTICS agent-run,agent,http,events]

@defgroup AgentRuns Agent-side typed client for backend run lifecycle APIs.

@LAYER Service

@RELATION DEPENDS_ON -> [AgentRuns.Api]

@INVARIANT Every call carries service JWT and current user JWT; logs redact both.

@RATIONALE Small client isolates retry/idempotency behavior from the large Gradio handler.

#endregion AgentRuns.Tracker

#region AgentRuns.Context.ValidateV2 [C:3] [TYPE Function] [SEMANTICS agent-run,context,intent,validation]

@ingroup AgentRuns

@BRIEF Validate UIContext v1/v2 and scenario-intent cross-field rules.

@POST Returns normalized context; v1 ordinary chat remains compatible.

@TEST_EDGE v1_without_intent -> accepted; v2_scenario_dashboard -> accepted; scenario_dataset -> rejected; unknown_intent -> rejected.

#endregion AgentRuns.Context.ValidateV2

#region AgentRuns.ToolPipeline.Scenario [C:4] [TYPE Function] [SEMANTICS agent-run,tools,scenario,no-sql]

@ingroup AgentRuns

@BRIEF Restrict scenario-intent tools to dashboard inspection, scenario, artifact, and approval operations.

@PRE RBAC filtering has already run.

@POST Tool list excludes arbitrary SQL operations.

@SIDE_EFFECT Emits pipeline_result audit metadata.

@INVARIANT No raw credentialed/arbitrary SQL tool reaches build_dashboard_test_scenario; bounded authoring SqlEvidenceSpec reaches 038 compiler validation only.

@TEST_INVARIANT No_Direct_SQL -> VERIFIED_BY: scenario_tool_list, replayed_sql_call.

@TEST_EDGE hallucinated_sql_tool_call -> invocation guard rejects.

@REJECTED Relying only on system prompt to avoid SQL — tool availability is enforceable.

#endregion AgentRuns.ToolPipeline.Scenario

#region AgentRuns.Verification.CreateRun [C:4] [TYPE Function] [SEMANTICS agent-run,verification,release,dashboard-testing]

@ingroup AgentRuns

@BRIEF Create an AgentRun triggered by release pipeline or scheduler, linked to VerificationRun.

@PRE Trigger valid; actor has dashboard testing execute; release triggers have DashboardRelease.

@POST AgentRun and linked VerificationRun are created atomically.

@SIDE_EFFECT Writes AgentRun and VerificationRun.

@DATA_CONTRACT CreateAgentRunRequest -> AgentRunSnapshot + VerificationRun

@RELATION DEPENDS_ON -> [AgentRuns.Service.Create]

@TEST_EDGE scheduled without release -> run without release_id.

@RATIONALE Trigger enum makes verification scope explicit and recoverable.

@REJECTED Creating verification outside AgentRun lifecycle — recovery and gate semantics would diverge.

#endregion AgentRuns.Verification.CreateRun

#endregion AgentTestStabilization.AgentPipeline