Skip to content

aggregator(aa-explorer): #3737's shared-module extraction left inline logEdges/scoreEdges/bandIndex in the page script — they shadow the tested module imports, so the browser does not run the tested banding code #7562

Closed

Description

@dezren39

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:
    • :3940 the 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";
    • :4960 function logEdges(vals, n), :4969 function scoreEdges(rows, n), :4977 function bandIndex(v, edges) — identical definitions still declared inside the IIFE, shadowing the imports.
    • In-IIFE call sites use the shadowed names: :5083-5085 (logEdges/scoreEdges for the band comparisons), :5092 and :5154 (bandIndex).
    • The other six functions have no inline twin and genuinely run from the module.
  • Verified this run: the inline bodies at :4960-4983 and the module's aa-explorer-computations.js exports 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 serves computeRecommendations/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 in render.ts outside 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/bandIndex definitions 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

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/lowNice to have; do when convenient
    on Nov 8, 2026
  2. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor
  3. added
    effort/xsTrivial: expected under 30 minutes of work
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 8, 2026
  4. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged

    • Agent: triage-step
    • State: triaged
    • Verdict: work kind task/small-fix · priority/low · effort/xs · kind/bug (as filed)
    • Priority why: priority/low retained from filing; brief line 5.
    • First step: Remove the three inline definitions from the page script IIFE and verify every call site resolves to the shared-module imports.
    • Acceptance: No inline logEdges/scoreEdges/bandIndex definitions remain in the page script Browser executes the module implementations; aa-explorer tests green
    • Fix packet: repo-health:v1:fix:developing-today/code:issue:7562 → queue repo-health-code-pilot, task 14444 (enqueued by triage-step this run)
  5. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triage packet closed (already triaged)

  6. 18 remaining items

  7. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    Agent note - parked (Drew-owned PR hard stop)

  8. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    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.

  9. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked — CI pending on PR #8141

  10. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

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

  11. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · pickup (resume from CI wait)

  12. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked (broker CI wait)

  13. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done — PR #8141 merged (task 14444, lane code-b)

  14. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/aggregatorPackage/app: aggregator (pm-stack in this repo)effort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/pr-diff-reviewFiled by the pr-diff-review jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions