Skip to content

doctor: declared gates (requireTrailers, citationStrictness) report healthy while nothing enforces them #289

Closed

Description

@stackbilt-admin

Summary

charter doctor validates that governance config parses, but not that the gates it declares are enforced. A repo can declare requireTrailers: true with trailerThreshold: HIGH and citationStrictness: FAIL, have no charter hook installed, and doctor reports every config check [ok].

The result is a governance gate that exists in config, appears healthy, and stops nothing.

Evidence (real repo, charter v1.9.2)

Stackbilt-dev/aegis — .charter/config.json:

"git": { "requireTrailers": true, "trailerThreshold": "HIGH" },
"validation": { "citationStrictness": "FAIL" }

Hook state:

$ git config core.hooksPath
.githooks
$ ls .githooks/
pre-commit                      # repo's own hook; does not invoke charter
$ grep -rl charter .githooks/ .git/hooks/
(no matches)

charter doctor output — all config checks pass, nothing mentions enforcement:

[ok] config file: .charter/config.json exists.
[ok] config parse: config.json is valid JSON.
[ok] patterns: 9 pattern(s) loaded.
[ok] policy docs: 1 markdown policy file(s).
...
Doctor status: WARN     # only from adf agent config / vendor bloat / loc budget

Meanwhile the declared gate is in fact being violated:

$ npx charter validate --range 3b65cc9..9168a61
[fail] FAIL: No governance trailers found across 2 commit(s) in scope.
  Commits: 2 | Trailers found: 0
  Policy offenders (strict trailer mode):
    - 9168a61 ... Missing required governance trailers under strict trailer mode.
    - 9b0dd1f ... Missing required governance trailers under strict trailer mode.

Two commits landed on main through a gate the repo declares as strict. The violation was only discovered by running charter validate by hand, after the fact.

Expected

charter doctor warns when config declares a gate that no installed hook or CI step enforces — in the same actionable style it already uses elsewhere (Run: charter adf migrate --dry-run). Something like:

[warn] gate enforcement: git.requireTrailers is true but no charter commit-msg hook is
       installed and core.hooksPath (.githooks) contains no charter invocation.
       Run: charter hook install --commit-msg

Actual

Doctor reports config health as [ok] and is silent on enforcement. Adoption of charter hook install is invisible to the one command operators run to check whether governance is working.

Why this matters

This is the failure mode governance tooling exists to prevent: the policy is declared, the dashboard is green, and nothing is actually gated. An agent or human reading doctor output reasonably concludes trailers are enforced.

Suggested check

Doctor already knows the config. It could additionally inspect:

  • core.hooksPath (and .git/hooks/) for a charter-invoking commit-msg / pre-commit hook when git.requireTrailers is true
  • whether a CI workflow invokes charter validate / charter audit

and warn when a declared gate has neither.

Related, lower confidence

.charter/config.json also carries a testing.command. In this repo it is:

"testing": { "command": "cd web && npm run typecheck" }

which runs a type check and zero tests, despite the field name. Doctor does not surface or validate this value. Detecting "this command runs no tests" is genuinely hard in general, so I am not proposing that — but simply echoing the resolved testing.command in doctor output would let an operator catch a no-op test gate by eye. Happy to split this into its own issue if you'd prefer to keep the primary one narrow.

Environment

  • charter v1.9.2 (latest published; @stackbilt/cli@^1.9.2)
  • repo: Stackbilt-dev/aegis, core.hooksPath=.githooks

Activity

  1. stackbilt-admin commented on Sep 9, 2026

    @stackbilt-admin
    MemberAuthor

    Follow-up from the same repo — a second, related weakness in the trailer gate, this time in validate itself rather than doctor.

    charter validate appears to evaluate trailers at range level, not per commit. One trailered commit passes the whole range.

    Same repo, same config (requireTrailers: true, trailerThreshold: HIGH), charter v1.9.2:

    $ npx charter validate --range 3b65cc9..9168a61
    [fail] FAIL: No governance trailers found across 2 commit(s) in scope.
      Commits: 2 | Trailers found: 0
      Policy offenders (strict trailer mode):
        - 9168a61 ... Missing required governance trailers under strict trailer mode.
        - 9b0dd1f ... Missing required governance trailers under strict trailer mode.
    

    Then I added trailers to one new commit and widened the range to include the two failures above plus eight older untrailered commits:

    $ npx charter validate --range origin/main..main
    [ok] PASS: All 10 commit(s) pass governance checks.
      Commits: 10 | Trailers found: 2
    
      Suggestions:
        - Only 10% of commits have governance trailers.
    

    Ten commits, two trailers, PASS — and the tool itself reports 10% coverage in the same breath. The two commits that were named Policy offenders moments earlier are now inside a passing range, unchanged.

    Why this matters: the natural CI invocation is a range (origin/main..HEAD, or a PR's commit span). Under this behavior, a single conforming commit anywhere in a PR satisfies the gate for every other commit in it. trailerThreshold: HIGH reads as "every high-risk commit needs trailers," but the observable behavior is "at least one commit in the range needs trailers."

    Expected: either per-commit evaluation (each HIGH-risk commit must carry its own trailers, and the Policy offenders list should fail the run), or — if range-level is deliberate — the PASS should not be emitted while the tool is simultaneously reporting 10% coverage. The "Only 10% of commits have governance trailers" line already computes the number that should drive the verdict.

    Happy to split this into its own issue if you'd rather keep #289 scoped to doctor; filing it here since both are the same underlying theme — a gate that reports healthier than it enforces.

  2. stackbilt-admin commented on Sep 9, 2026

    @stackbilt-admin
    MemberAuthor

    Fixed and published in v1.9.3. Doctor now detects strict trailer configuration without a real validate --ci enforcement path, and validate now evaluates required trailers per commit so one compliant commit cannot clear other offenders. Release: https://github.com/Stackbilt-dev/charter/releases/tag/v1.9.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions