Skip to content

feat(gate): env-configurable enforce threshold + blocking-checks#3

Merged
gorajing merged 1 commit into
mainfrom
feat/gate-env-config
May 26, 2026
Merged

feat(gate): env-configurable enforce threshold + blocking-checks#3
gorajing merged 1 commit into
mainfrom
feat/gate-env-config

Conversation

@gorajing
Copy link
Copy Markdown
Owner

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 (default stance_present; novelty always blocks)
  • Precedence: --max-similarity flag > env > default

Safety

  • resolveMaxSimilarity() uses full-string Number() validation (not parseFloat) + range check, so a partial-numeric typo like 1abc falls 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

  • codex: 1 round (caught the parseFloat partial-parse footgun) → fixed (strict Number()) → codex re-confirmed clean.

Test plan

  • +8 resolver unit tests (precedence, range/validation, partial-numeric rejection, all-invalid fallback)
  • full gate suite green (63 tests)
  • typecheck clean
  • env smoke: 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
  • CI

🤖 Generated with Claude Code

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>
@gorajing gorajing merged commit c856493 into main May 26, 2026
1 check passed
@gorajing gorajing deleted the feat/gate-env-config branch May 26, 2026 03:22
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.

1 participant