Skip to content

docs(architecture): per-module design pages for chat, generator, data/cursors, airc/realtime-store - #1495

Merged
joelteply merged 1 commit into
canaryfrom
docs/per-module-design-pages
May 31, 2026
Merged

joelteply merged 1 commit into
canaryfrom
docs/per-module-design-pages

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Step 3 of the doc set Joel approved on 2026-05-30 ("Yeah let's do it. In order"):

  1. ✅ Field manual codifying substrate (PR #1493)
  2. ✅ Generator v2 emitting modules per the template (PR #1494)
  3. This PR: per-module design pages for everything we've built
  4. (Next) MODULE-CATALOG.md update marking which modules are alive in Rust

Each doc follows the canonical 8-section template from the field manual (Role / Command surface / Cross-module deps / State model / Events emitted / Concurrency contract / Migration notes / Kinks found).

What this PR adds

Doc Lines Subject status
CHAT-MODULE.md 125 chat/poll + chat/send Rust (#1489); analyze/export still TS
GENERATOR-MODULE.md 127 v1 + v2 (#1487 + #1494) — recursive bootstrap
DATA-CURSORS-MODULE.md 164 data/query-{open,next,close} migrated to HandleRef (#1490)
AIRC-REALTIME-STORE-MODULE.md 142 In-memory store + 4 moment-of-truth concurrency tests (#1492)
Total 558

Why under docs/architecture/ (not next to mod.rs)

Field manual §3 prescribes "DESIGN.md next to mod.rs" for canonical directory modules. For this PR:

Resolution: all four go under docs/architecture/ following existing convention (PERSONA-COGNITION-CONTRACT.md, ORM-PHASE-2-DESIGN.md style). When the open PR chain merges, future PRs CAN move chat/DESIGN.md + generator/DESIGN.md into their respective directories if preferred — content stays the same; only the file path changes. Single-file module docs stay under docs/architecture/ indefinitely.

What each doc captures

CHAT-MODULE.md

  • chat/send dual-write semantics + warning-field degraded-success pattern
  • All 11 concurrency tests pinning multi-persona invariants
  • TS→Rust rethink table (resolved UUIDs only, no name resolution in kernel)
  • Three flagged substrate kinks waiting for second consumers (envelope builder, typed cross-module call, dual-write macro)

GENERATOR-MODULE.md

  • Recursive bootstrap doctrine + v1→v2 evolution
  • The two same-name race bugs the per-name lock caught
  • Why std::sync::Mutex over tokio::sync::Mutex (sync filesystem critical section)

DATA-CURSORS-MODULE.md

AIRC-REALTIME-STORE-MODULE.md

  • Module-wide mutex + correctness-vs-throughput rationale
  • Four moment-of-truth concurrency tests
  • Flagged per-room sharding refinement (when persona count grows)
  • Known stale-cursor + replay-bound limitation (out of scope but flagged)

What this PR explicitly does NOT do

  • Does NOT touch any code — pure documentation
  • Does NOT move chat/generator DESIGN.md into module directories — see above
  • Does NOT cover the full data module — only the cursor surface. CRUD / vector / migration / batch each get their own design page as they migrate
  • Does NOT cover the broader airc module — only the in-memory realtime store. queue-scan / daemon transport / file transport get their own audit when they become hot
  • Does NOT ship MODULE-CATALOG.md update — step 4, separate PR

Test plan

  • Docs render on GitHub; section anchors resolve
  • Cross-references (PRs, field manual, other architecture docs) all resolve
  • Internal links between the four docs work
  • Each doc's 8 required sections per field manual §3 are present

Stacks on

canary directly — pure documentation PR.

References

…/cursors, airc/realtime-store

Step 2 of the doc set Joel approved on 2026-05-30 ("Yeah let's do it. In order"):

1. ✅ Field manual codifying substrate (PR #1493)
2. ✅ Generator v2 emitting modules per the template (PR #1494)
3. **This PR**: per-module design pages for everything we've built
4. (Next) MODULE-CATALOG.md update marking which modules are alive in Rust

Each doc follows the canonical 8-section template from the field
manual (Role / Command surface / Cross-module deps / State model /
Events emitted / Concurrency contract / Migration notes / Kinks found).

# What this PR adds

| Doc | Lines | Status of subject |
|---|---|---|
| `CHAT-MODULE.md` | 125 | chat/poll + chat/send shipped Rust (PR #1489); analyze/export still TS |
| `GENERATOR-MODULE.md` | 127 | v1 + v2 (PRs #1487 + #1494) — recursive bootstrap |
| `DATA-CURSORS-MODULE.md` | 164 | data/query-{open,next,close} migrated to HandleRef (PR #1490) |
| `AIRC-REALTIME-STORE-MODULE.md` | 142 | In-memory store + 4 moment-of-truth concurrency tests (PR #1492) |
| **Total** | **558** | |

# Why under `docs/architecture/` (not next to mod.rs)

The field manual §3 prescribes "DESIGN.md next to mod.rs" for the
canonical directory-module pattern. For this PR:

- chat/ and generator/ ARE directory modules, but only exist on
  unmerged PR branches (#1489 / #1487). Putting their DESIGN.md
  there would couple this PR to that chain.
- data and airc/realtime_store are single-file modules — no
  natural "next to mod.rs" location.

Resolution: all four go under `docs/architecture/` following the
existing convention (PERSONA-COGNITION-CONTRACT.md, ORM-PHASE-2-DESIGN.md
style). When the open PR chain merges, future PRs CAN move
chat/DESIGN.md + generator/DESIGN.md into their respective
directories if the team prefers — content stays the same; only the
file path changes. Single-file module docs stay under
`docs/architecture/` indefinitely (no natural directory home).

# What each doc captures

## CHAT-MODULE.md

- The chat/send dual-write semantics + the warning-field degraded-
  success pattern
- All 11 concurrency tests pinning multi-persona invariants
- The TS→Rust rethink table (resolved UUIDs only, no name resolution
  in kernel)
- Three flagged substrate kinks waiting for second consumers before
  distillation (envelope builder, typed cross-module call, dual-write
  macro)

## GENERATOR-MODULE.md

- The recursive bootstrap doctrine + v1→v2 evolution
- The two same-name race bugs the per-name lock caught (silent
  "already exists" silencing; torn-state writes with force=true)
- Why std::sync::Mutex over tokio::sync::Mutex here (sync filesystem
  critical section)

## DATA-CURSORS-MODULE.md

- The read-then-async-then-write race story (the "page 1 served 8
  times" bug)
- The dual-shape (handle OR queryId) resolver + the additive
  migration story
- All seven HandleRef migration tests pinning invariants
- The substrate refinements distilled to PR #1491 (expect_owned_by,
  handle_id_or_legacy)

## AIRC-REALTIME-STORE-MODULE.md

- The module-wide mutex + correctness-vs-throughput rationale
- The four moment-of-truth concurrency tests
- The flagged per-room sharding refinement (when persona count grows)
- The known stale-cursor + replay-bound limitation (out of scope but
  flagged)

# What this PR explicitly does NOT do

- **Does NOT touch any code** — pure documentation.
- **Does NOT move chat/ or generator/ DESIGN.md into their module
  directories** — see "Why under docs/architecture/" above.
- **Does NOT cover the full data module** — only the cursor surface.
  CRUD / vector / migration / batch each get their own design page
  as they migrate.
- **Does NOT cover the broader airc module** — only the in-memory
  realtime store. queue-scan / daemon transport / file transport
  get their own audit when they become hot.
- **Does NOT ship a MODULE-CATALOG.md update** — that's step 4 of
  the doc set, separate PR.

# References

- PR #1493 — Field manual (canonical 8-section template)
- PR #1494 — Generator v2 (emits the same template skeleton)
- PRs #1487, #1489, #1490, #1492 — the modules being documented

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@joelteply
joelteply merged commit ffdbd2f into canary May 31, 2026
2 checks passed
@joelteply
joelteply deleted the docs/per-module-design-pages branch May 31, 2026 00:21
joelteply added a commit that referenced this pull request May 31, 2026
…in Rust (step 4 of 4) (#1496)

Final step of the doc set Joel approved on 2026-05-30 ("Yeah let's do it. In order"):

1. ✅ Field manual codifying substrate (PR #1493)
2. ✅ Generator v2 emitting modules per the template (PR #1494)
3. ✅ Per-module design pages for what we've built (PR #1495)
4. **This PR**: MODULE-CATALOG.md update marking which modules are alive in Rust

# What this PR adds

A new `§0. Currently Live In Rust` section near the top of the
catalog with three sub-tables:

## Sub-table 1: Live modules

| Module | What ships | PR | Design doc | Concurrency proven |
|---|---|---|---|---|
| `chat` | chat/poll + chat/send | #1489 | CHAT-MODULE.md | 4 tests |
| `generator` | generate/module + v2 scaffold | #1487 + #1494 | GENERATOR-MODULE.md | 3 tests |
| `data` cursors | data/query-* with HandleRef | #1490 | DATA-CURSORS-MODULE.md | 7 tests |
| `airc/realtime-store` | in-process realtime store | (pre-session) + #1492 tests | AIRC-REALTIME-STORE-MODULE.md | 4 tests |

## Sub-table 2: Substrate primitives

The kernel-level work the four modules ride on — `ServiceModule`
trait, interceptor chain (PR #1483/#1484), HandleRef + cell shapes
(#1485), envelopes (#1486), expect_owned_by + handle_id_or_legacy
(#1491), field manual (#1493), generator v2 (#1494).

## Sub-table 3: Three-primitive map

Per Joel 2026-05-30, mapping the live modules to Commands / Events
/ Persona — showing chat + generator + data are Commands; airc/realtime
is Events; Persona is the next migration target.

# Why minimal restructure

The catalog is 1133 lines of design-proposal entries for every
Continuum concern. Restructuring individual entries to mark which
are live would scatter the live-vs-proposal signal across dozens
of sections. Putting it in one top-of-doc §0 section gives readers
the live-status at a glance without disturbing the rest of the
catalog's design-proposal framing.

# Doctrine the §0 establishes

Modules earn a row in §0 when they clear ALL THREE of the field
manual's acceptance criteria:

1. Rust implementation merged
2. Per-module design doc capturing role / surface / state /
   concurrency / migration / kinks
3. Multi-thread concurrency tests pinning per-resource invariants

This makes the catalog dual-purpose:
- **Design proposal repository** (§I–§IX, unchanged) — what we
  intend to build
- **Implementation status board** (§0, new) — what we've actually
  built + proven

Future migrations grow §0; the proposal sections shrink as their
entries get promoted.

# Updates to the header

- Cross-ref added to COMMAND-INFRASTRUCTURE-FIELD-MANUAL.md
  (joining CBAR / GENOME-FOUNDRY-SENTINEL / PERSONA-COGNITION-CONTRACT)
- Status line updated: "Most entries are design proposals … Some
  are now live in Rust — see §0 below"

# Net diff

+41 lines, -2 lines. Surgical addition that doesn't disturb the
existing catalog content.

# What this PR does NOT do

- **Does NOT migrate any module** — pure documentation
- **Does NOT restructure §I–§IX entries** — each concern stays in
  design-proposal form until it migrates to Rust + earns a §0 row
- **Does NOT add new module concerns to the catalog** — chat,
  generator, data cursors, and airc/realtime-store are already
  represented implicitly in the existing concerns sections; §0 is
  the live-status index, not a new concern listing

# References

- PR #1493 — Field manual (acceptance criteria the §0 table inherits)
- PR #1494 — Generator v2 (eats own dogfood)
- PR #1495 — Per-module design pages linked from §0
- PRs #1487, #1489, #1490, #1492 — the live modules
- Memory: `three-primitives-commands-events-persona`,
  `headless-rust-must-work-soon`

Co-authored-by: Claude Opus 4.7 <[email protected]>
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