Skip to content

aggregator: Cost Explorer inline-script computations from PR #1390 (recommendations, Pareto, projection) ship with no committed tests #1405

Closed

Description

@dezren39

Finding

PR #1390 (merged, merge commit 37418e56339c315cf0ddf3e61c9c55c1e9d0c0a2) added roughly a thousand lines of new computation to the Cost Explorer's inline browser script in pm-stack/aggregator/src/render.ts — the recommendations engine, the Pareto frontier tables, the Pareto-gap inequality filters, and the task-assumptions projection — with no committed tests for any of that logic. The PR's test changes cover only the data layer (aaCaiPoints, caiFamily, catalog rate windows) plus HTML toContain assertions that the new sections' element ids exist. The PR body says the script was "runtime-smoke-tested against the fixture data" — a one-off manual check that is not in the repo and cannot regress.

Evidence

  • PR: feat(pm): Cost Explorer — ChatGPT-site parity (CAI perspective, Pareto tables, recommendations, bands, projection) #1390 (MERGED 2026-10-27)
  • New untested logic on current main, all inside the AA_EXPLORER_SCRIPT template string in pm-stack/aggregator/src/render.ts:
    • render.ts:2092 pctRank — percentile ranks shown in every Pareto table cell
    • render.ts:2105 paretoSet — non-dominated set behind all four frontier tables
    • render.ts:2170 gapMetrics — score gap / price premium / speed gap behind the inequality filters
    • render.ts:2814 computeRecs — banding, near-top floors, relative price/speed ceilings, dominance removal, tradeoff ranking (relative time)^w × (relative price)^(1−w), lab-diversity passes
    • render.ts:3191 project (+ pjBand band/window selection) — projected $/task and time/task; the PR body hand-verifies one fixture case (~$0.106/task, ~5m 53s) that is not encoded as a test
  • pm-stack/aggregator/test/aa.test.ts on current main contains zero references to computeRecs, project/pjBand, gapMetrics, or pctRank (grep-verified); the new render assertions are expect(html).toContain('id="xpl-pf-score"')-style presence checks.

Why it matters

These functions produce numbers a reader acts on (shortlists, projected costs). Because they live in a template string, neither tsc nor the existing test suite exercises them at all — a sign flip in pctRank, a band-selection off-by-one in pjBand, or a dominance error in computeRecs ships silently. The one hand-verified projection example in the PR body is exactly the kind of case that should have become a fixture test.

Acceptance criteria

  • The explorer script's pure computations (at minimum project/pjBand, paretoSet, pctRank, gapMetrics, and computeRecs banding/ranking) are covered by committed tests that run in the aggregator's normal bun test — e.g. by extracting them into an importable module the template string also uses, or by evaluating the script against the fixture data in a test harness.
  • The PR body's hand-verified projection case (Luna fixture rate: 3 turns × (10k uncached @ $0.75 + 10k cache reads @ $0.075 + 6k output @ $4.50) ≈ $0.106/task; time ≈ 5m 53s) is encoded as a test expectation.
  • Existing suite stays green (bun test in pm-stack/aggregator, bunx tsc --noEmit clean).

Found by pr-diff-review-b reviewing PR #1390's diff against current main. Remainder items for the same PR are already tracked in #1400; this test-coverage gap is not among them.

Activity

  1. added
    kind/testTest coverage, test infrastructure, or test-only fixes
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Oct 27, 2026
  2. developing-today commented on Oct 27, 2026

    @developing-today
    Contributor
  3. added
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    on Oct 27, 2026
  4. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  5. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 31, 2026
  6. 17 remaining items

  7. added
    user/reviewNeeds a user-look: Muse reviews first and handles what it can
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 1, 2026
  8. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  9. added
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    queue/queuedHas a queued task in the Supabase agent queue
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 1, 2026
  10. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: triaged (coverage pass)
    Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as triage at priority 40 (priority/normal). If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
    Found via: coverage pass 2026-11-03

  11. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  12. removed
    user/reviewNeeds a user-look: Muse reviews first and handles what it can
    on Nov 3, 2026
  13. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  14. removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/aggregatorPackage/app: aggregator (pm-stack in this repo)app/pm-stackpm-stack (Pad/Grist) in developing-today/codekind/testTest coverage, test infrastructure, or test-only fixespriority/normalOrdinary priority (the default)source/pr-diff-reviewFiled by the pr-diff-review jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions