Skip to content

test(csharp): Mode B slicer guard for the compound-assignment file shape (Part of #3320) - #5356

Merged
squid-protocol merged 1 commit into
mainfrom
churn/3320-20261017T1616Z
Oct 17, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
churn/3320-20261017T1616Z

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Part of #3320

What

Test-only. #4999 already made C# func_start linear on adjacent [...]/<...> runs (roslyn UserDefinedCompoundAssignmentOperatorsTests.cs: 60s timeout -> 0 functions became 1264 matches in 0.1s). The one item left on the issue was the residual csharp::Cartography_Mode_B_Braces cost, so I profiled it instead of guessing.

Finding: no engine defect in the brace slicer

  • The real roslyn file, scanned end to end (1 worker): 2.3s total, _slice_by_braces 0.38s.
  • 135 of the largest C# files from roslyn Test/ and runtime System.Runtime (80 MB), cProfile, 1 worker: 171s wall. _slice_by_braces 26.7s cumulative, 9.2s self (0.07s/file), roughly linear in size. The dominant cost is coding_analysis (43.8s self), then regex search/sub. Nothing super-linear.
  • So the 75s in the issue's sample is match volume across thousands of test files, not a backtracking or rescan trigger.

Change

tests/extraction/languages/test_csharp_strict.py: test_csharp_mode_b_slicer_compound_assignment_file_shape_3320 runs the synthetic compound-assignment file shape (4000 adjacent-bracket lines) through the real _slice_by_braces, asserting both methods are bounded and < 5s. #4999's tests only exercised the regex.

Gates

pr_gates --fast 6/6, --ratchets 8 pass / 0 fail / 0 skipped. No golden bless (test-only; engine untouched).

Class sweep

Same-mechanism siblings: none for the slicer. func_start siblings were swept in #4999 (53 regexes, none super-linear). Parity delta of #4999 (1829 phantom matches lost, 33 gained) is still awaiting owner acceptance on that PR's body.

Cross-repo

None.

Lessons for agents

  • ~/.cache/gitgalaxy/ruff-0.16.10/ holds bin/ruff, not ruff at the top level.

🤖 Generated with Claude Code

…ape (Part of #3320)

Profiling 135 of roslyn's/runtime's largest C# files (80 MB) found
_slice_by_braces linear in file size, so no engine change: the residual
Cartography_Mode_B_Braces cost is func_start match volume.

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 17, 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 17, 2026 16:28
@squid-protocol
squid-protocol enabled auto-merge (squash) October 17, 2026 16:28
@squid-protocol
squid-protocol merged commit 473a1f4 into main Oct 17, 2026
42 checks passed
@squid-protocol
squid-protocol deleted the churn/3320-20261017T1616Z branch October 17, 2026 16:34
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