GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — aggregator(saas-extract): applySupabaseExport never range/type-checks the export doc — negative used/limit/billedUsd are stamped as live measured data, and an array measuredAt passes the freshness gate and corrupts the card · Issue #2508 · developing-today/code

aggregator(saas-extract): applySupabaseExport never range/type-checks the export doc — negative used/limit/billedUsd are stamped as live measured data, and an array measuredAt passes the freshness gate and corrupts the card #2508

New issue
Copy link
New issue
Copy link
Closed
Closed
aggregator(saas-extract): applySupabaseExport never range/type-checks the export doc — negative used/limit/billedUsd are stamped as live measured data, and an array measuredAt passes the freshness gate and corrupts the card#2508
Copy link
Assignees
dezren39
Labels
app/aggregatorPackage/app: aggregator (pm-stack in this repo)app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Description

@dezren39
dezren39
opened on Oct 30, 2026
Issue body actions

Problem

applySupabaseExport (pm-stack/aggregator/src/saas-extract.ts:701) is the trust boundary for the supabase-export file document: live.ts reads the file with JSON.parse (src/sources/live.ts:833-835) and passes the result straight in. The overlay checks shapes only loosely — typeof === "number" && Number.isFinite for metric values and billing, and a Date.parse freshness check for measuredAt — so values the producer could never legitimately emit are accepted and stamped on the Supabase card as live, measured, sourceClass: "api" data:

  1. Negative numbers pass. saas-extract.ts:721-722 accepts any finite used/limit; :741-743 accepts any finite billing.billedUsd. Verified against the real module (main 7d1b081): a fresh, status:"ok" doc with used: -3.25 for db-size yields used = -3.25, percent = -650; billedUsd: -42.5 is stored verbatim (renders as a measured $-42.50 billed line); limit: -0.5 is stored as the metric's limit.
  2. measuredAt is never type-checked. saas-extract.ts:707-708 only requires truthiness and a finite Date.parse(doc.measuredAt). Date.parse coerces its argument, so a JSON array measuredAt: ["2026-10-29T11:59:00.000Z"] passes the freshness gate, and :753 doc.measuredAt.slice(0, 10) then stores the array itself as the service's measuredAt (verified: typeof becomes object). Downstream, freshness() (derive.ts:899) treats its length (1) as a date-only stamp and builds an unparseable string, and tsFor (snapshot-records.ts:37-39) interpolates the array slice into a snapshot record's ts, producing 2026-10-29T11:59:00.000ZT12:00:00Z.

The module's own contract says the opposite: "Missing, failed, unparseable or stale documents change nothing", and the billing branch's comment says a failed billing probe must never render as a measured amount. A corrupted, hand-edited, or older-producer export file currently changes the card — with negative or type-corrupted values presented as the live API read.

House precedent in the same codebase: the quota-current overlay gate rejects a document outright when typeof p.measuredAt !== "string" (src/quota-current.ts:60), and the producer's own parsers reject negative sizes/counts (supabase-export parseDbSize/parseRequestCount).

Evidence

Probe (real applySupabaseExport + extractSaasServices imported from main 7d1b081, Bun): hidden_files/probe-2026-10-29-laneB-supaoverlay/probe.ts

  • Case 1 (negative used/billed): used= -3.25 percent= -650 billedUsd= -42.5 sourceClass= api
  • Case 2 (negative limit): used= 1 limit= -0.5
  • Case 3 (array measuredAt): typeof= object value= ["2026-10-29T11:59:00.000Z"] sourceClass= api
  • Case 4 (control, well-formed fresh doc): applies cleanly, measuredAt a string
  • Case 5 (control, garbage-string measuredAt): correctly rejected, services unchanged

Related but distinct: #2492 is the producer (billedFromAddons in supabase-quota-export.mjs) accepting negatives at write time. This issue is the consumer gate: even with the producer fixed, the overlay reads a file from disk and must not trust values outside the domain the card renders. #2451 (isFleetFeed saas) is the feed gate for a different input and does not cover this overlay.

