Expand description
The profile lifecycle: materializing and deleting what an adapter owns for a profile (SP5a design §3).
Like config::link and config::unlink, the logic is a pure function over the application root that
returns an outcome value; the CLI layer renders it and decides the exit code.
Structs§
- Listing
- What
listandprofilesshow (SP5a design §3): one row per valid profile directory, plus the count of entries that were skipped as unrecognized.
Enums§
- Create
Outcome - What
createdid (SP5a design §3). - Delete
Outcome - What
deletedid (SP5a design §3). - Presence
- What
<agent> statusand thestatusdocument report for a profile (SP3 design §7.5).
Functions§
- blocking_
label 🔒 - Text for one blocking reference: the stored key for a repository-wide
profilefield, the stored key with the agent table for anagents.<id>field, and the literaldefault_profilefor the global default (SP5a design §3). - blocking_
references - Every mapping field and the global default that names
profileforagent, ignoring ASCII case, in the order the mapping fields are read and withdefault_profilelast. An empty result means nothing stands in the way of deleting the profile’s directory foragent. - create
- Ensures the paths
adapterowns forprofileunderrootexactly once: an already materialized profile is left untouched, so a user’s hand-edited configuration file is never overwritten. The returned path is the first of the adapter’s paths, the profile directory; the function is the same kind of pure, outcome-returning function asconfig::link. - delete
- Removes the profile directory for
agentunder the same exclusive locklinkandupdatetake (spec §18), re-checkingdelete_targetandblocking_referencesinside it: the advisory checks outside the lock can be seconds stale, and a deletion that never leaves a mapping or the global default pointing at nothing is the invariant this function exists to hold (SP5a design §3). - delete_
target - The profile directory
deletewould remove:<root>/profiles/<P>/<agent>, shown to the user un-canonicalized (SP5a design §3).Nonewhen nothing is there.Error::ProfileReferencedis not consulted here;blocking_referencesis the caller’s advisory or locked check. - list_
profiles - Reads what exists on disk, human-readable: each valid profile directory under
<root>/profilesbecomes a row naming everyadapterthat is materialized for it, inadaptersorder. Purely read-only: nothing is created, and a missing profiles directory is simply an empty listing. - presence
- The presence of
profileforagent; a case-only twin is reported before the adapter is asked. - symlink_
refusal 🔒 - The refusal for a symlinked entry, with the fixed message the tests anchor on.
- symlinked 🔒
- Whether the entry at
pathis itself a symlink (or, on Windows, a junction).Ok(false)when the entry is missing, so the caller’s symlink check never fires onNotFound. - unrecognized_
children 🔒 - The number of child directories of a listed profile directory that are not known agent ids: each one
is an unrecognized entry and the caller’s
ignoredgrows by one per child. A child file is never counted — only child directories can be unrecognized — and a child entry whose name starts with.is skipped without counting, mirroring the profiles-directory rule: the same OS litter (*.swp, .DS_Store) must behave the same one level deeper.