Repository navigation
Conversation
Three changes that had been made to the installed copies in ~/.claude/hooks and never made it back here, so install.sh would have reverted them. check-file-size: per-project thresholds from <repo>/.harness/file-size.conf, located from the edited file's git root and read by pattern rather than sourced, since a config file in a repo that gets sourced is arbitrary shell running on every edit. Falls back to the built-in defaults outside a repo. Also keeps the .daml case that was sitting uncommitted here. lint-on-edit: log which rules failed instead of the constant string "lint or typecheck failed". A constant detail makes the ledger uncountable, and it was the single largest unanalyzable cluster in one project's signal. check-silent-errors: skip scratchpad and temp paths. A throwaway diagnostic that gets deleted with the session does not owe anyone a re-raise.
Owner
Author
|
Superseded by 2b04e99, which carries all three changes (per-project thresholds read by pattern, rule ids in the lint ledger, scratchpad skip). Every conflict resolves to main. Dropped: the .daml tier (no consumer anywhere) and the /tmp skip (main excludes it deliberately, see hooks/README.md). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three changes had been made to the installed copies in
~/.claude/hooksand never made it back here. Sinceinstall.shcopieshooks/*.shover the installed ones unconditionally, running it would have reverted all three without saying anything.check-file-size.sh: per-project thresholdsReads
WARN_THRESHOLD/BLOCK_THRESHOLDfrom<repo>/.harness/file-size.confwhen present, falling back to the built-in defaults.The motivating case: one project's own rules said to consider splitting above ~300 lines, while the hook warned at 200. Of 585 warns in that project's ledger, 98% were for files the project had already decided were fine, across 95 distinct files. A guardrail that fires on things you have chosen to accept trains you to ignore it.
Three details are deliberate:
lib/log-event.shplaces the ledger. It is found whatever directory the session runs from, and sits next to the ledger by construction.$PWD, which handed files edited outside any repo the thresholds of whatever project the shell happened to be in.Verified across four paths: outside a repo, 230 lines still warns at the default 200; in a project configured to 260, 283 warns and 256 is silent; 310 still blocks at 300.
Also picks up a
.damlcase (300/450) that was sitting uncommitted in a local checkout.lint-on-edit.sh: log which rule failedThe ledger detail was the constant string
"lint or typecheck failed", which makes it uncountable: you cannot tell one rule breaking 200 times from 200 rules breaking once. It was the largest single cluster in one project's ledger and the only one that could not be analyzed.Now takes the rule ids out of the output, handling both ESLint stylish (id last on the line) and Biome (
lint/suspicious/noExplicitAny), capped at three and deduplicated. Falls back tounclassifiedrather than dropping the event.This immediately paid for itself: with real ids, the largest remaining cluster turned out to be
no-unused-vars+jsx-no-undef, which is the signature of a declaration and its use landing in two separate edits, and that became a project rule.check-silent-errors.sh: skip scratchpad and temp pathsA throwaway diagnostic in the session scratchpad gets deleted with the session. Holding it to the re-raise-or-log-with-context contract is noise, not safety.
Testing
All three ran continuously for a week on a large TypeScript monorepo before this PR (~1,700 ledger events). The file-size thresholds were verified against the four boundary cases above.