Artifact 904f849d2f472156b0699839d663a59e85424cb5b0c9d9fff7b213965ac960b2:
- File
src/git_import.zig
— part of check-in
[51afeef206]
at
2026-08-08 17:40:22
on branch sub-manifest
— import-git: name artifacts SHA3-256, not SHA-1
The algorithm was a hardcoded .sha1 that mis-named every import from a SHA3-256 Fossil, in both output modes. Sub-manifest mode reproduces nothing by construction, so it has nothing to inherit; flat mode is meant to inherit its source's algorithm, but that is unimplemented and sqlite shows it cannot be one choice anyway -- its history spans the promotion ratchet, so a single manifest there names both 40- and 64-hex blobs. SHA3-256 is the correct answer for a source whose algorithm cannot be derived, and the only defensible one for new addresses after SHATTERED.
Now one constant, with the store's default policy and the submanifest k-analysis derived from it rather than guessed. Four name-verification sites in the storage layer used the same constant and rejected every SHA3 name; they now use artifact.verify, which reads the algorithm off the name's own width and cannot go stale.
Two test repairs the change exposed: the ISSUE #24 e2e compared parent and child check-in names that both alias one readCheckoutState buffer, passing on the length difference alone, and that fixture no longer produces a mixed-width store -- noted inline, it needs its own fixture.
Hashing is ~2.9x slower than SHA-1 on Apple Silicon, which lengthens hash-bound work. (user: dmestas, size: 2949) [annotate] [blame] [check-ins using]
const implementation = @import("git_import_impl.zig"); pub const TreeStore = implementation.TreeStore; pub const TreeFormat = implementation.TreeFormat; pub const RootView = implementation.RootView; pub const TreeCommand = implementation.TreeCommand; pub const BuildResult = implementation.BuildResult; pub const TreeError = implementation.TreeError; pub const LoadedBytes = implementation.LoadedBytes; pub const TreeStoreError = implementation.TreeStoreError; pub const Attribution = implementation.Attribution; pub const UserOptions = implementation.UserOptions; pub const SubmanifestChoice = implementation.SubmanifestChoice; pub const WorkCounters = implementation.WorkCounters; pub const ResolvedOptions = implementation.ResolvedOptions; pub const import_hash_algo = implementation.import_hash_algo; pub const resolveOptions = implementation.resolveOptions; pub const analyzeSubmanifestK = implementation.analyzeSubmanifestK; pub const modeFromGit = implementation.modeFromGit; pub const CommitMarkState = implementation.CommitMarkState; pub const FinalizeOptions = implementation.FinalizeOptions; pub const FinalizedRef = implementation.FinalizedRef; pub const FinalizedRefs = implementation.FinalizedRefs; pub const RefCollision = implementation.RefCollision; pub const BranchHead = implementation.BranchHead; pub const BranchLabel = implementation.BranchLabel; pub const labelBranches = implementation.labelBranches; pub const MirrorRetainReason = implementation.MirrorRetainReason; pub const MirrorCensus = implementation.MirrorCensus; pub const mirror_candidate_names = implementation.mirror_candidate_names; pub const mirror_sterilizer = implementation.mirror_sterilizer; pub const MirrorDecisionKind = implementation.MirrorDecisionKind; pub const Digest = implementation.Digest; pub const tree_digest_domain = implementation.tree_digest_domain; pub const provenance_digest_domain = implementation.provenance_digest_domain; pub const formatDigest = implementation.formatDigest; pub const LedgerCandidate = implementation.LedgerCandidate; pub const LedgerCommit = implementation.LedgerCommit; pub const LedgerArtifact = implementation.LedgerArtifact; pub const VerificationLedger = implementation.VerificationLedger; pub const WitnessIdentity = implementation.WitnessIdentity; pub const WitnessCandidate = implementation.WitnessCandidate; pub const WitnessCommit = implementation.WitnessCommit; pub const WitnessRef = implementation.WitnessRef; pub const ImportWitness = implementation.ImportWitness; pub const TreeDigestBuilder = implementation.TreeDigestBuilder; pub const ProvenanceCandidate = implementation.ProvenanceCandidate; pub const ProvenanceInputs = implementation.ProvenanceInputs; pub const provenanceDigestOf = implementation.provenanceDigestOf; /// Production imports always use the incremental tree writer. pub const Importer = implementation.Importer(implementation.IncrementalTreePolicy, implementation.NoopObserver);