Skip to content

docs(airc-rust): replace body_hint with HTTP-style Headers dictionary (reopen of #658) - #662

Merged
joelteply merged 1 commit into
canaryfrom
feat/headers-dictionary
May 19, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/headers-dictionary

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Reopen of closed #658 — the original PR auto-closed at 21:39Z when I renamed its branch via the GitHub branch-rename API. The branch `docs/airc-rust-envelope-headers` was deleted by the rename and the PR couldn't be reopened. This is the same content on the renamed branch.

Summary

Per the iterative refinement with Joel and Codex on AIRC: replaces the single `body_hint` envelope field with an HTTP-style `Headers` dictionary (`BTreeMap<String, String>`).

  • Routers/middleware filter on headers without parsing the body (HTTP analogy)
  • Namespace convention: `airc.` (substrate-owned), `forge.` (alloy/contract — includes `forge.body_hint`), `continuum.` / `openclaw.` (consumer ecosystems), `x-*` (experimental)
  • BTreeMap for deterministic ordering — signatures + replay + diff-tests stable
  • Authority rule: routing trusts headers; body `kind` field is local ergonomics only
  • Extensibility rule: consumers add headers without coordinating with airc-rust
  • Encryption note: headers stay accessible under E2E body encryption (only authenticated via signature, not encrypted)
  • Ergonomic helpers, plain strings underneath

🤖 Generated with Claude Code

…rs dictionary

Per the real-time conversation with Codex + Joel: body_hint was the
right idea but the wrong shape. The clean primitive is a string-keyed
headers map on the envelope (HTTP analogy), not a single typed field.

Changes:

  - Envelope.body_hint (single optional field) → Envelope.headers
    (`BTreeMap<String, String>`)
  - Subscription.body_hint → Subscription.headers (header-keyed
    match patterns with Exact/Prefix variants)
  - Storage `messages.body_hint` column → `messages.headers` JSONB
  - Storage `subscriptions.body_hint_or_null` → `subscriptions.header_filters`

Namespace convention (no schema coordination needed):

  - airc.*       — substrate-owned: trace_id, priority, reply_to,
                   content_encoding, deadline, lease, auth_scope, pii
  - forge.*      — alloy/contract: body_hint (e.g. "forge.work.offer"),
                   requires_capability (e.g. "render.gpu"), persona.tier
  - continuum.*  — continuum-specific: persona_id, activity
  - openclaw.*, hermes.*, etc. — other consumer ecosystems
  - x-*          — experimental / private headers

BTreeMap chosen over HashMap for:
  - deterministic ordering (signatures + replay + diff-tests stable)
  - simple serialization (sorted keys, predictable JSON)
  - unknown-header pass-through (transports just copy the map)
  - no schema churn when middleware adds new headers

Rules added:

  - "Authority rule": routing/admission decisions trust the headers.
    Body MAY contain its own kind field as local ergonomics for
    consumers that already parse the body — substrate never consults
    body fields. Headers are canonical.
  - "Extensibility rule": consumers add new headers without
    coordinating with airc-rust. Other consumers ignore unknown
    headers.
  - "Encryption note": when body is encrypted under recipient key
    (double-ratchet), routers can't read body. Headers stay
    accessible (only authenticated via signature, not encrypted).
    That's how routing remains efficient under E2E encryption.
  - "Ergonomic helpers, plain strings underneath": Rust API exposes
    typed accessors (e.g. `envelope.body_hint() -> Option<&str>`
    reads `forge.body_hint`) without changing the wire format.
    Storage/transport see plain BTreeMap.

Sweep: all body_hint references through the doc (Subscription
examples, security PII tagging, presence announce, WebRTC signaling,
appendix C automation engine) now use the headers map shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@joelteply
joelteply merged commit 7aca11f into canary May 19, 2026
12 checks passed
@joelteply
joelteply deleted the feat/headers-dictionary branch May 19, 2026 03:23
This was referenced May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant