Audit response — explicit PASS / REVISE per issue
Audit: PRODUCTION-ARCHITECTURE-REVIEW.md (REVISE) + FAILURE-MODE-REGISTER.md +
METRICS-AND-ALERTS.md + LOGGING-COVERAGE.md.
Response design: ../architecture/B6-EXECUTION-DESIGN.md.
Legend: PASS = the revised design removes or controls the issue with a stated mechanism and a test. PASS-by-removal = the defective code path is deleted rather than mitigated. REVISE = still open, because it needs the owner decision, a staging measurement, or a later slice. Nothing is marked PASS because tests currently pass.
1. Failure-mode register (FM-01 … FM-25) — 25 rows
| ID | Verdict | Resolution |
|---|---|---|
FM-01 stranded running | PASS | Source lease (running_at, lease_expires_at, 120 s), reclaim in cron; every settle fenced on lease_owner. Design §2, §6. Tests AT-04, AT-08. |
| FM-02 duplicate replays all sources | PASS | One message per (search, source); a redelivery re-runs one source. AT-01/AT-02. |
| FM-03 ingest bound race | PASS-by-removal | remaining read/decrement deleted; replaced by reservation guard (§5). AT-09. |
FM-04 partial reported complete | PASS-by-removal | anyOk ⇒ complete deleted; aggregate CASE with partial. AT-15/AT-16. |
| FM-05 unbounded concurrency | PASS | Explicit ceilings (6 MiniWzrd / 4 jobindie; sum 10), never unset. §4. |
| FM-06 replica multiplies quota | REVISE | Owner decision D2. Interim: single replica enforced by deployment + documented; backend ceilings chosen for one replica. Brief §D2. |
| FM-07 ambiguous retry re-scrapes | PASS | ops_dispatch_attempts + uncertain; retry table forbids retry after send. §6.3/§6.4, AT-12. |
| FM-08 DLQ unread | PASS | DLQ consumer + ops_dead_letters + alert AL-02 + manual replay script that refuses ambiguity. §7, AT-13/AT-14. |
| FM-09 publish fails after charge | PASS | Rule: that source → failed/queue_publish_failed, uncharged; zero publishes ⇒ search failed + search cap released. AT-18. |
| FM-10 D1 write contention | REVISE | Ceilings chosen conservatively; ramp gates require measured batch p95 < 500 ms. §4.3. Cannot be closed before staging. |
| FM-11 partial D1 batch | PASS | Accounting rides the final chunk's transaction; ingest idempotent; resume path. §5.3, AT-07. |
| FM-12 unparsable 200 | PASS | Per-source err_code + detail endpoint; no longer folded into complete. AT-15. |
| FM-13 WAF blocks exits | REVISE | Gateway health alert AL-07 + per-source SOURCE_BLOCKED; per-source egress routing still not built (out of scope, unchanged). |
| FM-14 no usable exit | PASS | Fails closed; source failed with the gateway reason; AL-07. |
| FM-15 charge then refusal | PASS | Refusals remain pre-charge; AT-24/AT-25. |
| FM-16 silent cron failure | PASS | retention.run + search.reclaimed counters; AL-10 absence alert. |
| FM-17 session without owner row | REVISE | Logging catches it (auth.session.resolved without owner), detection only; the identity repair path is unchanged and untested. Add to B2 follow-ups. |
| FM-18 R2 orphan | REVISE | Detection via r2_orphans_total + RB-13; no automated scan in B6. |
| FM-19 partial erasure | REVISE | Existing list-until-empty design; outside B6 execution scope, unchanged. |
| FM-20 Logpush gap | REVISE | O10 plans partition-completeness detection; unprovable until staging. |
| FM-21 cron drift | REVISE | cron.started/completed events planned; a heartbeat row + alert is not yet in the migration list. Add in B6 observability phase. |
| FM-22 AI 429 | PASS | ai_* codes + keyword fallback semantics; AI queue deferred (separate workload). |
| FM-23 Gmail uncertain auto-retry | PASS | No send queue exists; the send stays synchronous with the explicit outcome field. |
| FM-24 backlog beyond retention | PASS | oldest_message_age_s alert AL-03 at 15 min (retention 4 days). |
| FM-25 clock skew | REVISE | Lease/expiry use server Date.now(); no monotonic guard. Documented limitation; revisit if multi-region. |
Summary: 16 PASS (2 of them PASS-by-removal), 9 REVISE (D2, staging measurements, adjacent slices, fairness). None of the 9 is an execution-model defect; each is a decision, a measurement or a neighbouring slice.
2. Alerts (AL-01 … AL-15) — now implementable?
| ID | Verdict | Depends on |
|---|---|---|
| AL-01 search stuck running | PASS | aggregate query + search.reclaimed event |
| AL-02 DLQ non-empty | PASS | DLQ consumer |
| AL-03 backlog age | PASS | Queues analytics (platform) |
| AL-04 5xx ratio | PASS | http.request.completed |
| AL-05 scrape uncertain | PASS | dispatch state machine |
| AL-06 all sources failing | PASS | scrape_outcome counter |
| AL-07 gateway degraded | PASS | gateway /health probe |
| AL-08 D1 batch failures | PASS | db.batch.failed |
| AL-09 scraper quota refusals | PASS | 402 dispatch events |
| AL-10 retention absent | PASS | retention.run |
| AL-11 Logpush gap | REVISE | staging only |
| AL-12 config 503 | PASS | CONFIG_* codes |
| AL-13 auth rejection spike | PASS | auth.rejected |
| AL-14 empty-ratio anomaly | REVISE | needs per-source history (only last_run_at/last_error_code exist) |
| AL-15 R2 orphans | REVISE | scan tool not built |
12 PASS, 3 REVISE (all detection-only, none blocking go-live).
3. Queue requirements Q1 … Q10
| # | Requirement | Verdict | Mechanism |
|---|---|---|---|
| Q1 | slow source doesn't block unrelated | PASS | one source per invoc + 10 permits |
| Q2 | sources independently executable | PASS | per-source message + lease + retry |
| Q3 | users concurrent | PASS | queue concurrency |
| Q4 | persist as each completes | PASS | per-source ingest + detail endpoint |
| Q5 | failure doesn't discard successes | PASS | per-source commit; partial |
| Q6 | status running/complete/partial/failed | PASS | aggregate CASE |
| Q7 | see finished sources while others run | PASS | GET /searches/{id} + polling |
| Q8 | failed message doesn't block others | PASS | batch size 1; DLQ |
| Q9 | one user can't starve others | REVISE | caps bound volume, but no per-tenant fairness scheduler; accepted for now (owner decision D1 keep) |
| Q10 | slow source no global lock | PASS | no lock; reservation guard |
9 PASS, 1 REVISE (fairness, deliberately deferred).
4. Review-§3 REVISE list (the ten ranked items)
- Fan-out granularity → PASS (design §1–2) · 2. Unbounded concurrency → PASS (§4) ·
- Process-local scraper quota → REVISE (D2) · 4. Stranded
running→ PASS (§2, §6) · - Partial-as-complete → PASS (§3) · 6. Ingest bound race → PASS-by-removal (§5) ·
- DLQ unobserved → PASS (§7) · 8. Observability → PASS (plan) (§10, O1–O10; unproven until implemented) · 9. Dispatch attempt ledger → PASS (§6) · 10. Per-source budget → REVISE (D2, second line of defence).
5. Logging-coverage gaps
| Module | Verdict | Where |
|---|---|---|
| router / auth / respond | PASS (plan) | O2 |
| platform/db | PASS (plan) | O3 |
| platform/scraperClient | PASS (plan) | O4 |
| platform/queue | PASS (plan) | O5 |
| ingest / validation | PASS (plan) | O6 |
| scrapers (Go/Rust) | PASS (plan) | §9 contract + O8 |
| frontend | REVISE | client error channel deferred to the app slice |
| redaction | PASS (plan) | O7 + AT-22 |
6. What is still not closed (honest list)
| Item | Blocked by |
|---|---|
| FM-06 / FM-09 fairness and replica quotas | owner decision D2 |
| FM-10 D1 latency under load | staging measurement (no production resources touched) |
| FM-13 per-source egress routing | separate slice, explicitly out of B6 |
| FM-17/FM-18/FM-19 detection gaps | adjacent slices (B2, B3, account erasure) |
| FM-20/FM-21 archival + cron heartbeat | staging + one small migration in the observability phase |
| Q9 per-tenant fairness | accepted risk while one-active-search remains |
| Observability plan itself | unimplemented by instruction: no source changed |
No item above is marked PASS on the strength of local tests alone.