Draft
Conversation
Return HTTP 501 instead of rendering a directory listing with broken links when the requested CID is an internal HAMT shard node. HAMT path resolution assumes traversal starts at the root shard (hash bit offset 0). Internal shards expect bits at a deeper offset, so LookupByString picks the wrong bucket and every link 404s. The directory listing looks fine because MapIterator walks links sequentially without hash-based navigation, but every click fails. Detection uses zero-I/O hash prefix alignment check on value links, with a one-block fallback for all-sub-shard nodes (large directories like Wikipedia). The fetched block is cached and reused by the subsequent EnumLinksAsync call. Fixes #1126
b16859e to
3fc7635
Compare
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #1127 +/- ##
==========================================
- Coverage 62.56% 62.51% -0.06%
==========================================
Files 261 261
Lines 26216 26263 +47
==========================================
+ Hits 16402 16417 +15
- Misses 8125 8153 +28
- Partials 1689 1693 +4
... and 9 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
Return HTTP 501 instead of rendering a directory listing with broken links when the requested CID is an internal HAMT shard node. This is better than returning partial broken state, and less involved if we had to write custom UI for this.
Complexity
Not a fan, but there seem to be no easy way to detect we are in internal HAMT node.
Detection uses zero-I/O hash prefix alignment check on value links, with a one-block fallback for all-sub-shard nodes (large directories like Wikipedia). The fetched block is cached and reused by the subsequent EnumLinksAsync call, but still,.. not a fan.
Maybe we just.. leave this alone?