Skip to content

feat(fold): add ObjectiveRegistry<T> for dynamic objective dispatch#306

Merged
ohdearquant merged 2 commits into
mainfrom
feat/fold-objective-registry
May 22, 2026
Merged

feat(fold): add ObjectiveRegistry<T> for dynamic objective dispatch#306
ohdearquant merged 2 commits into
mainfrom
feat/fold-objective-registry

Conversation

@ohdearquant
Copy link
Copy Markdown
Owner

Summary

  • Ports ObjectiveRegistry<T> from khive-internal, adapted to OSS Selection.item API
  • Thread-safe registration and lookup of named objective functions for fold composition
  • Adds parking_lot dep to khive-fold
  • 278 LOC, 5 new tests

Split from #297 (staging). Smallest, lowest-risk piece — lands first so khive-retrieval can depend on it.

Test plan

  • cargo check -p khive-fold clean
  • cargo test -p khive-fold — 156 tests pass (151 existing + 5 new registry tests)

🤖 Generated with Claude Code

ohdearquant and others added 2 commits May 22, 2026 12:34
Ports ObjectiveRegistry from khive-internal, adapted to OSS Selection.item
API. Provides thread-safe registration and lookup of named objective
functions for fold composition.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…time

Per ADR-058, ObjectiveRegistry is runtime infrastructure (named lookup,
concurrent mutable state), not fold algebra. Fixes from critic review:

- Single RwLock over combined RegistryInner (fixes TOCTOU in set_default)
- T: Send + Sync bounds on all public types
- Debug impls for RegisteredObjective and ObjectiveRegistry
- Documented score() as raw (no precision weighting per ADR-059)
- Added error path tests (get/get_default/set_default on missing)
- Added concurrent read/write test (validates RwLock)
- Removed parking_lot from khive-fold (foundation stays pure math)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ohdearquant ohdearquant merged commit 4062ecd into main May 22, 2026
1 of 3 checks passed
ohdearquant added a commit that referenced this pull request May 22, 2026
PR #306 relocated ObjectiveRegistry from khive-fold to khive-runtime.
This branch predated that change — sync both crates to main.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ohdearquant added a commit that referenced this pull request May 22, 2026
* feat: port khive-retrieval — hybrid retrieval composer

Ports the retrieval orchestration layer from khive-internal. Composes
khive-hnsw (vector), khive-bm25 (text), and khive-fusion into a unified
hybrid search pipeline with graph traversal, persistence adapters,
cross-encoder reranking support, and evaluation harness.

Includes prerequisite crates (hnsw, bm25, fusion) and fold objective
registry for compilability. Gates on their individual PRs for merge.

~7.1K LOC, tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(retrieval): add debug_assert for weighted fusion source count

Weighted fusion is constrained to exactly 2 sources (vector + keyword)
by the HybridSearcher trait hierarchy. Add assertion to catch misuse.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* style: cargo fmt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: sync khive-fold and khive-runtime with main

PR #306 relocated ObjectiveRegistry from khive-fold to khive-runtime.
This branch predated that change — sync both crates to main.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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