fix(drift): discount CALLS-layer tangle by unresolved_ratio (#244)#253
Conversation
tangle_ratio fades the CALLS layer by clip(1 - unresolved_ratio) before the max(), mirroring the drift-distance path (_clip_discount / _score_v2). t_calls is a census over RESOLVED intra-domain calls only, so a sparse/mostly-unresolved call graph with one resolved mutual triple could read a high calls-tangle and trip the hard gate on thin evidence. The IMPORTS layer (always resolved) is never discounted. Discount only lowers calls-tangle, so the 0.25 threshold and self-drift safety are unchanged (verified: cgis-self 0 tangle gate_failed). Closes #244. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
There was a problem hiding this comment.
Code Review
This pull request implements a confidence discount for the CALLS layer in the tangle_ratio calculation, addressing issue #244. The CALLS layer is now faded by 1 - unresolved_ratio (clipped between 0.0 and 1.0) to prevent sparse or mostly-unresolved call graphs from over-reporting calls-tangle. Unit tests have been added to verify this discounting behavior, ensuring that the IMPORTS layer remains unaffected and that the discount behaves correctly under various unresolved ratios. No review comments were provided, so there is no additional feedback to address.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.



Summary
Closes #244 (colleague-review note 1 from PR #241).
PatternFingerprint.tangle_rationow fades the CALLS layer by the confidence discountclip(1 − unresolved_ratio)before themax():t_callsis a census over resolved intra-domain CALLS only, so a domain whose calls are mostly raw/unresolved — plus one resolved mutual triple — could read a high calls-tangle (tangle_mass ≈ 0.67from a single201) and trip the hard hygiene gate on thin evidence. This mirrors the existing drift-distance treatment (_clip_discount/_score_v2), which already fades the calls layer for exactly this reason. The IMPORTS layer (always resolved) is never discounted.Why it's safe
The discount can only lower calls-tangle, so it can never push a green domain red — the
max: 0.25threshold stays valid and no re-measurement is needed.cgis drifton the self-graph → 0 tanglegate_failed(unchanged).Tests
unresolved_ratio(mesh + 0.5 unresolved → 0.5);Residual (deliberately not in scope)
This fixes the mostly-unresolved case (issue option 1). It does not address a domain with few but fully-resolved mutual calls (
unresolved_ratio = 0→ discount = 1 → full calls-tangle from one triple) — that's issue option 2 (a minimum-triad-count floor). Left out per YAGNI: it needs its own magic-number calibration, the common case is the unresolved one, and self-drift is safe regardless. Easy to add later if a real domain hits it.Co-Authored-By: Claude Fable 5 noreply@anthropic.com
🤖 Generated with Claude Code