Skip to main content

Module resolution

Module resolution 

Source
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§

CaptureProjectInputs
Inputs to the capture-time project chain. Deliberately has NO config_default field: .tracevault/config.toml default_project is a NAME, resolving it needs a network call, and the stream hook (which fires per event) never does one — so no caller of this chain can feed it in.
ProjectResolveInputs
Inputs for the effective-project precedence chain. project_flag and config_default are resolved by the caller; session/worktree_path come from the per-session state.
ResolveInputs
Inputs for the effective-binding precedence chain. repo_flag and bound are resolved by the caller (the --path override and the bound config.toml, respectively); session/worktree_path come from the per-session state.
ResolvedCodebase
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§

BindingSource
Which precedence tier produced the effective_binding result.
ProjectSource
Which precedence tier produced the effective_project result.
RegistrationPlan
What registering a checkout with the server should do, given the repos its remote’s codebase already has. See plan_registration.
RepoChoice
Which of a codebase’s repos to bind, as decided by ResolvedCodebase::choose.

Functions§

binding_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 the remote_id/codebase_name init persisted (best-effort, display-only) so bound-mode status can print the codebase without an extra network round-trip; git_url stays None here — bound mode has no live origin URL to hand back (that’s the older git_url fallback’s job, covering bindings that predate codebase_name).
capture_project_binding
THE capture-time project chain: --project flag → subagent worktree override → TRACEVAULT_PROJECT → session active_project → user default → none. Pure, no network. commands::stream::capture_project (ingest) and commands::project::status both call this, so they cannot drift.
capture_project_id
The id the hook will actually send for a capture binding: None when the stored project_id is not a UUID (a hand-edited or corrupted user_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.toml binds, if any. path may be anywhere in the checkout, or in one of its linked worktrees.
effective_binding
The binding that applies, and which tier produced it: --path flag → subagent worktree override → session active → bound config → user default → none.
effective_project
The project that applies, and which tier produced it: --project flag → subagent worktree override → TRACEVAULT_PROJECT → session active → config default → none. Pure; covers only the local tiers (flag → subagent → env_project → session.active_project → config_default). env_project is supplied BY THE CALLER — this module never reads the environment — and the capture path fills it from commands::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 by capture_project_binding / resolve_effective_project, which call this function first and only fall through to those tiers when it returns None.
plan_registration
Decide whether init/sync may register a repo for git_url.
resolve_effective_project
DISPLAY chain for commands::status’s “Project” line: --project flag → subagent override → TRACEVAULT_PROJECT → session active → config default (all pure, via effective_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_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.