Repository navigation
fix(javascript): index repeated graph observations before final sorting - #1759
Conversation
Retain stable live nodes and observation arrays while avoiding quadratic collection rebuilds. Preserve duplicate handling and canonical output. Fixes #1748 Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
N0zoM1z0
left a comment
There was a problem hiding this comment.
Reviewed exact synchronized head ffd3eb61fd169d5f2c669b794b7e1116c86f6496; independent local Luna review found no material issue and verified the final patch matches the reviewed two-file fix. Live node/array references, last-write deduplication and post-materialization index updates are retained. 25 focused tests, static checks, complete CLI output/identity comparison, and 4 integration tests with the merged cancellation fix passed. CPU comparison includes final sorting (8k medians down 88.6%); CI runs on this head before merge. Maintainer self-review comment, not independent GitHub approval.
|
Independent verification after merge Fresh merged runtime and all 25 focused tests passed. Ran the real public CLI against the same small inert directory application containing 300 This independently validates public CLI result preservation; it does not independently measure the author's accumulator speedup or establish a CLI/MCP end-to-end speedup. Private build/generated outputs were removed after verification; shared dependencies/caches were preserved. |
Summary
Fixes #1748. Repeated JavaScript endpoint observations now merge through a node-owned index instead of copying and sorting the growing collection on every addition. Complete output and Evidence identities remain unchanged.
Problem and expected behavior
A source with many calls to the same endpoint produces distinct observations on one node. Previously, each merge rebuilt a Map and sorted every retained observation, producing quadratic accumulation CPU. Retain all authenticated observations and canonical output without repeatedly rebuilding that collection.
Change and scope
Append or replace observations by their semantic-ID index. Finalize dirty arrays once when
nodes()materializes output, preserving the live node/array references and rebuilding indices for subsequent additions. Preserve first-input duplicates and their last-occurrence deduplication on a later merge. Current construction consumers use node IDs/edges; none depends on intermediate observation ordering.Contract and boundary impact
Evidence and regression coverage
Every size retained identical ordered observation checksums, graph IDs, counts and complete coverage. At 8k, the two-run CPU medians decrease 88.6%; this is host-specific accumulation evidence, not an end-to-end speedup claim.
User-visible output: the real 1k-call CLI fixture retains identical complete normalized result and Evidence ID. Existing CLI/MCP long-value workflows pass.
Flameox 0.2.9: paired 8k profiles corroborate the removed merge work (
addNodeself samples 1601/2567 baseline versus 2/445 fixed); samples are not timing or allocation measurements.Remaining proof gaps: no allocation measurement, no claim for capped/partial 4k public-CLI graphs or native providers. Internal construction observations may be unsorted until
nodes(); canonical published output is unchanged.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:focused -- src/application/javascript/JavaScriptArtifactGraphAccumulator.test.ts tests/acceptance/applications/javascriptEndpointPayload.test.ts tests/boundary/filesystem/javascriptArtifactGraphObservationLookup.test.ts src/application/javascript/JavaScriptApplicationEmptyLiterals.test.ts— 25 tests passed.npm run check— passed typecheck, lint, format, knip, metadata and architecture checks.npm run verify:test-discovery— new regression included exactly once; after main synchronization all 815 files discovered exactly once.ffd3eb61fd169d5f2c669b794b7e1116c86f6496: focused SDK cancellation, CLI/MCP endpoint and accumulator regressions — 4 tests passed across 3 files.analyze-javascript-application <1k-call fixture> --artifact-format directory --max-heap-mb 512 --json— complete normalized output and Evidence ID match the base output.Compatibility, safety, and release
nodes().Review checklist
type(scope): outcome.