fix(manifest): preserve remote link scope#905
Open
xylophonez wants to merge 2 commits into
Open
Conversation
| {link, ID, LinkOpts} = linkify(#{ <<"id">> => ID }, #{ <<"store">> => Store }), | ||
| ?assertEqual(Store, maps:get(<<"store">>, LinkOpts)), | ||
| ?assertEqual([local, remote], hb_opts:get(scope, undefined, LinkOpts)), | ||
| ?assertNot(maps:is_key(store, LinkOpts)), |
Collaborator
There was a problem hiding this comment.
Isn't this the opposite of what we want? Implies a deeper problem: We end up with both the atom version and the binary version, possibly with differing values 🤦♂️
| ?assertNot(maps:is_key(store, LinkOpts)), | ||
| ?assertNot(maps:is_key(scope, LinkOpts)). | ||
|
|
||
| manifest_child_link_remote_fallback_test_parallel() -> |
Collaborator
There was a problem hiding this comment.
No need for the specific manifest test if we have the pinpoint test above, I think.
Author
There was a problem hiding this comment.
Got it, removed in latest commit
Keep the manifest regression test scoped to preserving the configured binary store and remote scope. Drop the atom-key absence assertions and redundant manifest fallback test called out in review.
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.
Fix manifest child link resolution so manifest paths can fall back to remote stores when the manifest is cached locally but the child data item is not.
Problem
Manifest path resolution can fail even when both of these are true:
The failure occurs when resolving a manifest path such as:
The manifest itself is fetched, parsed, and linkified, but the generated child link is resolved as local-only. If the child data item is not already in the local cache, resolution fails instead of falling back to the remote gateway store.
Root Cause
dev_manifest:linkify/2was constructing link options with atom keys:The surrounding HyperBEAM option maps use binary keys such as
<<"store">>and<<"scope">>.That meant:
maps:with([store], Opts)dropped the configured<<"store">>valuescope => [local, remote]was not read by callers expecting canonical/binary option keyshb_cachefell back to local-only scope for the linked childThe fix preserves the existing store and sets the scope with the same binary-key convention used elsewhere:
URL Proof
Observed:
The linked child item itself is also available on Arweave:
Observed:
Clean upstream edge fails for that same manifest child path:
Observed:
The clean-edge node log shows the manifest was fetched from Arweave, then child link resolution failed:
The fixed branch succeeds under the same store shape:
Observed:
The fixed node log shows it fetching the linked child item from Arweave and returning it: