Repository navigation
fix(zig): branch counts the keywords and/or, not the nonexistent && and || - #8937
Closed
squid-protocol wants to merge 2 commits into
Closed
squid-protocol wants to merge 2 commits into
squid-protocol wants to merge 2 commits into
Conversation
…nd || (Part of #8905) The Zig branch rule listed `&&` and `||`, operators Zig does not have (its short-circuit operators are the keywords `and` and `or`), so boolean operators were never counted, unlike C, C++, Go, JavaScript, Python and PowerShell. Now `and` and `or` count. On ghostty/src (4,812 functions, family-oracle): branch recall 0.984 -> 1.000, precision 0.999 -> 1.000. The wider decision (whether short-circuit operators belong in the branch contract at all) stays open in #8905/#8862; this follows the rule's evident intent and the majority of languages. The old strict test pinned the dead spellings as matches; it now pins and/or. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvejJbzNR67xR3D2VxV
) Intended effect of the previous commit: Zig functions that use `and`/`or` now score higher branch counts (tigerbeetle, mach, bun, ghostty entries). Corpus-wide values that derive from branch counts (topological coordinates, repository fingerprint, health, composition, archetype distribution) shift slightly in every language, which is why the diff is wide but tiny outside Zig (e.g. tcl sqlite_query_planner Z 717.16 -> 717.29). Main was clean before this change (the Haskell re-bless on the same base moved only 45 values). Regenerated with tests/tools/crucible_check.py --update --yes. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvejJbzNR67xR3D2VxV
This was referenced Nov 21, 2026
Owner
Author
|
Superseded by the family split: Zig's |
squid-protocol
added a commit
that referenced
this pull request
Nov 22, 2026
…uit (leaf families, computed composites) (#8939) * feat(families): split boolean operators out of branch into a new short_circuit family (Part of #8862, #8905) Eagle Eye (#8863) showed the broad families scoring worst because one name covered several things that languages spell and count differently. Decision (owner, 2026-11-21): narrow leaf families with one-sentence contracts, composites computed from leaves, one parser oracle per leaf (docs/family_levels.md). First split: `branch` -> `branch` (constructs and arms) + `short_circuit` (boolean operators); composite `decision_points = branch + short_circuit` (computed, not scanned). - New family `short_circuit` (column struct_short_circuit): signal contract, display name, schema comment, docs/short_circuit_rule_contract.md, branch contract corollary 0. - 45 language rules: boolean operators moved from `branch` to `short_circuit` with the same literal-shielding scope filter. Verified per function on 71,000+ functions of 15 repositories (express, curl, flask, Alamofire, AFNetworking, brew, impacket, exiftool, retrofit, okhttp, tokio, redis, vue, vapor, wordpress): old branch == new branch + short_circuit for every function. - Deliberate differences: negation (`not`, `-not`) leaves `branch` in lua, livecode, csharp, powershell (neither family); csharp gains `&&`/`||` (it counted only its `and`/`or` patterns; jellyfin moves up); zig counts `and`/`or` (its rule listed `&&`/`||`, which Zig lacks; supersedes #8937); nim drops try/except/finally from branch (#8926) and counts `and`/`or`; solidity, groovy and haskell gain a rule. - Tests that pinned the old definition now pin the new one. Keyword-rosetta verifier output is identical to main for all 34 languages that have a fixture. Goldens and the archetype models are NOT updated in this commit. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvejJbzNR67xR3D2VxV * chore: regenerate docs_read_by_tests.txt for the short_circuit contract doc Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvejJbzNR67xR3D2VxV * feat(families): decision-density metrics read decision_points = branch + short_circuit (Part of #8862) Where the engine computes per-function and per-file decision density (magnitude, control-flow ratio, the function `branch`/`complexity` it exports, the file control-flow ratio, the signal processor's file cognitive inputs), read the composite instead of the narrowed leaf, so those metrics keep the meaning they had before boolean operators moved to `short_circuit`. The stored struct_branch / struct_short_circuit columns remain the two leaves. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvejJbzNR67xR3D2VxV * test: re-bless golden masters for the branch / short_circuit split (Part of #8862) Regenerated with tests/tools/crucible_check.py --update --yes, after decision density was wired to decision_points = branch + short_circuit. What moved: the `struct_branch` column falls in the 36 languages whose rule counted boolean operators (those hits are the new `struct_short_circuit`, a new fixture part in each golden); csharp gains && / || (counted before only through its and/or patterns); zig counts and/or; nim drops handlers; metrics that read the stored leaf follow. Per-function complexity is unchanged outside C# (0 of 71,763 functions on 15 repositories); archetype assignments change for 0.27% of 78,325 functions. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvejJbzNR67xR3D2VxV * test: re-bless the DOOM-rosetta golden for the branch / short_circuit split (Part of #8862) Regenerated with tests/tools/doom_rosetta_check.py --update --yes. Four ports moved, all through the deliberate differences of the split: odamex (powershell: -not leaves branch), edge-classic (lua: not leaves branch), managed-doom and helion (csharp: && and || now counted, `not` pattern removed). The other ports are unchanged. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvejJbzNR67xR3D2VxV * tests/docs: the signal count is 98 with short_circuit (Part of #8862) The two real failures of #8939's full suite (parts 3 and 4), caused by adding a family: test_surface_families_contract pins SIGNAL_SCHEMA at 98 (the surface-family exempt list is 36 with short_circuit beside branch; 22 families and 62 members are unchanged), and the docs that quote the count (gitgalaxy/README.md, docs/wiki/01-06 and 06-03) now say 98. Missed locally because the full core_engine run had timed out; the CI parts that failed held only these two tests. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvejJbzNR67xR3D2VxV * chore: golden masters rebuilt from main's store and re-blessed (the last push mixed two store layouts) Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.
Part of #8905 (does not close it: whether boolean operators belong in the branch contract is still a decision).
What and why
Found by the family-validity tool (#8864) with a Zig oracle on ghostty
src/(4,812 functions). The Zigbranchrule listed&&and||, which Zig does not have; its short-circuit operators are the keywordsandandor. Boolean operators were therefore never counted, unlike C, C++, Go, JavaScript, Python and PowerShell. The rule now countsandandor.This follows the rule's evident intent and the majority of languages. If maintainers decide boolean operators should not count (#8905/#8862), the right edit is to drop the pattern everywhere, and this PR's test then flips.
Measured (same oracle and scan, before -> after)
branch recall 0.984 -> 1.000, precision 0.999 -> 1.000.
argsunchanged at 1.00/1.00.Gates
test_zig.py; an existing strict test that pinneda && b/a || bas matches (the dead spellings) now pinsand/or. Zig suites: 133 passed.mainwas clean (a Haskell re-bless on the same base moved only 45 values). Goldens re-blessed withcrucible_check.py --update --yes, 60 fixture parts in a second commit.and/or.🤖 Generated with Claude Code
https://claude.ai/code/session_018srRvejJbzNR67xR3D2VxV