Repository navigation
feat: history index v2 — per-path version lists for Blame and History - #168
Merged
Merged
Conversation
A new tagged section (tag 1) after v1's paths: per path, its newest 256 first-parent changes (commit, mode, 6-byte blob oid prefix) and whether the list reaches the commit that added it, plus the commits' author names. v1 readers skip it. The manifest's offsetIndexParts records the format (2), so a v1 index neither covers a tip nor serves as a delta base: the next push or dg repo reindex publishes a full v2 index over it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Each delta is cumulative, so every push pays for all changes since the full index again. The old rule (delta under half the base) was cheap at v1's 67 KB; at v2's 753 KB it let one-commit pushes climb to ~0.14 DASH each. Rent or buy: publish deltas while the v2 deltas members already published over the base plus this one stay within the base's size, then a full index. On dashpay/dash that is about every 80 one-commit pushes, ~0.009 DASH a push on average. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
pathVersions answers from the v2 index's list when one covers the start commit (checked against the path's entry there), resumes inside it page by page, walks on past a cut list, and stops a walk at an index a few pushes behind. Blob oid prefixes resolve through the locator, so Blame reads one blob per version, four ahead, and no commit or tree. The History page moves onto pathVersions and says when the index listed it. The decoder reads the versions section and overlays deltas by the shared merge rule. Offline replay on dashpay/dash 3ba0805c: Blame of src/clientversion.h 357 chunk queries to 16, History of src/validation.cpp 22 to 3, same answers. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
M1: Blame drops each version's text once compared and reads nothing ahead once every line has its commit. M2: the writer holds an index to the readers' row and inflate bounds, halving the per-path limit until it fits (still v2); the web decodes the lists section lazily, so the column never parses it and a malformed section costs only the lists. L1/L2: a list is believed only where the path's entry at the page's start matches it, resumed pages included; a list naming an unreadable commit is dropped for the walk; Blame re-reads a version from the trees when the index's blob is not the file's text. L3: a delta supersedes a v1 index of its tip and the web ranks v2 first. L4: saturating arithmetic on member sizes. L5: the Rust overlay takes the delta's limit. L6: TS decoder refuses what forge-core refuses. L7: offsetIndexParts docs. L8: a due full index carries the delta as a fallback the cost guard can take instead. Blame takes an index list whole (listLimit), keeping 16 queries on dash. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Warning Review limit reachedNext included review available in 47 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (30)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commits-content: master's URL paging, author-date labels and footer count (L-27, L-31, L-35) kept, on pathVersions with entry.author and the history-index marker. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Sep 29, 2026
Merged
PastaPastaPasta
added a commit
that referenced
this pull request
Sep 29, 2026
…x format lives in its header #168 recorded a kind-3 index's format in packManifest.offsetIndexParts, which RC1 removes, so its writers would be refused on bonsia. The format now lives only in the artifact header's version byte: nothing writes offsetIndexParts, HistoryEntry/Artifact lose their format field, the planner treats every kind-3 manifest as an index with version lists (every RC1 writer writes version 2; no v1 index can exist on a network that started empty) and dg repo reindex drops its v1-upgrade note. The decoder refuses a header version other than 1 or 2 with an update-the-client error. history-index.md says so. The offline round trip now publishes main's history index as a push does, validates its manifest against RC1 and reads it back. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
PastaPastaPasta
added a commit
that referenced
this pull request
Sep 29, 2026
RC1 drops packManifest.offsetIndexParts, where #168 carried the kind-3 format: PackManifest.historyFormat is gone, and history-source ranks a full index over a delta with every index read as v2 until the format comes from the artifact header (PR-5a's history-index split rewrites that reader). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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.
What
History index v2: the push-time history index (packManifest kind 3, #146) now also lists, for every path of the tip, its newest 256 first-parent versions. Each version has the commit (with author, time and subject) and a 6-byte blob oid prefix, and each list says whether it reaches the commit that added the path. Blame and a path's History read those lists through
pathVersionsinstead of walking history in the browser. They fall back to the walk when the index is missing, behind, stale or fails to load.Design:
docs/design/history-index.md("v2: per-path version lists"). The original proposal isdocs/design/last-change-index-v2.md, now marked implemented, with where the build differs from it.Numbers (offline, dashpay/dash
develop@ 3ba0805c)moutai moved to beta.7 and can no longer be read with the forge contracts, so the "after" measurement is an offline replay.
forge-web/lib/view/history-replay.test.tsruns the realBrowseReader,blameFileandpathVersionsover the pack a push of that tip builds, its locator and its v2 index (all exported by forge-core'sexport_a_replay_fixture). It reads chunk documents as the browser does: 14,700-byte chunks, 100 per query, a 32 MiB chunk cache, 280 ms per query. The answers with and without the index must be equal, and they are.src/clientversion.h(135 versions, 10 commits)src/validation.cpp, first page (40)The live baseline on moutai was 121 s and 427 requests; the showcase mirror holds many packs, not one. Follow-up: measure live on bonsia once the dash mirror is re-imported, with
dg repo reindexas its owner, thene2e/history-index.spec.tshi-2 and hi-3.Sizes and fees (dash, quoted upper bounds,
docs/guides/costs.md)Average per push on Platform: about 0.009 DASH, over a cycle of ~80 one-commit pushes per full index (see below).
Format and rules
version= 2. v1 readers already skip unknown tags, so there is no flag day. The section has, per path row:(count << 1 | complete), then(commit, mode, oid prefix). It also holds an author table.clientversion.h, which has 136 versions. Blame compares at most 201 versions. Whole oids would make the index 1.3 MB (91 chunks). The web resolves a prefix through the locator it already holds, uses it only when it names exactly one object, and hash-checks the object it then reads.overlay_versions) and forge-web (overlayVersions). Both are tested on the same git-built fixtures (forge-contracts/fixtures/history-index-v2-{base,delta,tip}.hex), where base overlaid with delta equals the full index of the tip.offsetIndexParts(otherwise unused, since the artifact locates itself) records the format: 2 for v2, 0 from v1 writers. A v1 index neither covers a tip nor serves as a delta base, so the next push, ordg repo reindex, publishes a full v2 over it (the backfill). Reindex says "replaces the tip's v1 index". A delta also supersedes a v1 index of its own tip, and the web ranks a tip's indexes v2 first. This will be reworked at the wipe/beta7: the contract rework (R-09,pack_complete) makespackHashan identifier and dropsoffsetIndexPartsandmanifestPart. The marker is read in one place on each side (forge-coreHistoryEntry::format, forge-webPackManifest.historyFormat), so it moves with whatever replaces the field.pathVersionsand says "from the history index".Tests
git log --first-parent -- <path>across merges, renames, deletes, delete and re-add, file to directory, mode changes and gitlinks. Also: the limit andcomplete; delta overlay equals a full index; mixed v1/v2; the v2 decoder fixture; hostile sections (limit, oidLen, author and commit indexes, an over-long list, trailing bytes, a duplicate section, row cap, inflate cap); the planner's v1 handling and the rent-or-buy rule. The v1 fixture is unchanged.pathVersions(served with only the start commit and root tree read, paging and resume equal to the walk for files and directories, a cut list, stale, failing and v1 indexes, a behind index, the whole-repo log never asking); blame over the index equals the walk and reads no commit past the tip.Found on the way
dash's v1 index counts (33,553 / 7,979) came from a shallow clone. The real counts are 34,001 / 8,363. The shallow check now refuses such a clone, and the next index published for the mirror corrects them.
Tradeoff to note
The home's commit column loads the same artifact, so a cold home of dash downloads ~750 KB instead of 67 KB. It is still one chunk query, and IndexedDB caches it. The web decodes the lists section only when Blame or History first reads it, so the column doesn't parse it. Splitting the lists into their own kind-4 artifact would avoid the download too, if that matters.
Review
code-review-validator: M1 (Blame memory), M2 (writer bounds, plus lazy decoding) and L1–L8 are all addressed in 1d05774. code-simplifier's edits are behaviour-neutral, and the fixtures are byte-identical.
🤖 Generated with Claude Code