refine audit-core multidriver use case roles

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a02991-be07-7bb3-8b6d-e9701b5621de
This commit is contained in:
tegwick 2026-08-23 00:42:09 +02:00
parent 1b9860a8ee
commit e254fd2000
2 changed files with 38 additions and 16 deletions

View file

@ -131,6 +131,17 @@ def test_intent_has_independent_provenance_and_separate_roles():
def test_schedule_requires_cleanup_before_finalization(): def test_schedule_requires_cleanup_before_finalization():
phases = {phase.id: phase for phase in PHASE_CONTRACTS} phases = {phase.id: phase for phase in PHASE_CONTRACTS}
assert phases["finalize-and-deliver"].requires == ("cleanup-custody",) assert phases["finalize-and-deliver"].requires == ("verify-cleanup",)
assert phases["verify-cleanup"].requires == ("cleanup-custody",)
assert phases["cleanup-custody"].requires == ("delete-runner",) assert phases["cleanup-custody"].requires == ("delete-runner",)
assert phases["run-probes"].requires == ("ready-runner",) assert phases["run-probes"].requires == ("ready-runner",)
def test_every_role_participates_in_a_phase():
declared = {role.id for role in ROLE_CONTRACTS}
scheduled = {
role
for phase in PHASE_CONTRACTS
for role in phase.driver_roles
}
assert scheduled == declared

View file

@ -46,7 +46,7 @@ class PhaseContract:
"""Causal intent for the future orchestrator; never a shell transcript.""" """Causal intent for the future orchestrator; never a shell transcript."""
id: str id: str
driver_role: str driver_roles: tuple[str, ...]
requires: tuple[str, ...] requires: tuple[str, ...]
completion: str completion: str
timing: str timing: str
@ -101,71 +101,83 @@ ROLE_CONTRACTS = (
PHASE_CONTRACTS = ( PHASE_CONTRACTS = (
PhaseContract( PhaseContract(
"authorize", "authorize",
"authorizer", ("authorizer",),
(), (),
"Exact engagement and custody contracts are approved.", "Exact engagement and custody contracts are approved.",
"Before projection and before the engagement window opens.", "Before projection and before the engagement window opens.",
), ),
PhaseContract( PhaseContract(
"acknowledge-target", "acknowledge-target",
"target-owner", ("target-owner",),
("authorize",), ("authorize",),
"Target owner accepts the exact revision, routes and bounded fixtures.", "Target owner accepts the exact revision, routes and bounded fixtures.",
"Before any temporary credential exists.", "Before any temporary credential exists.",
), ),
PhaseContract( PhaseContract(
"preflight", "preflight",
"credential-custodian", ("credential-custodian",),
("acknowledge-target",), ("acknowledge-target",),
"Target is ready and all engagement-specific resources are absent.", "Target is ready and all engagement-specific resources are absent.",
"Immediately before the projection cutoff.", "Immediately before the projection cutoff.",
), ),
PhaseContract( PhaseContract(
"project-custody", "project-custody",
"credential-custodian", ("credential-custodian",),
("preflight",), ("preflight",),
"Exactly two scoped handles exist and a value-safe receipt is emitted.", "Exactly two scoped handles exist and a value-safe receipt is emitted.",
"Inside the narrow projection window; expiry equals engagement end.", "Inside the narrow projection window; expiry equals engagement end.",
), ),
PhaseContract( PhaseContract(
"admit-plane", "admit-plane",
"security-coordinator", ("security-coordinator",),
("project-custody",), ("project-custody",),
"Receipt, broker contract, target revision and cleanup authority agree.", "Receipt, broker contract, target revision and cleanup authority agree.",
"After projection and before any target packet.", "After projection and before any target packet.",
), ),
PhaseContract( PhaseContract(
"ready-runner", "ready-runner",
"cluster-executor", ("cluster-executor",),
("admit-plane",), ("admit-plane",),
"The exact attributed runner is Ready with its Secret mounted.", "The exact attributed runner is Ready with its Secret mounted.",
"Inside the authorized engagement window.", "Inside the authorized engagement window.",
), ),
PhaseContract( PhaseContract(
"run-probes", "run-probes",
"security-coordinator", (
"security-coordinator",
"tenant-a-attacker",
"tenant-b-control",
),
("ready-runner",), ("ready-runner",),
"Calibrated owner, attacker and absent controls produce a sanitized report.", "Calibrated owner, attacker and absent controls produce a sanitized report.",
"Before credential and engagement expiry.", "Before credential and engagement expiry.",
), ),
PhaseContract( PhaseContract(
"delete-runner", "delete-runner",
"cluster-executor", ("cluster-executor",),
("run-probes",), ("run-probes",),
"The exact runner pod is absent.", "The exact runner pod is absent.",
"Immediately after evidence collection.", "Immediately after evidence collection.",
), ),
PhaseContract( PhaseContract(
"cleanup-custody", "cleanup-custody",
"credential-custodian", ("credential-custodian",),
("delete-runner",), ("delete-runner",),
"Both identities, exact KV paths, projection resources and Secret are absent.", "Receipt-bound cleanup revokes both identities and removes exact resources.",
"Before credential and engagement expiry.", "Before credential and engagement expiry.",
), ),
PhaseContract( PhaseContract(
"finalize-and-deliver", "verify-cleanup",
"security-coordinator", ("independent-observer",),
("cleanup-custody",), ("cleanup-custody",),
"Both identities, exact KV paths, projection resources, Secret and runner "
"are independently absent while the target remains Ready.",
"After cleanup and before credential and engagement expiry.",
),
PhaseContract(
"finalize-and-deliver",
("security-coordinator",),
("verify-cleanup",),
"The report is bound to projection and cleanup receipts and reaches risk-nexus.", "The report is bound to projection and cleanup receipts and reaches risk-nexus.",
"Only after cleanup is independently observable.", "Only after cleanup is independently observable.",
), ),
@ -296,7 +308,7 @@ TEST_USE_CASE = UseCase(
"before expiry while the target remains ready", "before expiry while the target remains ready",
Provenance.SPEC, Provenance.SPEC,
_cleanup_is_complete, _cleanup_is_complete,
after_step="cleanup-custody", after_step="verify-cleanup",
source_ref=SPEC_REF, source_ref=SPEC_REF,
), ),
), ),
@ -328,4 +340,3 @@ TEST_USE_CASE = UseCase(
# Alias retained for the existing scenario-module convention. # Alias retained for the existing scenario-module convention.
USE_CASE = TEST_USE_CASE USE_CASE = TEST_USE_CASE