Skip to content

feat(chat-airc): add Stage 2 mirror writer skeleton - #1436

Merged
joelteply merged 3 commits into
canaryfrom
feat/oxidize-chat-airc-substrate
May 25, 2026
Merged

joelteply merged 3 commits into
canaryfrom
feat/oxidize-chat-airc-substrate

Conversation

@joelteply

@joelteply joelteply commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Card `6b564a9a-ba4f-4bc4-8ba8-c0fe88dd0eaa` (Replace Continuum chat/Postgres dependency with AIRC Rust SQLite substrate). Two commits:

  1. `ba67f44e9` (claude-tab-1): Stage 1 → 2 design + decision resolutions appended to `docs/grid/CHAT-TO-AIRC-MIGRATION-PROOF-GATES.md`.
  2. `96c395144` (codex): PR-A mirror writer skeleton implementing the Stage 2 design — `AircToORMMirrorWriter` daemon + `AircChatMirrorMapper` + types + 168 LOC unit tests + Rust realtime_store extensions.

Design slice (commit 1)

  • Status log: Stage 1 marked complete (continuum#1432 publisher seam + feat(airc): use structured publish for chat dual-write #1433 structured `airc publish` JSON-CLI + test(airc): add chat dual-write smoke proof #1435 smoke proof, all merged).
  • Decision resolutions for all 4 open decisions blocking Stage 1 → 2:
    1. Dual-write atomicity → option (b): append-only with reconciler.
    2. Message ID → AIRC `event_id` becomes canonical at Stage 2 cutover.
    3. Backfill → none. Pre-Stage-1 history served from ORM via mirror reader.
    4. Tombstones → ORM-local at Stage 2; `chat.redact` event deferred to Stage 3.
  • Stage 2 architecture (ASCII diagram, mirror writer subscribes via `LibAircSubstrate`).
  • Stage 1 → 2 PR sequence (A/B/C/D).

Implementation slice (commit 2 — PR-A)

  • `src/system/airc-chat/server/AircToORMMirrorWriter.ts` (74 LOC) — the daemon writer my design named.
  • `src/system/airc-chat/server/AircChatMirrorMapper.ts` (73 LOC) — AIRC envelope → `ChatMessageEntity` row mapping.
  • `src/system/airc-chat/server/AircChatMirrorTypes.ts` (41 LOC).
  • `src/system/airc-chat/test/unit/AircToORMMirrorWriterCheck.ts` (168 LOC unit tests).
  • Rust extensions to `realtime_store.rs` (176 LOC) and `realtime.rs` (29 LOC).
  • tsconfig.json + tsconfig.eslint.json wire-up for the new module.

Verification

  • TS build clean; ESLint baseline; Rust compile + tests passed pre-push (codex).
  • Precommit on commit 1 passed clean (TS build, chat-roundtrip).
  • 558 LOC total (4 doc + 514 impl + 40 cfg).

What this PR does NOT do

  • Does not flip the producer cutover (`ChatSendServerCommand` and `PersonaUser` persona-reply paths still write directly to ORM). That's PR-B.
  • Does not audit reader sites. That's PR-C.
  • Does not change the AIRC wire format (continues `AircChatEnvelope` / `chat_transcript`).
  • Does not touch persona memory / engram admission (orthogonal).

Follow-up

PR-B (producer cutover), PR-C (reader audit), PR-D (1h soak) per the Stage 2 PR sequence in the proof-gates doc.

Closes design portion + PR-A of work card `6b564a9a-ba4f-4bc4-8ba8-c0fe88dd0eaa`. Card remains open until PR-B/C/D land.

Continuum chat substrate migration card 6b564a9a (Replace Continuum
chat/Postgres dependency with AIRC Rust SQLite substrate) — Stage 1
of the proof-gates doc is now complete (continuum#1432 publisher seam,
#1433 structured airc-publish CLI, #1435 smoke proof, all merged to
canary). This PR appends the Stage 1 → 2 design + resolves the four
open decisions that were explicitly blocking that transition:

  1. Dual-write atomicity: pick (b) append-only with reconciler for
     Stage 2 (AIRC primary, mirror writer subscribes + back-fills on
     restart + every 60s).
  2. Message ID: invert from Stage 1 — AIRC event_id becomes canonical
     at Stage 2 cutover; legacy ORM ids retained in metadata for
     pre-Stage-1 history rows; same UUID shape so no schema change.
  3. Backfill: none. Pre-Stage-1 history stays in ORM, served via the
     mirror reader path. Known migration boundary, not a regression.
  4. Tombstones: stay ORM-local at Stage 2 (mirror retains deletedAt).
     Stage 3 introduces chat.redact AIRC event type (out of scope).

Plus the Stage 2 architecture: new AircToORMMirrorWriter daemon that
subscribes via LibAircSubstrate (gated on continuum#1434 wiring slice
landing first), ON CONFLICT DO NOTHING for idempotency, cursor-resumed
reconciler. Producers (ChatSendServerCommand, PersonaUser persona
replies) drop their direct ORM write; readers stay unchanged.

And the Stage 1 → 2 PR sequence: PR-A mirror writer skeleton, PR-B
producer cutover, PR-C reader audit, PR-D 1h soak. PR-A is the gating
slice on this lane.

Status log updated to mark Stage 1 complete with PR refs.

Does NOT touch ORM-side code (Stage 3 is the only irreversible step
and is out of scope), does NOT change the AIRC wire format, does NOT
touch persona memory / engram admission.

Closes design portion of work card 6b564a9a-ba4f-4bc4-8ba8-c0fe88dd0eaa.
Implementation lands in follow-up PRs A-D.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@joelteply joelteply changed the title docs(chat-airc): Stage 1 → 2 design + decision resolutions (closes design portion of 6b564a9a) feat(chat-airc): add Stage 2 mirror writer skeleton May 25, 2026
@github-actions github-actions Bot added size: XL and removed size: M labels May 25, 2026
@joelteply
joelteply merged commit 7ed3cc6 into canary May 25, 2026
4 checks passed
@joelteply
joelteply deleted the feat/oxidize-chat-airc-substrate branch May 25, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant