fix: never fail the start page over a query answer that came back short - #694
Open
ashleycaselli wants to merge 1 commit into
Open
fix: never fail the start page over a query answer that came back short#694ashleycaselli wants to merge 1 commit into
ashleycaselli wants to merge 1 commit into
Conversation
The home page reported "Configured home resource ... could not be found" whenever the resource repository had latched a snapshot and that snapshot had no entry for the configured id. Latching, though, took any answer at face value, an answer with no rows at all included: the query API is a set of instances with independently built indexes, so a short or empty result set is a routine kind of failure and not news that the resources are gone. One such answer latched an empty snapshot, ran removeStale() over it -- wiping every MaintainedResource instance -- and turned a passing API hiccup into the page declaring its own configuration broken, with the persisted cache that could have covered it overwritten as well. Three things now stand between such an answer and the page: - An answer carrying no resources is not latched while the current snapshot has some, so what was fetched before (or restored from the persistent cache after a restart) goes on being served, instances and all. - Every resource a snapshot ever held is kept by id, and findLastKnownById() falls back to it. findById() keeps its strict answer for the many callers that use it to ask whether an IRI is a maintained resource at all. - isAbsent() replaces isReady() as what the home page asks. It says a snapshot is latched, it holds resources, and neither it nor any earlier answer carried this id -- so the notice is reserved for a genuine misconfiguration, and everything else keeps the last known resource on screen or goes on waiting for one. The one case that now waits rather than explaining itself is an instance whose query API reports no maintained resources at all, which is indistinguishable from an answer that failed to carry them. Four tests come with it, driving the repository through the answers it has to survive. Suite: 1263 tests, green. Closes #623. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TtcVArNfYKiiTVowsdkF44
ashleycaselli
force-pushed
the
fix/623-home-page-falls-back-to-cache
branch
from
September 8, 2026 14:19
71ae55e to
a32ae70
Compare
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.
Closes #623.
The home page reported
Configured home resource ... could not be foundwhenever the resource repository had latched a snapshot and that snapshot had no entry for the configured id. Latching, though, took any answer at face value — an answer with no rows at all included.That is the wrong reading of an empty answer. The query API is a set of instances with independently built indexes, so a short or empty result set is a routine kind of failure and not news that the resources are gone. One such answer latched an empty snapshot, ran
removeStale()over it (wiping everyMaintainedResourceinstance), and turned a passing API hiccup into the page declaring its own configuration broken — with the persisted cache that could have covered it overwritten along the way.What now stands between such an answer and the page
build()keeps the current snapshot when a new answer carries no resources at all and the current one has some, so what was fetched before — or restored from the persistent cache after a restart — goes on being served, instances and all.findLastKnownById()falls back to it.findById()keeps its strict answer for the many callers that use it to ask whether an IRI is a maintained resource.isAbsent()replacesisReady()as what the home page asks: a snapshot is latched, it holds resources, and neither it nor any earlier answer carried this id.So the notice is reserved for a genuine misconfiguration — the configured IRI is none of the resources this instance knows, and never was. Anything else keeps the last known resource on screen, or goes on waiting for one.
The trade-off
An instance whose query API reports no maintained resources at all now waits on the loading state instead of showing the notice, because that case cannot be told apart from an answer that failed to carry them. That is the trade the issue asks for: the start page should not fail.
Tests
Four new, driving the repository through the answers it has to survive — an answer with nothing in it, an answer short of one resource, an id no answer ever carried, and a repository that knows nothing yet. All stubbed, so none of them goes near the network.
Suite: 1263 tests, green.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TtcVArNfYKiiTVowsdkF44