Repository navigation
fix(hashdb, cache)!: harden the public API before the first release - #12
Merged
Merged
Conversation
Crauzer
force-pushed
the
pre-release-api-hardening
branch
from
October 2, 2026 12:30
ffac8dc to
29f1c0c
Compare
Crauzer
enabled auto-merge (squash)
October 2, 2026 12:31
Crauzer
disabled auto-merge
October 2, 2026 12:32
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-release hardening of
ltk_hashdbandltk_mimir_cache. It is rebased in substance onto currentmain(merged, not force-pushed): the changesmainalready made since this branch started (key config onTable, runtime layered checks,ExtendedHashDbremoval, streaming downloads) are kept as they are. This PR adds only what was still missing. Neither crate is on crates.io yet, so the breaking changes cost nothing now. Item IDs refer to the Rust API Guidelines (C-) and the Microsoft Rust Guidelines (M-).Safety and robustness
openaccepted that, and onegetthen allocated the claimed size.opennow rejects frames aboveMAX_FRAME_SIZE(1 MiB), and the writer refuses larger frame sizes. Regression test:oversized_frame_claim_rejected_on_open.HashStore::open/open_sharedandcommitnow reject a file whose key config is notTable::key_config(), for example a bin table filed undergame. Previously onlyopen_layerednoticed, and only relative to the first base (C-VALIDATE).commitandgctake&UpdateLock. Previouslygccould delete another process's in-progress.download.tmp.[A-Za-z0-9._-]and not start with.. This blocks NTFS alternate data streams (x:y) and control characters.path_forvalidates the manifest's filename before joining it.max_size,HttpFetchError::TooLarge), checked against Content-Length and while streaming;with_agent/with_clientfor custom clients;ReqwestFetch::newreturns an error instead of falling back to a client that can panic;blocking.open/open_sharedretry once ifgcdeleted the file between reading the manifest and opening it.BuildError::HashKindTooWide: a 64-bit hash kind in a u32 table is rejected by the writer and on open.try_get/get_batch.HashDb::openstays a safe mmap with its documented contract, asmainhas it. M-UNSOUND would prefer anunsafeopener; I keptmain's decision.Semver and future-proofing
#[non_exhaustive]on:HashKind,Compression,ArenaOrder,UpdateOutcome,TableStatusandHttpFetchError;BuildStats,KeyConfigMismatch,UniverseMismatch,Manifest,Source,TableEntry,CommitItem,GcReport,PlannedTable,TableDiff,CheckReport,UnsupportedTableandUpdateReport(C-STRUCT-PRIVATE).Sourceis built fromDefault.zeekstd::Erroris wrapped in an opaqueCompressionError(M-DONT-LEAK-TYPES, C-STABLE).ltk_mimir_cachere-exportsltk_hashdb. M-FOREIGN-REEXPORTS discourages re-exports but exempts crates split for technical reasons, which covers this pair.Seekbound onHashDbWriter::build(C-GENERIC).Manifest::read/write_atomictakeimpl AsRef<Path>(M-IMPL-ASREF).Docs and packaging
missing_docsandmissing_debug_implementations(C-DEBUG, M-PUBLIC-DEBUG, M-CANONICAL-DOCS).HashDbWriter,UreqFetchandReqwestFetchnow implementDebug.rust-version = "1.89"(needed forFile::try_lock, checked withcargo +1.89 check), keywords and categories (C-METADATA).ltk_hashdb, and a rewritten cache README. Both compile as doctests and use absolute links.Verification
cargo fmt --check.cargo clippy --all-targets -D warnings, with default features and with all features.cargo test --workspace --all-features: 207 passed, 0 failed.RUSTDOCFLAGS=-D warnings cargo doc.cargo package -p ltk_hashdb.This work was done with the help of an LLM.
🤖 Generated with Claude Code