docs(p02): record guarded ACK and replay patch plus HTTP scope blocker [skip ci]

This commit is contained in:
victorsteele428 committed 2026-11-22 16:58:00 +06:00
1 parent 5c88088537
commit 6a873cb04f
6 files changed
+70

No files matched your search

+17
View File
@@ -100,3 +100,20 @@ Authorized follow-up baseline: Gitea/GitHub `fd57a3518d14bcb8367ce9ab9c3ec306bcf
**Candidate R-02 behavior:** Port 4000 `flushBuffer` and Port 3000 `DataBufferEngine.flush` stream-parse existing CSV/CSV.gz partitions for same-client/date/event IDs before replaying any buffered Redis or RAM batch, dropping already-persisted IDs while retaining Redis queue until the write/check completes. Scan/read/parse exceptions fail closed before LTRIM. In-scope test adds a direct Port 4000 writer + Redis LTRIM-failure/recovery test and updates the existing web-buffer replay fixture. **Not proven globally exactly-once:** cross-process CSV writers outside the Redis flush lock and unknown archival/partial-corruption cases remain; scanning partitions on each flush also has real disk-I/O cost, requiring throughput evaluation before production promotion.
**Candidate acceptance:** one disposable Gitea CI with 24/24 suites, strict TS, lint, Linux/Windows clean npm CI and production build; direct Port4000 replay tests; exact allowlist/diff audit and three-remote tree parity. The Gitea MCP/host was unavailable on the implementation attempt, so this is **NOT PASSED** and the P02 phase remains **BLOCKED / NOT CLOSED**. No live deployment or runtime production mutation.
## P02-RUNTIME-REMEDIATION-02 — Scope-locked post-patch forensic audit (2026-11-22)
**Source baseline:** P02 diagnostic `fd57a3518d14bcb8367ce9ab9c3ec306bcfc9898`. **Tested patch branch:** `p02-runtime-remediation-20261122`, final remediation source snapshot `5c880885378ae0f4fa8dd3a145f9c7055dada635`. This appendix supersedes the earlier "Gitea unavailable" candidate note. **Do not claim P02 CLOSED**: a separate HTTP fallback code path remains in scope-lock-excluded files.
**R-01 Port 4000 improvements implemented (not live-deployed):**
- `server/index.js:pushEventsToRedisOrFallback` fails closed with sanitized `BUFFER_PERSIST_FAILED` on Redis RPUSH rejection while retaining RAM for recovery; also deduplicates same-client/eventId retries inside a single push.
- The `onBufferPush` integration synchronously flushes to CSV before a successful ACK when Redis is intentionally absent; failed CSV append returns a negative ACK. No-Redis mode is therefore not an automatic RAM-only success ACK.
- `server/socket/handlers.js` single/batch ACK logic clears failed local idempotency claims, never calls an uncertain Redis claim "durable duplicate", verifies a claimed duplicate against a bounded Redis buffer read or read-only CSV/.csv.gz scan, and denies uncertain mixed-batch ACKs. The proof uses a 512-item Redis window and a bounded CSV scan (256 MiB, 1.8 seconds); lack of proof yields a negative ACK, **not proof of data loss**.
**R-02 Port 4000 + web-buffer improvements implemented:** Both allowed flush methods check same-client/partition/eventId in physically persisted CSV/CSV.gz (including rotation) before retrying after Redis trim failure, and only trim when the disk append/check succeeds. Direct disposable Port 4000 LTRIM failure and gzip-partition replay tests exist. **Not a formal globally atomic/exactly-once guarantee:** concurrent independent writers, data corruption and repeated full-partition scans may introduce performance or recovery limitations.
**Critical residual R-01 HTTP path (outside this approval):** `core/data/buffer.ts:412-442` silently falls back to RAM on Redis RPUSH error; `app/api/events/route.ts:744-754` returns HTTP success after `pushAsync`. `sdk/node/datastack/index.ts:643-666,916-942` routes non-auth WebSocket rejections into HTTP fallback. Thus a negative Socket.IO ACK does **not establish end-to-end SDK/HTTP durability**. A disposable HTTP fault diagnostic was added to the P02 test allowlist; it is not a runtime fix. Fixing HTTP `POST` and the buffer push/idempotency contract needs separate explicit approval, including `core/Security/security.ts:230-375` only if reproduced claim rollback demands it.
**R-03:** public `/health` remains HTTP 200 liveness; no readiness endpoint, UI or auth change.
**CI facts:** Gitea [#66](https://dev.ivib.cc/vibtools/DataStack/actions/runs/66) terminal SUCCESS for initial patch; [#68](https://dev.ivib.cc/vibtools/DataStack/actions/runs/68) diagnosed a same-ID retry assertion regression; the exact local idempotency-claim cleanup was fixed in scope. [#70](https://dev.ivib.cc/vibtools/DataStack/actions/runs/70) is the latest disposable source acceptance (check terminal outcome in notes/003). **No code was deployed to production.**