Skip to content

docs(rfc-0001): specify the operator-driven alias-index write path - #151

Merged
jensholdgaard merged 3 commits into
mainfrom
rfc0001-alias-write-path
Jun 7, 2026
Merged

docs(rfc-0001): specify the operator-driven alias-index write path#151
jensholdgaard merged 3 commits into
mainfrom
rfc0001-alias-write-path

Conversation

@jensholdgaard

@jensholdgaard jensholdgaard commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

Resolves the RFC 0001 §9 open question "alias index creation mechanism" (the drift-alias-index write path). DOC-ONLY — no Rust.

The maintainer chose (2026-06-07) operator-driven + audited aliasing over automatic-inference and "deferred entirely", precisely because §3.1 forbids silent template merges ("every merge emits an audit event; explicit"). An auto-aliased cross-semantic merge is a silent merge by another name.

The mechanism:

  • An alias assertion ("leaf B is the same template as leaf A") is an explicit operator action, never inferred.
  • Each assertion/retraction is an audited, durable event on the existing §6.4 audit stream, durable under the §3.4 WAL-before-ack barrier, and reversible.
  • Assertions are folded into a queryable per-tenant alias map the querier loads to expand RFC 0002's resolves_to(n)template_id IN (alias set).
  • Automatic inference is deferred to a possible future propose → operator-confirm layer (proposals never enter the active index unconfirmed) — mentioned as future work, not specified here.

What changed (all in docs/rfcs/0001-template-miner.md)

  • §6.7 — replaced the "no creation event / produced out of band" deferral with the full write path: alias model (per-tenant equivalence class of template_ids, cross-leaf only, canonical = numerically smallest representative; cross-version stays the template_version axis), the alias_asserted / alias_retracted audit events (field list in §6.4 schema style), materialization + storage venue analysis, eventual-consistency/staleness semantics, the resolves_to reader contract, reversibility, a Mermaid assert→audit→materialize→query sequence diagram, and the automatic-inference future-work note.
  • §5.3 — new acceptance criteria, Given/When/Then + greppable ids.
  • §8 — added an "Alias write-path tests" traceability entry covering RFC0001.12–.16.
  • §9 — marked the open question RESOLVED, pointing at §6.7 + the new criteria; flagged automatic inference as remaining future work and the physical alias-map file/format as an RFC 0005 storage decision.

New §5 acceptance criteria

  • RFC0001.12 — alias assertion is durably recorded (WAL-before-ack) and appears in the per-tenant map.
  • RFC0001.13resolves_to(rep) returns all members; expansion is by the set (rep or member); a non-member resolves to {C}.
  • RFC0001.14 — cross-tenant isolation: an alias in tenant A never affects tenant B (§3.7).
  • RFC0001.15 — retraction emits alias_retracted and removes membership on rebuild.
  • RFC0001.16 — a non-aliased id resolves to itself (matches base-member / bare template_id = X, RFC0001.6).

Storage venue choice + RFC 0005 split

Of three venues — (a) per-tenant projection from the durable audit/alias event log (chosen), (b) tenant-root aliases.parquet/JSON written directly, (c) extend the partition Manifest(a) wins: it reuses the §6.4 audit infra (no new write plane), matches the tenant scope of the data (§3.7), and keeps an append-only/replayable source of truth (the event log) with a rebuildable map cache. (b) is rejected as the source of truth (a directly-mutated file has no audit trail) but survives as the serialization format. (c) is rejected because the manifest is partition-scoped while alias sets are tenant-global.

RFC 0001 owns the model + write path + criteria. RFC 0005 (storage) owns the physical alias-map file/format and the snapshot cadence (the staleness bound). Sibling to the issue #147 split.

Status transition

redspecified. Following the RFC 0003 served-binary amendment precedent: adding new acceptance criteria re-enters the ladder at specified until RFC0001.12–.16 have failing test stubs (red) and then pass (green).

Invariants touched

§3.1 (no silent merges — aliasing is explicit + audited + reversible), §3.4 (WAL-before-ack — alias events inherit the §6.4 durability barrier), §3.7 (per-tenant — alias sets are tenant-scoped, RFC0001.14 locks isolation). Reader contract stays consistent with RFC 0002 RFC0002.9.

Verification

mdbook build succeeds; the only warning is the pre-existing mdbook-mermaid version note (built against 0.5.0, called from 0.5.2). The new Mermaid sequence diagram renders (class="mermaid" present in the built HTML). DOC-ONLY change — no cargo run needed.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated RFC 0001 status to "specified" and expanded alias handling coverage.
    • Added audited alias assertion/retraction semantics and stronger durability guarantees for alias writes.
    • Specified per-tenant alias isolation, alias-set expansion rules, and retraction behavior.
    • Included a revised sequence diagram and an operator-driven, reversible alias write path.
    • Enhanced testing strategy and resolved the alias index creation question; deferred format/snapshot details.

Resolve the RFC 0001 §9 open question "alias index creation mechanism"
with operator-driven + audited aliasing, the mechanism §3.1 (no silent
merges) demands.

§6.7: replace the "no creation event / produced out of band" deferral
with the alias write path — the alias model (per-tenant equivalence
class of template_ids, cross-leaf only, canonical representative), the
alias_asserted / alias_retracted audit events (WAL-before-ack durable
per §3.4), the per-tenant alias-map projection folded from the durable
event log, eventual-consistency / staleness semantics, the resolves_to
reader contract (RFC0002.9), and reversibility. Adds a Mermaid
assert→audit→materialize→query sequence diagram and defers automatic
inference to a future propose→operator-confirm layer.

§5.3: add acceptance criteria RFC0001.12–RFC0001.16 (durable assertion
+ map appearance; resolves_to set expansion; cross-tenant isolation
per §3.7; retraction; non-aliased id resolves to itself). §8 maps them
to an alias write-path test entry.

§9: mark the open question RESOLVED, noting automatic inference as
remaining future work and the physical alias-map file/format as an
RFC 0005 storage decision.

Status: red -> specified (new criteria re-enter the ladder; precedent:
the RFC 0003 served-binary amendment).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jensholdgaard
jensholdgaard requested a review from Copilot June 7, 2026 19:18
@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jensholdgaard, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 48 minutes and 3 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 39515658-079e-41ca-991f-0b978291efbd

📥 Commits

Reviewing files that changed from the base of the PR and between 0e8bdc0 and 316ece8.

📒 Files selected for processing (1)
  • docs/rfcs/0001-template-miner.md
📝 Walkthrough

Walkthrough

RFC 0001 status set to specified; adds RFC0001.12–RFC0001.16 acceptance scenarios and replaces the alias index placeholder with an operator-driven audited write path (alias_asserted/alias_retracted), per-tenant projection folding, resolves_to expansion rules, retraction semantics, and corresponding tests.

Changes

Alias Index Mechanism Specification & Acceptance Scenarios

Layer / File(s) Summary
Status elevation and acceptance scenarios
docs/rfcs/0001-template-miner.md
RFC status transitioned from red to specified. Added RFC0001.12–RFC0001.16 defining audited alias assertions/retractions, resolves_to expansion rules (including non-aliased ids resolving to themselves), and per-tenant alias isolation.
Operator-driven alias write-path specification
docs/rfcs/0001-template-miner.md
§6.7 now specifies operator-driven alias_asserted/alias_retracted audit events with WAL-before-ack durability, a per-tenant alias-map projection folded from the alias event log with eventual-consistency reads, template_id.resolves_to(X) expansion by alias-set membership (direction-independent, {X} for non-aliased ids), retraction reversibility, and defers automatic propose→operator inference.
Testing strategy and open-question resolution
docs/rfcs/0001-template-miner.md
Added "Alias write-path tests" coverage for durable audit/event-log behavior, per-tenant alias-map folding, resolves_to expansion, retraction effects, and cross-tenant invisibility. Marked "Alias index creation mechanism" resolved (operator-driven + audited) and deferred alias-map file/format and snapshot cadence to RFC 0005.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Poem

🐰
An operator taps the audit log with care,
alias_asserted whispers through the air.
Projections fold per tenant, neat and bright,
resolves_to returns the set or single light.
From red to specified — the path feels right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: specifying the operator-driven alias-index write path in RFC 0001, which is the core objective of this documentation PR.
Description check ✅ Passed The PR description is comprehensive and well-structured, covering the summary, rationale, detailed changes, new acceptance criteria, storage decisions, status transitions, and verification steps. It exceeds the template requirements with thorough technical justification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rfc0001-alias-write-path

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates RFC 0001 to specify the operator-driven, audited write path for the drift-alias-index (resolving the former §9 open question), and updates the RFC’s maturity/status accordingly.

Changes:

  • RFC frontmatter status moved to specified and new alias-focused acceptance criteria (RFC0001.12–.16) were added to §5.3.
  • §6.7 now specifies the alias model, audit events (alias_asserted / alias_retracted), projection/materialization semantics, and the resolves_to(X) reader contract (with an added Mermaid sequence diagram).
  • §8 test traceability and §9 open-questions checklist were updated to reflect the resolved alias-write-path decision.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/rfcs/0001-template-miner.md Outdated
