WayfinderProfileResolver class final
Resolves Git Profile sources, persists their lock metadata, and selects a bundle's Profile from them.
Its state lives under dataDirectory:
profiles/<sha256(location)>/, a bare mirror of each source, and beside itprofiles/<sha256(location)>.lock, held while a planner clones, refreshes or reads it; another planner waits for up to mirrorLockTimeout;profiles/packages/<sha256(commit, path)>.json, the package file of each package a plan read, so select reads files and never runs Git; restoreCachedPackages fills it from the mirrors for a cache an earlier Wayfinder wrote;projects/<sha256(root)>.get.lock, held while apply, resolve or an adoption (package:wayfinder/adoption.dart) changes a project, and recording that project's root.
Reading a Profile package runs its rules' tests, which run the package's
own patterns. Each read, whether a plan's or select's, therefore runs
on an isolate of its own and fails with profile-timeout once it runs
past packageTimeout (ProfilePackage.parseWithin).
Constructors
- WayfinderProfileResolver({required Directory dataDirectory, GitRunner git = runGit, Duration packageTimeout = ProfilePackage.parseTimeout})
Properties
- dataDirectory → Directory
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- packageTimeout → Duration
-
How long reading one Profile package, its rules' tests included, may
run before it fails with
profile-timeout.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
apply(
ProfileResolutionPlan plan) → Future< ProfileResolutionResult> -
Writes
plan: the lock, the skills it lists, and the removals, or only the lock for a plan that leaves skills alone. Holds the project'sgetlock and throws ProfileResolutionBusyException (resolution-busy) while another holder has it. Throwsresolution-stalewhenwayfinder.json,wayfinder.lockor a package file the plan read in the cache has changed sinceplan, and ProfileSkillDirectoriesException when a skill directory it would replace is no longer Wayfinder's. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
plan(
String project, {bool upgrade = false, bool lockedOnly = false, bool skills = true, ProfileFetchPolicy? allowFetch, WayfinderCancellation? cancel}) → Future< ProfileResolutionPlan> -
Resolves every binding's chain, composes it so a broken chain fails
here rather than at validation, locks one revision per Profile id, and
reads each locked package's skill from its locked commit. Fetches only
when the mirror is missing, a ref must move, or
upgradeasks, and only whatallowFetchallows (every fetch when it is null); never writes in the project. -
pruneProjectLocks(
{Duration unusedFor = const Duration(days: 30)}) → Future< List< String> > -
Deletes the
getlock file of each project whose root no longer exists, such as a removed worktree, once nogethas used it forunusedFor, and returns the deleted files. -
relock(
String project, {required FutureOr< String> edit(String configuration), WayfinderCancellation? cancel}) → Future<ProfileRelockResult> -
Applies
editto the project'swayfinder.jsonand writeswayfinder.lockfor the edited configuration, keeping exactly the commits the lock pins, under one hold of the project'sgetlock. -
resolve(
String project, {bool upgrade = false, ProfileFetchPolicy? allowFetch, WayfinderCancellation? cancel}) → Future< ProfileResolutionResult> -
wayfinder getandupgrade: plan then apply under one hold of the project'sgetlock. Converges: with the same configuration, lock and cache it fetches nothing and writes nothing in the project. -
restoreCachedPackages(
String bundle, {String? configPath, String? projectRoot, WayfinderCancellation? cancel}) → Future< int> -
Copies each package file select reads for
bundlethat the cache lacks out of its source's mirror, as after upgrading from Wayfinder 0.2, whose cache kept only the mirrors. Runs onlygit showon a mirror that already exists, under its lock: never fetches, never waits for another holder of a mirror, and never writes in the project. Does nothing unless the lock is current and holdsbundle's chain. Bindsbundleas select does. Returns how many files it wrote; select reports what is still missing. -
select(
String bundle, {String? configPath, String? projectRoot}) → Future< ProfileSelection> -
Validation's selection: the bundle's binding, its chain from the lock,
each package from the local cache, composed. Never runs Git, never
fetches, never writes, and reports every failure as exactly one
diagnostic. A chain member's skill that
gethas not installed at the locked commit is a warning, so the rules still run. WithoutconfigPathit binds through the nearestwayfinder.jsonabovebundle, never aboveprojectRootwhen one is given (WayfinderProjectConfig.bind). -
status(
String project) → Future< ProfileResolutionStatus> -
Where each Profile the project at
projectbinds stands on this machine, one ProfileBindingStatus perwayfinder.jsonbinding in id order: ProfileBindingState.resolved, or why select selects nothing for its bundles, with the diagnostic it reports. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
Constants
- mirrorLockTimeout → const Duration
- How long a planner waits while another holds a Profile source's mirror.