Skip to content

docs(adr,architecture): finalize ADRs 0005–0009 + extend reviewer checklist (Step 1.1f)#52

Merged
officialCodeWork merged 1 commit into
mainfrom
build/phase-1/step-1.1f-adrs-reviewer-checklist
May 24, 2026
Merged

docs(adr,architecture): finalize ADRs 0005–0009 + extend reviewer checklist (Step 1.1f)#52
officialCodeWork merged 1 commit into
mainfrom
build/phase-1/step-1.1f-adrs-reviewer-checklist

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

Summary

Closes the Phase-1 refactor window (Steps 1.1a–1.1f) by:

  • Promoting ADRs 0005–0009 from "Accepted (draft)" to "Accepted with implementation-path backlinks" — each ADR now has an explicit table pointing to the concrete files / SPI surfaces that realise it, plus the PRs in which the implementation landed.
  • Extending the reviewer checklist in docs/architecture/performance.md so every one of the five ADRs is covered by an explicit item reviewers can apply at PR time.
  • Adding module-level ADR backlinks to the two SPI files that were missing them: rag_core.spi.reranker (ADR-0006) and rag_core.spi.storage (ADR-0007). All other relevant modules (rag_core.types, rag_core.spi.vector_store, the three cache SPIs, rag_policy.*, the vector backends) already carried ADR references from earlier steps.

After this PR, Step 1.2 (Connectors framework) is the next actionable step.

Per-ADR finalization

ADR Decision Implementation already landed in
ADR-0005 — PolicyEngine PDP Single SPI for ACL / PII / quotas / redaction; coverage linter on every call site. Step 1.1c, #46
ADR-0006 — Two-stage rerank fast_rerank (ChunkRef) + precise_rerank (Chunk) + should_early_exit from day 1. Decision now; SPI lands in Step 2.7
ADR-0007 — Tiered storage with BlobRef Chunk.text: str | BlobRef; resolution via existing Storage SPI. Step 1.1a, #44
ADR-0008 — Cost-aware planner QueryPlan / PlanNode / Cost / Budget / StageEvent; planner mutates plan before dispatch. Step 1.1a, #44
ADR-0009 — Vector index strategy + quantization IndexHint selects index by scale tier; Embedding.dtype enables int8 / binary quantization. Steps 1.1a / 1.1b, #44 / #45

Reviewer checklist extensions

docs/architecture/performance.md already had 11 items covering ctx-threading, ACL, logging, queue-bounding, Pydantic discipline, PolicyEngine call sites, hydration discipline, Batcher, p99 budgets, cache-key correctness, and BlobRef-safety. This PR:

  • Tags BlobRef-safe with (ADR-0007).
  • Adds Plan + budget aware — new code consumes QueryPlan + RequestContext.budget; nodes carry estimated_cost; emits StageEvent for the online cost estimator. (ADR-0008)
  • Adds Index-hint + dtype honored — new VectorIndexBackend code accepts IndexHint at initialize() and respects Embedding.dtype on read and write. (ADR-0009)
  • Adds Two-stage rerank shape — new Reranker implementations (Step 2.7+) ship the three-method cascade, not a single rerank(). (ADR-0006)
  • Cross-links all 5 ADRs (not just 0006 / 0008 / 0009) from the "Related" section.

TRACKER sync

  • Step 1.1e: 🚧 → ✅, PR #51 recorded.
  • Step 1.1f: ⏳ → 🚧 on this branch.
  • Phase 1 progress: 5 / 16 → 7 / 16; total 18 / 84 → 20 / 84.
  • "Next action" line advanced to Step 1.2 (Connectors framework).
  • PR history table updated with #51.

Documentation

