mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
finder.target(ctx, need) finds the VM a command acts on: the folder's own, the nearest parent folder's (resolveFolder), or one named for devvm rm VM. Its need says what the command needs (has: any, the VM, its machine, made; own; folder; noVM), and need.check is the one place that refuses a missing VM, one made for an earlier folder at its path (found.other, from sameFolder), a pending remake and an unfinished one. It replaces Env's find, own, findExisting, existing (10 callers), folderVM (7 callers) and the linkVM, groupVM, portsVM and agentVM wrappers, Net's policyVM, up's and toRemake's checkFolder, and rm VM's inspect by name. devvm rm VM refuses a state whose folder doesn't hash to the VM's name (rm_vm_state_mismatch), so a changed vm.json never sends it to this folder's VM. The environment reads the folder devvm runs in lazily (finder.dir), so devvm build, rebuild, images, space and gc run from a deleted folder; NewEnv no longer fails. Guard: the structure test's callers rule, state.ReadHash and project.Parents called only in internal/vm/finder.go outside their package and tests. Tests: TestFinder (need x none, own, parent, nested repo, other folder, unfinished, remake pending with and without its machine), TestRmVMFolderOfAnother, callerCases, no_folder.txtar and rm_vm.txtar's mismatch case (its fixtures' hashes now match their dirs). Co-Authored-By: Claude Opus 5.5 <[email protected]>
16 lines
870 B
Plaintext
16 lines
870 B
Plaintext
# The commands that act on no folder's VM never read the folder devvm runs
|
|
# in: devvm build, rebuild, images, space and gc run from one that's gone.
|
|
# A command on the folder's VM still needs it.
|
|
exec sh -c 'mkdir gone && cd gone && rmdir ../gone && exec devvm build base'
|
|
stdout '^==> building_image image=base key=[0-9a-f]{12}$'
|
|
exec sh -c 'mkdir gone && cd gone && rmdir ../gone && exec devvm rebuild --force base'
|
|
stdout '^==> building_image image=base key=[0-9a-f]{12}$'
|
|
exec sh -c 'mkdir gone && cd gone && rmdir ../gone && exec devvm images'
|
|
stdout '^base +'
|
|
exec sh -c 'mkdir gone && cd gone && rmdir ../gone && exec devvm space'
|
|
stdout '^total +'
|
|
exec sh -c 'mkdir gone && cd gone && rmdir ../gone && exec devvm gc --force'
|
|
stdout '^gc_packages '
|
|
! exec sh -c 'mkdir gone && cd gone && rmdir ../gone && exec devvm stop'
|
|
stderr '^devvm: stop_vm_failed reason='
|