Skip to content

hook: doctor gate blocks commits on bloat in files that aren't part of the commit #357

Closed

Description

@stackbilt-admin

Follow-up from the review of #356 (#320). Operator-approved as the step after the #318 series.

Since #356, the pre-commit hook tidies only staged vendor files and never sweeps unrelated work. In repos without a verify:adf script, the hook's evidence gate (charter doctor --adf-only --ci) still scans the whole working tree for vendor-file bloat. So a commit can be blocked by state that isn't part of it. In review, 5 of 13 scenarios newly blocked vs. the old hook, which only passed them by rewriting or sweeping files the user hadn't staged:

  • an unstaged bloated GEMINI.md while committing something else
  • a partially staged vendor file, which the hook skips by design (CP-3)
  • a planned module that has unstaged or untracked work, which the hook skips by design (CP-4)

#356 keeps these blocks and explains them (option A). This issue does the rest:

  • B: in hook context, scope doctor's bloat checks to the staged vendor files.
  • C: in hook context, bloat in files the tidy block deliberately skipped does not block the commit. CI's doctor --ci still enforces it.

That makes CP-3/CP-4 truly non-blocking in the default hook. Option D (doctor reads the staged blob) is the exact version, if B+C prove too coarse. Review analysis: #356 review 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