Skip to content

feat(retrieval): add bounded ranked-prefix materialization - #2015

Draft
ohdearquant wants to merge 1 commit into
codex/adr-160-phase-4-attachment-cutoverfrom
codex/adr-160-phase-5-ranked-prefix
Draft

feat(retrieval): add bounded ranked-prefix materialization#2015
ohdearquant wants to merge 1 commit into
codex/adr-160-phase-4-attachment-cutoverfrom
codex/adr-160-phase-5-ranked-prefix

Conversation

@ohdearquant

@ohdearquant ohdearquant commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Stack and governance gate

What changed

  • Add a root-exported, runtime-independent khive-retrieval ranked-prefix materialization controller with bounded inputs, batches, drop taxonomy, counters, and diagnostics.
  • Preflight limits, taxonomy, uniqueness, and strict ordering before any callback or loader I/O.
  • Validate each returned loader batch structurally before classification, preserve caller errors, stop classification at K, and validate the remaining tail without loader/classifier I/O.
  • Replace moodboard's pack-local namespace merge with khive_fusion::union_fusion and migrate candidate materialization to the shared controller with loader_batch_size = 1.
  • Preserve moodboard's existing score/self/entity/scope/kind/subtype/content-ref/blob-existence precedence, one-shot overfetch, compact ranks, and honest underfill.
  • Document the opaque caller-owned score boundary and publish-order dependency.

Regression guards

  • Controller tests pin exact ceilings, invalid taxonomies, duplicate/non-monotonic input, malformed loader rows and deterministic error precedence, non-Clone scores, zero-output behavior, K/tail behavior, and bounded diagnostics.
  • Moodboard tests pin canonical union ties and global truncation, self-hit zero I/O, post-K validation-only behavior, earlier loader-error precedence, typed drop accounting, honest underfill, soft-deleted entities, and malformed compatibility-projected refs.
  • TDD RED was an intentional compile failure on the missing shared/moodboard seams; GREEN is the implementation in this PR.

Validation

  • RUSTC_WRAPPER= cargo check --workspace -j4
  • RUSTC_WRAPPER= cargo clippy --workspace --all-targets -- -D warnings
  • RUSTC_WRAPPER= cargo test --workspace -j4
  • cargo fmt --all -- --check
  • deno fmt --check on all six modified Markdown files
  • bash -n scripts/publish.sh
  • git diff --check

Independent contract, controller, resource, and final-diff reviews found no implementation Blocker/High/Medium issue. The remaining blocker is intentionally the spec/rollout gate above.

No Phase 6+ work is included.

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