Skip to content

aa feed: keep last good on failure + skip unchanged query; v_latest_import_batch rename - #3349

Merged
dezren39 merged 1 commit into
mainfrom
aa-keep-last-good
Nov 1, 2026
Merged

dezren39 merged 1 commit into
mainfrom
aa-keep-last-good

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Implements code#3332 plus Drew's terminology ruling (2026-11-01), built directly tonight after the 403 wipe recurred three times in one evening.

Keep last good (code#3332): the collector stores the last good AA section beside the feed (aa-last-good.json, keyed by import batch + opencode-config fingerprint). Any build failure — Management API 403, unreachable, empty payload, structural check — now degrades to that payload with stale/staleReason markers instead of blanking the section; the explorer shows a banner naming the failure and the good data's collection time. Absent is emitted only when no good build exists yet (the absent banner text updated to say so).

Skip unchanged: a cheap batch probe (one small query) runs first; while the import batch and config fingerprint are unchanged, the stored section is reused and the full payload query never runs. The every-5-minutes giant-query pressure was itself causing intermittent 403s — this removes nearly all of it.

Terminology: AA_SQL + probe now read ainventory.v_latest_import_batch (created additively in Supabase muse-dev2 and verified to return the identical batch; the old v_latest_workbook_batch view stays until its other consumers — e.g. the ainventory append tooling — are audited and moved). Workbook wording across the aggregator now says 'import' where database-resident data is meant; the sources.kind provenance value 'drive-workbook' is data and is deliberately untouched. The provenance card drops its stale hardcoded 'v4.3.2' claim.

Verification: tsc — no errors in any touched file (8 pre-existing errors elsewhere, same family as the 7 pre-existing manifest test failures). bun test: 747 pass / 7 fail, identical to the clean-main baseline verified by stash earlier tonight. Forced-failure + reuse behavior will be verified live post-deploy against a bogus project ref before the issue closes.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…atest_import_batch (code#3332)

A single transient Supabase Management API 403 blanked the AA
explorer: the collector rebuilt the section from scratch every tick
and emitted absent on any failure. It now keeps the last good
section beside the feed (aa-last-good.json): a failed build degrades
to that payload with a stale marker (the page shows a banner naming
the failure and the good data's collection time), and absent is
emitted only when no good build exists yet. A cheap batch probe runs
first: while the ainventory import batch and the opencode config
fingerprint are unchanged, the stored section is reused and the full
payload query never runs — the every-5-minutes query pressure was
itself causing intermittent 403s.

Terminology (Drew, 2026-11-01): the ainventory view is renamed
v_latest_workbook_batch -> v_latest_import_batch (new view created
additively in Supabase; the old view remains until other consumers
are audited), and workbook wording across the aggregator now says
import where the database-resident data is meant. The sources.kind
provenance value (drive-workbook) is data, not terminology, and is
untouched. The explorer provenance card also drops its hardcoded
v4.3.2 claim.
@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 05:29
@dezren39
dezren39 merged commit fa29b8f into main Nov 1, 2026
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f4e76d28-9042-40c0-afee-0cbe6f5cb090
Commits

Reviewing files that changed from the base of the PR and between 5de8ee1 and 3e280c4.

Files selected for processing: 6
  • pm-stack/aggregator/scripts/collect-fleet-feed.ts
  • pm-stack/aggregator/src/aa.ts
  • pm-stack/aggregator/src/feed.ts
  • pm-stack/aggregator/src/model.ts
  • pm-stack/aggregator/src/render.ts
  • pm-stack/aggregator/src/source.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39
dezren39 deleted the aa-keep-last-good branch November 1, 2026 05:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T05:30:33.491486Z 3e280c4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

dezren39 added a commit that referenced this pull request Nov 1, 2026
The phantom writer blanking /aa is identified: the sandbox host still
runs fleet-feed-collector.timer (systemd, system level), installed from
the stale ~/git/pm-feed clone (HEAD 2026-10-29, pre-#3349) and restored
on every sandbox boot by ~/tools/init.sh. Its collector defaults
SUPABASE_PROJECT_REF to the retired muse-dev project
(nltgxorqwxhgfzseiirt) while the bws management token
(supabase.access-token-muse-cli) is muse-dev2-scoped, so its AA query
fails HTTP 403 (verified directly: same token + retired ref = 403
"does not have the necessary privileges"; same token + muse-dev2 ref
keihfchslgjetkmnmzra = 201 with the current ainventory batch). Every
~5 min it scp-pushed its AA-absent, session-poor feed over the laptop
collector's good feed (~/pm-stack/aggregator symlinks into the
aggregator state dir), racing the laptop collector that has owned the
feed since the 2026-10-31 move (#3363/#3368).

The collector lives on the laptop now (pm-stack NixOS module), so the
sandbox-side units are deleted, not updated: remove
systemd/fleet-feed-collector.{service,timer} and
scripts/install-collector-units.sh, mark push-fleet-feed.sh
manual-only, and correct the stale "sandbox collector / pushed feed"
descriptions in README, src/feed.ts, src/topology.ts and
src/watchdog.ts. The charges confirm-after-delivery contract stays:
push-fleet-feed.sh + confirm-charges-surfaced.ts are untouched.

Tests: bun test in pm-stack/aggregator — 870 pass, 2 fail, identical
on pristine origin/main (pre-existing slice-3 routes failure).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant