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 it profiles/<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's get lock and throws ProfileResolutionBusyException (resolution-busy) while another holder has it. Throws resolution-stale when wayfinder.json, wayfinder.lock or a package file the plan read in the cache has changed since plan, 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 upgrade asks, and only what allowFetch allows (every fetch when it is null); never writes in the project.
pruneProjectLocks({Duration unusedFor = const Duration(days: 30)}) → Future<List<String>>
Deletes the get lock file of each project whose root no longer exists, such as a removed worktree, once no get has used it for unusedFor, and returns the deleted files.
relock(String project, {required FutureOr<String> edit(String configuration), WayfinderCancellation? cancel}) → Future<ProfileRelockResult>
Applies edit to the project's wayfinder.json and writes wayfinder.lock for the edited configuration, keeping exactly the commits the lock pins, under one hold of the project's get lock.
resolve(String project, {bool upgrade = false, ProfileFetchPolicy? allowFetch, WayfinderCancellation? cancel}) → Future<ProfileResolutionResult>
wayfinder get and upgrade: plan then apply under one hold of the project's get lock. 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 bundle that the cache lacks out of its source's mirror, as after upgrading from Wayfinder 0.2, whose cache kept only the mirrors. Runs only git show on 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 holds bundle's chain. Binds bundle as 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 get has not installed at the locked commit is a warning, so the rules still run. Without configPath it binds through the nearest wayfinder.json above bundle, never above projectRoot when one is given (WayfinderProjectConfig.bind).
status(String project) → Future<ProfileResolutionStatus>
Where each Profile the project at project binds stands on this machine, one ProfileBindingStatus per wayfinder.json binding 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

canonicalConfigurationSha256(String raw) → String

Constants

mirrorLockTimeout → const Duration
How long a planner waits while another holds a Profile source's mirror.