File Change
docs/adr/ADR-0005-policy-engine.md Implementation table (engine, types, filter, noop, writer, coverage linter); status note; performance.md backlink.
docs/adr/ADR-0006-two-stage-rerank.md Implementation-status note; performance.md backlink.
docs/adr/ADR-0007-tiered-storage.md Implementation table (BlobRef, Chunk, Storage); reviewer-rule backlink.
docs/adr/ADR-0008-cost-aware-planner.md Implementation table (Cost, PlanNode, QueryPlan, Budget, StageEvent); request-context backlink.
docs/adr/ADR-0009-vector-index-strategy.md Implementation table (IndexHint, WriteVolume, Embedding.dtype, vector SPI split, pgvector + Qdrant backends).
docs/architecture/performance.md 4 reviewer-checklist items added; ADR-0005 / 0007 added to "Related".
packages/core/src/rag_core/spi/reranker.py Module docstring backlinks ADR-0006.
packages/core/src/rag_core/spi/storage.py Module docstring backlinks ADR-0007.
TRACKER.md 1.1e ✅, 1.1f 🚧, milestone counts, "Next action", PR history.

Test plan

  • uv run ruff check passes on touched Python files.
  • uv run mypy --strict passes on touched Python files.
  • Doc-only PR otherwise — no runtime / SPI shape changes; existing 1.1a–1.1e conformance suites continue to apply unchanged.
  • CI: lint + mypy --strict + pytest + RAG001 logging check + log-schema gates green on Ubuntu / macOS / Windows.

🤖 Generated with Claude Code

…cklist (Step 1.1f)

Closes the Phase-1 refactor window (Steps 1.1a–1.1f) by promoting the five
architecture ADRs drafted in #41 from "Accepted (draft)" to "Accepted with
implementation-path backlinks", and by extending the reviewer checklist in
docs/architecture/performance.md so every ADR has a checklist item reviewers
can apply at PR time.

- ADR-0005 (PolicyEngine PDP): linked to packages/policy/ implementation
  files (engine, types, filter, noop, writer) and the policy coverage linter.
- ADR-0006 (two-stage rerank): noted that the current single-method SPI is a
  placeholder; the two-stage shape lands in Step 2.7.
- ADR-0007 (BlobRef tiered storage): linked to BlobRef + Chunk.text in
  rag_core.types and the Storage SPI resolution surface.
- ADR-0008 (cost-aware planner): linked to Cost / PlanNode / QueryPlan /
  Budget / StageEvent in rag_core.types; planner itself in 2.6, fallback
  rules in 4.2.
- ADR-0009 (vector index strategy + quantization): linked to IndexHint /
  WriteVolume / Embedding.dtype and the two backend implementations
  (pgvector, qdrant) that already consume the hint.

Reviewer checklist extensions in docs/architecture/performance.md:
- BlobRef-safe (ADR-0007) — explicit ADR tag added
- Plan + budget aware (ADR-0008) — new
- Index-hint + dtype honored (ADR-0009) — new
- Two-stage rerank shape (ADR-0006) — new for Step 2.7+

Module-level ADR backlinks added to the two SPI files that were missing
them: rag_core.spi.reranker (ADR-0006) and rag_core.spi.storage (ADR-0007).
All other relevant modules (rag_core.types, rag_core.spi.vector_store,
rag_core.spi.{embedding,retrieval,answer}_cache, rag_policy.*, and the
vector backends) already carry ADR references from earlier steps.

TRACKER.md sync: marks Step 1.1e ✅ with PR #51, marks Step 1.1f 🚧 on the
current branch, advances Phase 1 progress to 7 / 16, and updates the
"Next action" line to Step 1.2 (Connectors framework) now that the
refactor window is closed.

Documentation:
- docs/adr/ADR-0005-policy-engine.md — implementation table
- docs/adr/ADR-0006-two-stage-rerank.md — implementation-status note
- docs/adr/ADR-0007-tiered-storage.md — implementation table
- docs/adr/ADR-0008-cost-aware-planner.md — implementation table
- docs/adr/ADR-0009-vector-index-strategy.md — implementation table
- docs/architecture/performance.md — 4 reviewer-checklist items added,
  all 5 ADRs cross-linked

No behaviour changes; ruff + mypy --strict pass on touched files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@officialCodeWork
officialCodeWork merged commit d056f66 into main May 24, 2026
11 checks passed
officialCodeWork added a commit that referenced this pull request May 24, 2026
chore(tracker): sync Step 1.1f → ✅ and log PR #52
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