Extract the index --pack writer from main into the packed module #5

Closed
opened 2026-06-01 01:05:44 +02:00 by Brummel · 0 comments
Owner

Architect drift finding at the close of the packed-versioned-index-bundle cycle (commits 43b1b6f, 79de4e1).

The alpha-id index --pack writer logic — completeness check, row collection in corpus order, header construction (dim/corpus_name/corpus_sha256/n_rows derivation), write — lives inline in main (src/bin/alpha_id.rs, the Index/pack branch), not in src/packed.rs. The spec's component table implies packing is a packed-module concern, and the inline header-construction code currently sits outside library test reach (covered only end-to-end via the pack CLI tests, not unit-tested).

Proposed direction (not committal): extract a packed::pack_from_store(...) -> Result<PackedHeader, AppError> (or similar) that the binary calls, so the header derivation is unit-testable without spawning the binary.

context: low-priority tidy debt; behaviour is correct and CLI-test-covered, this is about testability + module placement.
depends on: nothing (self-contained, behaviour-preserving refactor).

Architect drift finding at the close of the packed-versioned-index-bundle cycle (commits 43b1b6f, 79de4e1). The `alpha-id index --pack` writer logic — completeness check, row collection in corpus order, header construction (dim/corpus_name/corpus_sha256/n_rows derivation), write — lives inline in `main` (src/bin/alpha_id.rs, the Index/pack branch), not in `src/packed.rs`. The spec's component table implies packing is a `packed`-module concern, and the inline header-construction code currently sits outside library test reach (covered only end-to-end via the pack CLI tests, not unit-tested). Proposed direction (not committal): extract a `packed::pack_from_store(...) -> Result<PackedHeader, AppError>` (or similar) that the binary calls, so the header derivation is unit-testable without spawning the binary. context: low-priority tidy debt; behaviour is correct and CLI-test-covered, this is about testability + module placement. depends on: nothing (self-contained, behaviour-preserving refactor).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Brummel/alpha-id#5