Repository navigation
Description
Finding
PR #3737 extracted the Cost Explorer computations into aa-explorer-computations.js so that, in its own words, "the browser and tests now execute the same implementations". For three of the nine functions that is not true on current main: logEdges, scoreEdges, and bandIndex were copied into the shared module and imported by the page script, but their original inline definitions inside the script's IIFE were never removed. The inline definitions shadow the module imports for every call site inside the IIFE, so the browser runs the untested inline copies of the banding functions while the Bun tests exercise the module copies. Today the copies are identical, so nothing renders wrong yet — but any future fix to the module's banding code (the code under test) will silently not reach the browser, and a fix to the inline copies will not be tested.
Evidence
- Source PR: test(aggregator): cover Cost Explorer client computations #3737 (merged, merge commit
adfa050a8094cae558135bccb1d74431e4afff8d) — "test(aggregator): cover Cost Explorer client computations". Deduped: searches for the module name / shadowing returned no covering issue. - Current main
2aca793a345a88b2f11a815fc190da4df07e0ee0,pm-stack/aggregator/src/render.ts::3940the emitted page script imports all nine from the module:import { applyInequalityFilters, bandIndex, computeRecommendations, logEdges, normName, paretoSet, pctRank, projectTask, scoreEdges } from "/assets/aa-explorer-computations.js";:4960function logEdges(vals, n),:4969function scoreEdges(rows, n),:4977function bandIndex(v, edges)— identical definitions still declared inside the IIFE, shadowing the imports.- In-IIFE call sites use the shadowed names:
:5083-5085(logEdges/scoreEdgesfor the band comparisons),:5092and:5154(bandIndex). - The other six functions have no inline twin and genuinely run from the module.
- Verified this run: the inline bodies at
:4960-4983and the module'saa-explorer-computations.jsexports are currently byte-for-byte equivalent in logic — this is a latent divergence, not a live numeric bug. - The guard test does not catch it:
pm-stack/aggregator/test/aa.test.ts:783("/aa loads the same browser computation module imported by Bun tests") asserts the page contains the module import and that the asset servescomputeRecommendations/projectTask; it never checks for inline redefinitions. - Secondary: the server-side import of the same module in
render.ts(:45-55) has no call site inrender.tsoutside the emitted script string.
Why it matters
The entire point of #3737 was one implementation under test. For the three banding functions — the ones that decide band edges and membership for the comparison shortlists — the guarantee is illusory, and the failure mode is silent: the first edit that lands in only one copy splits shipped behaviour from tested behaviour with every test green.
Acceptance criteria
- The inline
logEdges/scoreEdges/bandIndexdefinitions are removed from the emitted script, so all nine computations run from the shared module in the browser (or, if a local copy is genuinely needed, it is no longer claimed/tested as shared). - A regression test fails if the emitted page script redefines any name it imports from
aa-explorer-computations.js. - The existing aa / aa-explorer-computations suites still pass.
Activity
developing-today commentedon Nov 8, 2026
CODE-2274
dezren39 commentedon Nov 10, 2026
🤖 Agent note · triaged
task/small-fix· priority/low · effort/xs · kind/bug (as filed)repo-health:v1:fix:developing-today/code:issue:7562→ queuerepo-health-code-pilot, task 14444 (enqueued by triage-step this run)dezren39 commentedon Nov 10, 2026
🤖 Agent note · triage packet closed (already triaged)
directstatus/needs-triage. Per Queue/lane design rules: no by-id blocking by default, optional platform selector, triage separate from fixes #8097 Rule 3 (§1c), the triage step already triaged this issue — triage-step agent note on this issue at 2026-11-10T02:31:00Z, which enqueued the separate fix packet as task 14444. Completing task 13158 with outcometriaged(bookkeeping only; no duplicate triage, no label changes).18 remaining items
dezren39 commentedon Nov 10, 2026
Agent note - parked (Drew-owned PR hard stop)
dezren39 commentedon Nov 10, 2026
agent-note:v1 — parked by lane code-n (task 14444, issue #7562).
Resumed from checkpoint stage awaiting_ci. PR #8141 fresh check state (lane code-n): CodeRabbit SKIPPING, 4 basic checks still QUEUED/pending (fleet-search parity, proxy port fallbacks, scripts-test 3.12, scripts-test 3.14), 0 failing — runner backlog. Issue #7562 OPEN, no hard-stop labels; PR #8141 OPEN. Codex gate on record in task 14444: Codex review failed on usage limits and produced no findings — nothing to disposition.
Resume condition: PR #8141 basic checks green, then merge and complete task 14444. Parked 20 minutes per the CI rule — never hold a claim waiting on CI.
dezren39 commentedon Nov 10, 2026
🤖 Agent note · parked — CI pending on PR #8141
dezren39 commentedon Nov 10, 2026
🤖 Agent note · parked (CI pending) — Agent: queue worker (repo-worker-code), lane code-u — Session/ID: task 14444, repo-queue-worker-shift-u 2026-11-10 run. Task 14444 (small_fix) for issue #7562: resumed at awaiting_ci; PR #8141 diff verified fresh (inline logEdges/scoreEdges/bandIndex removed, regression test added), Codex findings already dispositioned on the PR. CI checks still QUEUED/pending since 2026-11-10T07:23Z, so parking task 14444 for 20 minutes; resume by reading PR #8141 checks fresh and merging under the standing criteria.
dezren39 commentedon Nov 11, 2026
🤖 Agent note · pickup (resume from CI wait)
bun test test/aa.test.ts(and the two-file run) crashed the bun process twice this shift (bun 1.4.4 crash-report banner) under heavy concurrent fleet load on the laptop — an environment failure, not a test failure. The verification of record at this exact head stands: 50 pass / 0 fail for aa.test.ts + aa-explorer-computations.test.ts (checkpoint 2026-11-10), with the regression test verified to fail on unfixed code as designed.dezren39 commentedon Nov 11, 2026
🤖 Agent note · parked (broker CI wait)
fix(aggregator): remove inline banding copies shadowing aa-explorer m…
dezren39 commentedon Nov 11, 2026
🤖 Agent note · done — PR #8141 merged (task 14444, lane code-b)
bun test test/aa.test.ts— 44 pass / 0 fail, including the new regression test (run with PM_AGG_FRESHNESS_PORT override; port 4871 is held by an unrelated long-running bun server on the laptop).