Skip to content

perf: line-gate state_mutation for typescript, javascript, python (Part of #3171) - #6368

Merged
squid-protocol merged 1 commit into
mainfrom
churn/3171-20261024T0449Z
Oct 24, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
churn/3171-20261024T0449Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #3171

What

state_mutation in typescript, javascript and python is now line-gated (_line_gates). Their method-call arms used \s*\(, which can span a newline, so pattern_is_line_local refused the rule ("class matches newline"). They now bind [ \t]*\(, the same narrowing cpp got in #3170. With that, build_line_gate builds a gate from the required literals (=, ++, --, add, pop, set, ...).

Class / Sibling gaps

Class: state_mutation rules that pattern_is_line_local refuses only because of a \s*\( call arm. Checked by swapping every \s*\( for [ \t]*\( in each language's rule and re-running the check.

Evidence

  • Zero match movement: old vs new finditer spans compared on every crucible file (typescript 39 files / 6265 matches, javascript 33 / 3200, python 290 / 10316): 0 files moved.
  • line_gate_bench.py (best of 7-11): corpus ts 1.5x, js 1.4x, python 1.8x; dense-case loss ts 28-35% in 6 of 7 runs (one run under load hit 37%), js 28-37% (one noisy run), python 16-18%.
  • gate_parity_audit.py: zero violations (exact-parity leg covers the three new rules).
  • Golden masters, both legs (golden-lock.sh crucible_check.py --update --yes): no drift.
  • tests/core_engine/test_line_gates.py + test_rule_prefilter.py: pass; ts/js/python strict suites: 290 pass.

Facts checked

  • keyword-rosetta is not checked out on this box, so the rosetta half of the zero-movement proof was NOT run; the crucible half was.
  • line_gate_bench.py is not run in CI, so the bench numbers are from this box only.

Remaining slices

Rust and the other narrowable languages above; how_to_add_a_language.md still lists only c/cpp/go/ada/yacc as shipped (not touched: 5-file cap).

🤖 Generated with Claude Code

…rt of #3171)

Narrow the method-call arms `\s*\(` -> `[ \t]*\(` so pattern_is_line_local
accepts the rule (same as cpp in #3170), then opt in via _line_gates.
Zero match movement over the language-crucible corpus; bench: corpus
1.4-1.8x, dense loss 22-35%. Java benched a 46% dense loss: left ungated.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 24, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 24, 2026 06:11
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant