Files
devvm/testdata/script/layout.txtar
T
w3cjandClaude Opus 5.5 ceda0bf925 feat(cli): --network TIER, devvm network TIER and the tier question
The command line names the four network tiers. --network TIER (open,
internet, allowlist or none) chooses a new VM's tier, checked before
anything runs (arg_not_choice). devvm network open|internet|allowlist|none
gives the folder's VM a tier through Net.SetTier, and devvm network -g
takes the tiers and ask. config.toml's and settings.json's network is ask
or a tier (settings.NetworkChoices, checked against netpolicy.TierNames
by a test, since settings can't import netpolicy).

The question on creation is Proxy.Choose(vm): net_about says what each
tier reaches, net_ask asks for one (Answer, AnsweredBy("--network")),
Enter or a refusal gives allowlist, and an answer that isn't a tier is
warned of (net_tier_unknown) and asked again. devvm setup's picker
offers ask and the four tiers (network_default_open, _internet,
_allowlist, _none). On an existing VM, --network is ignored with the
devvm network TIER command that changes it.

devvm network --json: policy is the tier or unenforced, and each policy
file whose denies alone apply (internet and none) has denies_only: true,
as the text output's "(denies only)", so a script can tell a file's
denies from all of its rules without knowing the tier rules.

Messages reworded: net_tier_backend (--network open), net_open_policy
(devvm network allowlist), net_about, net_ask, network_default*,
net_default_failed, network_failed, setting_already's and
widen_parent_vm*'s descriptions. safety/network's "Choosing a tier"
replaces its on/off section; docs, the cli skill, testscripts and e2e
use the new forms, and e2e's internet and none checks go through devvm
network.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 15:54:43 -07:00

248 lines
5.4 KiB
Plaintext

# devvm's folders: their layout version, checked before every command
# that reads them, and every file devvm keeps for a VM with network
# policy, ports, a link and a secret, against the listings below. A
# change to the layout changes a listing: consider the layout version
# then (Contributing's state layout).
# The first run gives both folders this devvm's version.
exec devvm ls
cmp $DATA/version want/version
cmp $CFG/version want/version
# A newer devvm's folders are refused, before the command runs, and so
# is a version file devvm can't read; help, completion and the version
# still run.
cp want/newer $DATA/version
! exec devvm ls
stderr '^devvm: layout_newer current=1 path=\S+/data/devvm/version version=2$'
! stdout .
exec devvm --version
exec devvm version
exec devvm help
exec devvm completion bash
cmp $DATA/version want/newer
cp want/version $DATA/version
cp want/newer $CFG/version
! exec devvm doctor
stderr '^devvm: layout_newer current=1 path=\S+/config/devvm/version version=2$'
cp want/corrupt $CFG/version
! exec devvm ls
stderr '^devvm: layout_unchecked reason=\S+/config/devvm/version: not a layout version$'
rm $CFG/version
exec devvm ls
cmp $CFG/version want/version
# A target VM that publishes a port, and a client VM with a link to it
# and a secret, both with network policy and forwarding a port, one free
# on this host, so the forwarders start whatever else listens.
free_port PORT
exec devvm ports -g $PORT
project db
exec devvm --network allowlist --no-git-protect
exec devvm link publish 5432
project app
exec devvm --network allowlist --no-git-protect
exec devvm link add db 5432
stdin $WORK/github.token
exec devvm secret set github --stdin
exec devvm secret use github
vm_name APP app
vm_name DB db
vm_state $APP_dir/vm.json
stdout '^made_by=\S+$'
# Every file and folder, with the VMs' hashes named and other hashes,
# times and versions left out.
exec sh $WORK/list.sh $CFG
cmp stdout $WORK/config.txt
exec sh $WORK/list.sh $DATA
[darwin] cmp stdout $WORK/data.txt
[!darwin] cmp stdout $WORK/data-linux.txt
-- want/version --
1
-- want/newer --
2
-- want/corrupt --
one
-- github.token --
ghp_testfake
-- list.sh --
# list.sh FOLDER: every path under FOLDER, sorted, with APP's and DB's
# hashes named and other hashes, times, versions and QEMU's architecture
# as X.
cd "$1" || exit 1
find . -mindepth 1 | sed -E \
-e 's|^\./||' -e 's/qemu-system-[a-z0-9_]+/qemu-system-X/' \
-e "s/${APP##*-}/APP/g" -e "s/${DB##*-}/DB/g" \
-e 's/[0-9a-f]{12,}/X/g' -e 's/[0-9]{8}-[0-9]{6}-[0-9]+/X/g' -e 's/[0-9]+\.[0-9]+\.[0-9]+/X/g' |
LC_ALL=C sort -u
-- config.txt --
version
-- data.txt --
groups.lock
images
images/X
images/X/record.json
images/locks
images/locks/X
images/locks/packages
images/locks/ubuntu
images/ubuntu.json
logs
logs/runs
logs/runs/X.log
making.lock
packages
packages/sets
packages/sets/X.json
run
run/build-ports
run/builds
run/claims.lock
run/link-X.ctl
run/link-X.sock
settings.json
ssh_config
tools
version
version.lock
vms
vms/APP
vms/APP/lock
vms/APP/logs
vms/APP/logs/links.log
vms/APP/logs/network.jsonl
vms/APP/logs/ports.log
vms/APP/logs/proxy.log
vms/APP/run
vms/APP/run/ca
vms/APP/run/ca/ca.key
vms/APP/run/ca/ca.pem
vms/APP/run/ca/lock
vms/APP/run/ca/next.key
vms/APP/run/ca/next.pem
vms/APP/run/known_hosts
vms/APP/run/links.json
vms/APP/run/links.pid
vms/APP/run/ports.lock
vms/APP/run/ports.pid
vms/APP/run/ports.status
vms/APP/run/proxy.json
vms/APP/run/proxy.pid
vms/APP/run/proxy.status
vms/APP/run/sandbox.sb
vms/APP/run/secrets.json
vms/APP/run/secrets.policy
vms/APP/run/started
vms/APP/vm.json
vms/DB
vms/DB/lock
vms/DB/logs
vms/DB/logs/network.jsonl
vms/DB/logs/ports.log
vms/DB/logs/proxy.log
vms/DB/run
vms/DB/run/ca
vms/DB/run/ca/ca.key
vms/DB/run/ca/ca.pem
vms/DB/run/ca/lock
vms/DB/run/ca/next.key
vms/DB/run/ca/next.pem
vms/DB/run/known_hosts
vms/DB/run/ports.lock
vms/DB/run/ports.pid
vms/DB/run/ports.status
vms/DB/run/proxy.json
vms/DB/run/proxy.pid
vms/DB/run/proxy.status
vms/DB/run/sandbox.sb
vms/DB/run/secrets.json
vms/DB/run/secrets.policy
vms/DB/run/started
vms/DB/vm.json
-- data-linux.txt --
groups.lock
images
images/X
images/X/record.json
images/locks
images/locks/X
images/locks/packages
images/locks/ubuntu
images/ubuntu.json
logs
logs/runs
logs/runs/X.log
making.lock
packages
packages/sets
packages/sets/X.json
run
run/build-ports
run/builds
run/claims.lock
run/link-X.ctl
run/link-X.sock
run/qemu
run/qemu/qemu-system-X
secrets
secrets/github
settings.json
ssh_config
tools
version
version.lock
vms
vms/APP
vms/APP/lock
vms/APP/logs
vms/APP/logs/links.log
vms/APP/logs/network.jsonl
vms/APP/logs/ports.log
vms/APP/logs/proxy.log
vms/APP/run
vms/APP/run/ca
vms/APP/run/ca/ca.key
vms/APP/run/ca/ca.pem
vms/APP/run/ca/lock
vms/APP/run/ca/next.key
vms/APP/run/ca/next.pem
vms/APP/run/known_hosts
vms/APP/run/links.json
vms/APP/run/links.pid
vms/APP/run/ports.lock
vms/APP/run/ports.pid
vms/APP/run/ports.status
vms/APP/run/proxy.json
vms/APP/run/proxy.pid
vms/APP/run/proxy.status
vms/APP/run/secrets.json
vms/APP/run/secrets.policy
vms/APP/run/started
vms/APP/vm.json
vms/DB
vms/DB/lock
vms/DB/logs
vms/DB/logs/network.jsonl
vms/DB/logs/ports.log
vms/DB/logs/proxy.log
vms/DB/run
vms/DB/run/ca
vms/DB/run/ca/ca.key
vms/DB/run/ca/ca.pem
vms/DB/run/ca/lock
vms/DB/run/ca/next.key
vms/DB/run/ca/next.pem
vms/DB/run/known_hosts
vms/DB/run/ports.lock
vms/DB/run/ports.pid
vms/DB/run/ports.status
vms/DB/run/proxy.json
vms/DB/run/proxy.pid
vms/DB/run/proxy.status
vms/DB/run/secrets.json
vms/DB/run/secrets.policy
vms/DB/run/started
vms/DB/vm.json