Skip to content

fix(metrics): control_flow_ratio divides by coding LOC — closes #2770 - #2927

Merged
squid-protocol merged 1 commit into
mainfrom
fix/2770-cfr-loc-denominator
Sep 9, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/2770-cfr-loc-denominator

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

The file-level ratio divided branch hits by branch + structural_boundaries.
structural_boundaries is an ungoverned per-language vocabulary tally (45 words
in solidity, 16 in shell, 0 in markdown), so identical decision density read
wildly differently per language -- the corpus's worst metric at 33% consistency.

The denominator is now line_count: the non-blank lines of the comment-stripped
code stream, i.e. coding-LOC semantics. Chosen over total lines because comment
culture varies per language and must not skew a cross-language density metric.
This also brings the file-level ratio into agreement with two existing siblings:
the per-FUNCTION Control Flow Ratio (already branches/LOC) and logic_density
(same line_count, two lines below), plus record_keeper's dependency_density
(moved onto coding_loc by this issue's earlier phase, #2801).

structural_boundaries stays: it is the relocation target the branch contract
(#2822/#2832) depends on; it simply no longer prices a ratio.

logic_loc downstream shifts with the corrected ratio; it is an input to the
pre-trained security_auditor model, which has already drifted and has a retrain
tracked on #96 -- the retrain absorbs the new semantics.

Golden masters re-blessed (both modes); CI-equivalent verification PASS/PASS.

Closes #2770

Co-Authored-By: Claude Opus 4.8 [email protected]
Claude-Session: https://claude.ai/code/session_01QBL6TAMVXRUY7iQyy9Ysvi

🤖 Generated with Claude Code

https://claude.ai/code/session_01QBL6TAMVXRUY7iQyy9Ysvi

…ary vocabulary (#2770)

The file-level ratio divided branch hits by branch + structural_boundaries.
structural_boundaries is an ungoverned per-language vocabulary tally (45 words
in solidity, 16 in shell, 0 in markdown), so identical decision density read
wildly differently per language -- the corpus's worst metric at 33% consistency.

The denominator is now line_count: the non-blank lines of the comment-stripped
code stream, i.e. coding-LOC semantics. Chosen over total lines because comment
culture varies per language and must not skew a cross-language density metric.
This also brings the file-level ratio into agreement with two existing siblings:
the per-FUNCTION Control Flow Ratio (already branches/LOC) and logic_density
(same line_count, two lines below), plus record_keeper's dependency_density
(moved onto coding_loc by this issue's earlier phase, #2801).

structural_boundaries stays: it is the relocation target the branch contract
(#2822/#2832) depends on; it simply no longer prices a ratio.

logic_loc downstream shifts with the corrected ratio; it is an input to the
pre-trained security_auditor model, which has already drifted and has a retrain
tracked on #96 -- the retrain absorbs the new semantics.

Golden masters re-blessed (both modes); CI-equivalent verification PASS/PASS.

Closes #2770

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QBL6TAMVXRUY7iQyy9Ysvi
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 6dd10b9 into main Sep 9, 2026
31 checks passed
@squid-protocol
squid-protocol deleted the fix/2770-cfr-loc-denominator branch September 9, 2026 19:54
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.

control_flow_ratio is the corpus's worst metric (33%): it divides a pinned numerator by structural_boundaries, an ungoverned 0-45 vocabulary tally

1 participant