DoD Compliance Sweep
Validate Definition of Done compliance across closed epics/tickets. Operates in
two modes: batch (retroactive sweep of recently completed tickets) and
targeted (pre-close gate for a specific epic or ticket).
Dual Mode
- Batch (
/dod-sweep): Query Linear for tickets completed in the lookback
window via tracker.list_issues, filter by completedAt.
- Batch since-last-cycle (
/dod-sweep --since-last-cycle): Query Linear for
tickets completed since the last autopilot close-out cycle. Reads the last cycle
timestamp from $ONEX_STATE_DIR/autopilot/cycle-state.yaml field
last_cycle_id, which stores the cycle boundary timestamp. Falls back to
--since-days 7 if no prior cycle exists.
- Targeted (
/dod-sweep <TICKET-ID>): If the target is an epic, expand child
tickets. If a single ticket, sweep just that one.
Per-Ticket Verification Mode
When --per-ticket-verify is passed (or when invoked from autopilot as Step B1),
the sweep runs dod-verify individually against each discovered ticket instead of
delegating to the batch check_dod_compliance.py handler. This provides granular
evidence receipts per ticket.
Flow:
- Discover tickets (via batch or since-last-cycle query)
- For each ticket, invoke the
dod-verify skill logic:
- Locate ticket contract at
$ONEX_CC_REPO_PATH/contracts/{ticket_id}.yaml
- If contract exists with
dod_evidence[], run evidence checks via the shared
runner at plugins/onex/skills/_lib/dod-evidence-runner/dod_evidence_runner.py
- Collect the DoD verification result for the ticket. Durable per-ticket
receipt persistence is not yet implemented in the backing node and must not be claimed until it is.
- Flag any tickets with incomplete DoD evidence (failed or missing checks)
- Aggregate results and report summary
Check Confidence Tiers
The 6 per-ticket checks are organized into two confidence tiers:
Primary (Artifact Checks -- High Confidence)
Deterministic file existence and content parsing. If the file is there and
parseable, the check is authoritative.
- CONTRACT_EXISTS:
ls $ONEX_CC_REPO_PATH/contracts/{ticket_id}.yaml
- RECEIPT_EXISTS: Check deterministic location
$ONEX_CC_REPO_PATH/.evidence/{ticket_id}/dod_report.json first, then
$ONEX_STATE_DIR as fallback. In targeted mode, also validate receipt
freshness -- receipt must be newer than the ticket's completedAt date.
- RECEIPT_CLEAN: Parse receipt JSON, verify
result.failed == 0.
Supporting (Operational Checks -- Medium Confidence)
Depends on cross-repo search, SHA linkage, and drift artifact grep. Can produce
UNKNOWN when linkage cannot be established cleanly.
- PR_MERGED:
gh pr list --search "{ticket_id}" --state merged --json number
across repos. If no PR found, record UNKNOWN with detail "No merged PR found
matching ticket ID -- may indicate PR title/branch naming mismatch" rather than
hard FAIL.
- CI_GREEN: Use the GitHub check-runs endpoint for the merged commit SHA --
verify all conclusions are "success". If the SHA cannot be determined, record
UNKNOWN.
- INTEGRATION_SWEEP_EVIDENCE: If contract has
interfaces_touched, grep
$ONEX_CC_REPO_PATH/drift/integration/*.yaml for ticket_id. This verifies
presence of sweep evidence linked to the ticket, not substantive correctness
of every relevant integration surface. If no interfaces_touched, this check
is automatically PASS (not applicable).
Receipt Freshness Doctrine (Targeted Mode Only)
In targeted mode (pre-close gate), receipts must be associated with the
completion being audited, not merely exist from some historical run:
- Validate: receipt timestamp > ticket's
completedAt date, OR receipt was
generated within the current session.
- Deterministic ticket-specific receipt locations
(
$ONEX_CC_REPO_PATH/.evidence/{ticket_id}/dod_report.json) are preferred
over broad find discovery to prevent false association.
- In batch mode (retroactive sweep), existence-only is acceptable since the
goal is historical audit, not real-time gating.
UNKNOWN Semantics
UNKNOWN is not a single state. It may represent:
| Meaning |
Example |
Gate behavior |
| Exempt / not checked |
Ticket predates contract system |
Non-blocking |
| Inconclusive linkage |
PR search found no match by ticket ID |
Non-blocking if primary checks pass |
| Mixed check state |
Some checks PASS, others UNKNOWN |
Non-blocking but flagged |
| No evidence-backed passes |
All tickets exempt |
Non-blocking (rollout accommodation) |
Targeted-Mode Gate Decision Matrix
| Primary checks |
Supporting checks |
Gate result |
Action |
| Any FAIL |
anything |
BLOCK |
Create follow-up tickets |
| All PASS |
All PASS |
ALLOW CLEAN |
Mark epic Done |
| All PASS |
Some UNKNOWN |
ALLOW WITH WARNING |
Mark epic Done, post warning |
| All PASS |
Any FAIL |
ALLOW WITH FOLLOW-UP |
Mark epic Done, create follow-up |
| All exempt |
n/a |
ALLOW UNKNOWN-REVIEW |
Mark epic Done (rollout accommodation) |
Exemption Handling
- Load
$ONEX_CC_REPO_PATH/dod_sweep_exemptions.yaml
- Skip tickets completed before cutoff_date
- Skip explicitly exempted ticket IDs
- Check
expires_on if present -- expired exemptions are no longer valid
Follow-Up Ticket Creation and Dedup
For each failed ticket (when not --dry-run):
- Search existing open tickets for
[dod-sweep-gap:{ticket_id}] marker in
description. If found and still open, update the existing ticket's description
with the current failed check set rather than creating a duplicate.
- If found but closed (gap recurred), create a new ticket with reference to the
previous closed one.
- On recurrence, record the delta explicitly (prior state vs current failed state)
rather than silently overwriting history.
Follow-up ticket format:
- Title:
fix: DoD gap -- {ticket_id} -- {failed_check_names}
- Parent: same epic as the original ticket
- Description includes: which checks failed, passed, and UNKNOWN, with confidence
tier of each failed check
Rendered Output Evidence Enforcement
Tickets with any of the following labels MUST have at least one rendered_output
evidence item in their dod_evidence[] array:
data_pipeline
dashboard
display
projection
Check logic:
- For each ticket in the sweep, check if any of the above labels are present
- If label match: verify
dod_evidence[] contains at least one item with type: rendered_output
- If missing: flag the ticket as
RENDERED_OUTPUT_MISSING in the sweep report
- Create a follow-up ticket with title
fix: DoD gap -- {ticket_id} -- missing rendered_output evidence
This enforcement encodes the Visual Output Verification requirement into the automated
DoD compliance pipeline.
Report Output
- Write
ModelDodSweepResult YAML to
$ONEX_CC_REPO_PATH/drift/dod_sweep/{date}.yaml
- Print summary table to stdout -- table distinguishes passed, failed, exempted,
and UNKNOWN counts
- Emit
dod.sweep.completed Kafka event (non-blocking)
Recurring Usage
/loop 2h /onex:dod_sweep --dry-run
/loop daily /onex:dod_sweep
1---2name: dod-sweep3description: DoD compliance sweep -- dispatches to node_dod_sweep_orchestrator for execution4---56<!-- routing-enforced: dispatches to node_dod_sweep_orchestrator. -->78# DoD Compliance Sweep910Validate Definition of Done compliance across closed epics/tickets. Operates in11two modes: **batch** (retroactive sweep of recently completed tickets) and12**targeted** (pre-close gate for a specific epic or ticket). <!-- skill-boundary-ok: iteration described here is performed by node_dod_sweep_orchestrator handler, not the skill itself -->1314## Dual Mode1516- **Batch** (`/dod-sweep`): Query Linear for tickets completed in the lookback <!-- skill-boundary-ok: ticket iteration is performed by node_dod_sweep_orchestrator handler, not the skill -->17 window via `tracker.list_issues`, filter by `completedAt`.18- **Batch since-last-cycle** (`/dod-sweep --since-last-cycle`): Query Linear for19 tickets completed since the last autopilot close-out cycle. Reads the last cycle20 timestamp from `$ONEX_STATE_DIR/autopilot/cycle-state.yaml` field <!-- skill-boundary-ok: state file read is performed by node_dod_sweep_orchestrator handler, not the skill -->21 `last_cycle_id`, which stores the cycle boundary timestamp. Falls back to22 `--since-days 7` if no prior cycle exists.23- **Targeted** (`/dod-sweep <TICKET-ID>`): If the target is an epic, expand child24 tickets. If a single ticket, sweep just that one.2526## Per-Ticket Verification Mode2728When `--per-ticket-verify` is passed (or when invoked from autopilot as Step B1),29the sweep runs `dod-verify` individually against each discovered ticket instead of30delegating to the batch `check_dod_compliance.py` handler. This provides granular31evidence receipts per ticket.3233Flow:341. Discover tickets (via batch or since-last-cycle query)352. For each ticket, invoke the `dod-verify` skill logic: <!-- skill-boundary-ok: per-ticket iteration is performed by node_dod_sweep_orchestrator handler -->36 - Locate ticket contract at `$ONEX_CC_REPO_PATH/contracts/{ticket_id}.yaml`37 - If contract exists with `dod_evidence[]`, run evidence checks via the shared38 runner at `plugins/onex/skills/_lib/dod-evidence-runner/dod_evidence_runner.py`39 - Collect the DoD verification result for the ticket. Durable per-ticket <!-- skill-boundary-ok: result collection is performed by node_dod_sweep_orchestrator handler -->40 receipt persistence is not yet implemented in the backing node and must not be claimed until it is.413. Flag any tickets with incomplete DoD evidence (failed or missing checks)424. Aggregate results and report summary4344## Check Confidence Tiers4546The 6 per-ticket checks are organized into two confidence tiers:4748### Primary (Artifact Checks -- High Confidence)4950Deterministic file existence and content parsing. If the file is there and51parseable, the check is authoritative.52531. **CONTRACT_EXISTS**: `ls $ONEX_CC_REPO_PATH/contracts/{ticket_id}.yaml`542. **RECEIPT_EXISTS**: Check deterministic location55 `$ONEX_CC_REPO_PATH/.evidence/{ticket_id}/dod_report.json` first, then56 `$ONEX_STATE_DIR` as fallback. In targeted mode, also validate receipt57 freshness -- receipt must be newer than the ticket's `completedAt` date.583. **RECEIPT_CLEAN**: Parse receipt JSON, verify `result.failed == 0`.5960### Supporting (Operational Checks -- Medium Confidence)6162Depends on cross-repo search, SHA linkage, and drift artifact grep. Can produce63UNKNOWN when linkage cannot be established cleanly.64654. **PR_MERGED**: `gh pr list --search "{ticket_id}" --state merged --json number`66 across repos. If no PR found, record `UNKNOWN` with detail "No merged PR found67 matching ticket ID -- may indicate PR title/branch naming mismatch" rather than68 hard FAIL.695. **CI_GREEN**: Use the GitHub check-runs endpoint for the merged commit SHA --70 verify all conclusions are "success". If the SHA cannot be determined, record71 `UNKNOWN`.726. **INTEGRATION_SWEEP_EVIDENCE**: If contract has `interfaces_touched`, grep73 `$ONEX_CC_REPO_PATH/drift/integration/*.yaml` for ticket_id. This verifies74 presence of sweep evidence linked to the ticket, not substantive correctness75 of every relevant integration surface. If no `interfaces_touched`, this check76 is automatically PASS (not applicable).7778## Receipt Freshness Doctrine (Targeted Mode Only)7980In targeted mode (pre-close gate), receipts must be associated with the81completion being audited, not merely exist from some historical run:8283- Validate: receipt timestamp > ticket's `completedAt` date, OR receipt was84 generated within the current session.85- Deterministic ticket-specific receipt locations86 (`$ONEX_CC_REPO_PATH/.evidence/{ticket_id}/dod_report.json`) are preferred87 over broad `find` discovery to prevent false association.88- In batch mode (retroactive sweep), existence-only is acceptable since the89 goal is historical audit, not real-time gating.9091## UNKNOWN Semantics9293UNKNOWN is not a single state. It may represent:9495| Meaning | Example | Gate behavior |96|---------|---------|---------------|97| Exempt / not checked | Ticket predates contract system | Non-blocking |98| Inconclusive linkage | PR search found no match by ticket ID | Non-blocking if primary checks pass |99| Mixed check state | Some checks PASS, others UNKNOWN | Non-blocking but flagged |100| No evidence-backed passes | All tickets exempt | Non-blocking (rollout accommodation) |101102## Targeted-Mode Gate Decision Matrix103104| Primary checks | Supporting checks | Gate result | Action |105|---------------|-------------------|-------------|--------|106| Any FAIL | anything | BLOCK | Create follow-up tickets |107| All PASS | All PASS | ALLOW CLEAN | Mark epic Done |108| All PASS | Some UNKNOWN | ALLOW WITH WARNING | Mark epic Done, post warning |109| All PASS | Any FAIL | ALLOW WITH FOLLOW-UP | Mark epic Done, create follow-up |110| All exempt | n/a | ALLOW UNKNOWN-REVIEW | Mark epic Done (rollout accommodation) |111112## Exemption Handling1131141. Load `$ONEX_CC_REPO_PATH/dod_sweep_exemptions.yaml`1152. Skip tickets completed before cutoff_date1163. Skip explicitly exempted ticket IDs1174. Check `expires_on` if present -- expired exemptions are no longer valid118119## Follow-Up Ticket Creation and Dedup120121For each failed ticket (when not `--dry-run`): <!-- skill-boundary-ok: follow-up ticket creation is performed by node_dod_sweep_orchestrator handler -->1221231. Search existing open tickets for `[dod-sweep-gap:{ticket_id}]` marker in124 description. If found and still open, update the existing ticket's description125 with the current failed check set rather than creating a duplicate.1262. If found but closed (gap recurred), create a new ticket with reference to the127 previous closed one.1283. On recurrence, record the delta explicitly (prior state vs current failed state)129 rather than silently overwriting history.130131Follow-up ticket format:132- Title: `fix: DoD gap -- {ticket_id} -- {failed_check_names}`133- Parent: same epic as the original ticket134- Description includes: which checks failed, passed, and UNKNOWN, with confidence135 tier of each failed check136137## Rendered Output Evidence Enforcement138139Tickets with any of the following labels MUST have at least one `rendered_output`140evidence item in their `dod_evidence[]` array:141- `data_pipeline`142- `dashboard`143- `display`144- `projection`145146**Check logic:**1471. For each ticket in the sweep, check if any of the above labels are present <!-- skill-boundary-ok: label-presence iteration is performed by node_dod_sweep_orchestrator handler -->1482. If label match: verify `dod_evidence[]` contains at least one item with `type: rendered_output`1493. If missing: flag the ticket as `RENDERED_OUTPUT_MISSING` in the sweep report1504. Create a follow-up ticket with title `fix: DoD gap -- {ticket_id} -- missing rendered_output evidence`151152This enforcement encodes the Visual Output Verification requirement into the automated153DoD compliance pipeline.154155## Report Output1561571. Write `ModelDodSweepResult` YAML to158 `$ONEX_CC_REPO_PATH/drift/dod_sweep/{date}.yaml`1592. Print summary table to stdout -- table distinguishes passed, failed, exempted,160 and UNKNOWN counts1613. Emit `dod.sweep.completed` Kafka event (non-blocking)162163## Recurring Usage164165```166/loop 2h /onex:dod_sweep --dry-run167/loop daily /onex:dod_sweep168```