Skip to content

fix(javascript): bound cyclic mutation captures by their paths - #6986

Merged
gensokyo-dev merged 1 commit into
mainfrom
fix/javascript-cycle-closure-20261024
Oct 24, 2026
Merged

gensokyo-dev merged 1 commit into
mainfrom
fix/javascript-cycle-closure-20261024

Conversation

@gensokyo-dev

@gensokyo-dev gensokyo-dev commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Problem and outcome

Main Source tests repeatedly exit in javascriptSemanticAnalysis.reference_lifetimes.test.ts (3ce311757 run, e3a6ce40f run). A cyclic parameter alias grows member-read capture history. The mutation collector puts that entire history outside its property-path prefix index, so a previously escaped receiver cannot cover a longer path with an additional capture suffix. Recursive widening restarts this work and exhausts the worker.

Index capture identity at each property-path edge, retaining distinct receiver captures, copied-slot fences, selectors and equal-depth write identity. Register the normalized prefix before recursive effect expansion so it owns its closure. Reuse the existing shared domain index; remove the superseded whole-capture-vector key from effect coverage. No timeout, heap limit, retry or correctness/performance assertion is relaxed. CLI, MCP and providers share the same analysis implementation; public schemas are unchanged. No separate issue was opened for this direct main-CI repair.

Executed correctness and resource checks

Linux x64, pinned Node 24.22.1 / npm 11.16.0, two CPUs. Tests below used merged base 48c203f35 plus this diff:

  • Original source-file runs crossed a 1.5 GiB sampled family stop before completing. A bounded diagnostic isolated cyclic member paths; the initial worker stderr marker was asynchronous and was replaced with synchronous markers before attributing the failing case. These stopped runs are not completed benchmarks, and their child CPU accounting is incomplete. No OOM was needed to reproduce the defect.
  • All original 113 reference-lifetime tests passed, preserving the 2 s assertions (6.41 s command wall / 6.41 s CPU / 572.2 MiB sampled family RSS). The formerly unbounded parameter cycle completed in 728 ms; the nine-way member-write cases also passed.
  • 732 tests passed across 14 complete files, including six new index regressions and existing capture lifetimes, copy exclusions, stored receivers, getter/setter mutation, module interop, typed arrays and externally supplied parameter/catch values (19.10 s wall / 23.51 s CPU / 678.2 MiB).
  • Compiled real CLI + stdio MCP analyses of the 613-byte cyclic source and the unchanged 2770-byte installed dot-prop 5.3.0 source: passed named output schemas, CLI/MCP parent Evidence identity, retained summary/page/item lookups, source SHA-256 and unchanged-input checks. CLI summary delivery published complete Evidence bundles; unknowns remained explicit (38 and 109 respectively). This reads self-authored and real library source without executing targets. 18.88 s wall / 23.61 s CPU / 903.1 MiB for the completed two-target workflow; fresh CLI processes and one fresh MCP session with a warm second call.
  • npm run check and git diff --check passed (37.41 s wall / 66.38 s CPU / 2669.5 MiB). Required runtime build passed (38.91 s wall / 49.05 s CPU / 1100.0 MiB).

RSS sums descendants sampled every 100 ms; shared pages may double-count and short-lived/reparented children may be missed. Source probes and public verification had a 1.5 GiB sampled stop; build/static checks had an 8 GiB sampled stop and all commands had elapsed guards. No OOM occurred. Warm build artifacts were reused where stated. The failing baseline did not complete, so no equivalent-task speedup percentage is claimed. Agent token costs were not measured. Raw diagnostics remain outside the repository.

The branch is rebased onto latest main before publication. CI will verify that integrated head, including unrelated concurrent changes. Main CI must still finish successfully after merge; this PR does not claim to repair the earlier one-off Chrome startup timeout or parent-capacity observation that did not recur in #6978's eight successful built shards.

Completed CI and remaining main repair

CI 40083831021 completed on exact head cdbe1d5d6: static checks, build, all eight built shards, selected real checks and the complete 113-case reference-lifetime file passed (614 ms for that file). Source execution now completes all 970 files instead of losing its worker: 17585 passed / 1 failed / 13 skipped. Its sole failure is agentEvaluationReport.test.ts reporting Runner failure gate missing; a clean pre-change worktree d3044a2df reproduces that same failure (1 failed / 5 passed). The predicate test still assumes a top-level try block after verifier cleanup moved the body into an async callback. Portable/CI required propagate this independent failure, so this PR's overall CI is not green; the next isolated main-health change repairs that test.

Codex code review completed on cdbe1d5d6 with no findings or unresolved threads. PR title and readiness passed. Main has advanced with unrelated native/release changes; final post-merge main qualification remains required for the maintenance task.

Author readiness

Human owner: @gensokyo-dev

The owner explicitly delegated readiness declarations and agent-managed review. Inspection and execution were performed by Codex; no separate human inspection is claimed.

  • 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T09:57:13.754192Z cdbe1d5 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.

@greptile-apps

greptile-apps Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge; no actionable issue was found in the changed code.

Summary

This PR moves capture identity into individual property-path edges so escaped prefixes can cover longer cyclic paths without losing distinct receiver captures.

  • JavaScript mutation paths stop expanding when their captured receiver is already covered.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Pending mutation] --> B[Normalize path and captures]
  B --> C[Look up coverage for binding and effect]
  C --> D{Matching prefix already retained?}
  D -->|Yes| E[Skip repeated work]
  D -->|No| F[Retain path with capture context on each edge]
  F --> G[Expand cycle and setter escapes]
  G --> H[Record effect and follow sources]
Loading

Reviews (1) · Last reviewed commit: "fix(javascript): bound cyclic mutation c..." · Reviewed by Greptile

@gensokyo-dev
gensokyo-dev merged commit dd02d8f into main Oct 24, 2026
38 of 41 checks passed
@gensokyo-dev
gensokyo-dev deleted the fix/javascript-cycle-closure-20261024 branch October 24, 2026 10:11
@morluto morluto added area: runtime Process capture and runtime observation bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants