Repository navigation
fix(rust): parse Rust 2015 files that use try! instead of falling to the lexical fallback (#10054) - #10072
Conversation
…the lexical fallback (#10054) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X6PpvQbrLxYbxRjHqJ4Aby
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 57 minutes. View limit details
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Edition fallback and validation crates/ripr/src/analysis/syntax/nesting.rs, changelog.d/10054-rust-2015-try-macro-parses.md |
The parser tries Rust 2015 after the current and Rust 2021 parses fail, and returns the result if it has no errors. Tests check try!(...) parsing and confirm malformed input still produces errors. The changelog describes the change. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Possibly related issues
- Issue 10054 describes the Rust 2015
try!(...)parsing defect addressed by this change.
Possibly related PRs
- EffortlessMetrics/ripr-swarm#8990: This PR changes the shared parsing path used by the parser-backed test-stub discovery described in PR 8990.
Merge Risk: 
Minimal · up to 91daf
-
The change matches the documented parser recovery policy, with no established merge-blocking risk.
Pre-merge checks: 
3 · 
2
-
Failed checks: 2 warnings Passed checks: 3 passed-
Full details: Title check
-
Explanation
The title names the main change: Rust 2015 files that use try! now parse instead of falling back to the lexical path. It is specific and matches the changeset (nesting.rs adds a third Edition2015 attempt, plus a changelog entry). The title is a single sentence of 16 words, which is slightly long but still clear. It uses the conventional fix(rust) prefix and includes the issue number.
-
Full details: Description check
-
Explanation
The description follows the repository template only partly. It has a Summary-like 'What changed' section and a 'Proof' section with commands and results. It links governing issue
#10054and gives a one-sentence acceptance delta. It omits most required template sections: Swarm/Source Boundary checkbox, Candidate Relationships (the objectives mention PR#10072, which the description does not mention), Scope and Scope Classification, Support-tier Impact, Policy Impact, Claim Boundary, Rollback, Spec-Test-Code Traceability, Static Language Check, CI Economics, Engineering Check, and Gates checklist. The Proof section lists only two commands, not the full gate list. The description contains no ledger or rollback notes. The attribution header and footer are author tooling and do not conflict with the template.Resolution
Complete the template sections the description skips. Specifically: (1) tick the Swarm / Source Boundary item and confirm the target repo; (2) fill Source-of-truth Links (proposal, spec, ADR, plan item) and state the acceptance delta; (3) fill Candidate Relationships, and reconcile the PR number mismatch: the objectives cite PR
#10072while the description cites issue#10054only; (4) complete Scope, Scope Classification (production delta, evidence delta, single acceptance criterion, non-goals); (5) answer Support-tier Impact and Policy Impact (for example, whether the change touches docs/status/SUPPORT_TIERS.md or the no-panic policy, since the new code path and test may matter); (6) add Claim Boundary and Rollback notes; (7) fill Spec-Test-Code Traceability with the test name and touched files; (8) confirm the Static Language Check; (9) mark CI Economics as n/a if no CI behavior changes; (10) complete the Engineering Check and Gates checklist, or record which gates ran and which were skipped.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
A rabbit parses try! with care,
Rust 2015 joins the parser’s lair.
Newer editions fail their test,
The older parse may handle the rest.
For broken input, errors stay;
The rabbit hops along its way.
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
Code Review
This pull request adds support for parsing Rust 2015 files that still use the try!(..) macro. Previously, such files would fail to parse under newer editions (where try is a reserved keyword) and drop to a lexical fallback. The parser now attempts to parse with Edition::Edition2015 if Edition::Edition2021 fails. A unit test has been added to verify this behavior, along with a changelog entry. There are no review comments, so no additional feedback is provided.
There was a problem hiding this comment.
Decision
- Needs verification checks before upstream.
Verification questions
- Confirm broad sibling-route coverage was not established because rip r, ast-grep, and cargo-test sensors were skipped.
- Confirm the added test covers both successful Rust 2015 try! parsing and preservation of real syntax errors, while checking that newer editions reject the legacy construct.
Refuted
- The new 2015 fallback might hide genuine syntax errors by returning the lexical parser result for valid 2015 sources.; refuted because: The 2015 parse is returned only when error-free; the test also confirms malformed Rust 2015 source still reports errors.
- The claim is already established by the seeded thread.; refuted because: The seeded PR body explicitly states the 2015 third attempt and its controls, so the review does not introduce a duplicate concern.
- The fix requires broader parser or analyzer changes.; refuted because: The implementation is confined to the edition-selection function, with a focused unit test and changelog entry; no other route or analyzer boundary is changed.
- The change could regress files that currently parse successfully under newer editions.; refuted because: The existing successful 2021 and current-edition return paths are preserved; 2015 is attempted only after those paths fail.
Parked follow-ups
- The regression test proves the intended try! acceptance and rejects a malformed Rust 2015 file, although it does not cover every possible 2015 syntax construct.
Evidence gaps
- The PR claims passing focused tests and precommit checks, but this review lane could not independently verify those executions because test/build sensors were skipped.
- Model proof intent was rejected by deterministic validation.
EffortlessSteven
left a comment
There was a problem hiding this comment.
No actionable source or test-oracle findings emitted. The bounded #10054 acceptance is independently established below. Final merge disposition remains REVIEW_INCOMPLETE: this local proof does not establish hosted qualification or effective protection satisfaction.
Subject and integration basis
reviewed_head_sha: 91dafa922a1781744af2ae2e63845815b3424d58; tree5264f4a6b5f5ad9dc8ef39f143cef72dd8386fd3.- Actual candidate parent / merge base:
0bfaa83289db7ef05e47a9909e15979ada6e9c0c. Live PR metadata still reports baseb92579fce6cb8ed1d9872d6ea4f8724a7e4c6b2d. - Observed receiving merge
92c5432618acc12b6c90bbc06778ed1dd4eab147, tree8decf08b5bbb37f30dc6f891cb966dedc2f4134a. Git commit headers verify its actual parents are b92579f… + 91dafa9…, matching the checkout message and the advisory job checkout log. - Parser blob
081f852cb9336c0574ef69550d49d9a15744a7bbis identical in candidate and receiving merge. Review-owned experiments did not change the submitted branch. Existing delivery ownership stays onclaude/fix-10054-edition-2015-parse; governing issue remains #10054.
Inspected source / consumers
Read the complete two-file change and repository review/proof instructions. Followed nesting::{parse_source_file_uncached, parse_source_file, parse_clean_source_file} through RA file summarization, lexical-fallback facts, and actual CLI JSON/human output. CURRENT and 2021 successful returns remain first; 2015 is tried only after both error; only a clean 2015 parse returns; otherwise the original CURRENT parse returns. The full-source cache key and pre-parse nesting refusal remain intact. No dependency, output-schema, platform-specific, credential, or release surface is changed.
Executed parser/oracle controls
Linux x86_64, rustc 1.95.0 (59807616e1fa2540724bfbac14d7976d7e4a3860), locked dependencies; all product builds used --no-default-features --features lang-rust, unoptimized debug-info=0, four build jobs.
- Exact candidate:
cargo test --locked -p ripr --no-default-features --features lang-rust --lib a_rust_2015_try_macro_parses_clean_and_real_errors_do_not -- --nocapture: exit 0, 1 passed, 11,213 filtered out. Compiled libtest enumeration confirmsa_rust_20selects both the 2015 and 2021 tests. - An independent rustc test harness included the unchanged production parser module using the same locked
ra_ap_syntax 0.0.349dependency: 3/3 passed. It checks legacy rejection under both newer editions / clean 2015 acceptance, repeated cached calls, >512 KiB cache bypass, successful CURRENT/2021 inputs, and legacy source beyond the nesting budget. - Three genuine malformed inputs fail all three editions. Repeated parser calls retain the CURRENT error values and syntax tree, while
parse_clean_source_filereturns None. - Repair-removal control retains the new test and removes only the 2015 production fallback. Experimental tree
f1ce91b3d81a6d67dbddc38bb1714593c743dbbd, parser blobad9da112222c42bd1c5ccc69ab65532d2a776703. In the retained-module harness the authored regression fails its legacy-acceptance assertion (exit 101); the independent legacy-acceptance test also fails (exit 101), while its syntax-error and newer-edition/budget controls still pass. These are observed behavioral failures, not build/setup failures.
Executed public acceptance
Each product executable was built with cargo build --locked -p ripr --no-default-features --features lang-rust --bin ripr (exit 0), frozen separately, and run on identical source/configuration with separate cold cache directories. Default draft mode; no discovered ripr.toml.
External subject: regex dd120a963a48d96d930bbc3ea0c63bd689259708, parent bc06024c7f3759e61ad75915a0c1ea49af0b4fe8; original parser blob 53976b3ebda5557bd24aefd90b53dac7f8b58c7e, all 39 try! calls intact. Command: <frozen-binary> check --root <regex-root> --base bc06024c7f3759e61ad75915a0c1ea49af0b4fe8 --format json. All three runs exit 0 and report identical input identity sha256:d67355b262bc8b46ad6a3f40e659dbfff77e011d83fc2209719f421057bafff6.
| Executed subject | Probes | no_static_path | Added parser-test lines |
|---|---|---|---|
| Candidate 91dafa9… | 25 | 0 | none above line 2700 |
| Repair removed, f1ce91b… tree | 51 | 22 | six warnings at 2806–2810 |
| Receiving merge 92c5432… | 25 | 0 | none above line 2700 |
The removal output reproduces the unrelated parse_decimal owner in its evidence. Both repaired subjects exclude those test lines. Intervening main changes touch extraction/test recognition/output, so the receiving composition was exercised: finding IDs, file/line, family, class, severity and outcome agree with candidate. All JSON differences are exactly the inherited #10052 related-test miss wording (31 strings); no unexplained delta.
A separate minimal Rust 2015 fixture changes Ok(v + 1) to Ok(v + 2) and adds a cfg(test) module. Both repaired subjects emit one production finding at line 3 and no added-test finding. Appending fn broken( { produces partial_with_limitations, analysis_complete=false, and the syntax-error producer_failure. Candidate/removal malformed JSON is byte-identical; receiving semantics agree (only one inherited wording string differs). The real human formatter explicitly displays incomplete analysis and recovery. CLI exit 0 here means the fallback analysis completed, not that malformed Rust was accepted as a clean AST.
Executable SHA-256:
- candidate:
7a2c6188befb918db821841e0f36873c7549b8e04eae5ec9e898eb0641f25f6d - removal:
3560aa6ac6cff1e3b17bdfe99319fc27180a6ef014fe473375e1658adb6c6aa3 - receiving:
2674e9b2d0366e4d8622571696630deec90d552e2cdcf43df9d9e2b9971d41a6
Hosted evidence / limits / existing-owner continuation
The available commit-run read returns 11 PR-event runs (first-page scope). Ordinary CI 40087856341 and all four listed jobs are skipped. The UB advisory review remains incomplete as hosted parser proof: its job log explicitly records two parser red/green tasks deferred with zero matching receipts, and labels the existing pass head-only. That valid unrelated receipt is retained; its test suite was not duplicated. Wheel success is separate. CodeRabbit has no actionable source comments; current inline-thread read is empty, which was not used as source acceptance.
The checked-in routed-rust.yml / docs/PR_AUTOMATION.md install the explicit merge-ready request for Ripr Rust Small Result; no request is present in the returned inventory. The observed basis’s hard-cut packet is inactive. This is not a claim that no other run or effective required context exists.
Preserved read blockers: gh api GETs for commits/main, commits/91dafa…/check-runs?per_page=100, and branches/main/protection each returned Forbidden. No HTTP headers/cause were supplied. They were not retried or routed around. Consequently independent live-main-tip, exhaustive check inventory and effective protection satisfaction remain unestablished.
blocking_findings: none in the bounded source/oracle/public-output claim.
proof_or_review_missing: hosted current-head qualification / effective protection and full inventory verification.
affected_currentness_dimensions: source/test/oracle/public output accepted for frozen head; bounded integration accepted for observed receiving merge only.
residual_assumptions_and_non_claims: no broad/default-feature suite, other-platform, whole-regex correctness, wheel, release, or merge-readiness claim. Regex also reports existing contextual include/module limitations on stderr; this review claims the changed-file behavior above.
Single next qualification transition: the existing delivery owner/parent coordinator reconciles the preserved read-access/admission limits, then requests the installed exact-head pre-merge qualification for this selected candidate and inspects its actual checkout/result. This review lane requested no CI, changed no labels/Ready state, made no author-branch edit, and performed no merge or publication.
…t the macro tree (#10054) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X6PpvQbrLxYbxRjHqJ4Aby
|
Independent review (two fresh read-only passes) on head 40520c5: first pass led to repairs (doc comment, gate on Generated by Claude Code |
There was a problem hiding this comment.
Decision
- Needs one verification check before upstream.
Verification questions
- Confirm broader source-route coverage beyond the direct parser helper was not established from the supplied diff; other
try!lexical spacing variants remain a residual boundary.
Refuted
- The retry could regress files that parse successfully under newer editions.; refuted because: The function returns the successful 2021 parse before examining the try! gate, while the 2024 result remains the fallback if all attempts fail.
- Retrying Edition2015 might hide genuine syntax errors.; refuted because: The implementation returns the 2015 parse only when error-free; otherwise it returns the prior parse. The test asserts malformed source still has errors.
- The change requires parser-wide or analyzer-wide architectural changes.; refuted because: The implementation is confined to edition selection in parse_source_file_uncached, with a focused unit test and changelog entry; no sibling route or analyzer contract is modified.
- The change requires broad parser or analyzer changes and has broad route coverage.; refuted because: The implementation is confined to edition selection in nesting.rs, but broad route coverage was not independently established because ripr failed and cargo-test evidence was still late.
Parked follow-ups
- The gate is textual rather than syntactic; unusual tokenization of try! may omit the retry, but that case remains fail-closed rather than incorrectly succeeding.
- The narrow try! gate intentionally excludes other Rust 2015-only syntax, making this the smallest fix for the stated try! acceptance delta.
- The 2015 retry is a syntax-validity fallback but does not identify Edition2015 in the returned Parse value.
Evidence gaps
- Hosted proof remains trust-affecting because the ripr sensor failed and cargo-test evidence was pending or scheduled rather than shown in the packet.
- The PR body reports materially stronger route evidence than the unit test: 51 to 25 probes, zero no_static_path, and none above line 2700 on BurntSushi/regex.
- Model proof intent was rejected by deterministic validation.
|
Owner receipt reconciliation for #10054 / #10072. @EffortlessSteven: the PR metadata verifies merge at 2026-10-24 14:02:06 UTC as d27cb6eb47eaaabd8ed27171abd4a9b36457e6fe, with final PR head 40520c5105263942b6f0eedbf06150e30c18934a. The final-head and landed nesting.rs blobs both equal 230ab27f63de847032cb592ee3e5df143d423c91; the landed changelog is 275addc2cc4d9fedb9f8800e4dbbc9027b3d965c. The landing includes the later try! / try ! gate, doc update, async-identifier rejection and macro-tree assertion. Independent review 5638232910 remains valid historical proof for 91dafa9 and receiving 92c5432: parser controls, removal discrimination, regex 51/22 to 25/0 and malformed-source refusal. Its parser blob was 081f852cb9336c0574ef69550d49d9a15744a7bb, so those executed receipts are not promoted to final-head qualification. To reuse the two passes reported in the 13:14 coordination comment, please link their original dispositions, including each original timestamp, exact reviewed revision, findings/repair relationship and executed versus inspect-only scope. Please also link any existing final-head parser, public-output/removal, receiving-composition and hosted receipts, preserving their original subject and terminal outcomes. If a dimension was not executed or retained, state that rather than reconstructing a pass. This requests existing evidence only, not a new reviewer or qualification campaign. The previously recorded Forbidden holds on live-main, exhaustive check-run inventory and branch-protection reads remain in effect; no bypass or retry is requested. Landing is verified, while final-head proof and qualification remain limited to the receipts actually available. |
Requested by Steven · project thread
Governing issue or accepted claim: #10054
Acceptance delta (one sentence): A Rust 2015 file using
try!(..)is parsed (2015 tried after 2024 and 2021) instead of dropping to the lexical fallback that seeded added test lines as warning probes.What changed
parse_source_file_uncached(analysis/syntax/nesting.rs) gains a third attempt withEdition::Edition2015, used only when both newer editions report errors. Unit testa_rust_2015_try_macro_parses_clean_and_real_errors_do_nothas controls proving 2024 and 2021 rejecttry!and that a real syntax error still fails.Proof
dd120a9,ripr check --base dd120a9^ --format json: before, 51 probes with 22no_static_pathincluding 6 warning probes on the added testerror_class_unsupported_char(parser.rs:2806-2810, ownerparse_decimal); after this change 25 probes, 0no_static_path, none at lines above 2700.cargo test -p ripr --lib a_rust_20passes;cargo xtask precommitpasses.Generated by Claude Code