Repository navigation
Contextual Baseline Fix: case-fold the resolver for case-insensitive-import languages (#2871) - #2915
Merged
Merged
Conversation
…import languages (#2871) galaxyscope's _resolve_dependency_graph -- the resolver the Contextual Baseline Fix is gated on -- kept an exact-case suffix fast path and a stem fallback whose `len(stem) >= 3` guard rejects `b`. Haskell module names must be capitalised, so `import B` missed the fast path (key `b`) and was refused by the fallback, while network_risk_sensor's #2540 case-folded graph (the one pagerank and the recorded `popularity` column read) resolved the same edge fine. Every column a reviewer could see said the chain resolved; the one consumer that wipes an imported file's orphans never ran. keyword-rosetta haskell a/b/c: unreferenced_by_name 3 where every other language reads 0, risk_tech_debt 97 against an irc0 median of 30. This adds the orchestrator's twin of the sensor's Stage 1c: a per-language lowercase view of the suffix keys, built only for CASE_INSENSITIVE_IMPORT_LANGS (fortran, cobol, haskell -- the same registry flag #2540 introduced) and holding only that language's own files, consulted only after both exact-case fast paths miss. Case-sensitive languages gain nothing; folding never invents a cross-language edge; the language-agnostic stem fallback is untouched. Measured: haskell a/b/c popularity 0 -> 1 at the CBF, state_unreferenced 3 -> 0, risk_tech_debt 97.07/97.07/100 -> 0/0/81.76 (java, rust, swift read exactly that). rosetta_audit 46/46: no gated cell moves (haskell PASS 80; c's a.c is #2907's pending re-bless). crucible_check: both golden masters PASS unchanged. Corpus owes the retirement of ledger entry haskell-module-name-invisible-to-popularity-tally (rosetta:rebless-owed). Phase 1 of #2908. Co-Authored-By: Claude Fable 5.1 <[email protected]>
7 of 11 tasks
Contributor
Closed
13 of 24 tasks
squid-protocol
added a commit
that referenced
this pull request
Sep 9, 2026
…S timing asserts (#2901) (#2919) * ci: dedupe concurrent runs, parallelise pytest, cap job runtime Measured over the last 400 workflow runs (~27h window, 2026-09-08/09): 2201 min of wall clock, of which Full Suite Gate alone was 983 min (45%). The cost was not test execution -- it was running the same tests repeatedly and then queueing for runners. Three findings drove this: 1. `full-suite-gate.yml` triggers on `pull_request: types: [labeled]` with no label filter, so EVERY label added starts a separate run. PRs here routinely carry four labels (bug, metrics, core-engine, rosetta:rebless-owed), and #2915 fired four identical 12-job matrix runs against one SHA (56624e7) within 10 seconds. rosetta-audit, which also listens for `labeled`/`unlabeled`, fired five times on the same commit. No workflow in the repo declared `concurrency`, so nothing superseded anything. ~577 min of the sampled 2201 was redundant. 2. Queue time dwarfed run time. In run 34346837647 the matrix jobs RAN for 10-18 min but QUEUED for 23-65 min, macOS worst (51-65 min) as the scarcest pool -- 16 macOS jobs were queued where 4 were needed. 3. `pytest tests/ -v` ran the whole suite single-threaded and streamed 7946 lines / 1.1 MB to the Actions log per job. Changes: - `concurrency` on 18 workflows, keyed by workflow + PR number (or ref). `cancel-in-progress` is deliberately scoped to `pull_request` via an expression: the push/schedule/tag runs are the ones that COMMIT (docs deploy, tri-comparison / tree-sitter history charts, releases), and cancelling one mid-write risks a half-written commit. Those now serialise on the group instead. `publish.yml` and `release-crucible-archive.yml` are left untouched entirely -- the release path should not be interfered with. - pytest jobs get `pytest-xdist` and run `-n auto -q -ra --durations=25`. Verified locally against this same tree: 8685 tests, serial 323.6s -> parallel 104.8s (3.1x on 6 cores), identical pass/skip/xfail counts. CI runners are 4-core, so expect ~2.5x. `-ra` keeps the xfail/skip summary and `--durations=25` keeps a slow-test report, which is the only part of `-v` that was load-bearing on a green run. - `timeout-minutes` on every job across 18 workflows. The default is 6h; a Full Suite Gate run was observed sitting at 78 min mid-flight during this investigation with nothing to stop it. - `full-suite-gate.yml` sizes its matrix per checkpoint. A `v*` tag still gets the untrimmed 12-way grid. A PR label gets 8 jobs: all four Python versions on ubuntu (the thing this gate exists to catch is a version-specific break the every-push ubuntu/3.12 full-suite cannot see), with windows and macOS covering the version floor and ceiling only. That halves the macOS jobs that dominate the queue. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(tests): replace wall-clock ReDoS ratios with absolute bounds (#2901) #2901 reports two asserts going red on shared macOS runners for PRs whose diffs touched neither: `test_embedded_python_spec_exposure_redos_immunity` (macOS runs 34288012477, 34212533327 -- expected ratio > 2.5, got 2.31) and `test_var_decl_pattern_scales_linearly_not_quadratically`. Both compare wall-clock samples on a contended runner. Scope is wider than the two files the issue names, deliberately: the same shape appears at 22 timing sites, and the companion CI change in this branch runs the suite under `pytest -n auto`, which raises CPU contention and would have made every one of them flakier. `_strict_harness._best_of_timing`'s own docstring already records this class of failure recurring (#713, #800), and groovy's spec_exposure test carries a comment about it going red on macos-3.10 during #770. Triaged into three groups: - 6 sites already assert an ABSOLUTE bound on the shipped pattern (test_prism, abap, matlab, scheme, yaml, security_lens). Left alone -- these are the shape the issue recommends. - 13 sites timed the PRE-FIX pattern to prove it was quadratic before checking the shipped one. Removed. They measured a regex this repo no longer ships, so no threshold makes them both meaningful and stable, and every one is redundant with an `assert_redos_immune` already in the same test. The measured pre-fix numbers are preserved as comments, and `test_language_standards_strict.py` keeps each language's pre-fix pattern in its parametrize table as documentation (the param is renamed `_old_pattern_text` to mark it non-executable). - 3 sites (groovy x2, yacc) asserted a ratio ceiling on the SHIPPED pattern immediately after an `assert_redos_immune` call on a 100k payload. The ratio was strictly weaker than the absolute bound above it; removed. - 2 sites converted from ratio to absolute bound, since they had no `assert_redos_immune` of their own: * `var_decl`: verified the replacement still catches what it is for -- restoring the adjacent-unbounded-quantifier shape (`[^=\n]{0,80}` -> `[^=\n]*`) makes the new 160k assertion FAIL, while the shipped pattern passes it in ~1.1s including process spawn. * ada `func_start`: measured while replacing it, this site has NO reachable quadratic regression -- the aspect segment is lazy, so even fully unbounded (`[^;{}]{0,300}?` -> `[^;{}]*?`) it stays linear (0.0002s / 0.0004s / 0.0007s / 0.0014s at n=2000/4000/8000/16000). The old ratio's additive 0.05 floor was deciding the result. Kept as a plain ceiling on a long aspect run and the docstring says so rather than overclaiming. Suite is green both ways on this tree: 8685 passed / 4 skipped / 9 xfailed / 3 xpassed, identical serial and under `-n auto`. No new ruff findings (the one I001 in test_language_standards_strict.py predates this branch). Closes #2901 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: Joe Esquibel <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[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.
Closes #2871. Phase 1 of #2908 (child of #2812).
What
Two dependency resolvers disagreed.
network_risk_sensor's graph (pagerank, the recordedpopularitycolumn) learned in #2540 that haskell's necessarily-capitalisedimport Bbindsb.hs. The orchestrator's own_resolve_dependency_graph— the resolver the Contextual Baseline Fix is gated on — did not: its suffix fast path is exact-case (keyb, tokenB) and its stem fallback'slen(stem) >= 3guard rejectsb. So every visible column said the chain resolved while the orphan wipe never ran.This adds the orchestrator's twin of the sensor's Stage 1c: a per-language lowercase view of the suffix keys, built only for
CASE_INSENSITIVE_IMPORT_LANGS(fortran, cobol, haskell — the registry flag #2540 introduced) and holding only that language's own files, consulted only after both exact-case fast paths miss. Case-sensitive languages gain nothing, folding never invents a cross-language edge, and the language-agnostic stem fallback is untouched.Measured
haskell corpus folder, full precision, before → after:
state_unreferencedrisk_tech_debtjava, rust and swift (same stratum, same layout) read exactly 0 / 0 / 81.76. This clears the
risk_tech_debtopen-defect cell and takes haskell'srisk_documentationinput onto the right footing for Phase 2.rosetta_audit.py, 46 languages against keyword-rosetta at origin/main: no gated cell moves (haskell PASS, 80 assertions; the one reported regression is c'sa.c, c api rule counts top-level variable declarations as public surface (a.c reads api 5 for 3 functions; +25.0% sits at the band edge) #2907's re-bless in keyword-rosetta#110). The manifest gate cannot seeunreferenced_by_nameafter the wipe, which is why this was ledgered rather than asserted.crucible_check.py: both golden masters PASS unchanged — no crucible file carries a short capitalised import that this path decides.test_galaxyscope.py60 passed, incl. the new regression (haskellimport B→b.hs; goBdoes not fold; haskellimport Qdoes not fold ontoq.py).audit_check.pyall clear.Corpus
Label
rosetta:rebless-owedfor the ledger only:haskell-module-name-invisible-to-popularity-tallyretires (risk_tech_debthaskell +178% → on the median), and the haskell manifest note's "control for #2827" remark gets the correction the issue names (itsapi_orphan_credit0 was a suppression that never had a chance to run). No manifest number changes.Not done here
The issue's deeper fix — the Contextual Baseline Fix reading the sensor's graph instead of a second resolver — is a refactor of the orchestrator's Phase 1.5 and stays open as a design question. This PR makes the two resolvers agree on the case the corpus proved, with the same scoping rules, so they cannot disagree on it again.
🤖 Generated with Claude Code