Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions prompts/cac-pr-ready-enforcement.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# CAC Enforcement Prompt — Drift-Proof, Merge-Ready
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Register this prompt in the immutable prompt registry

This new prompt is not accompanied by a prompts/registry.yaml entry, which makes it unusable in the governed agent flow because PR metadata validation resolves prompts strictly by hash and throws when the hash is missing (scripts/ci/validate-pr-metadata.ts lines 120-125). As written, any task that references this prompt cannot pass the required metadata/integrity checks until the prompt id/path/hash/scope are added to the registry.

Useful? React with 👍 / 👎.


## Operating Mode
You are implementing inside Summit. CAC already exists. Do not redesign.

Your only valid output is **mergeable patches** that enforce CAC.

## Non-Negotiable Contract
- Output at most **7 PRs** and at least **1 PR**.
- Every PR is atomic, independently mergeable, and CI-passable.
- No placeholders, no pseudocode, no TODOs, no mock-only enforcement.
- Every referenced path must already exist or be created in the patch.
- Every config must parse and execute in CI.
- If uncertain, choose the smallest runnable implementation.

## Hard Failure Rules
If any of the following is missing, treat output as invalid:
1. Required evidence artifacts are absent.
2. Determinism check does not byte-compare regenerated artifacts.
3. CAC verdict is missing, false, or not explicitly `admissible: true`.
4. Branch protection drift sentinel does not verify CAC required check presence.
5. K8s admission policy does not deny on invalid or missing verdict.

## Required Deliverable Format

### 1) PR Stack Plan (exact block)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The instruction 'exact block' for the PR Stack Plan contradicts the rule on line 9 which allows for a variable number of PRs ('at most 7 PRs and at least 1 PR'). If the agent determines that fewer than 7 PRs are needed, it will be unable to provide the 'exact block' as specified. Changing this to 'template' or 'suggested structure' allows the agent to adapt the plan to the actual work required.

Suggested change
### 1) PR Stack Plan (exact block)
### 1) PR Stack Plan (template)

```id="prstack"
/PR-1: evidence-contract
/PR-2: cen-engine
/PR-3: ci-gate
/PR-4: k8s-enforcement
/PR-5: ingestion-gate
/PR-6: audit-ledger
/PR-7: integration-glue
```

For each PR include:
- Purpose
- Files changed
- Risk level (low/medium/high)
- Rollback strategy (exact commands or commit revert strategy)

### 2) Patches (mandatory)
For each PR provide:
- File tree
- Full file contents (not snippets)
- Exact repo-relative paths
- Exact validation commands

### 3) CI Integration (mandatory)
Wire CAC gate as a **required** CI check. Pipeline must fail on:
- missing evidence
- hash mismatch
- `admissible != true`

### 4) Determinism Script (mandatory)
Implement:
- `/scripts/verify_determinism.mjs`

Script requirements:
- regenerate artifacts twice in clean temp dirs
- normalize line endings where needed
- byte-compare outputs
- exit non-zero on mismatch with actionable error

### 5) Drift Sentinel Extension (mandatory)
Extend:
- `/scripts/check_branch_protection_drift.mjs`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Target the CI-enforced branch-protection checker path

The prompt tells implementers to extend /scripts/check_branch_protection_drift.mjs, but the enforced gate and integration tests invoke scripts/ci/check_branch_protection_drift.mjs (see package.json ci:branch-protection:check and tests/integration/ci-gate.test.mjs). Following this instruction literally can place CAC-required-check logic in the wrapper script while leaving the actual CI sentinel unchanged, so the required protection check may never be enforced in CI.

Useful? React with 👍 / 👎.


Must validate:
- CAC check exists in required checks list
- check is required for protected branches
- fail CI when missing

### 6) Kubernetes Enforcement (mandatory)
Provide valid Kyverno policy:
- deny admission when CAC verdict missing
- deny admission when verdict is false
- enforcement mode must block (not audit-only)

### 7) Ingestion Gate (mandatory)
Implement:
- `/apps/ingestion/validator.ts`

Must:
- validate schema
- hash canonical input
- reject duplicates
- return structured typed errors

### 8) Executable Tests (mandatory)
Create:
- `/tests/cac/pass.test.ts`
- `/tests/cac/nondeterminism.test.ts`
- `/tests/cac/poisoning.test.ts`

Tests must assert failure-first behavior:
- no evidence => fail
- nondeterministic artifacts => fail
- poisoned/invalid verdict => fail
- valid evidence + admissible true => pass

## Implementation Bias
- Prefer existing Node.js/TypeScript repo patterns.
- Reuse existing dependencies unless strictly necessary.
- Minimize scope and avoid framework churn.

## Forbidden Output Patterns
- Architecture essays
- Future-state redesigns
- "Example" files
- Untested abstractions
- Optional gates for required controls

## Completion Gate
Task is complete only if all are true:
1. PR without evidence fails in CI.
2. Non-deterministic artifacts fail in CI.
3. Invalid CAC verdict is blocked at deploy/admission.
4. Each PR can merge independently without hidden dependency on later PRs.
Comment on lines +115 to +120
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The 'Completion Gate' criteria do not fully align with the 'Hard Failure Rules' defined earlier. Specifically, the requirement for the branch protection drift sentinel (Rule 4 on line 21) is missing from the final checklist. Including it ensures the agent verifies this critical security control before completing the task.

Suggested change
## Completion Gate
Task is complete only if all are true:
1. PR without evidence fails in CI.
2. Non-deterministic artifacts fail in CI.
3. Invalid CAC verdict is blocked at deploy/admission.
4. Each PR can merge independently without hidden dependency on later PRs.
## Completion Gate
Task is complete only if all are true:
1. PR without evidence fails in CI.
2. Non-deterministic artifacts fail in CI.
3. Invalid CAC verdict is blocked at deploy/admission.
4. Branch protection drift sentinel verifies CAC check presence.
5. Each PR can merge independently without hidden dependency on later PRs.

Loading