Skip to content

[ADR-004] HandlerDef Pack Contract #321

@ohdearquant

Description

@ohdearquant

Summary

Replace VerbDef-only metadata with HandlerDef/VerbCategory/schema-plan/validation/presentation metadata foundations across khive-types, runtime pack APIs, DB schema-plan hooks, and public exports.

Source ADRs

  • F022 ADR-004 (MAJ): PackRuntime exposes note_kinds() -> &'static [&'static str] (from audit-foundation/e2/ADR-004.md)
  • F090 ADR-017 (MAJ): Pack metadata uses VerbDef { name, description } (from audit-platform/e1/ADR-017.md)
  • F091 ADR-017 (MAJ): Pack declares const VERBS: &'static [VerbDef]. (from audit-platform/e1/ADR-017.md)
  • F092 ADR-017 (MAJ): PackRuntime exposes fn verbs(&self) -> &'static [VerbDef] (from audit-platform/e1/ADR-017.md)
  • F116 ADR-023 (MAJ): The stable metadata type is still VerbDef { name, description }. (from audit-platform/e1/ADR-023.md)
  • F117 ADR-023 (MAJ): Pack still declares const VERBS. (from audit-platform/e1/ADR-023.md)
  • F135 ADR-025 (MAJ): Handler metadata is VerbDef with only name and description (from audit-platform/e1/ADR-025.md)
  • F136 ADR-025 (MAJ): khive-types exports VerbDef, not HandlerDef or VerbCategory. (from audit-platform/e1/ADR-025.md)
  • F158 ADR-028 (MAJ): The Pack trait exposes static vocabulary, verbs, edge rules, and requirements only; it has no schema_plan() method. (from audit-platform/e3/ADR-028.md)
  • F159 ADR-028 (MAJ): StorageBackend::apply_schema just applies a ServiceSchemaPlan (from audit-platform/e3/ADR-028.md)
  • F191 ADR-034 (MAJ): The Rust runtime exports no validation module, PackRuntime only exposes name/kinds/verbs/edge rules/requires/kind hook/dispatch, Pack has no VALIDATION_RULES, and KgPack only... (from audit-rest/r3/ADR-034.md)
  • F239 ADR-045 (MAJ): Verb metadata is VerbDef { name, description } only. (from audit-rest/r5/ADR-045.md)

Files affected

  • crates/khive-runtime/src/pack.rs (2677 sampled LOC)
  • crates/khive-types/src/pack.rs (121 sampled LOC)
  • crates/khive-types/src/lib.rs (41 sampled LOC)
  • crates/khive-db/src/backend.rs (627 sampled LOC)
  • crates/khive-runtime/src/lib.rs (55 sampled LOC)
  • crates/khive-pack-kg/src/lib.rs (163 sampled LOC)
  • crates/khive-runtime/src/validation.rs (new/planned path)

Acceptance criteria

  • All source findings listed above are addressed exactly once in this cluster.
  • Public types, handlers, schema, and docs touched by the affected files agree on the ADR contract.
  • Regression tests cover happy path and edge cases for the changed public APIs or schema behavior.
  • cargo test -p khive-types -p khive-runtime -p khive-db -p khive-pack-kg passes.
  • cargo clippy --workspace -- -D warnings passes.
  • make ci passes.

Dependencies

  • Depends on: #[ADR-001] Entity Kind and Type Contract
  • Depends on: #[ADR-002] Edge Ontology, Lifecycle, and Bulk Link Semantics
  • Depends on: #[ADR-004] Note Kind, Storage, and Curation Operations
  • Depends on: #[ADR-005] Storage Capabilities, Sparse Store, and Vector Contract
  • Depends on: #[ADR-004] Event Observable and Provenance Model
  • Depends on: #[ADR-007] Namespace Token and Runtime API Migration
  • Depends on: #[ADR-003] Runtime Backend and Substrate Coordinator
  • Blocks: #[ADR-017] Pack Verb Registry, Wire Names, and Introspection
  • Blocks: #[ADR-016] Request Execution Modes and Presentation Envelope
  • Blocks: #[ADR-023] Dynamic Pack Loading, Template, and Pack Binary Inclusion
  • Blocks: #[ADR-004] GTD Pack Schema Plan and Lifecycle Audit
  • Blocks: #[ADR-043] Embedding Model Registry and Vector Engine Migration
  • Blocks: #[ADR-025] Event-Sourced Proposals

LOC estimate

~350 lines added/110 removed; 6 existing affected file(s) sampled at 3684 current LOC via wc -l, plus 1 new/planned path(s).

Risk notes

  • Same-file dependencies must merge first; dependency list includes the exact overlapping paths.
  • 1 affected path(s) are new/planned and were not present in rg --files --hidden; create them in the owning PR rather than in independent parallel work.

Auto-generated by ADR alignment triage

Metadata

Metadata

Assignees

No one assigned

    Labels

    adr-alignmentADR v1 series alignment workadvancedAdvanced layer (ADR-031..046)foundationFoundation layer (ADR-001..015)platformPlatform layer (ADR-016..030)

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions