Repository navigation
A code read can name a branch as repo@branch - #1977
Conversation
A code call's `namespace` can be `<repository or namespace>@<branch>` on HTTP, MCP and the SDKs alike. The name resolves in the shared admission sequence, before validation and the gate, to the namespace that indexes that branch, and the gate authorizes that namespace exactly as it authorizes one named directly. A branch the repository does not index, or the caller cannot read, answers UNKNOWN_BRANCH (404) naming the readable branches. `@` is not a namespace character (`server/core/naming.py`), so the form never collides with a name. `repo_members(org, repo_key)` replaces `docs_namespaces`, `repo_siblings` and `release_namespaces`: one list of a repository's entries in the Repositories page's branch order, the trunk first. The architecture page states the trunk's role. Related: ClickHouse#1680 Signed-off-by: Kaloyan Naumov <knaumov@gmail.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Both transports resolved the branch name into a copy of the arguments, so the request identity, the ledger rows and the gates that read the raw body named the text the caller wrote instead of the namespace that served the call. Those rows fell outside the namespace's activity, usage and erasure. HTTP now writes the resolved name into the raw body, as `@me` is written, and MCP writes it into the call's arguments, as the screen does. A unit test reads the rows both transports hand the event writer, and an integration test finds them with an erasure export of the namespace. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ilure The resolver kept only whether each branch's read check allowed it, so a check refused because a read it needed failed made a branch the caller may read look absent: the call answered UNKNOWN_BRANCH, the caller's error, and dropped that branch from the list it named. The resolver now reads the check's `unverified` flag, as the screen's repository resolver does. When the branch asked for was not admitted and any check could not run, it raises the gate's refusal marked unverified and notes the request as the server's; each transport answers it as its gate answers a failed check. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`repo_members` grouped entries by `remote.repo_key`, which lets a URL remote decide the key. An entry that names the repository as the others do but fetches it from a fork became a repository of its own: its own trunk, documents and decisions namespace, and a release set without it. The documents namespace and the release set grouped by the spelling of `repo`, so a configuration with such an entry changed meaning. `repo_members(org, repo)` now groups by `repo` as written, the grouping those derivations had, and a test holds a fork-remote entry to the repository's trunk, release set and branch names. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`code.blame_range` and `code.first_build` took their siblings from `repo_members`, which lists every entry of the repository. An entry an operator gave its own clone then became a sibling of the others: the indexed view tested its head against this clone, and a release ref resolved to its head was read in a clone that may not hold it. The history reads resolve refs in one clone, so their siblings are the entries on that clone again (`repo_siblings`), and bisect reads its entry as before. A test reads the siblings both ops hand their history reads for a configuration with a branch on a clone of its own. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The entries these tests configure gained a `git_remote` field when the repository's members were keyed on the remote. They are grouped by `repo` alone now, which the stubs always had, so the field goes. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zlareb1
left a comment
There was a problem hiding this comment.
An omitted org can resolve repo@branch over HTTP and fail over MCP. The existing finding follows from the MCP screen using the token org and the HTTP resolver preferring the code-plane org. Use the same effective org for branch resolution and the subsequent read check. Cover an omitted org with a configured code-plane org on both transports.
A code call that names no org acts in the code plane's org on HTTP, but the MCP screen resolved `repo@branch` and read the namespace in the token's org. With a token org that is not the code plane (dev mode, federated login) the same call answered on HTTP and was refused on MCP. `gates.org_for_op` is the one derivation of the org a call acts in, and `resolve_org` is now its op form. The MCP screen resolves the branch in that org and makes the read check on the resolved namespace in it. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Round 2 Both transports now pick one effective org for branch resolution and the read check that follows, so an omitted org with a configured code-plane org resolves the same namespace on HTTP and MCP (a02e246). |
zlareb1
left a comment
There was a problem hiding this comment.
The branch resolver and the MCP namespace screen now use the same effective organization as HTTP. All 226 focused transport, branch, backport, and SDK error tests passed.
zlareb1
left a comment
There was a problem hiding this comment.
The analyzer job reports the same mentor evidence shape mismatch on this head's tested base. The focused test passes on current main with the snapshot update from #1957. The existing digest repair in #1990 addresses the SQL comment that made the literal affect the shape. Failed CI job · Digest repair
zlareb1
left a comment
There was a problem hiding this comment.
GitHub reports a merge conflict in sdk/ruby/lib/clickhouse/loom/generated/errors.rb. Please reconcile the schema changes with main and regenerate the Ruby error definitions so CI can test the combined tree.
The Ruby error definitions are regenerated from the combined tree with scripts/codegen/sdk_rb_gen.py, so they carry main's codes and UNKNOWN_BRANCH. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Round Merged main in 2e688c9. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 2e688c9. Configure here.
`resolve_branch` finds the repository by its normalized spelling, but `repo_members` compares `repo` exactly, so a repository configured under two spellings (`Acme/kj` and `acme/kj`) hid the other group's branches and answered UNKNOWN_BRANCH. The resolver now lists the entries of every spelling that normalizes to the repository's, its own spelling first. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
The mixed repository spelling finding blocks approval. The resolver matches the repository using a normalized name, then looks for branches only under the chosen entry’s exact spelling. Use the same repository identity for both steps and cover a readable release branch configured under a different spelling.
zlareb1
left a comment
There was a problem hiding this comment.
Branch lookup uses the same repository spelling rules as name lookup and still checks read access on each candidate. All 39 focused branch and transport tests passed.
zlareb1
left a comment
There was a problem hiding this comment.
The branch-resolution cases pass. CI found a type regression in the new member helper. Failed type gate
zlareb1
left a comment
There was a problem hiding this comment.
The seed 2 Undo failure also reproduced on clean main. Four fixture pairs share values, so a delete can make another key’s value ineligible for Undo. The repair seeds distinct values and passes the same test with its Undo assertion. Failed integration job · Repair #2035
`_members` returned `list[Any]`, so `hit.namespace` was `Any` and `resolve_branch` returned it from a `str | None` signature. The mypy ratchet caught it as `no-any-return`. Annotate the helper with the `RepoConfig` that `repo_members` already returns, imported for typing only so the registry stays a lazy import. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fixed in one line: Same command your CI runs — The ratchet is the pin: the baseline is
|
zlareb1
left a comment
There was a problem hiding this comment.
The member helper keeps the registry’s RepoConfig type through branch resolution, so the annotated return is a string or None. All 99 focused branch and transport tests passed.
zlareb1
left a comment
There was a problem hiding this comment.
The exact CI merge fails both new history cases because their mock targets a helper that the handlers no longer import. The existing blame and first-build tests pass on main. Failed unit job
zlareb1
left a comment
There was a problem hiding this comment.
The pinned Biome check finds the same unformatted dashboard assertion in this run and on clean main. The separate repair formats that assertion. Failed job · Repair #2107
…-resolve-type-r37
blame calls mirrors.history_dir and first_build calls the history_dir it imported; the wrapper history_git_dir went out with the default-mirror change, so both cases died at setattr before the handler ran and the clone-isolation assertions never executed. Patch the seam each handler reads: the mirrors module attribute for blame, the imported name for first_build. The assertions are unchanged. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
|
Steady point: Both history cases now mock the seam each handler reads, on the merged tree.
The clone-isolation assertions are unchanged, and sibling selection still comes from the configuration entries ( Red, before the change: both params die at |
zlareb1
left a comment
There was a problem hiding this comment.
The history tests patch the resolver used by blame and first-build and still check clone isolation. All 227 focused branch, transport, backport, and SDK tests passed.

A code call can now name a branch as
<repository or namespace>@<branch>innamespace(ClickHouse/ClickHouse@26.4), over HTTP, MCP and the SDKs alike, and it runs on the namespace that indexes that branch. A branch the repository does not index answersUNKNOWN_BRANCHwith the branches the caller can read. The documents namespace and the release set now read a repository's entries from one helper,repo_members, which groups them as before.Related: #1680
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
A code call can name a branch as
repository@branchinnamespaceon every surface; a branch that is not indexed, or that the caller cannot read, answersUNKNOWN_BRANCHand lists the branches the caller can read.Why
A repository with several indexed branches is addressed by the namespace of each branch, and a caller has to know those names. Over MCP,
server/transport/namespace_resolve.pyalready resolves a repository's name to its default branch's namespace, but only there:mcp_authandmcp_outcomeimport it, and HTTP and the SDKs takenamespaceas given. A caller of any other surface, or one that wants a release line, had no way to say "this repository, that branch".This change gives the name a spelling,
<repository or namespace>@<branch>, and resolves it where both transports share their admission sequence, before validation and before the gate:namespace_resolve.resolve_branchfinds the repository the left part names (a repository, its name, or any namespace of it), lists its members, and returns the namespace whose branch is the right part. It reads only what the caller can read: the branches of the repository the caller can see are the ones it matches against and the ones an error names.gates.with_branch_nameruns it for acode.*op'snamespaceand rewrites the argument. HTTP calls it before_validate_payload; MCP calls it from_named_input(every tool, a call the screen did not resolve) and from the pre-dispatch screen (for aloom_code_*tool, ahead of the read check that would otherwise refuse the literal name)._resolve_personalwrites@me's namespace, and MCP's arguments, as the screen writes its own resolution. The request identity, the ledger row and the gates after validation name the namespace the call runs on, so the call counts in that namespace's activity and usage, and an erasure of the namespace finds its rows.UnknownBranchError(UNKNOWN_BRANCH, 404) naming the readable branches. The two cases answer alike, so the error confirms no branch the caller cannot read. When the caller reads no branch of the repository, nothing resolves and the gate refuses the name as it would any ungranted namespace.server.auth.fail_closed) leaves the branch unknown, so it is never answered as one that is not there. The resolver reads each check'sunverifiedflag, as the screen's repository resolver does. When the branch asked for was not admitted and any check could not run, the call is refused as the gate refuses its own failed check on that transport, and the row is the server's failure.@is not a namespace character:validate_namespace_nameaccepts[a-z0-9][a-z0-9-]*(_NAMESPACE_REinserver/core/naming.py), so a name made through it never collides with the form. An operator entry (LOOM_CODE_REPOS_JSON) is not checked against that rule, so the resolver also leaves any configured namespace alone before it reads a name as a branch.Two places listed a repository's entries each their own way:
docs_namespaces(server/code/domain/index/repos.py) for the documents namespace, andrelease_namespaces(server/code/app/backport.py) for the release set, whose groupingbackport.branch_refsrepeated. They are replaced byrepo_members(org, repo), which lists the entries of one org whoserepospells the repository, in the Repositories page's branch order. The first member is the trunk. Their callers read it:repo_scope,memory_links,source_sync,code.reposandbackport_gap. It groups as they did, byrepoas written, so an entry that fetches the repository from another remote (a fork) stays one of its branches. The history reads (blame_range,first_build) keep their own grouping, the entries on one clone (repo_siblings), because they resolve refs in that clone.docs/architecture/code-index-architecture.mdnow states the trunk's role as it is: its namespace holds the repository's documents.Scope and risk
Touches the transport admission sequence, the name resolver, the list of a repository's entries and the places that read it. It adds no op, field, setting, table or migration.
Every configuration groups as before: the documents namespace and the release set by the spelling of
repo, the history reads by clone. The release set's order for two branches of the same version follows the page's branch order instead of the order of the configuration.Authorization: unchanged. The resolver reads
check_authorizedwithVIEWER, the check the MCP screen already uses for the same purpose, and the gate runs again on the resolved namespace. A registry that has not been read resolves nothing, so the gate refuses the literal name. A check that could not run is the server's failure on both transports, never an unknown branch.Compatibility, rollout and rollback
UNKNOWN_BRANCH(HTTP 404, withrepository,branchandbranchesbesidemessage). It is indocs/reference/errors.mdand the Ruby SDK's generated errors; the SDKs map it toNotFoundby status. No op or field changes.matchfinds no namespace for the form and answersUNKNOWN_NAMESPACE; on HTTP its gate refuses the ungranted literal. Neither runs the call on a wrong namespace.Tests
Red on
main, then green with the change. The new files aretests/unit/test_repo_at_branch.pyandtests/integration/test_repo_at_branch_ledger_live_ch.py. Onmain33 of the unit file's 37 tests fail, and the integration test fails; on the change all pass. The four that pass onmainhold whatmainalready does: the documents namespace and the release set as the replaced derivations answered, the history reads' siblings, and a name that is no branch.kj,@me,kj@, an unknown repository, a memory namespace); another org's entries; a configured namespace that holds@; a check that could not run, for the branch asked for or another; a registry not yet read.namespace_resolved; answersUNKNOWN_BRANCHfor an unreadable or an unindexed branch; refuses a check that could not run as the server's failure; leaves a tracker tool alone.repo_members: order, org, the spelling ofrepo, and the snapshot argument; an entry on a fork remote stays in the repository's trunk, release set and branch names.repo_scope,memory_links) and the release set (backport) answer as the two replaced derivations did, over one configuration of several repositories, orgs, spellings, remotes and branch kinds; the previous derivations are in the test as the reference.code.blame_rangeandcode.first_buildhand their history reads the entries on their own clone, in the configuration's order.The existing tests that patched
repos.docs_namespacesor calledrelease_namespacesread the new seams (repo_members,resolve_branches); their assertions are unchanged. The source-level order guard intest_mcp_session_runs.pylooks for_named_input(, which now precedes the gate where_validated_input(did, andtest_sdk_errors_from_response.pylists the new code among the server's.Also run:
ruff format --checkandruff check,function_length_gate,check_no_secrets,mypy_gate, every generator's--checkwith the CI toolchains (sdk_py_gen,sdk_py_client_gen,sdk_py_admin_gen,sdk_ts_gen,sdk_rb_gen,sdk_rust_genwith and without--fixtures,sdk_go_gen,agent_plugin_sync,standalone_skills,served_skills,settings_reference,settings_schema,settings_example,docs_reference,op_reach_census), the unit tests of the transports, the resolver, blame, first build, bisect, backport, mirrors, the repository registry and its access rules, memory code links and doc links, and the integration tests that read those paths.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code; I read the diff and ran the tests above.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make test-unitand applicable integration results are reported by CI; a full local run is not required before pushing.docs/reference/errors.mdand the Ruby SDK'serrors.rb; no op, setting or plugin file changed.main: not applicable, none added.frontend/changed: not applicable, unchanged.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.Note
Medium Risk
Changes shared transport admission and namespace resolution before authorization; auth rules are unchanged but mis-resolution could route calls to the wrong index without the new tests and fail-closed paths.
Overview
Code calls can target a specific indexed branch by setting
namespaceto<repository or namespace>@<branch>on HTTP, MCP, and the SDKs. Admission resolves that form to the branch’s code namespace before validation and authorization (resolve_branch,gates.with_branch_name), so ledger activity and erasure use the resolved namespace—not the literal string.Unknown or unreadable branches return
UNKNOWN_BRANCH(404) with the branches the caller may read; failed read checks stay fail-closed (gate refusal, not a branch list).Repository grouping is consolidated:
repo_membersreplaces separatedocs_namespaces/release_namespaceslogic for trunk docs, release sets, listings, and backport—behavior is preserved with tests against the old derivations.Reviewed by Cursor Bugbot for commit 86eb526. Bugbot is set up for automated code reviews on this repo. Configure here.