Expand description
Detached/workspace-mode repo resolution: turn a filesystem path into a
RepoBinding (via the path’s git remote + the server), and pick the
effective binding for an event/command from the precedence chain
(--path flag → subagent worktree override → session active → bound
.tracevault/config.toml). See design §2/§3/§4.
Structs§
- Capture
Project Inputs - Inputs to the capture-time project chain. The config tier is the
.tracevault/config.tomlproject_id(a UUID, viaproject_from_config); the legacydefault_projectNAME is never an input — resolving it needs a network call, and the stream hook (which fires per event) never does one.init/syncmigrate it toproject_id(commands::migrate). - Project
Resolve Inputs - Inputs for the effective-project precedence chain.
project_flagandconfig_projectare resolved by the caller;session/worktree_pathcome from the per-session state. - Resolve
Inputs - Inputs for the effective-binding precedence chain.
repo_flagandboundare resolved by the caller (the--pathoverride and the boundconfig.toml, respectively);session/worktree_pathcome from the per-session state. - Resolved
Codebase - A checkout path resolved to its codebase: the origin URL it was resolved from, the codebase (git remote) the server deduplicates that URL to, and the live repo records linked to it.
Enums§
- Binding
Source - Which precedence tier produced the
effective_bindingresult. - Project
Source - Which precedence tier produced the
effective_projectresult. - Registration
Plan - What registering a checkout with the server should do, given the repos
its remote’s codebase already has. See
plan_registration. - Repo
Choice - Which of a codebase’s repos to bind, as decided by
ResolvedCodebase::choose.
Functions§
- binding_
from_ config - capture_
project_ binding - THE capture-time project chain:
--projectflag → subagent worktree override →TRACEVAULT_PROJECT→ sessionactive_project→ workspace.tracevault/config.tomlproject_id→ user default → none. Pure, no network.commands::stream::capture_project(ingest) andcommands::project::statusboth call this, so they cannot drift. - capture_
project_ id - The id the hook will actually send for a capture binding:
Nonewhen the storedproject_idis not a UUID (a hand-edited or corrupteduser_project.toml/session file), in which case ingest treats the binding as absent and the event goes repo-scoped. - checkout_
config_ repo_ id - The repo id a checkout’s own
.tracevault/config.tomlbinds, if any.pathmay be anywhere in the checkout, or in one of its linked worktrees. - effective_
binding - The binding that applies, and which tier produced it:
--pathflag → subagent worktree override → session active → bound config → user default → none. - effective_
project - The project that applies, and which tier produced it:
--projectflag → subagent worktree override →TRACEVAULT_PROJECT→ session active → workspace configproject_id→ none. Pure; covers only the local tiers (flag → subagent → env_project → session.active_project → config_project).env_projectis supplied BY THE CALLER — this module never reads the environment — and the capture path fills it fromcommands::stream::env_project_binding, which honours the UUID form only. The user-level default (and, in the display chain only, server-side deduction) are applied afterward bycapture_project_binding/resolve_effective_project, which call this function first and only fall through to those tiers when it returnsNone. - plan_
registration - Decide whether
init/syncmay register a repo forgit_url. - project_
from_ config - A RepoBinding from a pinned
.tracevault/config.toml(bound mode), if it has a repo_id. Pure — caller supplies the already-loaded config. Carries through theremote_id/codebase_nameinitpersisted (best-effort, display-only) so bound-modestatuscan print the codebase without an extra network round-trip;git_urlstaysNonehere — bound mode has no live origin URL to hand back (that’s the oldergit_urlfallback’s job, covering bindings that predatecodebase_name). The workspace project tier of a.tracevault/config.toml: itsproject_id, with the recordedproject_namefor display.Nonewhen the config has noproject_id— in particular for a config that still carries only the legacydefault_projectname, which is never resolved here (VIS-1256: ingest never resolves names). Aproject_idthat is not a UUID is returned as is; the capture path drops it viacapture_project_id, andproject statuswarns about it. - resolve_
effective_ project - DISPLAY chain for
commands::status’s “Project” line:--projectflag → subagent override →TRACEVAULT_PROJECT→ session active → config default (all pure, viaeffective_project; no network call) → user-level default → server-side deduction from the repo’s git remote. - resolve_
path_ to_ binding - Resolve a filesystem path to a registered-repo binding: read its origin
remote URL and ask the server.
Ok(None)when the path has no remote or the server has no matching codebase (pre-registered-only). - resolve_
path_ to_ codebase - Resolve a filesystem path to its codebase and live repos: read its origin
remote URL and ask the server.
Ok(None)when the path has no remote or the server has no matching codebase (pre-registered-only); an error when the codebase is registered but has no live repo. - resolve_
path_ to_ project_ binding resolve_path_to_bindingamong the repos of projectproject_idonly (VIS-1258): the checkout’s codebase, narrowed to the repos the project holds, then picked the same way.Ok(None)when the checkout has no origin remote, the server has no codebase for it, or none of that codebase’s live repos belongs to the project — a repo outside the project is never returned, since a send declaring the project with it is refused.- resolve_
url_ to_ codebase - Resolve an origin URL to its codebase (by NORMALIZED URL, deduped) and
list the codebase’s live repos, which may be none.
Ok(None)when the server has no matching codebase.