Repository navigation
fix(typescript): classify mock-payload braces in linear time - #8626
Merged
EffortlessSteven merged 2 commits intoOct 18, 2026
Merged
Conversation
Index matching parentheses once and memoize each brace prefix so
has_method_like_block no longer walks every enclosing control block
for every nested `{`. Verdicts stay the same.
Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
The allowlist control needs an owned String on the left of `+`. Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
EffortlessSteven
left a comment
Member
Author
There was a problem hiding this comment.
Author self-review (COMMENT; GitHub cannot request changes from the author). This is not approval.
reviewed_head_sha: 15230e2f59122cbad4a732c1c9e270df22eae9b7
integration_basis: origin/main a213d93a071315ca9d2cfb8a711e3eb278744447 (behind-only; mock_payload_guard.rs untouched on main since merge-base b66465e1c)
claim_boundary: has_method_like_block classifies nested owner braces in near-linear recorded work without changing mock-payload verdicts. No spec/golden/corpus/traceability. No typescript/tests.rs, committed_snapshot.rs, or oracle.rs.
changed_surfaces_and_semantic_owners_inspected:
- production: matching_parens index, BraceMemo, brace_context_at iterative walk with path memoization, has_method_like_block allowlist (unchanged shapes)
- consumer: MockCallFacts::read -> runs_changed_line_once -> has_method_like_block; changed_line_is_top_level_statement; opens_function_before_call
- follows_braceless_if_or_else still uses matching_open_paren (not the quadratic path)
- tests: in-file module (allowlist, nested-if credit, method-shorthand refuse, 500 vs 2000 work bound)
- changelog.d/7698-typescript-method-like-block-linear.md
blocking_findings: none
non_blocking_suggestions:
- BraceMemo magic 0/1/2 is local packing; fine for this seam
refuted_or_stale_findings:
- CodeRabbit docstring-coverage 80% warning: not a repository gate; production walk is documented; test helpers are not a public rustdoc surface. Gemini quota: missing provider review, not a clean Gemini pass.
proof_and_ci_observed:
- cargo test -p ripr --lib analysis::language::typescript::mock_payload_guard: 4 passed (2000-deep case in the 0.02s suite)
- mock_object_argument_tests: 5 passed; literal_matcher_tests: 9 passed (existing verdicts unchanged)
- cargo xtask precommit: pass on 15230e2f5; selected clippy -p ripr --all-targets and -p xtask --all-targets -D warnings
- merge ref pull/8626/merge d142e677 parents 30911f93 (then-base) + 15230e2f (head). No content conflict on this file.
proof_or_review_missing:
- hosted required checks on the Ready-triggered qualification of this exact head
- Gemini review (quota)
- classic branch-protection JSON 403 (evidence gap, not absence of protection)
affected_currentness_dimensions: production implementation, test stimulus, test oracle, public claim (changelog). Integration basis behind-only.
residual_assumptions_and_non_claims:
- Does not claim every TypeScript scan is now fast
- Does not claim RIPR-SPEC-0255 changed
- Does not claim runtime mutation killed/survived
- Work counter is an operation count, not wall-clock
disposition: REVIEW_INCOMPLETE for merge (hosted exact-head CI missing). Source/oracle review found no blocker. Ready may request qualification of 15230e2f5. Merge wait: required checks green on this SHA, then a published-head REVIEW_READY pass.
EffortlessSteven
marked this pull request as ready for review
October 18, 2026 00:01
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Member
Author
Exact-Head Review: fix(typescript): classify mock-payload braces in linear time (#7698) (#8626)
|
EffortlessSteven
deleted the
cursor/ts-mock-payload-linear-braces-f227
branch
October 18, 2026 00:56
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 #7698.
Summary
has_method_like_blockclassified every{by walking back through enclosing control headers and rescanning the prefix for matching(). On a nestedif (a) {owner that is quadratic in depth (the issue measured n=4000 at 6 s in debug). This PR indexes matching parentheses in one forward pass and memoizes each brace-prefix classification so the same verdicts stay near-linear in depth.Swarm / Source Boundary
This PR targets
EffortlessMetrics/ripr-swarm, the normal development trunk for trusted same-reporiprwork. Confirm the change belongs here:ripr-swarmSource-of-truth Links
Proposal: n/a
Spec: RIPR-SPEC-0255 (owner only; this PR does not edit the spec)
ADR: n/a
Plan item: n/a
Governing issue or accepted claim: #7698
Acceptance delta: deeply nested owner braces classify in near-linear work with unchanged mock-payload verdicts.
Candidate Relationships
Candidate branch (GitHub PR head is authoritative after publication):
cursor/ts-mock-payload-linear-braces-f227Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Acceptance retained from a replaced candidate (if any): n/a
Accepted winner and losing candidate disposition (when decided): n/a
Collision search before publication: no open PR, issue comment, remote branch, or commit claims #7698. Closed mentions (#7656 found the defect; #8258/#8201/#5416 are incidental). Open TypeScript PRs #8590, #8573, #8552, #8539 are out of this file.
Scope
crates/ripr/src/analysis/language/typescript/mock_payload_guard.rs(production scan plus its own test module) andchangelog.d/7698-typescript-method-like-block-linear.md.Scope Classification
This PR is scoped by:
Production delta:
has_method_like_blockbuilds a matching-()index once and memoizes each(prefix_end, block)brace-context answer. The allowlist and refuse-closed shapes are unchanged.Evidence/support delta:
ifowners still credit; method shorthand still refuses; 500-deep vs 2000-deep operation counts must stay within a 6× bound (linear scan, not n² walk-back).Single acceptance criterion:
ifowner of large depth classifies with near-linear recorded work, and existing mock-payload verdicts stay identical.Non-goals:
corpus.json, or traceability edits.typescript/tests.rs,committed_snapshot.rs, ororacle.rs.Support-tier Impact
Claim/proof notes:
Policy Impact
Ledger or exception notes:
Proof
Result, failures, or skipped proof:
mock_payload_guardtests: 4 passed on15230e2f59122cbad4a732c1c9e270df22eae9b7(including 500 vs 2000 depth work bound; suite 0.02 s).mock_object_argument_tests5 passed;literal_matcher_tests9 passed.cargo xtask precommit: pass. Selected Clippy:cargo clippy -p ripr --all-targets -- -D warningsand-p xtask --all-targets -- -D warnings. Goldens skipped (no output-surface change).cargo xtask worktree doctorpassed onorigin/mainat branch creation (b66465e1c).a213d93a0);mock_payload_guard.rsis untouched on main. Behind-only, no restack.Claim Boundary
What may be claimed after this PR? Nested mock-payload owner braces no longer take quadratic walk-back / prefix-rescan work in
has_method_like_block; verdicts are unchanged.What must not be claimed yet? Runtime mutation killed/survived results; that every TypeScript scan is now fast; that RIPR-SPEC-0255 changed.
Rollback
Revert this PR. The previous iterative walk-back remains correct, only super-linear.
Spec-Test-Code Traceability
mock_payload_guard.rstestsmodule; existing mock-payload tests stayed greenhas_method_like_block,matching_parens,brace_context_atStatic Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a (ordinary analyzer PR; no workflow, lane, or protection change)
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.Gates
Local
precommitpassed on15230e2f59122cbad4a732c1c9e270df22eae9b7. Hosted required checks on this published head.Exact candidate SHA:
15230e2f59122cbad4a732c1c9e270df22eae9b7Continuation
Head frozen except for real CI failures or new review findings. Resume on check-completed/failed or a new review finding. No per-minute rechecks. Squash-merge when required checks are green on this SHA and published-head review remains REVIEW_READY.