Comment thread docs/rfcs/0001-template-miner.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/rfcs/0001-template-miner.md (1)

1296-1300: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

AuditEventType contract is internally inconsistent after introducing alias events.

§6.4 still defines AuditEventType as only the three template-widening variants, but §6.7 adds alias_asserted/alias_retracted on the same audit stream. This leaves the normative event schema ambiguous for implementers and tests.

Proposed doc fix
 {
-  event_type: AuditEventType,  # enum:
-                               #   template_widened
-                               #   template_type_expanded
-                               #   template_widening_rejected_degenerate
+  event_type: AuditEventType,  # enum:
+                               #   template_widened
+                               #   template_type_expanded
+                               #   template_widening_rejected_degenerate
+                               #   alias_asserted
+                               #   alias_retracted
   tenant_id: TenantId,
-  template_id: u64,
-  old_version: u32,
-  new_version: u32,
-  old_template: String,        # canonical form, with <*> for wildcards
-  new_template: String,
+  # template_* events:
+  template_id: u64,
+  old_version: u32,
+  new_version: u32,
+  old_template: String,        # canonical form, with <*> for wildcards
+  new_template: String,
   ...
+  # alias_* events use alias payload per §6.7:
+  # representative_id, member_ids, actor, reason, timestamp
 }

Also applies to: 1543-1562

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/rfcs/0001-template-miner.md` around lines 1296 - 1300, The
AuditEventType enum and its usage are inconsistent: update the normative schema
so the event_type field and the AuditEventType definition (referenced in §6.4)
explicitly include the alias_asserted and alias_retracted variants (or clearly
document a separate alias audit stream) and reconcile §6.7 to reference the same
enum; update all occurrences (including examples and schema blocks around
AuditEventType, §6.4, and §6.7) so tests and implementers see a single
authoritative definition that lists template_widened, template_type_expanded,
template_widening_rejected_degenerate, alias_asserted, and alias_retracted (or
state the intentional separation if you choose a separate stream) and ensure the
event_type field examples and any normative language reflect that choice.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/rfcs/0001-template-miner.md`:
- Around line 1546-1562: The fenced code block showing the audit event structure
(keys like event_type, tenant_id, representative_id, member_ids, actor, reason,
timestamp) is missing a language tag; update the opening ``` to include a
language identifier (e.g., change ``` to ```text) so the markdown linter (MD040)
recognizes the block and suppresses the noisy warning.

---

Outside diff comments:
In `@docs/rfcs/0001-template-miner.md`:
- Around line 1296-1300: The AuditEventType enum and its usage are inconsistent:
update the normative schema so the event_type field and the AuditEventType
definition (referenced in §6.4) explicitly include the alias_asserted and
alias_retracted variants (or clearly document a separate alias audit stream) and
reconcile §6.7 to reference the same enum; update all occurrences (including
examples and schema blocks around AuditEventType, §6.4, and §6.7) so tests and
implementers see a single authoritative definition that lists template_widened,
template_type_expanded, template_widening_rejected_degenerate, alias_asserted,
and alias_retracted (or state the intentional separation if you choose a
separate stream) and ensure the event_type field examples and any normative
language reflect that choice.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 90376458-ac37-4f92-9768-89e13cfd30a1

📥 Commits

Reviewing files that changed from the base of the PR and between f225be9 and 66c5d73.

📒 Files selected for processing (1)
  • docs/rfcs/0001-template-miner.md

Comment thread docs/rfcs/0001-template-miner.md Outdated
…e detail

Maintainer review of #151: the numerically-smallest-member selection is an
implementation detail, not a contract — it may evolve (e.g. operator-
designated representative) without changing alias-set semantics, since
resolves_to expands by membership (RFC0001.13).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread docs/rfcs/0001-template-miner.md Outdated
Comment thread docs/rfcs/0001-template-miner.md Outdated
Comment thread docs/rfcs/0001-template-miner.md Outdated
…emetry

Make the canonical representative a derived display convenience
(min member), with membership the only contract-bearing notion;
define the asserted set as the full union {representative_id} ∪
member_ids so retraction is well-defined for any member including
the canonical. Add alias_assertions_total / alias_retractions_total
to the §6.8 telemetry table, tag the audit-event fence as text, and
extend the staleness discussion to cover retraction over-inclusion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@jensholdgaard
jensholdgaard merged commit d9f0d66 into main Jun 7, 2026
11 checks passed
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.

2 participants