Require explicit api_root for an index API#478
Draft
consideRatio wants to merge 1 commit into
Draft
Conversation
Stop defaulting `api_root` to the discovery root. An index now exposes an API only when its discovery document advertises `api_root` explicitly; absent that, the index is read-only regardless of whether its discovery root is a plain URL or a URL template. This makes "the index has an API" mean exactly "the discovery document advertises api_root", removing the ambiguity where a plain-URL index looked like it had an API surface. Reads are unaffected (they use index_root, which still defaults to the discovery root). Publishing to an index that advertises no api_root now fails early with a clear "does not advertise a publish endpoint" message instead of composing a request against the discovery root. BREAKING CHANGE: a plain-URL index that previously accepted uploads at the discovery root must now advertise `api_root` in sysand-index-config.json. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EfyrkJkeo3mRngVoppJjUN Signed-off-by: Erik Sundell <erik.sundell+2025@sensmetry.com>
consideRatio
force-pushed
the
feat/require-api-root
branch
from
July 24, 2026 16:43
53e62f1 to
f9ef3ae
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.
Summary
Stop defaulting
api_rootto the discovery root. An index now exposes an API only when its discovery document (sysand-index-config.json) advertisesapi_rootexplicitly. Absent that, the index is read-only, regardless of whether its discovery root is a plain URL or a URL template.This makes the invariant clean and unambiguous:
Previously a plain-URL index implicitly gained an
api_rootequal to its discovery root, so it looked like it had an API surface even when it was a static-file mirror. That ambiguity is exactly what makes it hard, elsewhere in the client, to tell "I failed to reach the API" apart from "there is no API". Removing the implicit default resolves it at the source.Why now
This is the decoupled prerequisite for the credential-storage work (#453 / #437): login validation only wants to probe an API surface when one genuinely exists. With this landed, "advertises
api_root" becomes the single reliable signal for "has an API", and the credential-storage branch can rely on it.Behavior changes
index_root, which still defaults to the discovery root.api_rootnow fails early withdoes not advertise a publish endpointinstead of composing an upload request against the discovery root. (This message already existed for templated indexes; it is now the general case.)--index: now yields the same "no publish endpoint" refusal (404 discovery → noapi_root) rather than reachingapi_rootshape validation. Shape validation still guards an advertisedapi_rootthat points at the upload endpoint, and keeps its unit coverage.BREAKING CHANGE: a plain-URL index that previously accepted uploads at the discovery root must now advertise
api_rootinsysand-index-config.json.Spec
design/index-protocol.mdanddesign/index-api-protocol.mdupdated:api_roothas no default; absence means no API / read-only.Tests
discovery_absent_config_yields_no_api_root,discovery_config_without_api_root_yields_no_api_rootlock the new contract (404 config and{}config both leaveapi_rootunset).publish_rejects_upload_endpoint_index_urlto assert the new bail path.sysand-core --all-featureslib suite (352) and the entiresysandCLI integration suite pass; clippy clean across core + cli all-features.🤖 Generated with Claude Code