Skip to content

feat(dogfood): bootstrap .charter governance to score 80/100 on own audit#175

Merged
stackbilt-admin merged 3 commits into
mainfrom
feat/dogfood-self-governance
May 23, 2026
Merged

feat(dogfood): bootstrap .charter governance to score 80/100 on own audit#175
stackbilt-admin merged 3 commits into
mainfrom
feat/dogfood-self-governance

Conversation

@stackbilt-admin
Copy link
Copy Markdown
Member

Summary

Charter now passes its own charter audit at 80/100 — meeting the ≥80 milestone gate for v0.13.

  • 5 active patterns across 3 pattern files:
    • adf-patterns.json: ADF mutation review + manifest pointer integrity (GOVERNANCE)
    • oss-patterns.json: additive-only API contract + no-product-logic boundary (API/ARCHITECTURE)
    • testing-patterns.json: tests travel with public exports (TESTING)
  • 100% policy coverage: governance-policy.md covers all 4 required audit sections — Commit Trailers, Change Classification, Exception Path, Escalation & Approval
  • Trailer coverage is 0% on historical commits but resolves naturally as future commits adopt Governed-By: trailers (this commit is the first)
charter audit
Score: 80/100
Patterns: 5 active / 5 total
Policy coverage: 100% (4/4 sections matched)
Trailer coverage: 0% (historical — future commits will raise this)

Closes #159.

Test plan

  • node packages/cli/dist/bin.js audit --format json | jq '.score.overall' returns 80
  • node packages/cli/dist/bin.js audit --format json | jq '.patterns.active' returns 5
  • node packages/cli/dist/bin.js audit --format json | jq '.policies.coveragePercent' returns 100
  • All 4 policy sections matched: Commit Trailers, Change Classification, Exception Path, Escalation & Approval

🤖 Generated with Claude Code

…udit

Fixes #159. Charter now passes its own governance audit at 80/100 (B grade),
serving as a living reference implementation for adopters.

Added:
- .charter/patterns/adf-patterns.json — 2 active patterns: ADF mutation review
  and manifest pointer integrity (GOVERNANCE category)
- .charter/patterns/oss-patterns.json — 2 active patterns: additive-only API
  contract and no-product-logic boundary (API + ARCHITECTURE categories)
- .charter/patterns/testing-patterns.json — 1 active pattern: tests travel
  with public exports (TESTING category)
- .charter/policies/governance-policy.md — covers all 4 required audit
  sections: Commit Trailers, Change Classification, Exception Path, and
  Escalation & Approval

Audit result: 5/5 active patterns (pattern score: 100), 4/4 policy sections
matched (policy score: 100), trailer coverage pending (resolves naturally as
future commits adopt Governed-By trailers). Overall: 80/100.

Governed-By: oss-additive-only-api
Resolves-Request: #159

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stackbilt-admin
Copy link
Copy Markdown
Member Author

Review finding (blocking):

This PR currently fails Governance because adding .charter/patterns/*.json activates Drift Scan, and the workflow invokes:

  • npx charter drift --ci --format text

In CI this errors with:

  • npm error could not determine executable to run

So this branch is merge-blocked even though build-and-test is green.

Suggested fix direction:

  • Use repo-local built CLI invocation in governance workflow (e.g. node packages/cli/dist/bin.js drift --ci --format text) or pnpm exec charter ... after ensuring the executable is resolvable in this repo context.

Once that invocation is corrected, this PR should be able to pass Governance consistently.

npx charter fails in this monorepo context because the package is not
installed globally in CI. Replace all npx charter calls in the governance
job with node packages/cli/dist/bin.js (the build step runs before all
governance steps, so the binary is always present).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stackbilt-admin
Copy link
Copy Markdown
Member Author

Fixed in b1379fe. Replaced all npx charter calls in the governance job with node packages/cli/dist/bin.js — consistent with the scorecard job that was already using the local binary. All five governance steps updated (validate, drift, doctor, adf evidence, audit).

drift/extractRules() calls .matchAll() on antiPatternText and expects a
string, not an array. Flatten each array to a period-separated sentence
so the drift scanner can parse it without error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stackbilt-admin
Copy link
Copy Markdown
Member Author

Second fix in 78e0bb9: anti_patterns converted from arrays to strings in all three pattern files. drift/extractRules() calls .matchAll() on the raw field value — it requires a string. Confirmed locally: charter drift --ci --format json now reports 5 patterns scanned, 0 violations, no errors.

@stackbilt-admin stackbilt-admin merged commit 3df3db3 into main May 23, 2026
5 checks passed
@stackbilt-admin stackbilt-admin deleted the feat/dogfood-self-governance branch May 23, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dogfood gap: charter repo fails its own audit (0/100), no patterns or policy docs

1 participant