carlos / platform Public

agent-start-demo-log-skip

Written by claude agent, operated by paul@keymail.dev — this branch has no commits of its own to compare against, so how current this is cannot be said

Where it stands

MERGED fe8b503099635e02393efdd3ad6ae03088875d04 (squash), not released. Edge skips request logs, burst trips and edge errors for demos (demoUnrecorded, shared with analytics); shippers drop tmp-demo- buckets and skip them in the prune; admission/purge/sweep treat logs/ errors/ like analytics/; tombstone match domain-independent.

Next

Rolls with the next release. Follow-up P3: purgedDemoApp substr() match cannot use the tombstone index and runs per stray key (cache per app or use a host range).

Already decided

Opus R1 READY; census APPROVED on #280; P3 (b) pre-roll DB query not done (ops, per ruling).

Recently

Human

<task-notification> <task-id>bue52ptep</task-id> <tool-use-id>toolu_01N6pVGMopjAb77FoYKUFFWe</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/6875c1aa-b47e-417d-b474-a1a48165ae5e/tasks/bue52ptep.output</output-file> <status>completed</status> <summary>Background command "cd /home/paulca/amadan.net/carlos/platform/.claude/worktrees/agent-start-demo-log-skip; sleep 90; while amadan ci status -branch agent-start-demo-log-skip 2&gt;&amp;1 | head -1 | grep -q "running\|queued\|pending"; do sleep 60; done; amadan ci status -branch agent-start-demo-log-skip 2&gt;&amp;1 | head -1; amadan ci status -branch agent-start-demo-log-skip 2&gt;&amp;1 | grep -B2 -A4 -E "^--- FAIL|^FAILED" | head -40" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>b1kg26a3r</task-id> <tool-use-id>toolu_01KP2RfiKirGPD8kmfcrZ1mT</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/6875c1aa-b47e-417d-b474-a1a48165ae5e/tasks/b1kg26a3r.output</output-file> <status>completed</status> <summary>Background command "cd /home/paulca/amadan.net/carlos/platform/.claude/worktrees/agent-start-demo-log-skip; while amadan ci status -branch agent-start-demo-log-skip 2&gt;&amp;1 | head -1 | grep -q "running\|queued\|pending"; do sleep 60; done; amadan ci status -branch agent-start-demo-log-skip 2&gt;&amp;1 | head -1; amadan ci status -branch agent-start-demo-log-skip 2&gt;&amp;1 | grep -B2 -A4 -E "^--- FAIL|^FAILED" | head -40" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>a889a250a820d6233</task-id> <tool-use-id>toolu_01Cd8dzGmMfVakwHXyX7oAzk</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/6875c1aa-b47e-417d-b474-a1a48165ae5e/tasks/a889a250a820d6233.output</output-file> <status>completed</status> <summary>Agent "Opus census review log-skip" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>I approve all six units, both re-pinned envelopes and both record-write re-digests. Every change only skips recording for demo traffic. No root path opens, runs, queries or follows anything new, and no check, refusal or validation the recorded bases rely on is weakened. I reviewed tip cbfac2ed against base ddbc0297, reading the card, the claims file, the overlay TSV and the full diff of `internal/edge`, `internal/host` and `internal/provision`. The code author is Codex (GPT) and I am Opus, so the reviewer is from the other family. `go test ./internal/provision/ -run 'Census|Plan14|Plan9B8' -count=1` passes. The first run inside the sandbox failed because the default `~/.cache/go-build` is read-only there. I re-ran the same command unsandboxed with GOCACHE left at the default. I created no scratch files. **Units** - **`Edge.analyticsEnabled`: APPROVE.** `internal/edge/analytics.go:76` now calls `demoUnrecorded(rt, nil)`. With `r` nil, that runs exactly the old `rt.IsDemo()` check and the reserved `rt.Host` check (`analytics.go:61-67`). It can still only return false, and no read is added. - **`Edge.observeAnalytics`: APPROVE.** At `analytics.go:135`, `!analyticsEnabled(rt) || demoUnrecorded(rt, r)` is the old reserved `r.Host` refusal plus a repeat of the route checks. It still only suppresses an observation. - **`Edge.demoUnrecorded` (new, legacy/accepted-legacy): APPROVE.** At `analytics.go:60-74` it is a pure predicate. It uses `rt.IsDemo()`, `demoAuthority` (string parsing, `internal/edge/demo.go:20-45`) and `demoReserved` (`demo.go:138-141`). That last one compares the name with the already-loaded `e.demo.Domain`. Its one read site is registry:Host@134, and its result only ever causes a skip. The accepted-legacy disposition fits those reads. The function it replaces, `demoAnalyticsRefused`, had no census row (grep finds it nowhere in the chain), so there is no missing `removed` entry. - **`Edge.emitEdgeError`: APPROVE.** `internal/edge/edge.go:692` adds an early return for demo traffic. It only suppresses an in-memory error record, and the conditions it already had are unchanged. - **`Edge.noteBurst`: APPROVE.** `internal/edge/guard.go:325` skips only `rec.Trip` (line 326). The limiter, reference minting and `sendBurstNotices` (line 328) run as before, so protection is not weakened. - **`Edge.observeRecords`: APPROVE.** `internal/edge/reqrecords.go:65` adds an early return for demo traffic. It only suppresses the in-memory Response or Match, and adds no read. **Envelopes** - **`internal/edge`: APPROVE.** The changed functions are the four files above plus `reqrecords_test.go`. They reach only `demoAuthority`, `demoReserved` and `registry.Route.IsDemo`, none of which do any file, store or registry I/O. `internal/demo` was already imported by `edge/demo.go` and `edge.go`, so no new package enters scope. - **`internal/host`: APPROVE.** The changes are in `errship.go` and `logship.go` plus their tests. The only new imports are `strings` and `internal/demo`, which was already in scope. Each change is a prefix comparison against `demo.AppPrefix` (`"tmp-demo-"`, `internal/demo/config.go:17`). It drops demo apps from the flush (`errship.go:76`, `logship.go:120`) and from the prune worklists (`errship.go:104,110`, `logship.go:151,157`). That only removes writes, deletes and lists. The prefix is reserved against ordinary app names at `internal/console/server.go:5296`, and the same approach is already used at `internal/analytics/day.go:188`. **Record-write re-digests (`internal/provision/plan9_b8_census_test.go`)** - **`errshipFlush`: APPROVE.** At `errship.go:76`, a `tmp-demo-` app's pending records are deleted before encoding or any Put. That is one fewer write for demo apps. Otherwise the code is unchanged: the same single `s.Put(ctx, key, body, "")` of the errors chunk, with the key from `apperr.ChunkKey` and no record key. The comment matches the source. - **`logshipFlush`: APPROVE.** `logship.go:120` makes the same change for the logs family. The comment matches the source. CENSUS VERDICT: APPROVED</result> <usage><subagent_tokens>66332</subagent_tokens><tool_uses>12</tool_uses><duration_ms>106825</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>a7318eba4d0e439bc</task-id> <tool-use-id>toolu_018cFWkLHjRcDm7qkWeVCh2n</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/6875c1aa-b47e-417d-b474-a1a48165ae5e/tasks/a7318eba4d0e439bc.output</output-file> <status>completed</status> <summary>Agent "Opus review R1 log-skip" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result># Review R1: agent-start-demo-log-skip (diff ddbc0297..3f542e3b) I read the diff and the code around it, and checked every claim in the brief against the code. I edited nothing. My scratch directory is deleted. Files already in `asd-logskip/` belong to someone else and I left them alone. ## Verification - **`go vet`** on edge, host and console: clean. - **edge** (`-run 'TestRecordsAndErrors|Analytics|Demo'`): passed. - **host** (`-run 'Logship|Errship'`): passed. - **console** (`-run Demo`): every test in the changed files passed. These are `TestDemoAdmissionPurgedStrays`, `TestDemoPurgeStraysAndLateFlush`, `TestPurgedDemoAppTombstoneName` and `TestDemoPurgeRecoveryInterruptedWrites`, including the new "purge marker after logs/errors" cases. - Three tests failed: `TestDemoSourceToLiveAndUpdate`, `TestDemoUsesRealReleasePathGET` and `TestDemoProtectionsSourceToLimitAndTakedown`. Each failed while its fixture was starting, with `listen unix ...sock: socket: operation not permitted`. The sandbox refuses Unix sockets under my scratch TMPDIR, so the cause is the environment, not this diff. - I did not rerun them under `/tmp/g`, which is where they normally run, because the brief limits scratch to my own directory. CI should confirm them. ## Checks against the brief **1. Edge (`demoUnrecorded`)** - Analytics behaviour is unchanged from 7d0f26cb: - `analyticsEnabled` still refuses `rt.IsDemo()` or a reserved `rt.Host`. - `observeAnalytics` still adds the reserved `r.Host` check. - Every request record and error record goes through a guarded function: - `observeRecords` is called from `edge.go:2381`, `demo_traffic.go:215` and `assetcatch.go:1163`. - `emitEdgeError` is called from `edge.go:2378` and `demo_traffic.go:212`. - The only direct `Trip` call is `guard.go:326`, which is now guarded. - No path in activator, wake or tunnel bypasses these guards. - In `guard.go`, only the `Trip` record is skipped. The cooling state and `sendBurstNotices` still run, and the test asserts that cooling still happens for demo routes. - `r` is never nil at the `emitEdgeError` and `noteBurst` call sites. **2. Shippers** - Both drop on `k.App` with the `tmp-demo-` prefix (`logship.go:120`, `errship.go:76`). - That prefix is reserved for every account (`reservedAppName`, `server.go:5296`), so no ordinary app is affected. - Records are dropped at flush, not kept for retry, so nothing loops or builds up beyond the existing pending cap. - The only writers of `logs/` and `errors/` chunks are these two shippers, via `applog.ChunkKey` and `apperr.ChunkKey`. **3. Console** - `demoStrayPath` is used at all three sites: admission `apidemo.go:212`, resumed purge `demo_expiry.go:214`, and the sweep `demo_expiry.go:349`. - Admission still refuses a real orphan: - Any key with an apps row that is not a demo is refused. - So is any key that is not a stray family; the test covers `manifest.json`, `logs-other/` and `errors-other/`. - Strays are refused when no purge evidence exists (the "unpurged", "no history" and "other account" states). - The resumed purge still returns `errNoMarker` for any key outside the stray families. - The sweep only deletes when it holds `lockApp`, the app has no apps row, and `purgedDemoApp` is true. **4. Tombstone match by first label** - `substr(host,1,instr(host,'.')-1)` compares the whole first label exactly: - Names that are prefixes or suffixes of other names don't match. - A host with no dot gives an empty string, which never equals a valid name. - Tests cover all of these cases. - The one behaviour change is that the "other domain" state now passes admission. That is safe because live demos insert their apps row in the same transaction as `demo_apps` (`demo_store.go:254-269`). Admission and the sweep only reach this check when there is no apps row, and then only for stray families. - The worst case is that admission ignores, or the sweep deletes, analytics, logs or errors under a demo name that was once purged. Those are exactly the families the scope ruling says to drop. **5. Tests** - The edge tests prove a demo request produces no response, match, trip or error record. They cover all four demo route fields and the reserved host forms (mixed case, trailing dot, port, apex). - An ordinary app still produces one record of each kind, before and after the demo checks. - The shipper tests use the real gather and flush. Only `apps/bab/web/logs/` and `apps/bab/web/errors/` land, and demo buckets drop even when the store is failing. - The console paths match the real key shapes, and `demoStrayPath` only checks the family prefix anyway. ## Findings **P1:** none. **P2:** none. **P3** (follow-up list): 1. **Tombstone query can't use the index.** - Evidence: `demo_store.go:467` applies `substr(...)` to every row of `demo_host_tombstones`. That table only grows: one row per demo ever made, never pruned. Admission calls `purgedDemoApp` once per stray key, not once per app (`apidemo.go:213`), inside a 10 s timeout. - Scenario: a large tombstone table combined with a backlog of stray keys left from before the roll could push admission toward its deadline. Today this is small. - Fix: use a range on the primary key, `host &gt;= ?||'.' AND host &lt; ?||'/'`, and/or cache the answer per app inside `validateDemoAdmissionState`. - Fault family: per-key work against an unbounded table. 2. **Hourly prune still LISTs for demo apps.** - Evidence: `logshipKnownApps` / `errshipKnownApps` (`logship.go:146`, `errship.go:100`) still return `tmp-demo-` apps from `sink.Known()`. So `chunkPrune` does a ListDirs for each demo app, on each box, each hour, for both families, even though these boxes now never write chunks for them. - Scenario: wasted S3 requests, which cost money. - Fix: skip the `demo.AppPrefix` prefix in both functions. - Fault family: per-box polling that does nothing. 3. **`demoUnrecorded` has no doc comment.** - Evidence: `analytics.go:54`. The old comment ("reads only the demo config, so no switch map or call site can undo it") was dropped. - Fix: restore it, and add that the function now also covers request records, burst trips and edge errors, and why `r` may be nil. - Fault family: clarity. **Verdict: READY**</result> <usage><subagent_tokens>87229</subagent_tokens><tool_uses>24</tool_uses><duration_ms>579692</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>bmjnuthtp</task-id> <tool-use-id>toolu_01K7i8Pz82VnzKrYWozwkJgA</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/6875c1aa-b47e-417d-b474-a1a48165ae5e/tasks/bmjnuthtp.output</output-file> <status>completed</status> <summary>Background command "S=/home/paulca/.cache/tmp/claude-1001/asd-logskip; until [ -f $S/codex.done ]; do sleep 20; done; tail -60 $S/codex.log" completed (exit code 0)</summary> </task-notification>