Skip to content

test(javascript): bound member-path propagation by alias states instead of elapsed time - #11635

Merged
morluto merged 1 commit into
mainfrom
test/js-member-path-work-counter
Nov 16, 2026
Merged

morluto merged 1 commit into
mainfrom
test/js-member-path-work-counter

Conversation

@morluto

@morluto morluto commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Summary

Refs #10513. javascriptSemanticAnalysis.reference_lifetimes.test.ts had eight performance.now() - start < 2000 bounds. They measured wall time on a shared runner and never showed which mechanism kept member-path propagation small. Seven become deterministic alias-state allowances. Each fails when the mechanism from 2859527 it guards is removed. The eighth guarded no mechanism a mutant could remove, so it is deleted; its semantic assertion stays.

Problem and expected behavior

An elapsed bound passes on a fast machine even after a regression, and can fail on a loaded one without one. A bound should fail exactly when the propagation work it guards grows.

Change and scope

The tests pass an allowance to analyzeJavaScriptSemantics(source, undefined, { aliasStates, source: "request" }). This is the production member-mutation allowance (JavaScriptSemanticWorkMeter), which charges every alias state the member-mutation traversal schedules and refuses the source when the count exceeds it. Each bound is twice the states the case schedules today, recorded in a comment. A refusal fails the test.

Case States today Bound Fails without
linked-list walk through class instances 3 6 path normalization
dynamic-key setter loop 94 188 covering antichain
16-branch cyclic member paths 12,523 25,046 covering antichain
16-branch loop from a scalar member 2 4 path normalization
self alias node[key]: toLowerCase / mutate / write 19 / 11 / 25 38 / 22 / 50 covering antichain
self alias node.next: write 21 42 path normalization
9-member reassignment: use / write m0.value / write mode 40 / 750 / 750 80 / 1,500 / 1,500 normalization / both / both
dynamic destructuring across 9 shared alias levels 31 62 covering antichain
  • "Path normalization": observablePaths.normalize in the alias traversal. The mutant used current.path unchanged.
  • "Covering antichain": if (!covering.retain(path, captureContexts)) continue;. The mutant retained every path.
  • The destructuring case had no semantic assertion; it now also asserts that alias0[0] stays unknown.
  • Deleted: the elapsed bound on "conditional shallow-copy traversal" (now titled "retains shared children through conditional shallow-copy traversal"). None of these mutants changed its count of 832 states: path normalization, covering antichain, copied-slot selection union, alias-selection widening, exact-selection dedup, lifetime revisit. It keeps its unknown assertion.

On the task's "counter on the member-path normalization": no new counter was added. The existing production meter already counts the work both mechanisms bound, and these probes show it detects removal of either. A test-only counter would duplicate it.

Not included: the other elapsed-time bounds on #10513 (34 assertions in 25 files on main after this change).

Contract and boundary impact

  • Semantic owner and earliest changed stage: tests only. The bound reads the producer's own alias-state allowance.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: the 12 bounded test instances in src/domain/javascript/javascriptSemanticAnalysis.reference_lifetimes.test.ts.
  • Base reproduction or other evidence: counts come from a binary search over the allowance on main. Mutants were run with npx vitest run <file> -t bounds. The normalize mutant fails 6 of the 12 (linked list, scalar member, node.next, and all three 9-member rows). The covering mutant fails 8 (setter, cyclic, three node[key] rows, two 9-member write rows, destructuring). Together they fail all 12. Unmodified, all 113 tests in the file pass.
  • User-visible CLI/MCP output (if applicable): not applicable.
  • Remaining proof gaps: under the normalize mutant, other tests in this file that run with the default allowance exhaust a 1.5 GB heap before the meter refuses, which is outside this change. The 2x margin is a judgment: it tolerates small changes in scheduling while staying below the mutants' growth (more than 4x).

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:local -- src/domain/javascript/javascriptSemanticAnalysis.reference_lifetimes.test.ts: 113 passed.
  • npx vitest run src/domain/javascript/javascriptSemanticAnalysis.reference_lifetimes.test.ts -t bounds under each mutant: 6 failed (normalize) and 8 failed (covering), as listed above.
  • npm run check:fast: passed. npx oxfmt on the changed file.

Compatibility, safety, and release

  • Breaking changes or migration steps: none (tests only).
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

…ad of elapsed time

The eight elapsed-time bounds in the reference-lifetime tests measured wall
time. Seven become alias-state allowances at twice each case's measured count,
using the production member-mutation allowance that charges every scheduled
alias state. With 2859527's path normalization or its covering antichain
removed, each bounded case needs more than four times as many states, so the
analysis refuses it and the test fails. The shallow-copy bound guarded no
mechanism that a mutant could remove, so it is deleted and its
uncertainty assertion stays.

Refs #10513
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T01:07:25.907149Z
We couldn’t complete this review. Comment @codex review to try again.
73dbfc3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The test-only changes appear safe to merge.

Summary

Replaces elapsed-time checks with deterministic alias-state allowances in javascriptSemanticAnalysis.reference_lifetimes.test.ts.

  • Member-path tests now limit alias work instead of elapsed time.

Validation limits: tests and mutation probes were not rerun. Supersession could not be checked because GitHub access required authentication.

Reviews (1) · Last reviewed commit: "test(javascript): bound member-path prop..." · Reviewed by Greptile

@morluto
morluto merged commit f86b83c into main Nov 16, 2026
7 checks passed
@morluto
morluto deleted the test/js-member-path-work-counter branch November 16, 2026 01:29
@morluto morluto added the area: tests Test suite and verification label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Test suite and verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant