feat(gate): env-configurable enforce threshold + blocking-checks#3
Merged
Conversation
Tuning without code edits (Step 3 of the gate rollout):
- ZUHN_GATE_MAX_SIMILARITY ratchets the near-duplicate block threshold
- ZUHN_GATE_BLOCKING_CHECKS promotes checks (e.g. stance_directional) to blocking
Defaults unchanged (0.95, [stance_present]; novelty always blocks). Precedence:
--max-similarity flag > env > default. resolveMaxSimilarity() uses full-string
Number() validation so a partial-numeric typo ("1abc") can't silently weaken the
threshold; resolveBlockingChecks() warns on unknown tokens and falls back to the
default when all tokens are invalid.
Tests: +8 resolver cases (precedence, range/validation, partial-numeric rejection).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Step 3 of the gate rollout: make the enforce gate tunable without code edits, so the threshold/policy can be ratcheted with a config flip once forward evidence accumulates. Defaults unchanged — this is purely an enabling change.
ZUHN_GATE_MAX_SIMILARITY— ratchet the near-duplicate block threshold (default 0.95)ZUHN_GATE_BLOCKING_CHECKS— promote checks (e.g.stance_directional) from warning to blocking (defaultstance_present; novelty always blocks)--max-similarityflag > env > defaultSafety
resolveMaxSimilarity()uses full-stringNumber()validation (notparseFloat) + range check, so a partial-numeric typo like1abcfalls through to the default rather than silently weakening the dedup block.resolveBlockingChecks()warns on unknown tokens and falls back to the default when all tokens are invalid.Review
parseFloatpartial-parse footgun) → fixed (strictNumber()) → codex re-confirmed clean.Test plan
ZUHN_GATE_MAX_SIMILARITY=0.90→ threshold 0.9;=1abc→ falls through to 0.95;ZUHN_GATE_BLOCKING_CHECKS=stance_present,stance_directional→ blocking reflects it; invalid token warns🤖 Generated with Claude Code