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 .visdom/tracing.toml). See design §2/§3/§4.

Structs§

CaptureProjectInputs
Inputs to the capture-time project chain. The config tier is the .visdom/tracing.toml project_id (a UUID, via project_from_config); the legacy default_project NAME is never an input — resolving it needs a network call, and the stream hook (which fires per event) never does one. init/sync migrate it to project_id (commands::migrate).
ProjectResolveInputs
Inputs for the effective-project precedence chain. project_flag and config_project 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
capture_project_binding
THE capture-time project chain: --project flag → subagent worktree override → TRACEVAULT_PROJECT → session active_project → workspace .visdom/tracing.toml project_id → 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 .visdom/tracing.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 → workspace config project_id → none. Pure; covers only the local tiers (flag → subagent → env_project → session.active_project → config_project). 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.
project_from_config
A RepoBinding from a pinned .visdom/tracing.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). The workspace project tier of a .visdom/tracing.toml: its project_id, with the recorded project_name for display. None when the config has no project_id — in particular for a config that still carries only the legacy default_project name, which is never resolved here (VIS-1256: ingest never resolves names). A project_id that is not a UUID is returned as is; the capture path drops it via capture_project_id, and project status warns about it.
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_path_to_project_binding
resolve_path_to_binding among the repos of project project_id only (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.