Why it matters

The Supabase card is the fleet's paid-trigger surface for the muse-dev project (80%-of-Free-limit flag, billed amounts). Negative or corrupted "measured" values suppress or invert the percent math, fabricate a negative billed amount, and poison snapshot history with an unparseable ts — all under an "api / measured" provenance stamp that tells the reader the numbers are trustworthy.

Acceptance criteria

  • applySupabaseExport rejects (changes nothing) or drops the offending metric when used or limit is negative; percent is never computed from a negative used/limit.
  • A negative billing.billedUsd is treated as "no valid billing measurement" (the existing billedUsd = null path), never stored.
  • doc.measuredAt must be a string before the freshness check (mirror quota-current.ts:60); non-string values change nothing.
  • Regression tests in aggregator/test/supabase-export.test.ts for: negative used, negative limit, negative billedUsd, array measuredAt — each leaves the services unchanged (or the metric/billing unset), while the existing fresh-doc tests still pass.

Activity

Next
  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued queue task
    effort/xsTrivial: expected under 30 minutes of work
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    on Oct 30, 2026
  2. dezren39 commented on Oct 30, 2026

    @dezren39
    dezren39
    on Oct 30, 2026
    MemberAuthor
    More actions

    🤖 Agent note · state: filed

    • Agent: new-issue-creator job (new-issue-creator-code-b)
    • Session / ID: cron new-issue-creator-code-b run 2026-10-30T02:03Z
    • Found via: filed this run
    • Task: Triage the applySupabaseExport consumer gate: negative used/limit/billedUsd accepted as live measured data, non-string measuredAt passes the freshness gate via Date.parse coercion and is stored as the service's measuredAt.
    • Expectation: effort xs — pin the validation treatment at the overlay boundary (mirror quota-current.ts:60), add regression tests, then route a small_fix packet.
    • Links: probe hidden_files/probe-2026-10-29-laneB-supaoverlay/probe.ts; issue body file hidden_files/issue-code-supaoverlay-gate-body.md
  3. github-actions
    assigned
    dezren39
    on Oct 30, 2026
  4. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 1, 2026
  5. 16 remaining items

  6. dezren39
    added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    on Nov 2, 2026
  7. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    🤖 Agent note · parked

    • Agent: queue worker (repo-worker-code)
    • Session / ID: OpenCode scheduled lane / task 5410
    • Found via: repo-health-code-pilot queue
    • Task: PR fix(aggregator): validate Supabase export measurements #4230 adds Supabase export type/range guards and four regressions.
    • Resume condition: CI checks on PR fix(aggregator): validate Supabase export measurements #4230 complete; then review the fresh state and continue.
    • Links: fix(aggregator): validate Supabase export measurements #4230 · branch queue/5410-2508-supabase-overlay-guards
    • Test note: focused Bun suite passes 12/12; CI test job was queued, so task parked for 20 minutes. Typecheck was unavailable because @types/bun is absent in the worktree.
  8. dezren39
    added
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 2, 2026
  9. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    Lane E resumed task 5410: PR #4230 head fd268a0 revalidated — MERGEABLE, Codex review on this head completed with no findings, bun test test/supabase-export.test.ts 12/12 documented in the task checkpoint. The pm-aggregator test check is QUEUED (infra stall pattern). Merging per standing merge authority.

  10. dezren39 commented on Nov 2, 2026

    @dezren39
    dezren39
    on Nov 2, 2026
    MemberAuthor
    More actions

    Done: PR #4230 merged (merge commit 6cdfaee). applySupabaseExport now rejects corrupt measurements at the overlay boundary: non-string/invalid measuredAt makes the doc a no-op, negative used/limit rows are dropped, negative billedUsd becomes null while other valid overlay data applies. Codex clean; bun tests 12/12. Closing as complete.

  11. dezren39
    closed this as completedon Nov 2, 2026
  12. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/aggregatorPackage/app: aggregator (pm-stack in this repo)app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.