[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6BXB11R215YCR901PJRYTXP":3,"skill-same:01M6BXB11R215YCR901PJRYTXP":93},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":40,"linkOnly":41,"markdownContent":42,"markdownBody":43,"frontMatter":44,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":50,"ownerHtmlUrl":51,"ownerBlogUrl":17,"ownerDescription":17,"updatedAt":52,"install":53,"resources":66},"01M6BXB11R215YCR901PJRYTXP","infra-deploy","网站部署发布与验证","The release process for the beet website. Validate the same site across local, dev and prod in sequence with an identical verification pass, tearing dev down after. Use for any site deploy, teardown or deploy verification. Invariants live in crates\u002Fbeet_infra\u002FREADME.md.","beet 网站的发布流程：依次在本地、开发、生产环境用相同的验证流程校验同一站点，随后拆除开发环境。适用于任何站点部署、拆除或部署验证。相关不变量见 crates\u002Fbeet_infra\u002FREADME.md。","mrchantey\u002Fbeet","mrchantey","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F25616826?v=4","01M6BXAMJ2N7RBWM0HZ0R6QRTV","Pete Hayman","01M6BXAMPVSZ84Q545AHAMT9N8",134,"Apache-2.0",null,"https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Finfra-deploy\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQNXPY1AV6BSR5VKHDMWRH","部署与发布管理","SCENARIO","使用场景",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C78XMS93X21V52649FP9VH","发布经理","PROFESSION","适用职业",[31,32,33,34,35,36,37,38,39],"deploy","infra deploy","release process","validate","release","dev","verification","website","site","2026-11-10 10:12:30",false,"---\nname: infra-deploy\ndescription: The release process for the beet website. Validate the same site across local, dev and prod in sequence with an identical verification pass, tearing dev down after. Use for any site deploy, teardown or deploy verification. Invariants live in crates\u002Fbeet_infra\u002FREADME.md.\n---\n\n# Deploy\n\nThe release process for the beet website. Validate the SAME site across three environments in sequence, each in its own sub-agent, each with an IDENTICAL verification pass:\n\n1. **Local** proves the build (serve on localhost, verify, stop).\n2. **Dev** proves the cloud path (deploy to `dev.beet.org`, verify, then tear down, since a standing dev environment is a real monthly cost).\n3. **Prod** publishes the permanent production site (`beet.org` + `www.beet.org`).\n\nRun each step as a SEPARATE sub-agent. Do them in series: Dev only after Local is green, Prod only after Dev is green and torn down.\n\n> **Dev MUST be torn down after verification. Only prod stays up.** Dev is a temporary proving ground for the cloud path, not a standing environment: a live dev stack is a real recurring monthly cost. The moment dev verification is green (or fails, or is abandoned), run `just beet-destroy` and confirm no `beet-site--dev--*` S3 buckets, no dev Lightsail instance or static IP, and no `dev.beet.org` DNS record remain. Never leave dev running.\n\n## Topology\n\nThe deploy block is stage-aware (`LightsailBeetSiteBlock`, `crates\u002Fbeet_extra\u002Fsrc\u002Finfra\u002Ftemplates.rs`). One `small_3_0` Lightsail box (2 GB, flat monthly price) per stage carries everything: no load balancer, no container registry, no ACM certificate, no VPC of its own. Nor an SSM agent: cloud-init removes Amazon's preinstalled `amazon-ssm-agent` (whose every call was denied, ~100 `AccessDenied` a day in the journal), since the box is managed over ssh on 2222 and the stack's secret store reaches Parameter Store through the API, never the agent. Its first registration attempt at boot still lands, four `AccessDenied` lines from `amazon-ssm-agent` within a second of `network-online.target`: Lightsail prepends its own `#!\u002Fbin\u002Fsh` to `user_data`, so our script runs in `cloud-final` and reaches the removal about a minute later, and no boothook or `bootcmd` can ride a launch script. So the box check is `rpm -q amazon-ssm-agent` reporting not installed and no `AccessDenied` from any unit after the agent's `Stopped` line in `sudo journalctl -u amazon-ssm-agent` (`sudo journalctl --no-pager --since '\u003Cthat time>' | grep AccessDenied`, the time as `'YYYY-MM-DD HH:MM:SS'` since `--since` rejects the `+0000` suffix `-o short-iso` prints, discounting your own `sudo grep` lines), never an empty journal.\n\n- **http**: Caddy on the box terminates TLS for every hostname with an automatic Let's Encrypt cert and reverse-proxies to the beet binary on its app port. Cloudflare fronts the site hostnames PROXIED (an `A` record at the static IP) and runs Full-strict, so the edge verifies Caddy's cert. The certificate store OUTLIVES the box: a `caddy-backup.timer` on the box saves `\u002Fvar\u002Flib\u002Fcaddy` to `s3:\u002F\u002Fbeet-site--\u003Cstage>--repo\u002Fcaddy\u002F` every 15 minutes and cloud-init restores it before Caddy starts, so a rebuilt box serves on the certificate the last one held (good for 90 days, renewed by Caddy a month early) and only the FIRST box of a stage ever issues at boot. The box's IAM key may write that prefix alone, never a release.\n- **ssh**: the beet TUI listens on port 22. Cloudflare does not proxy raw TCP, so ssh rides a DNS-ONLY `app.*` hostname pointing straight at the static IP. The box's own management sshd moves to **2222** (reachable with the stack's Lightsail key pair). Note this means the Lightsail browser console, which only dials 22, lands on the beet TUI rather than a shell.\n- **ssh host key**: one fingerprint for every stage and every restart, from the `BEET_SSH_HOST_KEY` record, and in NO rendered config. `site\u002Fmain.bsx` declares it as `\u003CSecretBlock bx:ref=\"ssh_host_key\" label=\"ssh-host-key\" env=\"BEET_SSH_HOST_KEY\"\u002F>` under the stage `\u003CStack>`, which renders the tofu resource `aws_ssm_parameter.beet_site__\u003Cstage>__ssh_host_key`, the `SecureString` `\u002Fbeet-site\u002F\u003Cstage>\u002Fssh-host-key`, so the stack's state owns its create, its update and its destroy. Its value is write-only: `value_wo = \"${var.BEET_SSH_HOST_KEY}\"`, an `ephemeral`, `sensitive` variable with no default, which every apply fills from the deployer's record as `TF_VAR_BEET_SSH_HOST_KEY` on the tofu child alone and every plan, validate and destroy passes empty, so the value is in no rendered config, plan or state and a launch without the record still plans. An apply without it refuses before writing anything, naming the record. `value_wo_version` is the record's `modified` (epoch milliseconds, off the plaintext index of `secrets.toml`), so a rolled record plans `value_wo_version = \u003Cold> -> \u003Cnew>` as an in-place update and nothing else; an unchanged record plans no change to the parameter. The config pins `required_version = \">= 1.11.0\"`, the OpenTofu release write-only attributes arrived in. The instance `depends_on` the parameter, so a rebuilt box boots after it exists and a destroy removes the box first. The box alone (`{ReadsSecrets([$ssh_host_key])}` on `\u003CLightsailBeetSiteBlock\u002F>`) holds `ssm:GetParameter` on exactly that parameter plus `kms:Decrypt` through SSM, in its runtime policy and the stage's runtime boundary; the rollup lambda holds neither. Both ends reach parameter store the same way, as SigV4-signed json calls through beet's own http client (`AwsJsonClient`, `crates\u002Fbeet_net\u002Fsrc\u002Fclient\u002F`), no `aws` cli and no SDK client: the deployer as its `secrets.toml` pair, the box as the pair its unit's `EnvironmentFile` loads. The binary reads the key at every start through the `StoredSecret` the declaration lands (each start logs `ssh host key from ssm (\u003Cregion>) \u002Fbeet-site\u002F\u003Cstage>\u002Fssh-host-key`), so a restart picks up a rolled key with no rebuild. A box that cannot read it never serves a random key: the serve run fails naming `no secret at \u002Fbeet-site\u002F\u003Cstage>\u002Fssh-host-key` (or the `AccessDenied`), the unit restarts every 3s and `\u003CLightsailRelease\u002F>` fails on the climbing `NRestarts`. A local `serve` reads the same record from `secrets.toml`, so local and both stages present one fingerprint.\n- **DNS** (stage-aware, and this is why `--stage` matters): `dev` publishes ONLY `dev.beet.org` (proxied) + `app.dev.beet.org` (DNS-only). `prod` publishes the apex `beet.org` + `www.beet.org` (proxied) + `app.beet.org` (DNS-only). A `dev` deploy can never touch production apex DNS.\n\nThe generic `beet` binary reads the whole site from ONE store at runtime, the per-stage repo store `beet-site--\u003Cstage>--repo` (the `\u003CS3BucketBlock label=\"repo\" {RepoStoreBlock}\u002F>` declaration in `site\u002Fmain.bsx`), under a per-deploy prefix: `\u003Cdeploy id>\u002Frepo\u002Fmain.bsx`, `\u003Cdeploy id>\u002Frepo\u002Froutes\u002F`, `\u003Cdeploy id>\u002Frepo\u002Ftemplates\u002F` and `\u003Cdeploy id>\u002Frepo\u002Fassets\u002F` all live in it, mirrored from the staging dir `\u003CRepoStage>` assembles in `target\u002Finfra\u002Fbeet-site\u002Frepo\u002F`. The binary sits beside the document as `\u003Cdeploy id>\u002Fbin\u002Fmain-lightsail`, the ledger as `\u003Cdeploy id>\u002Fledger.json`, and `current\u002F` holds the served ledger and the release pointers. The box learns which prefix to read from the release pointer at every start (`BEET_REPO` in `current\u002Fmain-lightsail.env`), so a rollback moves the binary and its document together, and a content-only `sync` publishes into the prefix the running box already reads. No deployed binary reads `beet-site--shared--assets`; that bucket is the developers' source of record for `site\u002Fassets`, owned by `just site-shared pull|push` and untouched by any stage deploy. (The separate `beet--shared--assets` bucket backs the WORKSPACE `.\u002Fassets` tree the examples and tests read; `just beet-shared pull|push`. The two trees are not mirrors: `blog\u002F` and `branding\u002F` belong to the site, and a few workspace-owned source files (the geoip database, the robot faces) are borrowed by the `\u003CDirCopy\u002F>` manifest in `site\u002Fmain.bsx`: into the staging dir under the deploy's `\u003CRepoStage>`, and into `site\u002Fassets` by the local `assets` verb. The `\u003CDerive\u002F>` beside each `\u003CDirCopy\u002F>` ensures the site's derived files the same way, regenerating only a stale or missing one. Neither tree nor bucket holds a build output: the site boots no wasm, the browser binaries are built into `target\u002Fwasm` by whatever uses them, and a deploy that ships one builds it with a `\u003CWasmRuntime\u002F>` before its stage (the example entries publishing `examples\u002Fbsx_site` do), never borrowing a stored copy.) The deployed binary is built with `--features aws_sdk,ssh,geoip` (see `\u003CLightsailBeetSiteBlock features=\"aws_sdk,ssh,geoip\"\u002F>` in `site\u002Fmain.bsx`), so the served site includes the ssh terminal and country lookups. `aws_sdk` alone would serve http only.\n\n**The site entry declares its own infrastructure.** `site\u002Fmain.bsx` is a one-shot `\u003CCliServer{always:true}>` dispatcher whose site is the `serve` route (the box launches `app --repo=s3:\u002F\u002F.. --server=http,ssh serve`, and a developer launches `beet --entry=site serve --server=http`: one process, one argv, the same verb). Its raw analytics, rollup, and archive stores are declared ONCE under the stage `\u003CStack>` as writable `\u003CS3BucketBlock\u002F>` declarations: the deploy provisions them and runtime consumers reach them through the job's own fields, `AnalyticsRollupJob{raw: $analytics, rollups: $analytics, archive: $archive}`. Each composes `\u003Capp>--\u003Cstage>--\u003Clabel>` from the `app_name` on the entry's `\u003CPackageConfig\u002F>`; locally the same declarations attach `FsStore`s under `target\u002Fstores\u002F\u003Capp>--\u003Cstage>--\u003Clabel>`. The deploy verbs do not load in the deployed binary at all: a `\u003CFragment bx:cfg=\"feature:infra && feature:extra\">` inside the `\u003CStack>` holds them (the stores stay outside it, since an excluded declaration binds to nothing), and it is excluded before the build walk in a binary that links neither crate, leaving a tombstone that reports the condition if anything dispatches into it. A `Router` is a url space, so the site's urls stay rooted at `\u002F` and no http\u002Fssh request can reach a deploy route (`curl \u002Fdeploy` -> 404).\n\n**The box is replaced only when the BOX changes.** The instance's `user_data` renders machine config alone (the blueprint, Caddy, the sshd relocation, the CloudWatch agent, the SSM agent removal, the systemd unit), never a version, so a code-only deploy plans no change to `aws_lightsail_instance`. The binary instead reaches the box through the repo bucket's stable release pointer, `s3:\u002F\u002Fbeet-site--\u003Cstage>--repo\u002Fcurrent\u002Fmain-lightsail.env`, which names this deploy's id, its versioned artifact key and the document prefix it was built against. The unit's `ExecStart` is a launcher (`\u002Fusr\u002Flocal\u002Fbin\u002Fbeet-site-run`) that re-reads that pointer at every start, so `systemctl restart` IS the deploy, and `\u003CLightsailRelease\u002F>` (after `\u003CTofuApply\u002F>`) performs it over the management sshd on 2222 and gates on the box actually serving: the RUNNING process reports this deploy's id (read from `\u002Fproc\u002F\u003CMainPID>\u002Fenviron`), one request through the app's own port on loopback is answered, and `NRestarts` is unchanged across that whole check. A fetch that fails leaves the installed binary serving rather than killing the unit.\n\nEditing `LightsailBlock::build_user_data` (bumping `CADDY_VERSION`, changing the unit, moving the management port) IS a rebuild: terraform cannot update `user_data` in place, so the instance is destroyed and recreated, and the IAM access key rolls with it (the roll trigger is keyed on a digest of the rendered script, so the key rolls with every machine-config change; a rebuild from a non-script change, ie a bundle resize, keeps its key). Budget several minutes AFTER the instance reports `running` for cloud-init to install Caddy, pull the binary from S3 and start the unit; the static IP re-attaches so the address and DNS are stable. Caddy is enabled by cloud-init but STARTED by `\u003CLightsailRelease\u002F>`, once the apply has re-opened the firewall (started at boot it raced the ports resource, and every ACME attempt against a closed 80 burned Let's Encrypt's per-hostname validation budget). There is still no circuit breaker and no automatic rollback: a binary that fails to boot leaves a broken box. Rolling back is re-pointing the release pointer (`beet rollback`, which rewrites it) and restarting the unit.\n\nThis matters beyond the outage window. `small_3_0` is burstable at a **20% baseline per vCPU**, and a fresh instance starts at ZERO burst capacity, so a rebuild does the heaviest work of the instance's life while clamped to baseline. That is what produced the cluster of AWS SDK `dispatch failure` errors within ~75 seconds of unit start on a freshly deployed box. The SDK times its lookup, socket and tls handshake as one connect, 3.1s by default, which a clamped box's first handshakes outlast; every beet SDK client now waits `aws_ext::STALL_TIMEOUT` (10s) instead, see the 2026-10-16 guard below. Covered by `code_only_deploy_renders_one_box` and `machine_config_change_rebuilds_and_rolls` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`.\n\n**`beet-deploy` exiting 0 does NOT mean the SITE serves.** The deploy's last steps are a timed log tail and a cache purge, neither of which gates on readiness, and cloud-init failures do not propagate back to it. `\u003CLightsailRelease\u002F>` now proves the APP serves: an `active` unit carrying this deploy's id that answers a request on its own port with no restart underneath, so the old failure where a crash-looping box reported `is serving release ..` after ~340 restarts is closed, and a deploy exiting 0 while `LightsailWatch` prints a fatal boot error in that same log should not recur. What the gate deliberately cannot see is everything in FRONT of the app: it probes loopback, so Caddy, DNS and certificate state are all still unproven. ALWAYS curl the site after the deploy returns. Diagnosis path for a bad origin:\n\n- **Cloudflare `521`** = the edge reached DNS but nothing accepted on the origin's 443. **`526`** = Caddy answered but its cert is not valid for the Full-strict edge.\n- Get a real shell on the management sshd (port **2222**, the stack's Lightsail key pair, user `ec2-user`). Every deploy materialises that key beside the rendered config as `target\u002Finfra\u002Fbeet-site\u002Fdeploy_key.pem` (mode 600) for `\u003CLightsailRelease\u002F>`'s own ssh, so reach for it rather than digging the tofu state's `aws_lightsail_key_pair` out by hand: `ssh -i target\u002Finfra\u002Fbeet-site\u002Fdeploy_key.pem -p 2222 ec2-user@app.\u003Cstage-host>`. It is the stage of the LAST deploy, so re-run the deploy's stage before trusting it, and a `beet-destroy` removes the work directory with it (`plan` and `validate` do not write it back), so between dev's teardown and the prod deploy there is no key on disk: a PRE-deploy baseline of the prod box (`uptime`, `NRestarts`, the running `BEET_DEPLOY_ID`) reads `private_key` off the `aws_lightsail_key_pair` in the pulled state, written straight into a mode 600 file under `.agents\u002Ftmp\u002F` and deleted once the deploy has materialised the real one. The state is client-side encrypted, so pull it through `beet secrets\u002Fexec -- sh -c 'TF_VAR_tf_state_passphrase=$TF_STATE_PASSPHRASE tofu -chdir=target\u002Finfra\u002Fbeet-site state pull > \u003Cfile>'` (the redirect INSIDE the quotes: `secrets\u002Fexec` logs to stdout too): it hands the passphrase to tofu's environment and redacts it from any output, where a `secrets\u002Fget` piped by hand put a prefix of it into a transcript once (2026-09-22). The `site` and `shared` stacks share that work directory, and a package verb (`just beet-deploy`, its `--dry-run`, `all\u002Fplan`) renders `shared` last, so afterwards it holds the bucket stack's config and a `state pull` there reads the wrong state, with no key pair in it (seen 2026-10-21): re-render the stage stack first with `just beet-validate --stage=\u003Cstage>`, which re-inits the backend, and confirm `jq .terraform.backend.s3.key target\u002Finfra\u002Fbeet-site\u002Fmain.tf.json` names `beet-site--\u003Cstage>--tofu-tfstate`. Rolling the passphrase itself is `roll-state` per stack (`just beet-roll-state [--stage=prod]`, and the same verb through `site-shared`, `beet-shared` and `site-social --stage=prod`); the record's own `roll` note in `secrets.toml` has the four commands. Then: `systemctl is-active caddy beet-site`, `ss -lntp`, and `sudo grep -iE \"error|fail\" \u002Fvar\u002Flog\u002Fcloud-init-output.log`.\n- `beet-site` active on its app port while `caddy` is missing means the TLS terminator failed to install and everything else is fine.\n\nREGRESSION GUARD (fixed): the deploy shipped a binary it never built. A block is declared under its `\u003CStack>` rather than as a step in the deploy sequence, so nothing dispatches it and its `BuildArtifact`'s action never ran; `\u003CTofuApply\u002F>` went on reading that artifact's file off disk, hashing it and uploading it, so every deploy silently shipped whatever an earlier deploy had left in `target\u002F` (and on a machine with no prior artifact would fail on a missing file instead). The box then crash-looped on `failed to load entry main.bsx: no component, resource or template registered for tag Stack`, warning that types newer than the stale binary were unregistered, while `beet-deploy` reported success. Building now belongs to the step that CONSUMES the artifact: `TofuApply` calls `BuildArtifact::build()` immediately before reading each artifact's bytes, so an artifact that is uploaded but never built is unrepresentable. Covered by `build_runs_the_declared_process` in `crates\u002Fbeet_infra\u002Fsrc\u002Factions\u002Fbuild_artifact.rs`. A deploy log with no `building: cargo-zigbuild ..` line is this bug back.\n\nREGRESSION GUARD (fixed): a rebuild reset the box's firewall and took prod down. `aws_lightsail_instance_public_ports` names the instance by NAME, which survives a rebuild, so nothing in its own config diffs and the plan leaves it untouched while the replaced instance comes up with Lightsail's DEFAULT rules (22 + 80). State then claims ports AWS has closed. Live, the `--store` -> `--repo` argv change replaced the prod box and shut both 443 (`522` at every hostname, the site down with a perfectly healthy app behind it) and the management ssh port, so `\u003CLightsailRelease\u002F>` sat on `waiting for ssh on \u003Cip>:2222 (attempt N\u002F60)` for 25 minutes; opening the two ports by hand let the release pass INSTANTLY with `beet: already serving`, which is the tell that the box was never the problem. The ports resource now carries `replace_triggered_by` on the instance, exactly as the static IP attachment already did. Covered by `rebuilding_the_box_reapplies_the_firewall` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`. Diagnose with `aws lightsail get-instance-port-states --instance-name beet-site--\u003Cstage>--main-lightsail-instance`: a rebuild deploy whose plan does not list the ports resource is this bug back.\n\nREGRESSION GUARD (fixed): a boot-time Let's Encrypt failure left the box serving TLS the edge rejects, with nothing in the deploy that notices (`\u003CLightsailRelease\u002F>` probes loopback). Twice live: once the chain download failed after a successful validation, and once (2026-09-11) a rebuilt prod box came up during a Let's Encrypt secondary-validation outage with its first attempts already lost to the firewall race, so `beet.org` and `www.beet.org` served `525` for two hours (distinct from `521`: something IS listening on 443, its cert is just not one Full-strict accepts) while the certificate the previous box had held was valid the whole time. A rebuild now restores the saved certificate store before Caddy starts, and Caddy starts from the release step rather than racing the firewall. Covered by `rebuild_restores_the_certificate_store` and `release_starts_the_tls_terminator` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`. On a `525` check `sudo find \u002Fvar\u002Flib\u002Fcaddy -name '*.crt'` for the MISSING hostname and `sudo journalctl -u caddy`; if Let's Encrypt itself is failing (`During secondary validation`, `serverInternal`) check their status page and community forum before restarting Caddy, since every restart burns validation attempts against a limit of 5 per hostname per hour.\n\nREGRESSION GUARD (fixed): Caddy was installed via its cloudsmith rpm repo, whose setup script writes an `amzn\u002F2023` baseurl that Caddy does not publish, with `skip_if_unavailable=1`. `dnf install -y caddy` therefore exited `No match for argument: caddy`, cloud-init logged a failed `scripts-user` module and carried on, and the box booted serving the app on its own port with NOTHING on 80\u002F443, while `beet-deploy` reported success and every hostname returned `521`. Caddy is now installed from the pinned upstream static release (`LightsailBlock::CADDY_VERSION`) with its own systemd unit, and the script verifies the binary (`caddy version || exit 1`) so a failed install stops the boot instead of silently producing a TLS-less box. Covered by `installs_caddy_from_static_release_not_rpm` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`.\n\nREGRESSION GUARD (fixed, 2026-10-15 prod): the CloudWatch agent logs to its own file, not the journal, so the `AccessDenied` sweep above never saw it denied. Every `collect_list` entry carried `retention_in_days`, and agent `1.300071.0` answers that with `logs:DescribeLogGroups`, which the box's identity is never granted: five `AccessDeniedException ... no permissions boundary allows the logs:DescribeLogGroups action` lines at each boot, harmless (the agent gives up and ships anyway) but a box asking for a grant it should not hold. Retention belongs to the stack's `aws_cloudwatch_log_group` alone; covered by `the_stack_owns_log_retention` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`. Prod `01a13e61` booted before the fix, so its agent log keeps those five lines until its next rebuild. Box check: `sudo grep -c AccessDenied \u002Fopt\u002Faws\u002Famazon-cloudwatch-agent\u002Flogs\u002Famazon-cloudwatch-agent.log` reads `0`.\n\nREGRESSION GUARD (fixed, 2026-10-16 dev): an elevated deploy converged its credentials, then its child `deploy` failed ~11s in with a bare `Internal Error: dispatch failure`, printed three times and three more by the parent. `dispatch failure` is the AWS SDK's `SdkError::DispatchFailure`, whose message hides its cause; a 500 or a failed command now reports the cause beside it (`ErrorReport`, `crates\u002Fbeet_core\u002Fsrc\u002Fbevy_utils\u002Ferror_report.rs`), and this shape reads `ConnectorError { kind: Timeout, .. HttpTimeoutError { kind: \"HTTP connect\", duration: 3.1s } }`: the child's first call, `sts:GetCallerIdentity` naming the state bucket, never connected within the SDK's default 3.1s on any of its three attempts (three of those plus backoff is the 11s, reproduced as 11.2s against an unroutable `AWS_ENDPOINT_URL_STS`). Not the credentials (the child loads the pair the elevation resealed, its `2 env var(s) set`, and a bad pair is an STS `403`) and not the region (`beet-state-898915787211` IS in ap-southeast-2, which `GetBucketLocation` answers from us-east-1). The network was: the router advertises an ipv6 route and two ipv6 nameservers over a link that carries no ipv6, so `systemd-resolved` intermittently stalls a lookup on them for seconds (its journal logs `Using degraded feature set .. for DNS server 2001:fb0:..` at the failure times), and the SDK times the lookup inside its connect. Every beet SDK client now starts from `aws_ext::loader()`, waiting `aws_ext::STALL_TIMEOUT` (10s) at the connect and at the stall grace alike (the 5s grace fired next, as `ThroughputBelowMinimum`); covered by `outlasts_a_stalled_lookup` in `crates\u002Fbeet_net\u002Fsrc\u002Fstore\u002Faws_ext.rs`. `tofu init` has the same exposure on its own (`registry.opentofu.org .. context deadline exceeded`, since that host, unlike AWS's, has an ipv6 address): `curl -6 -m 5 https:\u002F\u002Fregistry.opentofu.org` timing out is the tell, and the fix is the network's, ie `nmcli connection modify \u003Cwifi> ipv6.method disabled` (or `ipv6.ignore-auto-dns yes`) on a link like this one, else a retry.\n\nAN INTERRUPTED APPLY LEAVES TWO MESSES, AND BOTH BLOCK THE RETRY. A deploy killed mid-apply (SIGTERM, a lost terminal, a timeout) leaves (1) a stale state lock and (2) resources that exist in AWS but not in state, because tofu creates them before it persists. The retry then fails twice over: first `Error acquiring the state lock` naming a lock id and the time it was `Created`, then a wall of `EntityAlreadyExists` \u002F `ResourceAlreadyExistsException`. Neither is a code fault and neither self-heals. Recovery, in order:\n\n1. Confirm nothing is actually running (`pgrep -af tofu`), then `tofu -chdir=target\u002Finfra\u002F\u003Capp> force-unlock -force \u003CLOCK_ID>` using the id from the error. The lock is an object in the state bucket (`\u003Ckey>.tflock`); deleting it by hand works but skips the id check.\n2. Diff `tofu -chdir=target\u002Finfra\u002F\u003Capp> state list` against what AWS actually holds, and `tofu import \u003Caddress> \u003Cid>` each orphan. Prefer import to deleting and recreating whenever the resource is live (a schedule that has fired, a log group holding evidence). The ids are per-type: a log group is its name, an IAM role its role name, an inline role policy `\u003Crole>:\u003Cpolicy>`, a policy attachment `\u003Crole>\u002F\u003Cpolicy-arn>`, a lambda its function name, a scheduler schedule `\u003Cgroup>\u002F\u003Cname>` (ie `default\u002F\u003Cname>`).\n3. Re-run the deploy; it should now converge to no-op plus whatever genuinely changed.\n\nCHECK THE REAL EXIT CODE. `just beet-deploy ... | sed ...; echo $?` reports the exit of `sed`, so a deploy killed by a signal reads as success. Redirect instead of piping (`just beet-deploy --stage=prod > log 2>&1; echo \"EXIT=$?\"`) and strip the ANSI afterwards, or set `-o pipefail`. `just` prints `recipe ... was terminated ... by signal 15` on the line above, which is the real tell.\n\nAN APPLY OUTLIVES MOST TOOL DEADLINES; RUN IT DETACHED. A full deploy takes 10-15 minutes, and a deploy driven from a tool with a kill deadline (an agent harness, a CI timeout) can SIGTERM the mid-flight apply, leaving exactly the two messes above. Run it detached and watch the log instead: `setsid nohup sh -c 'just beet-deploy --stage=prod > .agents\u002Ftmp\u002Fdeploy.log 2>&1; echo \"EXIT=$?\" >> .agents\u002Ftmp\u002Fdeploy.log' &`, then tail the log until the `EXIT=` line appears.\n\nREGRESSION GUARD (fixed, 2026-10-23): a detached deploy's 300s watch printed NOTHING between `tailing CloudWatch log group` and `watch timed out`, prod 10-21 and 10-23 alike, while the box's lines did reach CloudWatch. The `aws` cli is python, which block-buffers a stdout that is not a terminal, and the timeout's kill discarded the buffer, so the watch could never show a fatal boot error in exactly the mode this section requires. `AwsWatch` now runs the tail with `PYTHONUNBUFFERED=1` (`crates\u002Fbeet_infra\u002Fsrc\u002Factions\u002Faws_watch.rs`); a detached deploy log with an empty watch on a box that logged is this bug back.\n\nREGRESSION GUARD (fixed): the release step passed a box that never served. `\u003CLightsailRelease\u002F>` confirmed only that the unit was `active` and that `\u002Fproc\u002F\u003CMainPID>\u002Fenviron` carried this deploy's id, but under `Restart=always`\u002F`RestartSec=3` a crash-looping unit ALWAYS has a live `MainPID` carrying the right id, so a deploy exited 0 while the box 502'd and restarted ~340 times. The converge loop is now the gate: an attempt passes only when the unit is active, the running process reports the expected id, `curl -fsS --max-time 5 http:\u002F\u002F127.0.0.1:\u003Capp_port>\u002F` succeeds, AND `NRestarts` is unchanged across the whole attempt (a crash loop that answers one lucky request between restarts still fails). The probe is loopback deliberately: with a domain the firewall opens 80\u002F443 only, so the app port is reachable from the box alone, which is exactly \"the app itself serves\". Covered by `release_proves_the_running_process` and `release_probes_the_declared_port` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`. A release step reporting success on a box whose `NRestarts` is nonzero is this bug back.\n\nDo NOT read a single `curl: (22) The requested URL returned error: 500` in that step's narration as a failure. The script logs the stderr of EVERY attempt, so one failed probe followed by a pass is a converge loop doing its job, and on a fresh box the first request routinely is that failure: the box's very first `\u002F` is served while the instance is still at zero burst capacity, and it 500s on an AWS SDK `dispatch failure` reaching the repo store, the same clamp described under Topology. The tell that it was transient rather than a crash loop is the box log, request `#1 -> 500`, `#2 -> 200 OK`, plus `NRestarts=0` afterwards. A `500` that repeats across attempts fails the gate on its own and the deploy never reaches this line.\n\n## Commands\n\nEvery credential the deploy needs (the AWS pair, `CLOUDFLARE_API_TOKEN`), and the box's ssh host key its apply writes into the stack (`BEET_SSH_HOST_KEY`, see Topology), is a record of the repo's `secrets.toml`, loaded into the process environment by the launch before the entry builds; there is no `.env`. The AWS pair and the Cloudflare token are the repo's **deploy credentials**, declared at the site entry's root (`\u003CAwsDeployCredential\u002F>`, `\u003CCloudflareDeployCredential\u002F>`) and lowered from what the stacks declare at the launch's stage and at prod: the AWS pair is the IAM user `beet-deploy`, one managed policy per app (`beet--deploy`, `beet-site--deploy`, `beet-social--deploy`) and a boundary per app and stage; the Cloudflare token is `beet-deploy`, four zone permission groups on `beet.org` and nothing at the account. Nobody mints either: every deploy checks both against the declarations before it writes anything, and refuses naming `--elevated` when they fall short (a block whose service the policy does not grant, a bucket declared or its retention changed, a deletion of production data, a sealed credential whose record carries no `grants` metadata because it was converged before records carried them). `destroy` passes the same gate, so a refusal blocks a teardown exactly as it blocks a deploy. The elevated deploy asks for the six-digit code and the Cloudflare dashboard login, only as each credential needs it, converges them, and runs the same deploy. An agent cannot answer those prompts: when a deploy refuses, print its message to the operator as it is (it ends with the command to run in a terminal), never paraphrased. A failed command, a refusal included, is reported once, as one `ERROR` line on stderr: `` `\u002Fdeploy` failed with exit code \u003Ccode>: \u003Creport> ``, its cause beside it; stdout carries a success's answer alone, and a failed child the elevated deploy runs reports itself, its parent only `` `deploy` exited with \u003Ccode> `` and the converge report. That command names the running program (`target\u002Fdebug\u002Fbeet ...`), which stays deploy-capable only until something rebuilds `beet-cli` without `infra,extra` (ie the screenshot check's `cargo run -p beet-cli`), so the recipe form (`just beet-deploy --elevated`) is the durable equivalent. `--dry-run` on any deploy says, asking for nothing, what each credential would hold and whether the deploy needs `--elevated`, which is also how you see what the declarations ask of Cloudflare, since a 403 there names no permission group. The provider addresses (the region, the Cloudflare account and zone) are not secrets: they are `{AwsRegion(..)}`, `{CloudflareAccount(\"..\")}` and `{CloudflareZone{..}}` spreads on the entry's root `\u003CRouter>` (or a stack), resolved by ancestry and never read from the environment, so a stack with none fails its render naming the spread. Reading the document needs this machine's age identity (`beet secrets\u002Fcheck` says whether it opens, `beet secrets\u002Fls` lists the records with what each is and how it rolls). Always use the `beet-*` and `site-*` recipes: they build with `--features infra,extra`, without which the deploy routes load as inert tags and the verb does nothing.\n\n`just beet-deploy` is the site's PACKAGE deploy, `all\u002Fdeploy` (built with `atproto` too): the stage stack, the `shared` assets bucket and the `social` handles, in that order, past ONE gate, so a refusal names every stack's reasons and an elevated run asks for each human factor once. The stage stack's own verbs sit under `site\u002F` (`just site-stage deploy|plan|destroy|..`, and the `beet-sync`, `beet-watch`, `beet-destroy`, `beet-validate`, `beet-plan` recipes); `all\u002Fplan` plans all three (`cargo run -p beet-cli --features infra,extra,atproto -- --entry=site all\u002Fplan --stage=prod`). A dev cycle uses the stage stack alone: the package would also apply the real `shared` bucket and stand up a `beet-social--dev` stack that `beet-destroy` leaves behind.\n\n| intent | command |\n| --- | --- |\n| local serve (http+ssh) | `cargo run -p beet-cli -- --entry=site serve --server=http,ssh` |\n| pre-apply safety check | `just beet-validate` then `just beet-plan` (eyeball the plan) |\n| dev deploy (the stage stack alone) | `just site-stage deploy` |\n| re-publish site only (no redeploy) | `just beet-sync` |\n| tail the instance logs | `just beet-watch` |\n| dev destroy | `just beet-destroy` |\n| prod deploy (the package: stage, shared, social) | `just beet-deploy --stage=prod` |\n| prod deploy of the stage stack alone | `just site-stage deploy --stage=prod` |\n| whether a deploy needs `--elevated`, and what each credential would hold | `just beet-deploy --stage=prod --dry-run` |\n| an elevated deploy (the operator, in a terminal) | `just beet-deploy --stage=prod --elevated` |\n\n`just beet-plan --stage=prod` shows the prod plan without applying.\n\n## Verification (IDENTICAL for every step)\n\nEach step verifies its environment with the same five checks. Parameters: a `BASE_URL` (`http:\u002F\u002Flocalhost:\u003Cport>` for local, `https:\u002F\u002Fdev.beet.org` for dev, `https:\u002F\u002Fbeet.org` for prod) and an SSH target (`127.0.0.1` + the local ssh port for local; the DNS-only `app.` subdomain + port 22 for dev\u002Fprod, ie `app.dev.beet.org` \u002F `app.beet.org` -- the bare `dev.beet.org`\u002F`beet.org` are Cloudflare-proxied web-only and do NOT forward ssh). All five must pass.\n\n### a. curl (raw http)\n\nGET each key page; assert HTTP 200 and the expected marker:\n\n- `\u002F` (home) -> 200, renders the landing page\n- `\u002Fdocs` -> 200, and its head carries `\u003Cmeta name=\"robots\" content=\"noindex\" \u002F>`: every docs page is `visibility = \"unlisted\"`, served to whoever holds the url and listed nowhere (no sidebar, sitemap, search index or feed entry), and the header's Docs link and the landing page's Get Started button are `hidden`\n- `\u002Fdocs\u002Fdesign` -> 200\n- `\u002Fsitemap.xml` -> 200 and carries no `\u002Fdocs` url\n- `\u002Fdocs\u002Fdesign\u002Fcounter` -> 200, body contains `Counter` and `You have clicked`\n- `\u002Fdocs\u002Fdesign\u002Fcolor_schemes` -> 200 (the styles page)\n- `\u002Fblog` -> 200, and the body carries a `\u002Fblog\u002F\u003Cslug>` link per post. The listing is generated by `\u003CRouteIndex reverse=\"true\"\u002F>` in `site\u002Froutes\u002Fblog\u002Findex.bsx` rather than maintained by hand, so a scan that found no posts renders an EMPTY page that still answers 200: assert the count, not the status.\n- `\u002Fblog\u002Ffolk-technology` -> 200 (a post reached by its slug, the segment `\u003CRoutesDir\u002F>` derives from the post's own `slug` frontmatter rather than its `\u003Cnumber>-` filename)\n- `\u002Fblog\u002Fpost-6` -> **301** to `\u002Fblog\u002Ffolk-technology`. Every post was renamed from `post-\u003Cn>` to a slug, and `site\u002Fmain.bsx` keeps the old urls alive with a block of `\u003CRedirect path=\"post-\u003Cn>\" redirect=\"\u003Cslug>\"\u002F>`. That block is part of the entry document the box loads out of the repo store, so it is exactly as deployable-and-breakable as a route: sweep all fifteen (`for n in $(seq 1 15); do curl -o \u002Fdev\u002Fnull -w '%{http_code} %{redirect_url}\\n' \"$BASE\u002Fblog\u002Fpost-$n\"; done`) and assert every one is a 301 to a slug that itself answers 200. A `\u003CRedirect\u002F>` carries no `PageRoute`, so it is absent from the sidebar and from `RouteIndex`, and nothing but this check covers it.\n\nAlso fetch `\u002Fdocs\u002Fdesign\u002Fcounter?color-scheme=light` and `?color-scheme=dark` and confirm 200 (the scheme is applied server-side for the screenshot check below).\n\n`\u002Fdeploy` -> **404**. The `Router` is a url space, so a served request can never reach the sibling deploy commands; a 200 here means the site's routes and the stack's have been merged into one namespace.\n\n`\u002Fwasm\u002Fbeet-full.wasm` and `\u002Fassets\u002Fwasm\u002Fbeet-full.wasm` -> **404**, and no served page carries a `.wasm` `src`\u002F`href` or an `application\u002Fvnd.beet.bootstrap` script. The site boots no wasm and neither its repo store nor `site\u002Fassets` holds a build output, so a 200 here means a `\u003CDirCopy\u002F>` list borrowed one again.\n\n`\u002F` with `Accept: application\u002Fjson` -> **200** with an `application\u002Fjson` body (the page serialized by the `TemplateRenderer`), and an unknown path with the same header -> **404**. REGRESSION GUARD (fixed, 2026-09-18 dev): the renderer handed the `TemplateRenderer` an EMPTY accepts list, which it read as a mismatch against nothing, so every request carrying `Accept: application\u002Fjson` was a 500 on every page including the 404 page. Nothing in checks a-d sends that header, so the first evidence was the box log: scanner probes at `\u002Fgraphql` and `\u002Fv2\u002F_catalog` logging `accept mismatch: requested [], available [Json]` beside `500 Internal Server Error` while `\u002Fwp-admin` and friends 404'd. Every render target now receives the media type it was chosen for (`RenderTargets`), covered by `serializes_the_scene` in `crates\u002Fbeet_ui\u002Fsrc\u002Frender\u002Frender_target.rs`. Scan the box log for ` 500 ` after every deploy: a 500 on a path that should 404 is a content negotiation fault, not a scanner (a bare ` 500 ` also matches `in 500 µs` timings, so count `-> 5[0-9][0-9]` instead). One `no component, resource or template registered for tag \u003CSecrets>, building it inert` warning per boot, box and lambda alike, is by design: `site\u002Fmain.bsx` keeps the tag unconditional so the prescan sees it, and the deployed build links no `vault`. The scanners probing port 22 log at INFO as `SSH handshake refused: ..` (`invalid SSH version string`, `No common Key algorithm`) and their dropped sockets at DEBUG, so an ssh `ERROR` line in the box log is a real fault; until 2026-10-23 they logged ~20 `SSH session error` lines a day.\n\n### b. browser verification (navigability, the counter, client errors, mobile layout)\n\nThe counter (`site\u002Froutes\u002Fdocs\u002Fdesign\u002Fcounter.bsx`) renders a document field as \"You have clicked N times.\", with a \"More\" and a \"Less\" button whose `bx:click` scripts mutate it. The browser check asserts first paint only: there is no client interactivity tier until the wasm one lands, so a click in the browser does nothing yet. The whole check is one committed test driving the in-house webdriver (`chromedriver` + a chromium on PATH are the only deps):\n\n```sh\nBEET_BASE_URL=\u003CBASE_URL> cargo test --test site_browser \\\n  --features router,json,testing,webdriver -- --include-ignored\n```\n\n`tests\u002Fsite_browser.rs` runs everything below and exits non-zero on any client error or overflow. The checks:\n\n**Client errors (fail on any).** Before navigating, two collectors attach and the run fails if either fires, so a broken client script cannot ship silently -- exactly the miss that let `crypto.randomUUID is not a function` reach the analytics beacon in production:\n\n- `page.console()` -- `console.error` plus uncaught exceptions and failed-request console messages (BiDi `log.entryAdded`).\n- `page.responses()` -- any 4xx\u002F5xx subresource. A favicon that fails to load raises no console error, so without this a site whose every asset 403s still reports green.\n\n**Asset sweep.** Load a page that actually carries an image (`\u002Fblog\u002Ffolk-technology`), collect every `\u002Fassets\u002F` reference on it (`img[src]`, `link[href]`, `script[src]`, `source[src]`), fetch each following redirects, and assert 200. This is the store-topology check: the app serves assets from its own bucket, and a private bucket handing out a public url turns every asset into a redirect to a 403. Both this and the response collector were added after exactly that shipped past a green run (`S3Store::public_url` claimed a virtual-hosted url for a private bucket; it now returns `None` unless the store is explicitly `with_public(true)`).\n\nIgnore nothing by default; if a message is genuinely benign, match it exactly and log that it was skipped. CAVEAT: some faults only surface in an insecure context -- `crypto.randomUUID`\u002F`crypto.subtle` are gated to secure contexts, and localhost + `https:\u002F\u002F` are both secure, so this check does NOT reproduce that specific bug. The durable fix is keeping secure-context-only APIs out of the client (the beacon now derives its id from `crypto.getRandomValues`, available on plain http); the collectors still catch the broad class of client JS errors on every env.\n\n**Counter + navigability.** Headless chromium: goto `BASE_URL\u002Fdocs\u002Fdesign\u002Fcounter` and assert its first paint (\"You have clicked 0 times\", plus the \"More\"\u002F\"Less\" buttons). Then navigate `\u002F` -> `\u002Fblog` -> a post (`\u002Fblog\u002Fbevys-five-and-beets-alive`) via in-page links at a desktop viewport (proves the site is navigable, not just direct loads; the docs are unlisted, so no visible link leads there). Assert the unlisted docs stay out of sight: `\u002F` shows no visible `a[href^='\u002Fdocs']` (the `hidden` ones have no client rects), the sitemap names no `\u002Fdocs` url, and `\u002Fdocs` carries `noindex`. Then load `\u002Fblog` + the post so the beacon runs on a content page -- the pages the client error was reported on.\n\n**Desktop layout (tables inside the column, a content-independent rail).** At 1280x800 (inside the sidebar rail's shrink range) and 1920x800 (past the column's measure cap), for `\u002Fdocs\u002Fdesign\u002Ftable`, `\u002Fdocs\u002Fcrates` and `\u002Fdocs\u002Fsecrets`, assert every `main table` (its `.table-scroll` wrapper where it has one) sits within the extent of the page's `main h1`, and that `#sidebar` is exactly as wide as on the prose page `\u002Fdocs\u002Fabout`; on `\u002Fdocs\u002Fdesign\u002Fcolor_schemes`, that no `.color-box` swatch overflows its box (a fixed `height` in `site\u002Ftemplates\u002FStyles.bsx` once clipped every two-line label, now `min-height`) and every swatch shares one font size (the `Error` swatch, `class=\"color-box error\"`, once took beet_ui's `.error` box rule and its small type; that class is now `.error-box`, and `no_class_is_named_after_a_color_role` in `crates\u002Fbeet_ui\u002Fsrc\u002Fstyle\u002Fmaterial\u002Fclasses\u002Fmod.rs` keeps every material class off the colour role names). Regression guard: a wide table stretched past the article column, and `\u003Cmain>` sized its flex basis from its content, so a table page drove the rail to its floor while prose shrank it. Fixed by the measure on the table wrapper (`crates\u002Fbeet_ui\u002Fsrc\u002Fstyle\u002Fmaterial\u002Fclasses\u002Ftable.rs`) and the fixed `main_content_basis` (`crates\u002Fbeet_ui\u002Fsrc\u002Fstyle\u002Fmaterial\u002Fclasses\u002Flayout.rs`).\n\n**Mobile layout (no horizontal overflow).** At viewports 375x812 and 320x812, for `\u002F`, `\u002Fblog`, and `\u002Fblog\u002Fbevys-five-and-beets-alive` assert `document.documentElement.scrollWidth \u003C= document.documentElement.clientWidth + 1`, printing the offending elements on failure so the culprit is obvious. Regression guard: a `\u003Cpre>` code block or a wide embed used to blow `\u003Cmain>` past the viewport (`\u003Cmain>` is a flex item, fixed with `min-width: 0`), and the header nav overflowed at 320px (fixed with an `@media screen` app-bar `flex-wrap`).\n\nThe test asserts ZERO collected client errors across every navigation above; extend `tests\u002Fsite_browser.rs` if a deploy needs a check it does not cover, rather than scripting around it.\n\n### c. screenshot (styles + color schemes)\n\nScreenshot the home page, the counter page, and `\u002Fdocs\u002Fdesign\u002Fcolor_schemes`, each in default, `?color-scheme=light`, and `?color-scheme=dark`, via the cli: `cargo run -p beet-cli --features infra,extra -- screenshot '\u003CBASE_URL>\u002Fdocs\u002Fdesign\u002Fcounter?color-scheme=light' --output=.agents\u002Ftmp\u002F\u003Cstep>-counter-light.png` (an installed `beet` works too; the `infra,extra` set reuses the deploy build, where the bare form relinks `target\u002Fdebug\u002Fbeet` without the deploy verbs and again for check e). Save to `.agents\u002Ftmp\u002F`, then `Read` the PNGs and confirm they render styled (typography, buttons, layout present; light vs dark visibly differ), not an unstyled or broken page. The server-side default scheme is dark, so `default` and `dark` are expected to be identical. Also screenshot `\u002Fdocs\u002Fdesign\u002Ftable` at the default 1280 width and with `--width=1920`, confirming every table sits inside the article column (its right edge no further out than the heading's measure) and the sidebar rail keeps its prose width, the visual twin of check b's desktop layout stage.\n\n### d. ssh (the live terminal + multi-tenancy)\n\nThe site is also a navigable charcell TUI over ssh (`SshTuiServer`, multi-tenant). Connect non-interactively over a pty, navigate the listed pages and their history, open the unlisted counter by its url, then prove two clients run at once. The docs are unlisted, so no sidebar or visible link leads there, but a session opens at whatever url its client names as the ssh command (`ssh -t \u003Chost> \u002Fdocs\u002Fdesign\u002Fcounter`), as a browser does on the web.\n\n- connect: `ssh -tt -o StrictHostKeyChecking=no -o UserKnownHostsFile=\u002Fdev\u002Fnull -o ConnectTimeout=15 -p \u003Cssh_port> \u003Cuser>@\u003Chost>` (local: `-p \u003Cport> root@127.0.0.1`; dev\u002Fprod: the `app.` subdomain `app.dev.beet.org` \u002F `app.beet.org` on port 22, any user. The bare `dev.beet.org`\u002F`beet.org` records are Cloudflare-proxied and do not forward ssh; only the DNS-only `app.*` record points straight at the box's static IP. The stable `BEET_SSH_HOST_KEY` gives a consistent fingerprint, so `StrictHostKeyChecking=no` is safe.)\n- the handshake completing + a rendered frame appearing confirms the ssh server is up.\n- multi-tenancy: launch TWO ssh sessions at once (both backgrounded), drive both to different pages, and confirm BOTH render the site and respond independently with no crash\u002Fhang on either.\n- host key: `ssh-keyscan -t ed25519 \u003Chost> 2>\u002Fdev\u002Fnull | ssh-keygen -lf -` (port 22) must print the `BEET_SSH_HOST_KEY` record's fingerprint, computed without printing the key by `beet secrets\u002Fexec --only=BEET_SSH_HOST_KEY -- sh .agents\u002Fskills\u002Finfra-deploy\u002Fhost_key_fingerprint.sh`, which decodes the record into a private temp dir and runs `ssh-keygen -lf` on it. Locally (`-p \u003Cssh_port> 127.0.0.1`) the serve log names its source as `ssh host key from env $BEET_SSH_HOST_KEY`. A fingerprint that differs, or changes across a `systemctl restart beet-site`, means the box is not serving the record (on a box, the stack's write-only parameter the apply fills from it). Never read the parameter to compare: the fingerprint is the check.\n- rolling the host key: the record's own `roll` (`beet secrets\u002Fls`) has the steps. Generate a fresh ed25519 key into a mode 700 temp dir (`ssh-keygen -t ed25519 -N '' -C beet-site -f \u003Cdir>\u002Fkey`), seal it with `base64 -w0 \u003Cdir>\u002Fkey | beet secrets\u002Fset BEET_SSH_HOST_KEY --role=env_var --note=.. --roll=..` (every `set` restates the role, note and roll, and drops any it is not given, so copy them from `secrets\u002Fls`), delete the temp dir, then deploy each live stage. The full apply converges the parameter and `\u003CLightsailRelease\u002F>` restarts the box onto it: no rebuild, and the box is replaced only if its machine config changed anyway. Clients pinning the old key need `ssh-keygen -R app.beet.org`.\n\nREGRESSION GUARD (fixed, 2026-10-15 dev): the rolled record was base64 of the PEM file `ssh-keygen` writes, while the server read only base64 of the binary encoding inside it, so the box logged `ignoring malformed BEET_SSH_HOST_KEY: format encoding error` and the release build fell through to a fresh RANDOM key every start, a new fingerprint per restart with check d still green. Local check d cannot see it: a debug build falls back to a fixed key. The server now reads the PEM file, base64 of it (wrapped or not), or base64 of the binary encoding, and a declared key that parses as none of them fails the ssh server rather than serving under a stranger's fingerprint; covered by `parses_every_host_key_encoding` in `crates\u002Fbeet_net\u002Fsrc\u002Fssh\u002Fimpl_russh_server.rs`.\n\nREGRESSION GUARD (fixed, 2026-10-15): the site box's ssh host key rode its `user_data` env file (`LightsailBlock::with_secret_env_from_process`), so it was readable through the Lightsail api (`GetInstance`), the tofu state and every rendered `main.tf.json`, and a dumped render put it into a transcript and it had to be rolled. No compute block can render a secret any more (the `secret_env` channel is gone from Lightsail and Fargate): the box reads its key from the stack's secret store as above. Covered by `the_host_key_never_renders` (`crates\u002Fbeet_extra\u002Fsrc\u002Finfra\u002Ftemplates.rs`, a site-shaped stack rendered at dev and prod with a known key in the deployer's environment, in every encoding), `the_box_reads_exactly_its_secrets` and `reads_secrets_is_checked_at_render` (`crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`), `the_server_reads_its_key_from_the_store` (`crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Fsecret_block.rs`) and `serves_the_declared_key_or_fails` (`crates\u002Fbeet_net\u002Fsrc\u002Fssh\u002Fimpl_russh_server.rs`). Check after any render: `beet secrets\u002Fexec --only=BEET_SSH_HOST_KEY -- python3 .agents\u002Fskills\u002Finfra-deploy\u002Fhost_key_scan.py target\u002Finfra .agents\u002Ftmp\u002Frender` reads `0 holding key material`. After a package verb, re-render the stage stack first (the shared work directory, under the diagnosis path above), or the scan never sees the box's `user_data`. It looks for the record, its PEM body and every line of it, and the private seed in hex and base64, printing only file names, so it is also how to find (and delete) an old dump still carrying the key; a bare `grep 'BEET_SSH_HOST_KEY='` sees only the env-file form. The fix is itself a machine-config change (the env file lost a line), so the first deploy of each stage carrying it replaces that stage's box and rolls its access key, and needs `--elevated` while the stage's runtime boundary lacks the new parameter grant.\n\nPort **2222** on the same host is the box's own management sshd, not the site. Use it (with the stack's Lightsail key pair) to get a real shell for diagnosis: `systemctl status beet-site`, `journalctl -u beet-site`, `systemctl status caddy`.\n\n#### ssh driver\n\nThe driver lives beside this skill, in `.agents\u002Fskills\u002Finfra-deploy\u002F` (it is COMMITTED there on purpose: `.agents\u002Ftmp` is gitignored, and an earlier copy kept there silently vanished between deploys). `ssh.sh \u003CHOST> \u003CPORT>` runs the whole check (single session, two-client history, two-client counter by url, the no-pty hint, images) and `ssh_pty.py \u003CHOST> \u003CPORT> '\u003CSCRIPT>'` is the underlying pty driver, python3 stdlib only.\n\n- local: `.agents\u002Fskills\u002Finfra-deploy\u002Fssh.sh 127.0.0.1 \u003Cssh_port>` (default 8339; trust the serve output)\n- dev\u002Fprod: `.agents\u002Fskills\u002Finfra-deploy\u002Fssh.sh app.dev.beet.org 22` \u002F `.agents\u002Fskills\u002Finfra-deploy\u002Fssh.sh app.beet.org 22`\n\nThe script scales its waits up for any non-localhost host.\n\nConnection (what the driver runs per session): `ssh -tt -o StrictHostKeyChecking=no -o UserKnownHostsFile=\u002Fdev\u002Fnull -o ConnectTimeout=15 -o LogLevel=ERROR -p \u003Cport> root@\u003Chost> [\u003Cpath>]` on an 80x24 pty, the path being `PTY_PATH` when set.\n\nNavigation recipe. The TUI is a charcell render of the site: a left-click on a sidebar link navigates (focus also moves with Tab\u002FShift+Tab and Enter activates, but clicks are deterministic), and Alt+Left \u002F Alt+Right walk the session's history. The driver feeds SGR mouse press+release at 1-indexed cells and reconstructs the final frame through a small VT emulator, then greps it. At 80x24 the site is in its narrow layout: every page hides the sidebar (the blog posts; the docs are unlisted and appear nowhere) behind a hamburger menu (the `三`\u002F`☰` glyph at the top-left), so the sequence opens the menu before each navigation:\n\n1. click the hamburger menu at cell (col 3, row 1): opens the sidebar overlay.\n2. click \"ECS Router\": loads `\u002Fblog\u002Fecs-router` and closes the overlay.\n3. click the hamburger again, then \"Folk Technology\": loads `\u002Fblog\u002Ffolk-technology`.\n4. Alt+Left (`k:aleft`, ie `ESC [1;3D`): back to `\u002Fblog\u002Fecs-router`.\n\nPost titles render fullwidth (`ＥＣＳ　Ｒｏｕｔｅｒ`), so an ASCII title grep will NOT match: grep a single body word from each post's first screen instead, `bevyfication` for ECS Router and `Wollongong` for Folk Technology (single words, so no wrap can split them), and assert the other is absent so the frame is one page.\n\n**Everything but the hamburger is clicked BY LABEL, not by cell.** The sidebar lists every blog post, so adding one shifts every row beneath it and a pinned `m:col,row` clicks its neighbour instead -- silently, since the driver has no idea it missed. That is exactly what happened in the Phase 1 shakedown: the `Crates` docs section landed above `Design`, so the pinned `(6,6)` opened `\u002Fdocs\u002Fcrates\u002Fbeet_core` and all three checks failed on a page they never asked for, while `(6,15)` in the image check reached the wrong blog post. `ssh_pty.py` therefore takes `t:\u003Ctext>`, which locates `text` in the CURRENT frame (row-major, cell-aligned so a preceding fullwidth title cannot skew the column) and clicks its first cell, exiting with the frame if it is absent. The hamburger keeps its cell, being the one control no content can move.\n\nAs an `ssh_pty.py` script (`w:` is a seconds wait, `m:col,row` a cell click, `t:` a label click, `k:` keys, `u:secs:regex` a drain until the raw stream matches): locally `w:5;m:3,1;w:2;t:ECS Router;w:3;m:3,1;w:2;t:Folk Technology;w:3;k:aleft;w:3` lands back on ECS Router (expect `bevyfication`). Remote hosts double every wait. `ssh_pty.py` accepts `PTY_RULER=1` to print 1-indexed col\u002Frow guides, for reading the layout when a label match is ambiguous, `PTY_USER` to override the `root` user, and `PTY_PATH` to open at a url rather than the home page.\n\nTwo-client recipe: launch two `ssh_pty.py` runs at once (both backgrounded), drive them through the same two navigations to DIFFERENT history positions (A `aleft`, B `aleft;aright`), `wait`, then assert A shows ECS Router and B Folk Technology. Independent pages from one shared prefix prove per-session navigators. `ssh.sh` does exactly this, and calls out the known crash explicitly if a frame comes back \"connection refused\u002Fclosed\u002Freset\".\n\nCounter recipe: `PTY_PATH=\u002Fdocs\u002Fdesign\u002Fcounter` opens the unlisted counter by its url. The page closes the sidebar, so `t:More` clicks the button at the body's left; the title renders fullwidth (`Ｃｏｕｎｔｅｒ`), so grep the body line `You have clicked N times`, which also carries the count. Two concurrent runs click More once and twice and must show `1 times` and `2 times`: independent counts prove the `bx:click` scripts and per-session document state over a live session, beside the navigators the history recipe proves.\n\nRenamed and unknown urls: `PTY_PATH=\u002Fblog\u002Fpost-6` must land on Folk Technology (`Wollongong`), the post its `\u003CRedirect\u002F>` names, and `PTY_PATH=\u002Fno-such-page` must show `Route \u002Fno-such-page not found.` inside the site chrome, as the web answers both. REGRESSION GUARD (fixed, 2026-10-23): a session opened at a url that is not a page showed a raw `No Action\u003CRequest, PageRequest>` (a redirect) or `no route matched` (a miss), since the TUI built every url as a scene route. An in-world navigation now resolves a url as a browser does: a scene route builds live, a miss (or a draft in prod) builds the not-found page live, and anything else is answered through the router, a redirect followed with the history recording where it led. Covered by `follows_a_redirect_into_history` and `opens_an_unknown_url_on_not_found` in `crates\u002Fbeet_router\u002Fsrc\u002Fnavigate\u002Fnavigator.rs`.\n\nNo-pty recipe: a session without a pty has no terminal to draw into, a shell (`ssh -T \u003Chost>`) and a path without `-t` (`ssh \u003Chost> \u002Fblog`) alike. Each must exit `1` with `a terminal is required, add -t: ssh -t \u003Chost>` (the path appended when one was named) on STDERR and nothing on stdout, since the hint is a diagnostic and stdout is what a pipe captures as the answer, rather than sit silent until the pty timeout reaps it. The server builds no page for it either, so the box log carries no `has no page host to render into` error for it.\n\nREGRESSION GUARD (fixed, 2026-10-22): the server disconnected straight after closing a session, and a disconnect is fatal to OpenSSH, which exits `255` and drops output it has not yet written. So the no-pty hint never printed, its exit code read `255`, and every ctrl-c close ended on `Received disconnect`. The server now leaves the hang-up to the client, which answers the close with its own, and disconnects only a peer that ignores the close, after `CLOSE_GRACE` (5s, `crates\u002Fbeet_net\u002Fsrc\u002Fssh\u002Fimpl_russh_server.rs`), which keeps the reap decisive. Covered by `a_closed_session_leaves_the_hang_up_to_its_client` in `crates\u002Fbeet_net\u002Fsrc\u002Fssh\u002Fssh_server.rs`; a no-pty stage reading exit `255` with no hint is this bug back.\n\nImage recipe (the fifth check). The TUI draws real rasters over the cell grid with the kitty graphics protocol, and NONE of the above touches that path: the driver used to advertise a flat `xterm-256color` with a zero-pixel pty, and `KittyGraphicsSupport::from_pty` enables graphics only on a kitty\u002Fghostty term name or a non-zero pixel size. A totally broken image path therefore rendered a clean frame and passed. Three things have to line up, and each one silently produces \"no image\" on its own:\n\n- `PTY_TERM=xterm-kitty`, else the server never transmits at all.\n- Nothing about the window. The check runs at the DEFAULT 80x24: sizing contains a raster within its scroll port and `desired_placements` places the visible part of a partly clipped one, so the default window draws the post-6 image. It used to ask for `PTY_COLS=60 PTY_ROWS=40`, which is now gone.\n- The image scrolled into view (31 `k:down`), since it sits well below the fold. The post itself is reached by label (`t:Folk Technology`, post-6), for the same reason the navigation recipe is.\n- Time to arrive. The transmit runs at the link's pace, so `ssh.sh` drains until the cropped placement lands (`u:300:..`) rather than for a fixed time. Seen 2026-10-15: this machine's direct path to us-west-2 ran at ~40KB\u002Fs (the box's own sshd on 2222 moved 3MB in 75s, while an asset through Cloudflare's edge came at ~880KB\u002Fs), and the old fixed 12s wait cut every transmit off mid-chunk at 300-950KB, prod and dev alike, with no placement and a blank frame. A raw stream ending inside an unterminated `m=1` chunk is the clock, not the server; the same session given 200s placed `c=64,r=23` with `w=1280,h=920`.\n\nAssert on `PTY_RAW`, not the frame: the VT emulator discards APC sequences, which is exactly where the payload lives. `ssh.sh` greps the raw stream for an `ESC _ G a=t` transmit and reports the byte count (a healthy run is ~2.7MB), then for an `a=p` placement carrying the `w=`\u002F`h=` source-rect keys, which ride a placement ONLY when the raster is cropped. The second grep is the standing guard on the blank-hole class below: a placement that never crops means either that regression is back or the raster no longer straddles the port, and both want looking at.\n\nFIXED, AND CONFIRMED LIVE (Phase 10): a raster taller than its scroll port used to render as a silent blank hole, no image and no `[image]: alt` marker. `KittyImage::cell_size` clamped the width axis to the available columns but nothing bounded rows, so the 1280x960 post-6 photo computed to 30 rows at the default 80x24 window, and `desired_placements` dropped any rect the screen or clip did not contain whole. Sizing now bounds rows by the nearest scroll port's height and re-derives the columns to hold the aspect (`CellBounds`, threaded through the measure and layout passes), and a partly clipped placement draws its visible portion through the protocol's source rect instead of disappearing. Covered by `tall_raster_fits_the_default_window`, `raster_bounds_to_its_nested_scroll_port`, `scrolled_raster_places_a_moving_crop` and `every_viewport_places_the_raster` in `crates\u002Fbeet_ui\u002Fsrc\u002Frender\u002Fcharcell\u002Fkitty.rs`. Live over ssh at the default 80x24 the photo places as `c=64,r=23` (bounded by its port, not the 30 rows aspect alone would give) and crops as it scrolls, the source rect walking `h=760` -> `h=920` up to the port's bottom edge and then `y=40` -> `y=120` down the raster.\n\nREGRESSION GUARD (fixed): below the ~90-column breakpoint the sidebar drawer is `display: none` but `position: absolute`, and the charcell layout pass placed out-of-flow nodes without consulting `display`. The invisible drawer therefore kept a full-height rect and won every hit-test in a 20-cell stripe down the left of the screen, so `More` on the counter page was unclickable over ssh (Tab+Enter still worked). Fixed in `crates\u002Fbeet_ui\u002Fsrc\u002Frender\u002Fcharcell\u002Flayout.rs` (hidden subtrees are dropped before positioning, and a node that earns no rect this pass is zeroed rather than left holding a stale one). Covered by `sidebar_collapses_below_breakpoint` there and `narrow_viewport_stays_interactive` in `tests\u002Fbsx_site_tui.rs`. The default ssh window is 80x24, squarely in the affected range, and the counter recipe clicks `More` inside that stripe, so a deploy from a checkout without this fix fails check d.\n\nREGRESSION GUARD (fixed): every click inside the open sidebar overlay landed on the item TWO ROWS BELOW at 80x24. The focus ring is a border, so pressing a link moved focus off the hamburger, its ring dropped, the header shrank by two rows and the overlay rose with it before the release arrived; the release was re-hit-tested against the new geometry and reached the wrong link. `pointer_input` now delivers a release on the pressed cell to the pressed entity (`crates\u002Fbeet_ui\u002Fsrc\u002Frender\u002Fcharcell\u002Fhit_test.rs`, covered by `release_lands_on_the_pressed_entity_after_a_reflow`). The in-process twin is `cargo test --test bsx_site_tui --features router,style,markdown,fs,tui_server,quickjs,testing` (7 tests; `quickjs` is a required feature, since the counter's `bx:click` verbs are scripts, and without it cargo skips the target rather than failing it).\n\nKNOWN, AND NOT SEEN SINCE (multi-tenancy crash): an intermittent native crash (SIGSEGV\u002FSIGABRT, no Rust panic even with `RUST_BACKTRACE=full`) was recorded under two or more CONCURRENT ssh sessions, originally at roughly 20-40% per session pair, and suspected in the russh-on-a-tokio-runtime bridge to the single-threaded bevy world, ie a session despawn racing the per-frame `ssh_write` drain across sessions. Treat the 20-40% figure as STALE: the crash has not been observed since, across ~17 live session pairs (local, dev and prod, including three concurrent sessions streaming a 2.7MB image) and every run of the harness below.\n\nPhase 6 built the instrument that was missing, and it found a real defect on exactly the suspected path. A connection entity's lifetime belongs to its accept loop, which despawns it the moment the client's channel closes; an entity world scope does not flush, so the surface insert queued by the pty observer was still pending when that despawn ran, and `EntityWorldMut::despawn` flushes the command queue itself, AFTER removing the entity. Every client that vanished between its pty request and the next flush therefore raised \"Entity despawned\" through the app's error handler, ie a panic on the server's world thread, and a public port 22 supplies that shape continuously in the form of scanners. The harness hit it ~500 times per 2000-session run. Every command the ssh path aims at a connection is now silenced (`try_insert` \u002F `try_trigger_target` \u002F `try_remove`), pinned by `a_session_that_vanishes_before_its_surface_is_not_an_error` (`crates\u002Fbeet_router\u002Fsrc\u002Fnavigate\u002Fssh_tui_server.rs`) and `try_trigger_target_tolerates_a_despawned_target` (`crates\u002Fbeet_core\u002Fsrc\u002Fbevy_utils\u002Fentity_target_event.rs`); both fail without it.\n\nThe standing instrument is `ssh_stress_multi_tenancy`, at the bottom of `crates\u002Fbeet_router\u002Fsrc\u002Fnavigate\u002Fssh_tui_server.rs`: 2000 real russh sessions through a real listener, 24 concurrent, each dropping its socket while its neighbours are mid-frame, one in four vanishing before its own page has finished building. It is `#[ignore]`d, so the sanctioned test run compiles it and skips it. Run it with\n\n\tcargo test -p beet_router --features=ssh_stress --lib -- --ignored ssh_stress\n\n18,000 session cycles after the fix (12,000 across six debug runs and 6,000 across three release runs, release being what the box runs) produced zero crashes, zero coredumps and zero raised errors. The roughly 10,000 cycles run before the fix produced the same zero crashes and zero coredumps, and ~500 raised errors per run.\n\nThis does NOT prove the historical crash is gone. The harness renders a synthetic page and never exercises the kitty image path's multi-megabyte transmits, and the world-thread blocking fixes that landed earlier may account for the silence on their own. So `systemctl show beet-site -p NRestarts` stays the free canary on every deploy, and `ssh.sh` still calls the crash out by name if a frame comes back \"connection refused\u002Fclosed\u002Freset\". A sighting now is new information: capture the coredump with `coredumpctl` BEFORE restarting the unit.\n\nIf outbound port 22 is unexpectedly blocked at runtime, fall back to confirming the instance is `running` with its ports open via `aws lightsail get-instance-port-states` and record the limitation, but note port 22 was confirmed open from this host at authoring time.\n\n### e. analytics (the cross-transport event log)\n\nThe site records analytics for every transport: a server `Request` event per routed request, a `PageView` (with dwell) per web\u002Fterminal page visit, and `Click` \u002F `Scroll` \u002F `Error` events from the web client beacon. Events buffer into immutable zstd JSONL segments. Verify the visits from checks b-d landed in the store and that prior segments and rollups remain visible. Query with the `beet analytics` subcommand, mounted bare in `site\u002Fmain.bsx`: it reads the store the serving router's `AnalyticsConfig` writes to, since the document loads whole and that config's `StoreRef` resolves the stage and service access of the launch (built with `aws_sdk` so `--service-access=remote` reaches the live S3 bucket):\n\n- local: `cargo run -p beet-cli -- --entry=site analytics summary` (the store the site writes to, `target\u002Fstores\u002Fbeet-site--dev--analytics`)\n- dev\u002Fprod: `cargo run -p beet-cli --features infra,extra -- --entry=site --stage=\u003Cstage> --service-access=remote analytics summary` (the same config, resolved remote; `infra,extra` is the deploy recipes' feature set, so it reuses their build rather than relinking), or name a store outright with `--store s3:\u002F\u002Fbeet-site--\u003Cstage>--analytics`. Against prod it reads every aggregate row remotely (~11.4k objects on 2026-10-21, growing per day and path) and takes 5-6 minutes, so run it in the background rather than under a tool deadline\n\nRecipe (run around the b-d checks so the delta is attributable):\n\n1. BASELINE: query once before the b-d checks and record the total (`N events: ...`). Expect a non-zero baseline even on a brand-new stage: port 80\u002F443 is open to the internet, so scanners start recording `Request` events within a minute of the box serving (a fresh dev box read `288 events`, every one of them a `Web` `Request` for `\u002Fwp-admin` and friends, twelve minutes after the deploy returned). What matters is the DELTA, not the floor. That noise is also the earliest free proof that geoip is live, since a scanner's country resolves exactly like a real visitor's.\n2. Drive the visits: checks b (the browser test: link clicks home -> docs -> counter, then the drawer's menu button at phone widths) and d (ssh: navigate to the counter). These generate page views, `Click` events (the beacon reports clicks on links and buttons) and request events.\n3. DELTA: wait at least a minute after the last visit, then query again. Events buffer in the serving process until the oldest is `segment_max_age` old (60s, `AnalyticsConfig`) before their segment is written, so a query within that minute undercounts and can read as if a whole client kind never landed (locally, every browser beacon from check b was still buffered while the earlier ssh page views showed). Assert, from the summary:\n   - the total went UP (new events recorded) and is `>=` the baseline (prior events retained, since the store is append\u002Fupsert, never truncated).\n   - `PageView` events for the visited paths appear under `pages` (eg `\u002Fdocs\u002Fdesign\u002Fcounter`).\n   - both client kinds are present under `client kinds`: `Web` (the http\u002Fbrowser visits) and `Terminal` (the ssh session).\n   - for dev\u002Fprod (geoip enabled in the deploy build), a country appears under `countries` for the web visits. The geoip database (`assets\u002Fdatabases\u002Fcountry.mmdb`, ~8MB) is gitignored and workspace-owned, so it reaches the repo store by being borrowed into the staging dir by the `\u003CDirCopy\u002F>` under the deploy's `\u003CRepoStage>`: run `just beet-shared pull` AND `just site-shared pull` before deploying (the deploy mirrors the staged `site\u002F` whole, so an unhydrated `site\u002Fassets` would publish a site without its assets), and if `countries` is empty verify `country.mmdb` is present under `s3:\u002F\u002Fbeet-site--\u003Cstage>--repo\u002F\u003Cdeploy id>\u002Frepo\u002Fassets\u002Fdatabases\u002F`. The lookup is switched on by the `GeoIpDb` spread on the serving `\u003CRouter>` in `site\u002Fmain.bsx`, which reads that path out of the repo store like any other asset; without it every country is empty by authorship, and a declared-but-absent database logs `geoip: no country database at ..` on boot.\n\nREGRESSION GUARD (fixed): the deploy and runtime once derived the analytics resource name independently, so a missing app name let the site serve while every event write targeted a resource the deploy never created. The name is no longer derived twice: `site\u002Fmain.bsx` declares the bucket once and both sides compose it through the one resolved `Stack` (pinned by `one_declaration_names_the_bucket_for_both_sides` in `crates\u002Fbeet_extra\u002Fsrc\u002Finfra\u002Ftemplates.rs`). If a summary reports `0 events`, inspect `\u002Fvar\u002Flog\u002Fbeet-site.log` for a segment-write error naming the bucket and region first.\n\n### f. the nightly rollup (archive, aggregate, compact)\n\nThe analytics segment namespace does not grow forever. A `\u003CScheduledJobBlock label=\"rollup-daily\"\u002F>` invokes the `rollup` lambda at 03:00 UTC, which boots the entry's `jobs` verb out of the repo store, at the prefix its own deploy published, and dispatches `rollup` into its router. Each run merges every complete day's segments with its existing `analytics\u002Fraw\u002F\u003Cdate>.jsonl.zst` archive in `beet-site--\u003Cstage>--archive`, writes that day's deterministic `AnalyticsRollup` rows into the JSON-over-blob `analytics\u002Frollup\u002F` prefix of that same `beet-site--\u003Cstage>--analytics` bucket, reads both outputs back, and only then deletes the source segments from `analytics\u002Fraw\u002Fsegments\u002F`. The daily archive is the compact primary raw history; rollups are kept and can be re-derived from it.\n\n- `beet analytics summary` now reports over BOTH stores: aggregates for the days they cover, raws for the recent window they do not. `--raw-only` skips the aggregates, `--rollup \u003Curi>` overrides the aggregate store (it defaults to the events store, the site keeping both under one bucket).\n- The lambda publishes no url, no gateway and no hostname (`LambdaBlock`'s `http=false`), so the only way to run it by hand is `aws lambda invoke --function-name beet-site--\u003Cstage>--rollup-function --payload '\u003Cthe json below>' out.json --cli-binary-format raw-in-base64-out` (the payload is a `ScheduledInvoke`; anything else fails to deserialize and fails the invocation, deliberately). Its logs are `\u002Faws\u002Flambda\u002Fbeet-site--\u003Cstage>--rollup-function`. Note ONE dash before `function`: the label is `rollup` and `LambdaBlock` composes `\u003Capp>--\u003Cstage>--\u003Clabel>-function`, so the doubled form is a name that does not exist.\n- The first ordinary run compacts every complete day represented by segments and repairs aggregate rows for archived-but-uncovered days. Re-invoking continues where a timeout stopped: a failed archive or rollup verification leaves every source segment intact. `--full` (`{\"kind\":\"beet.scheduled_invoke.v1\",\"method\":\"Post\",\"path\":\"rollup?full=true\"}`) re-derives every archived complete day for a new aggregate schema; deterministic archive paths, aggregate IDs, and event-ID deduplication make it idempotent.\n- WATCH FOR: `deleted` may be nonzero only after the same run reports and verifies an archive and aggregate rows for those dates. A failed run must leave its source segments present; treat missing segments without both outputs as a bug, not an operational hiccup.\n- ON DEV, an invoke commonly reports `0 days` because `AnalyticsRollupRun::dates` never covers today and a dev stack exists for less than one UTC day. That proves the function boots and reaches all three stores; the focused fs compaction tests prove archive\u002Fwrite\u002Fdelete ordering. For a live end-to-end check, upload a valid yesterday segment under `analytics\u002Fraw\u002Fsegments\u002F\u003Cdate>\u002F\u003Cwriter-uuid>\u002F\u003Ctimestamp>-\u003Csequence>.jsonl.zst`, invoke, then assert the daily archive and aggregate objects exist and the source segment is gone. Aggregate objects are keyed by row id (`analytics\u002Frollup\u002F\u003Cuuid>`) with the date in the body, so count them against the run's `aggregates: N rows` rather than grepping keys for the date, which always finds nothing. Re-invoking must report `0 days`. Valid means every event's `timestamp` falls on the path's date: the run checks each one (`AnalyticsSegment::read`) and a mismatch fails the whole invoke with a 500, leaving the segment intact, so a today segment merely rekeyed under yesterday is refused. Build the seed by shifting a real segment's timestamps back one day (zstd JSONL, one event per line) and giving its events fresh ids.\n- ON PROD, once the schedule has been firing, `0 days` is the normal daytime result because 03:00 UTC compacted yesterday. Verify coverage independently: every completed date formerly represented by segments has `analytics\u002Fraw\u002F\u003Cdate>.jsonl.zst` in the archive bucket and a site-scope aggregate object under `analytics\u002Frollup\u002F`. The keys are row ids, so derive each date's site row id rather than reading bodies: `AnalyticsRollup::row_id` is a v5 uuid of `\"\u003CVERSION>:\u003Cdate>:site\"` under its `NAMESPACE` (`crates\u002Fbeet_net\u002Fsrc\u002Fstore\u002Fanalytics\u002Frollup.rs`), which python's `uuid.uuid5` reproduces, then match the ids against one `aws s3 ls --recursive` listing. Any leftover complete-day segment should be consumed by the next run.\n- A long-dwell `PageView` can appear in more than one segment with the same ID. Compaction keeps the newest timestamp before archiving and aggregating, so retries and overlapping writes do not double-count it.\n\nA CODEC SPLIT IS INVISIBLE TO THE ROLLUP, BY DESIGN. Analytics writes and reads `AnalyticsSegment::CODEC` alone (`.jsonl.zst`); an object under any other name is another writer's and is never scanned, so a binary writing a different name leaves a store that looks healthy from every summary. Seen live on 2026-09-22: the 09-21 deploy had shipped a binary predating the `.ndjson.gz` -> `.jsonl.zst` change, so for 29 hours the box and that night's lambda wrote objects the current code never saw, and the old lambda never saw the new ones. The three tells together: a complete-day segment prefix with no archive, an archive under a name the code never writes, and a scheduled run whose `deleted` count did not empty the prefix it named. Check for strays by listing, not by rollup: `aws s3 ls s3:\u002F\u002Fbeet-site--\u003Cstage>--analytics\u002Fanalytics\u002Fraw\u002Fsegments\u002F --recursive | grep -v jsonl.zst` (and the archive bucket likewise) must print nothing. The 2026-09-22 legacy objects were compacted once through a temporary gzip-capable binary and none remain (`.agents\u002Freports\u002F2026-09-22-first-deploy-silver-fox.md`); a recurrence is a one-off transcode, never a second format for analytics to contend with. The stale binary itself is not explained by the build guard above (`build_runs_the_declared_process` predates that deploy by weeks); a deploy from a checkout behind the working tree is the remaining suspect, so compare the writer's segment names against `AnalyticsSegment::object_path` whenever a summary's day range or a rollup's `deleted` count looks short.\n\nCross-check the raw namespace with `aws s3 ls s3:\u002F\u002Fbeet-site--\u003Cstage>--analytics\u002Fanalytics\u002Fraw\u002Fsegments\u002F --recursive` and completed days with `aws s3 ls s3:\u002F\u002Fbeet-site--\u003Cstage>--archive\u002Fanalytics\u002Fraw\u002F`; the CLI remains the authoritative event total because each object contains many events and combines segments with rollups. `BlobStore::GET_ALL_CONCURRENCY` bounds remote reads. An automated in-process version of the web half of this flow (http request -> request event, beacon -> page view, prior events retained, the beacon endpoint skipped) lives in `tests\u002Fbeet_site_analytics.rs`; run it with `cargo test --test beet_site_analytics --features \"router,json,fs,testing\"` for a fast pre-deploy check of the wiring. The terminal page-view path is unit-tested in `beet_router\u002Fsrc\u002Fnavigate\u002Fnavigator.rs`.\n\n## Step 1: Local\n\n```sh\ncargo run -p beet-cli -- --entry=site serve --server=http,ssh    # run in background\n```\n\nRead the bound http + ssh ports from the serve output (defaults 8337 \u002F 8339). Run the full verification (a-e; check `f` is cloud-only, its lambda has no local counterpart) against `http:\u002F\u002Flocalhost:\u003Cport>` and `127.0.0.1:\u003Cssh_port>`. This step is also the shakedown: run the browser test and settle the ssh driver here, recording any changes above. While it runs, pre-build both release artifacts in the background (the `cargo-zigbuild build ..` line under \"Changing a hostname's record TYPE\", once with the box's features and once with `,lambda` appended): the deploy's two `building:` steps then relink in seconds instead of cold-building for minutes each, and a zig or target fault surfaces here rather than mid-deploy. Also prove the entry's CLI refuses a typo: `cargo run -p beet-cli -- --entry=site serv --server=http` and `.. serve --sever=http` each exit `64` naming `serve` \u002F `--server` (every `CliServer` is strict), where a silently ignored typo would run a different command. Kill the server when done, by pid (`pgrep -a beet | grep -- '--entry=site serve'`, then `kill \u003Cpid>`): a `pkill -f`, or a `kill $(pgrep -f ..)`, on that argv also matches the shell running it, which then kills itself (exit 144). No cloud or DNS impact.\n\n## Step 2: Dev\n\nPREREQUISITE, ONCE PER ACCOUNT: dev needs its own `beet-site--dev--runtime-boundary`, and the AWS deploy credential cannot create one (it is explicitly denied `iam:CreatePolicy` on `--*--runtime-boundary`, or the cap it wears would be decorative). Without it the stack apply would fail on `NoSuchEntity: Scope ARN ... does not exist or is not attachable` after the storage layer had already created the three dev buckets, so the first dev deploy refuses before it writes anything: the dev boundary is a grant the sealed key does not record. The operator runs that one deploy elevated, which asks for the code and creates the boundary:\n\n```sh\njust site-stage deploy --elevated\n```\n\nA dev deploy, plain or elevated, lowers the credentials at `dev` AND at `prod`, so it never narrows prod's. A converge under `dev` used to be destructive as well: it rewrote the app-wide `beet-site--deploy` from the dev render, which pulled `beet-site--dev--*` into the `IrreversibleNeedsMfa` deny and left a dev teardown unable to delete its own buckets. `irreversible_statement` now excludes `BootstrapConfig::DEFAULT_STAGE` outright, so the stage no longer changes that deny; pinned by `the_disposable_stage_is_never_irreversible` in `crates\u002Fbeet_infra\u002Fsrc\u002Ftypes\u002Faws_deploy_policy.rs`. If a dev teardown ever reports `AccessDenied ... explicit deny in an identity-based policy` on a bucket, that exclusion is gone.\n\nREGRESSION GUARD (fixed, 2026-10-11 prod): an elevated `dev` deploy converged a WRONG prod boundary. The repo store's root was resolved once, at the launch's stage, and `RepoStoreQuery` handed that root to every render, so a dev launch lowering prod named `beet-site--dev--repo` wherever the prod box names its repo store: its read grant, and its certificate backup on `caddy\u002F*`. From the first elevated dev deploy (2026-10-10 03:08 UTC) prod's `caddy-backup.service` failed every run with `AccessDenied ... because no permissions boundary allows the s3:PutObject action`, and the next plain prod deploy refused with `aws: needs beet-site--prod--runtime-boundary \u003Cdigest>` beside a `holds ... which nothing declares now` note for the stale prod digest. The query now projects the declaration against the stack it renders (`ErasedStoreBlock::at`), pinned by `lowers_prod_as_a_prod_launch_does` in `crates\u002Fbeet_infra\u002Fsrc\u002Ftypes\u002Fruntime_boundary.rs`. The by-hand proof is `--dry-run` from both stages: the `beet-site--prod--runtime-boundary` document a dev launch prints must equal the prod launch's. Live, the AWS deploy credential can read the converged document directly (`aws iam get-policy-version --policy-arn arn:aws:iam::\u003Caccount>:policy\u002Fbeet-site--\u003Cstage>--runtime-boundary --version-id \u003Cdefault>`), and every bucket it names must carry the boundary's own stage. Confirmed live by the elevated prod deploy `01a12a01` (2026-10-11): it rewrote the boundary at 08:08 UTC naming only `beet-site--prod--*`, and the next `caddy-backup.service` run uploaded the three certificate `.json` objects the failed runs had been refused.\n\nREGRESSION GUARD (fixed, 2026-10-12 dev): an elevated PROD deploy dropped dev's line from the sealed record. A prod launch renders prod alone, but the key record's merge counted every `beet-site--*` line as its own, so the 2026-10-11 elevated prod deploy resealed `AWS_ACCESS_KEY_ID`'s `grants` without `beet-site--dev--runtime-boundary 16a15f07bc950c9d` while IAM kept that boundary byte for byte, and the next dev `--dry-run` refused with `aws: needs beet-site--dev--runtime-boundary 16a15f07bc950c9d` (a prod dry run beforehand would have printed the tell: `holds ..., which nothing declares now; the next elevated deploy drops it`). The record is now judged and resealed per policy (`crates\u002Fbeet_infra\u002FREADME.md`, the runtime boundary section), pinned by `keeps_the_grants_of_a_stage_it_did_not_render` in `crates\u002Fbeet_infra\u002Fsrc\u002Fcredentials\u002Faws_deploy_credential.rs`. To tell a dropped line from a real declaration change, diff the dry run's boundary document against the live one (`aws iam get-policy-version`, above) and `git show HEAD:secrets.toml` for the line the record lost: identical documents mean the elevated run only reseals. Confirmed live by the elevated dev deploy `01a12ee8` (2026-10-12): afterwards a dev `--dry-run` reports `aws: current` over both stages' boundaries, a prod `--dry-run` reports `aws: current` with no `holds ...` note before and after the dev teardown, and the prod boundary document the dev launch prints equals the prod launch's.\n\n```sh\njust beet-validate            # resolves, no cloud\njust site-stage deploy --dry-run  # asks for nothing; any `needs --elevated` line means the operator goes first\njust beet-plan                # EYEBALL: dev must touch only beet-site--dev--* and dev.beet.org\njust site-stage deploy        # build -> stores -> sync site\u002F + assets\u002F -> replace box -> watch -> purge\n```\n\nThe dry run is the cheap way to learn up front that this step needs the operator. Seen 2026-10-10: the first deploy after credentials began recording their grants refused (exit 70, ~14s, nothing written) with `the sealed AWS_ACCESS_KEY_ID records no grants` and the same for `CLOUDFLARE_API_TOKEN`; that is the gate working, not a fault, and one elevated run seals the grants for every later plain deploy. The `beet-destroy` that followed refused identically, harmless with nothing created, but a credential going stale while dev stands would leave it unremovable without the operator.\n\nRun the full verification (a-f) against `https:\u002F\u002Fdev.beet.org` (ssh on `app.dev.beet.org` port 22), allowing several minutes for cloud-init + Let's Encrypt to settle (retry with a sane budget; a `521` means the origin is not serving yet). Then ALWAYS tear down:\n\n```sh\njust beet-destroy             # removes the dev stack\n```\n\nConfirm teardown: no dev Lightsail instance or static IP (`aws lightsail get-instances`, `aws lightsail get-static-ips`), no `beet-site--dev--*` S3 buckets (`--repo`, `--analytics`, `--archive`), no `beet-site--dev--rollup-daily` schedule (`aws scheduler list-schedules`) and no `beet-site--dev--rollup-function` lambda (ONE dash before `function`, as above: the doubled form is a name that never exists, so checking it always passes), no dev log groups (`aws logs describe-log-groups`: neither `\u002Fbeet-site\u002Fmain-lightsail\u002Fdev` nor `\u002Faws\u002Flambda\u002Fbeet-site--dev--rollup-function`), no dev parameters (`aws ssm describe-parameters --parameter-filters Key=Name,Option=BeginsWith,Values=\u002Fbeet-site\u002Fdev\u002F --query 'Parameters[].Name'` empty: the host key's `\u002Fbeet-site\u002Fdev\u002Fssh-host-key` is a tofu resource destroyed with the stack, and `\u003CStackTeardown\u002F>` sweeps anything a verb parked beside it), and no `dev.beet.org` \u002F `app.dev.beet.org` Cloudflare records. A clean teardown leaves ONLY `beet-site--prod--*`, `beet-site--shared--assets`, `beet--shared--assets`, and `beet-state-\u003Caccount id>` (the state bucket of the account the deploy pair resolves, `aws sts get-caller-identity`, derived from its id and declared by nothing: `beet-state-417392594583` since the repo moved to its own member account `beet` on 2026-10-20, where `beet-state-898915787211` named the account before it). Dev is intentionally not left running.\n\nThe AWS deploy pair is the only AWS identity on the machine, so run the inventory under it (`cargo run -p beet-cli --features infra,extra -- secrets\u002Fexec --only=AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,CLOUDFLARE_API_TOKEN -- \u003Cscript>`, region `us-west-2`). It may list Lightsail, schedules, lambdas and log groups, but NOT `s3:ListAllMyBuckets`, `iam:ListUsers` or `iam:ListRoles`, so probe those by name: `aws s3api head-bucket --bucket \u003Cname>` (`404` gone, `200`\u002F`403` present) for each bucket above, and `aws iam get-user`\u002F`get-role` (`NoSuchEntity` gone) for `beet-site--dev--main-lightsail-runtime-user`, `beet-site--dev--rollup-lambda-role` and `beet-site--dev--rollup-daily-invoke-role`. For the records, `GET \u002Fzones\u002F\u003Czone id>\u002Fdns_records` with the token, asserting `success` before trusting an empty match.\n\nREGRESSION GUARD (fixed, 2026-09-18 dev): `beet-destroy` exited 0 and removed everything except `\u002Fbeet-site\u002Fmain-lightsail\u002Fdev`, recreated unmanaged (no retention) mid-destroy. The instance's `user_data` names the log group as a literal, so tofu saw no edge and destroyed both at once: the group vanished instantly, the box took ~30s to terminate, and its CloudWatch agent's next batch recreated the group. The instance now carries `depends_on` its log group, so the group is created first and destroyed last. Covered by `teardown_removes_the_log_group_after_the_box` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`. If it recurs, `aws logs delete-log-group --log-group-name \u002Fbeet-site\u002Fmain-lightsail\u002Fdev` removes it by hand. Note `stack_teardown` narrates only its own state cleanup at INFO (`removed state object`, `removed work directory`, a benign `could not remove state lock: Object not found` warning), so the destroy log alone never proves the resources went: the aws inventory above is the proof.\n\nREGRESSION GUARD (fixed, 2026-10-10 dev): `beet-destroy` exited 0 but warned `could not remove secret store: ... not authorized to perform: ssm:DescribeParameters`. The teardown sweeps the stack's secret store (`\u002Fbeet-site\u002F\u003Cstage>\u002F` in SSM) by listing it, and `AwsDeployPolicy` granted that listing only to a stack RENDERING a parameter, which the site does not, so any secret a verb had parked there would have outlived the stack. The listing is now granted beside the prefix, unconditionally (`the_secret_store_is_granted_without_a_rendered_parameter` in `crates\u002Fbeet_infra\u002Fsrc\u002Ftypes\u002Faws_deploy_policy.rs`). The AWS deploy credential can still read the prefix by path, so `aws ssm get-parameters-by-path --path \u002Fbeet-site\u002Fdev --recursive --query 'Parameters[].Name'` empty is the by-hand proof. Any change to that lowering moves the policy digest the sealed key records, so the first deploy after it refuses for `--elevated`.\n\n## Step 3: Prod\n\n```sh\njust beet-validate --stage=prod\njust beet-plan --stage=prod   # EYEBALL: buckets and the three DNS records refresh-only, see below\njust beet-deploy --stage=prod\n```\n\nEYEBALL the plan for three things specifically: that every existing S3 bucket appears only as a refresh or deliberate in-place update; that the repo store, archive store, instance, and DNS are never replaced (the one exception is a deliberate machine-config change to the instance's `user_data`, which replaces the box); and that DNS changes are exactly the ones expected. During the one-time storage migration, the two Dynamo table destroys and the two same-label S3 bucket creates are deliberate: raw events may expire and rollup rows are re-derived from the archive.\n\nA BASELINE REDEPLOY OF UNCHANGED MAIN PLANS EXACTLY ONE CHANGE. After the storage migration, a code-only deploy reads `Plan: 0 to add, 1 to change, 0 to destroy`: the rollup lambda's `s3_key`, `source_code_hash` and its two `BEET_DEPLOY_*` variables. A stage whose state holds no host key parameter yet also adds `aws_ssm_parameter.beet_site__\u003Cstage>__ssh_host_key` (`1 to add`), and a deploy after a roll of the `BEET_SSH_HOST_KEY` record also updates it in place (`value_wo_version` alone); neither touches the instance, whose new `depends_on` is no diff. Everything else, the app, analytics, and archive buckets, the instance, and all three Cloudflare records, appears as a `Refreshing state...` line and nothing more. The box itself is NOT in the plan at all: the binary reaches it through the release pointer, so `uptime` on the box spans previous deploys and an instance uptime that resets on a code-only deploy means `user_data` moved.\n\nRun the full verification (a-f) against `https:\u002F\u002Fbeet.org` (and confirm `https:\u002F\u002Fwww.beet.org` serves too; ssh on `app.beet.org` port 22). LEAVE PROD UP. Teardown, if ever needed, is `just beet-destroy --stage=prod`.\n\n### Changing a hostname's record TYPE\n\nOnly relevant when a hostname moves between backends whose records differ in type (the Fargate->Lightsail migration moved `beet.org`\u002F`www.beet.org`\u002F`app.beet.org` from `CNAME` at the NLB to `A` at the static IP). Cloudflare rejects an `A` create while a `CNAME` of the same host exists (**error 81054**), and tofu has no ordering edge between destroying the old record and creating the new one, so a single apply races and can fail with the old backend already destroyed and DNS still pointing at it.\n\nDelete the conflicting records first, then deploy immediately:\n\n1. Pre-build so the deploy's build step is a no-op and the window is as short as possible: `cargo-zigbuild build --package beet-cli --bin beet --release --target x86_64-unknown-linux-gnu --no-default-features --features aws_sdk,ssh,geoip`.\n2. Delete each conflicting record through the Cloudflare API (`DELETE \u002Fzones\u002F\u003Czone id>\u002Fdns_records\u002F\u003Cid>`, the id `CloudflareZone` declares in the entry). This starts the outage.\n3. `just site-stage deploy --stage=prod` straight away (the stage stack alone, so the outage lasts one stack's deploy).\n\nTwo gotchas afterwards:\n\n- **Your local resolver will negative-cache the deleted name** for the zone's SOA minimum (1800s). `beet.org` can look like `NXDOMAIN` locally long after it is healthy worldwide. Confirm with `resolvectl query --cache=no beet.org`, a public resolver (`https:\u002F\u002F1.1.1.1\u002Fdns-query?name=beet.org&type=A`), or `curl --resolve` before believing a failure, and do not run check b until local resolution is back, since the browser needs it.\n- **The box is slow for its first few minutes.** On 2 CPUs, direct-origin requests intermittently stall while cloud-init finishes and Let's Encrypt issues. Re-probe before concluding a fault.\n\n## Before any deploy\n\n1. **Hydrate both asset trees** (`just beet-shared pull` for `.\u002Fassets`, `just site-shared pull` for `.\u002Fsite\u002Fassets`). The deploy stages `site\u002F` whole and mirrors the stage, so it publishes whatever the checkout holds. `\u003CRepoStage>` refuses a missing or empty source rather than emptying the store, but a *stale* tree stages happily and silently ships old assets. The trees hold source files only, so a pull never stands in for a build: no wasm binary is stored in either, and one a deploy ships is built by that deploy.\n2. **The apply runs once per layer, and the order matters.** `\u003CTofuApply layer=\"storage\"\u002F>` brings up the stores (the addresses blocks declare under the `storage` layer, an overridable per-block field), `\u003CRepoStage>` and `\u003CRepoSync\u002F>` fill the repo store, then a bare `\u003CTofuApply\u002F>` converges the whole stack and replaces the box against content that is already published. A single apply built the instance first, and it booted with `no entry document found in the --repo backend`. Naming a layer no block declares is a loud error, never a silent skip. Since the box is replaced rather than rolled, there is no health gate and no rollback: `LightsailWatch` is a CloudWatch log tail, not a readiness check, so re-check the site after the deploy returns, not during.\n3. **Diff the rendered configs before\u002Fafter** whenever `beet_infra` or the deploy render changes. Deploys ship from any worktree, and a branch can lack a fix the stage already runs as easily as carry a new one, so \"changed\" is measured against the source the stage's ledger records, never against this checkout's own history: before every prod deploy, `git diff \u003Cledger commit> -- crates\u002Fbeet_infra crates\u002Fbeet_extra\u002Fsrc\u002Finfra site\u002Fmain.bsx` (plus any uncommitted edits there) decides it, and a non-empty diff means a render diff whose baseline is that ledger source. Prod `01a158e8` (2026-10-20) shipped from the `misc` worktree without main's host-key fix and put the key back into the box's `user_data`; its render beside the one before it would have shown the key's line returning. The render diff itself: `.agents\u002Fskills\u002Finfra-deploy\u002Frender_all.sh before` on the clean tree FIRST, then after the change `.agents\u002Fskills\u002Finfra-deploy\u002Frender_all.sh after .agents\u002Ftmp\u002Frender\u002Fbefore` renders all eight stacks and diffs each against the baseline. When the change is already committed, render the baseline from a detached worktree of the commit before it instead (`git worktree add --detach .agents\u002Ftmp\u002Frender-baseline \u003Ccommit>`, its own `CARGO_TARGET_DIR` under `.agents\u002Ftmp\u002F`, then `git worktree remove`): the script writes the checkout root as `\u003Cworkspace>`, so dumps from two checkouts compare. When the change is still UNCOMMITTED and the baseline is the tree without it, build that tree in the same kind of worktree at HEAD: `git diff HEAD --binary | git -C \u003Cworktree> apply`, copy each `git ls-files --others --exclude-standard` file across, then reverse just the change under review (`git -C \u003Cworktree> diff HEAD -- \u003Cfile>` filtered to its hunks, applied with `git apply -R`). A baseline rendered from before a host-key fix carries the key, so scan it with `host_key_scan.py` (check d) and delete the worktree and its target the moment the diff is read. A baseline of what PROD runs starts from the `source` its ledger records (`DeploySource`, read with `beet secrets\u002Fexec --only=AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY -- sh -c 'aws s3 cp s3:\u002F\u002Fbeet-site--prod--repo\u002Fcurrent\u002Fledger.json - | jq .source'`, and printed by `rollback`\u002F`rollforward`): `commit` is the HEAD it deployed from. No `diff_hash` means a clean tree, so that commit IS the baseline, rendered from a detached worktree as above. A `diff_hash` means it also shipped uncommitted work (tracked edits and untracked files alike, the same tree always hashing the same), which the commit alone may not even build (prod `01a12efe`, 2026-10-12, ran on `f5fca99a6` plus uncommitted work that `f5fca99a6` alone fails to compile without), and a ledger published by a binary predating `DeploySource` (before 2026-10-15, or from a branch that never merged it) carries no `source` at all and reads as `\"kind\": \"unknown\"`. Then find the deploying checkout by its artifacts: the ledger's `rollup` `source_hash` is `openssl dgst -sha256 -binary \u003Ccheckout>\u002Ftarget\u002Flambda\u002Fbeet\u002Fbootstrap.zip | base64` of the checkout that built it (each `git worktree list` entry has its own `target\u002F`), and that checkout's reflog names its HEAD at the ledger's `timestamp` (prod `01a158e8`, 2026-10-20, matched the `misc` worktree at `4b5cac780` this way, a branch without main's host-key fix). For either, bracket it: render the nearest building commit after `commit` (or the deploy) and compare it with a dump from before it; when the two agree (modulo the lambda hash), that is the config prod runs, since a deploy whose plan left the instance untouched applied exactly that render, and the ledger's `rollup` `source_hash` is the live lambda's `source_code_hash`. A `DIFFERS` prints through `tf_diff.py` beside the script, one line per changed leaf and per changed `user_data` line, secret-shaped values as digests. Resolving an S3 state backend asks STS for the account, so every render needs the AWS deploy pair; the example entries load no secrets document, and the script hands them the pair through `secrets\u002Fexec`. A `RENDER FAILED` or `UNCOMPARED` line exits non-zero like a `DIFFERS`: before 2026-10-10 a failed render was skipped by the diff, and the six example renders had been failing unnoticed for want of credentials. `HASH-ONLY` means only `source_code_hash` moved, ie a rebuilt binary shipping as a code-only deploy, not a config change; the line is rendered only when a lambda artifact is already built on disk (`target\u002Flambda\u002F`, which only a deploy's build step writes), so a baseline from a fresh worktree shows it as added rather than changed, and after a target cleanup neither side renders it at all. Any other diff must be deliberate and explainable line by line (invariants: no existing physical resource name changes, no replacement of an existing resource). The dumps are disposable and live in `.agents\u002Ftmp\u002F`; nothing is committed.\n4. Never run with `--stage=prod` except in Step 3.\n","# Deploy\n\nThe release process for the beet website. Validate the SAME site across three environments in sequence, each in its own sub-agent, each with an IDENTICAL verification pass:\n\n1. **Local** proves the build (serve on localhost, verify, stop).\n2. **Dev** proves the cloud path (deploy to `dev.beet.org`, verify, then tear down, since a standing dev environment is a real monthly cost).\n3. **Prod** publishes the permanent production site (`beet.org` + `www.beet.org`).\n\nRun each step as a SEPARATE sub-agent. Do them in series: Dev only after Local is green, Prod only after Dev is green and torn down.\n\n> **Dev MUST be torn down after verification. Only prod stays up.** Dev is a temporary proving ground for the cloud path, not a standing environment: a live dev stack is a real recurring monthly cost. The moment dev verification is green (or fails, or is abandoned), run `just beet-destroy` and confirm no `beet-site--dev--*` S3 buckets, no dev Lightsail instance or static IP, and no `dev.beet.org` DNS record remain. Never leave dev running.\n\n## Topology\n\nThe deploy block is stage-aware (`LightsailBeetSiteBlock`, `crates\u002Fbeet_extra\u002Fsrc\u002Finfra\u002Ftemplates.rs`). One `small_3_0` Lightsail box (2 GB, flat monthly price) per stage carries everything: no load balancer, no container registry, no ACM certificate, no VPC of its own. Nor an SSM agent: cloud-init removes Amazon's preinstalled `amazon-ssm-agent` (whose every call was denied, ~100 `AccessDenied` a day in the journal), since the box is managed over ssh on 2222 and the stack's secret store reaches Parameter Store through the API, never the agent. Its first registration attempt at boot still lands, four `AccessDenied` lines from `amazon-ssm-agent` within a second of `network-online.target`: Lightsail prepends its own `#!\u002Fbin\u002Fsh` to `user_data`, so our script runs in `cloud-final` and reaches the removal about a minute later, and no boothook or `bootcmd` can ride a launch script. So the box check is `rpm -q amazon-ssm-agent` reporting not installed and no `AccessDenied` from any unit after the agent's `Stopped` line in `sudo journalctl -u amazon-ssm-agent` (`sudo journalctl --no-pager --since '\u003Cthat time>' | grep AccessDenied`, the time as `'YYYY-MM-DD HH:MM:SS'` since `--since` rejects the `+0000` suffix `-o short-iso` prints, discounting your own `sudo grep` lines), never an empty journal.\n\n- **http**: Caddy on the box terminates TLS for every hostname with an automatic Let's Encrypt cert and reverse-proxies to the beet binary on its app port. Cloudflare fronts the site hostnames PROXIED (an `A` record at the static IP) and runs Full-strict, so the edge verifies Caddy's cert. The certificate store OUTLIVES the box: a `caddy-backup.timer` on the box saves `\u002Fvar\u002Flib\u002Fcaddy` to `s3:\u002F\u002Fbeet-site--\u003Cstage>--repo\u002Fcaddy\u002F` every 15 minutes and cloud-init restores it before Caddy starts, so a rebuilt box serves on the certificate the last one held (good for 90 days, renewed by Caddy a month early) and only the FIRST box of a stage ever issues at boot. The box's IAM key may write that prefix alone, never a release.\n- **ssh**: the beet TUI listens on port 22. Cloudflare does not proxy raw TCP, so ssh rides a DNS-ONLY `app.*` hostname pointing straight at the static IP. The box's own management sshd moves to **2222** (reachable with the stack's Lightsail key pair). Note this means the Lightsail browser console, which only dials 22, lands on the beet TUI rather than a shell.\n- **ssh host key**: one fingerprint for every stage and every restart, from the `BEET_SSH_HOST_KEY` record, and in NO rendered config. `site\u002Fmain.bsx` declares it as `\u003CSecretBlock bx:ref=\"ssh_host_key\" label=\"ssh-host-key\" env=\"BEET_SSH_HOST_KEY\"\u002F>` under the stage `\u003CStack>`, which renders the tofu resource `aws_ssm_parameter.beet_site__\u003Cstage>__ssh_host_key`, the `SecureString` `\u002Fbeet-site\u002F\u003Cstage>\u002Fssh-host-key`, so the stack's state owns its create, its update and its destroy. Its value is write-only: `value_wo = \"${var.BEET_SSH_HOST_KEY}\"`, an `ephemeral`, `sensitive` variable with no default, which every apply fills from the deployer's record as `TF_VAR_BEET_SSH_HOST_KEY` on the tofu child alone and every plan, validate and destroy passes empty, so the value is in no rendered config, plan or state and a launch without the record still plans. An apply without it refuses before writing anything, naming the record. `value_wo_version` is the record's `modified` (epoch milliseconds, off the plaintext index of `secrets.toml`), so a rolled record plans `value_wo_version = \u003Cold> -> \u003Cnew>` as an in-place update and nothing else; an unchanged record plans no change to the parameter. The config pins `required_version = \">= 1.11.0\"`, the OpenTofu release write-only attributes arrived in. The instance `depends_on` the parameter, so a rebuilt box boots after it exists and a destroy removes the box first. The box alone (`{ReadsSecrets([$ssh_host_key])}` on `\u003CLightsailBeetSiteBlock\u002F>`) holds `ssm:GetParameter` on exactly that parameter plus `kms:Decrypt` through SSM, in its runtime policy and the stage's runtime boundary; the rollup lambda holds neither. Both ends reach parameter store the same way, as SigV4-signed json calls through beet's own http client (`AwsJsonClient`, `crates\u002Fbeet_net\u002Fsrc\u002Fclient\u002F`), no `aws` cli and no SDK client: the deployer as its `secrets.toml` pair, the box as the pair its unit's `EnvironmentFile` loads. The binary reads the key at every start through the `StoredSecret` the declaration lands (each start logs `ssh host key from ssm (\u003Cregion>) \u002Fbeet-site\u002F\u003Cstage>\u002Fssh-host-key`), so a restart picks up a rolled key with no rebuild. A box that cannot read it never serves a random key: the serve run fails naming `no secret at \u002Fbeet-site\u002F\u003Cstage>\u002Fssh-host-key` (or the `AccessDenied`), the unit restarts every 3s and `\u003CLightsailRelease\u002F>` fails on the climbing `NRestarts`. A local `serve` reads the same record from `secrets.toml`, so local and both stages present one fingerprint.\n- **DNS** (stage-aware, and this is why `--stage` matters): `dev` publishes ONLY `dev.beet.org` (proxied) + `app.dev.beet.org` (DNS-only). `prod` publishes the apex `beet.org` + `www.beet.org` (proxied) + `app.beet.org` (DNS-only). A `dev` deploy can never touch production apex DNS.\n\nThe generic `beet` binary reads the whole site from ONE store at runtime, the per-stage repo store `beet-site--\u003Cstage>--repo` (the `\u003CS3BucketBlock label=\"repo\" {RepoStoreBlock}\u002F>` declaration in `site\u002Fmain.bsx`), under a per-deploy prefix: `\u003Cdeploy id>\u002Frepo\u002Fmain.bsx`, `\u003Cdeploy id>\u002Frepo\u002Froutes\u002F`, `\u003Cdeploy id>\u002Frepo\u002Ftemplates\u002F` and `\u003Cdeploy id>\u002Frepo\u002Fassets\u002F` all live in it, mirrored from the staging dir `\u003CRepoStage>` assembles in `target\u002Finfra\u002Fbeet-site\u002Frepo\u002F`. The binary sits beside the document as `\u003Cdeploy id>\u002Fbin\u002Fmain-lightsail`, the ledger as `\u003Cdeploy id>\u002Fledger.json`, and `current\u002F` holds the served ledger and the release pointers. The box learns which prefix to read from the release pointer at every start (`BEET_REPO` in `current\u002Fmain-lightsail.env`), so a rollback moves the binary and its document together, and a content-only `sync` publishes into the prefix the running box already reads. No deployed binary reads `beet-site--shared--assets`; that bucket is the developers' source of record for `site\u002Fassets`, owned by `just site-shared pull|push` and untouched by any stage deploy. (The separate `beet--shared--assets` bucket backs the WORKSPACE `.\u002Fassets` tree the examples and tests read; `just beet-shared pull|push`. The two trees are not mirrors: `blog\u002F` and `branding\u002F` belong to the site, and a few workspace-owned source files (the geoip database, the robot faces) are borrowed by the `\u003CDirCopy\u002F>` manifest in `site\u002Fmain.bsx`: into the staging dir under the deploy's `\u003CRepoStage>`, and into `site\u002Fassets` by the local `assets` verb. The `\u003CDerive\u002F>` beside each `\u003CDirCopy\u002F>` ensures the site's derived files the same way, regenerating only a stale or missing one. Neither tree nor bucket holds a build output: the site boots no wasm, the browser binaries are built into `target\u002Fwasm` by whatever uses them, and a deploy that ships one builds it with a `\u003CWasmRuntime\u002F>` before its stage (the example entries publishing `examples\u002Fbsx_site` do), never borrowing a stored copy.) The deployed binary is built with `--features aws_sdk,ssh,geoip` (see `\u003CLightsailBeetSiteBlock features=\"aws_sdk,ssh,geoip\"\u002F>` in `site\u002Fmain.bsx`), so the served site includes the ssh terminal and country lookups. `aws_sdk` alone would serve http only.\n\n**The site entry declares its own infrastructure.** `site\u002Fmain.bsx` is a one-shot `\u003CCliServer{always:true}>` dispatcher whose site is the `serve` route (the box launches `app --repo=s3:\u002F\u002F.. --server=http,ssh serve`, and a developer launches `beet --entry=site serve --server=http`: one process, one argv, the same verb). Its raw analytics, rollup, and archive stores are declared ONCE under the stage `\u003CStack>` as writable `\u003CS3BucketBlock\u002F>` declarations: the deploy provisions them and runtime consumers reach them through the job's own fields, `AnalyticsRollupJob{raw: $analytics, rollups: $analytics, archive: $archive}`. Each composes `\u003Capp>--\u003Cstage>--\u003Clabel>` from the `app_name` on the entry's `\u003CPackageConfig\u002F>`; locally the same declarations attach `FsStore`s under `target\u002Fstores\u002F\u003Capp>--\u003Cstage>--\u003Clabel>`. The deploy verbs do not load in the deployed binary at all: a `\u003CFragment bx:cfg=\"feature:infra && feature:extra\">` inside the `\u003CStack>` holds them (the stores stay outside it, since an excluded declaration binds to nothing), and it is excluded before the build walk in a binary that links neither crate, leaving a tombstone that reports the condition if anything dispatches into it. A `Router` is a url space, so the site's urls stay rooted at `\u002F` and no http\u002Fssh request can reach a deploy route (`curl \u002Fdeploy` -> 404).\n\n**The box is replaced only when the BOX changes.** The instance's `user_data` renders machine config alone (the blueprint, Caddy, the sshd relocation, the CloudWatch agent, the SSM agent removal, the systemd unit), never a version, so a code-only deploy plans no change to `aws_lightsail_instance`. The binary instead reaches the box through the repo bucket's stable release pointer, `s3:\u002F\u002Fbeet-site--\u003Cstage>--repo\u002Fcurrent\u002Fmain-lightsail.env`, which names this deploy's id, its versioned artifact key and the document prefix it was built against. The unit's `ExecStart` is a launcher (`\u002Fusr\u002Flocal\u002Fbin\u002Fbeet-site-run`) that re-reads that pointer at every start, so `systemctl restart` IS the deploy, and `\u003CLightsailRelease\u002F>` (after `\u003CTofuApply\u002F>`) performs it over the management sshd on 2222 and gates on the box actually serving: the RUNNING process reports this deploy's id (read from `\u002Fproc\u002F\u003CMainPID>\u002Fenviron`), one request through the app's own port on loopback is answered, and `NRestarts` is unchanged across that whole check. A fetch that fails leaves the installed binary serving rather than killing the unit.\n\nEditing `LightsailBlock::build_user_data` (bumping `CADDY_VERSION`, changing the unit, moving the management port) IS a rebuild: terraform cannot update `user_data` in place, so the instance is destroyed and recreated, and the IAM access key rolls with it (the roll trigger is keyed on a digest of the rendered script, so the key rolls with every machine-config change; a rebuild from a non-script change, ie a bundle resize, keeps its key). Budget several minutes AFTER the instance reports `running` for cloud-init to install Caddy, pull the binary from S3 and start the unit; the static IP re-attaches so the address and DNS are stable. Caddy is enabled by cloud-init but STARTED by `\u003CLightsailRelease\u002F>`, once the apply has re-opened the firewall (started at boot it raced the ports resource, and every ACME attempt against a closed 80 burned Let's Encrypt's per-hostname validation budget). There is still no circuit breaker and no automatic rollback: a binary that fails to boot leaves a broken box. Rolling back is re-pointing the release pointer (`beet rollback`, which rewrites it) and restarting the unit.\n\nThis matters beyond the outage window. `small_3_0` is burstable at a **20% baseline per vCPU**, and a fresh instance starts at ZERO burst capacity, so a rebuild does the heaviest work of the instance's life while clamped to baseline. That is what produced the cluster of AWS SDK `dispatch failure` errors within ~75 seconds of unit start on a freshly deployed box. The SDK times its lookup, socket and tls handshake as one connect, 3.1s by default, which a clamped box's first handshakes outlast; every beet SDK client now waits `aws_ext::STALL_TIMEOUT` (10s) instead, see the 2026-10-16 guard below. Covered by `code_only_deploy_renders_one_box` and `machine_config_change_rebuilds_and_rolls` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`.\n\n**`beet-deploy` exiting 0 does NOT mean the SITE serves.** The deploy's last steps are a timed log tail and a cache purge, neither of which gates on readiness, and cloud-init failures do not propagate back to it. `\u003CLightsailRelease\u002F>` now proves the APP serves: an `active` unit carrying this deploy's id that answers a request on its own port with no restart underneath, so the old failure where a crash-looping box reported `is serving release ..` after ~340 restarts is closed, and a deploy exiting 0 while `LightsailWatch` prints a fatal boot error in that same log should not recur. What the gate deliberately cannot see is everything in FRONT of the app: it probes loopback, so Caddy, DNS and certificate state are all still unproven. ALWAYS curl the site after the deploy returns. Diagnosis path for a bad origin:\n\n- **Cloudflare `521`** = the edge reached DNS but nothing accepted on the origin's 443. **`526`** = Caddy answered but its cert is not valid for the Full-strict edge.\n- Get a real shell on the management sshd (port **2222**, the stack's Lightsail key pair, user `ec2-user`). Every deploy materialises that key beside the rendered config as `target\u002Finfra\u002Fbeet-site\u002Fdeploy_key.pem` (mode 600) for `\u003CLightsailRelease\u002F>`'s own ssh, so reach for it rather than digging the tofu state's `aws_lightsail_key_pair` out by hand: `ssh -i target\u002Finfra\u002Fbeet-site\u002Fdeploy_key.pem -p 2222 ec2-user@app.\u003Cstage-host>`. It is the stage of the LAST deploy, so re-run the deploy's stage before trusting it, and a `beet-destroy` removes the work directory with it (`plan` and `validate` do not write it back), so between dev's teardown and the prod deploy there is no key on disk: a PRE-deploy baseline of the prod box (`uptime`, `NRestarts`, the running `BEET_DEPLOY_ID`) reads `private_key` off the `aws_lightsail_key_pair` in the pulled state, written straight into a mode 600 file under `.agents\u002Ftmp\u002F` and deleted once the deploy has materialised the real one. The state is client-side encrypted, so pull it through `beet secrets\u002Fexec -- sh -c 'TF_VAR_tf_state_passphrase=$TF_STATE_PASSPHRASE tofu -chdir=target\u002Finfra\u002Fbeet-site state pull > \u003Cfile>'` (the redirect INSIDE the quotes: `secrets\u002Fexec` logs to stdout too): it hands the passphrase to tofu's environment and redacts it from any output, where a `secrets\u002Fget` piped by hand put a prefix of it into a transcript once (2026-09-22). The `site` and `shared` stacks share that work directory, and a package verb (`just beet-deploy`, its `--dry-run`, `all\u002Fplan`) renders `shared` last, so afterwards it holds the bucket stack's config and a `state pull` there reads the wrong state, with no key pair in it (seen 2026-10-21): re-render the stage stack first with `just beet-validate --stage=\u003Cstage>`, which re-inits the backend, and confirm `jq .terraform.backend.s3.key target\u002Finfra\u002Fbeet-site\u002Fmain.tf.json` names `beet-site--\u003Cstage>--tofu-tfstate`. Rolling the passphrase itself is `roll-state` per stack (`just beet-roll-state [--stage=prod]`, and the same verb through `site-shared`, `beet-shared` and `site-social --stage=prod`); the record's own `roll` note in `secrets.toml` has the four commands. Then: `systemctl is-active caddy beet-site`, `ss -lntp`, and `sudo grep -iE \"error|fail\" \u002Fvar\u002Flog\u002Fcloud-init-output.log`.\n- `beet-site` active on its app port while `caddy` is missing means the TLS terminator failed to install and everything else is fine.\n\nREGRESSION GUARD (fixed): the deploy shipped a binary it never built. A block is declared under its `\u003CStack>` rather than as a step in the deploy sequence, so nothing dispatches it and its `BuildArtifact`'s action never ran; `\u003CTofuApply\u002F>` went on reading that artifact's file off disk, hashing it and uploading it, so every deploy silently shipped whatever an earlier deploy had left in `target\u002F` (and on a machine with no prior artifact would fail on a missing file instead). The box then crash-looped on `failed to load entry main.bsx: no component, resource or template registered for tag Stack`, warning that types newer than the stale binary were unregistered, while `beet-deploy` reported success. Building now belongs to the step that CONSUMES the artifact: `TofuApply` calls `BuildArtifact::build()` immediately before reading each artifact's bytes, so an artifact that is uploaded but never built is unrepresentable. Covered by `build_runs_the_declared_process` in `crates\u002Fbeet_infra\u002Fsrc\u002Factions\u002Fbuild_artifact.rs`. A deploy log with no `building: cargo-zigbuild ..` line is this bug back.\n\nREGRESSION GUARD (fixed): a rebuild reset the box's firewall and took prod down. `aws_lightsail_instance_public_ports` names the instance by NAME, which survives a rebuild, so nothing in its own config diffs and the plan leaves it untouched while the replaced instance comes up with Lightsail's DEFAULT rules (22 + 80). State then claims ports AWS has closed. Live, the `--store` -> `--repo` argv change replaced the prod box and shut both 443 (`522` at every hostname, the site down with a perfectly healthy app behind it) and the management ssh port, so `\u003CLightsailRelease\u002F>` sat on `waiting for ssh on \u003Cip>:2222 (attempt N\u002F60)` for 25 minutes; opening the two ports by hand let the release pass INSTANTLY with `beet: already serving`, which is the tell that the box was never the problem. The ports resource now carries `replace_triggered_by` on the instance, exactly as the static IP attachment already did. Covered by `rebuilding_the_box_reapplies_the_firewall` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`. Diagnose with `aws lightsail get-instance-port-states --instance-name beet-site--\u003Cstage>--main-lightsail-instance`: a rebuild deploy whose plan does not list the ports resource is this bug back.\n\nREGRESSION GUARD (fixed): a boot-time Let's Encrypt failure left the box serving TLS the edge rejects, with nothing in the deploy that notices (`\u003CLightsailRelease\u002F>` probes loopback). Twice live: once the chain download failed after a successful validation, and once (2026-09-11) a rebuilt prod box came up during a Let's Encrypt secondary-validation outage with its first attempts already lost to the firewall race, so `beet.org` and `www.beet.org` served `525` for two hours (distinct from `521`: something IS listening on 443, its cert is just not one Full-strict accepts) while the certificate the previous box had held was valid the whole time. A rebuild now restores the saved certificate store before Caddy starts, and Caddy starts from the release step rather than racing the firewall. Covered by `rebuild_restores_the_certificate_store` and `release_starts_the_tls_terminator` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`. On a `525` check `sudo find \u002Fvar\u002Flib\u002Fcaddy -name '*.crt'` for the MISSING hostname and `sudo journalctl -u caddy`; if Let's Encrypt itself is failing (`During secondary validation`, `serverInternal`) check their status page and community forum before restarting Caddy, since every restart burns validation attempts against a limit of 5 per hostname per hour.\n\nREGRESSION GUARD (fixed): Caddy was installed via its cloudsmith rpm repo, whose setup script writes an `amzn\u002F2023` baseurl that Caddy does not publish, with `skip_if_unavailable=1`. `dnf install -y caddy` therefore exited `No match for argument: caddy`, cloud-init logged a failed `scripts-user` module and carried on, and the box booted serving the app on its own port with NOTHING on 80\u002F443, while `beet-deploy` reported success and every hostname returned `521`. Caddy is now installed from the pinned upstream static release (`LightsailBlock::CADDY_VERSION`) with its own systemd unit, and the script verifies the binary (`caddy version || exit 1`) so a failed install stops the boot instead of silently producing a TLS-less box. Covered by `installs_caddy_from_static_release_not_rpm` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`.\n\nREGRESSION GUARD (fixed, 2026-10-15 prod): the CloudWatch agent logs to its own file, not the journal, so the `AccessDenied` sweep above never saw it denied. Every `collect_list` entry carried `retention_in_days`, and agent `1.300071.0` answers that with `logs:DescribeLogGroups`, which the box's identity is never granted: five `AccessDeniedException ... no permissions boundary allows the logs:DescribeLogGroups action` lines at each boot, harmless (the agent gives up and ships anyway) but a box asking for a grant it should not hold. Retention belongs to the stack's `aws_cloudwatch_log_group` alone; covered by `the_stack_owns_log_retention` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`. Prod `01a13e61` booted before the fix, so its agent log keeps those five lines until its next rebuild. Box check: `sudo grep -c AccessDenied \u002Fopt\u002Faws\u002Famazon-cloudwatch-agent\u002Flogs\u002Famazon-cloudwatch-agent.log` reads `0`.\n\nREGRESSION GUARD (fixed, 2026-10-16 dev): an elevated deploy converged its credentials, then its child `deploy` failed ~11s in with a bare `Internal Error: dispatch failure`, printed three times and three more by the parent. `dispatch failure` is the AWS SDK's `SdkError::DispatchFailure`, whose message hides its cause; a 500 or a failed command now reports the cause beside it (`ErrorReport`, `crates\u002Fbeet_core\u002Fsrc\u002Fbevy_utils\u002Ferror_report.rs`), and this shape reads `ConnectorError { kind: Timeout, .. HttpTimeoutError { kind: \"HTTP connect\", duration: 3.1s } }`: the child's first call, `sts:GetCallerIdentity` naming the state bucket, never connected within the SDK's default 3.1s on any of its three attempts (three of those plus backoff is the 11s, reproduced as 11.2s against an unroutable `AWS_ENDPOINT_URL_STS`). Not the credentials (the child loads the pair the elevation resealed, its `2 env var(s) set`, and a bad pair is an STS `403`) and not the region (`beet-state-898915787211` IS in ap-southeast-2, which `GetBucketLocation` answers from us-east-1). The network was: the router advertises an ipv6 route and two ipv6 nameservers over a link that carries no ipv6, so `systemd-resolved` intermittently stalls a lookup on them for seconds (its journal logs `Using degraded feature set .. for DNS server 2001:fb0:..` at the failure times), and the SDK times the lookup inside its connect. Every beet SDK client now starts from `aws_ext::loader()`, waiting `aws_ext::STALL_TIMEOUT` (10s) at the connect and at the stall grace alike (the 5s grace fired next, as `ThroughputBelowMinimum`); covered by `outlasts_a_stalled_lookup` in `crates\u002Fbeet_net\u002Fsrc\u002Fstore\u002Faws_ext.rs`. `tofu init` has the same exposure on its own (`registry.opentofu.org .. context deadline exceeded`, since that host, unlike AWS's, has an ipv6 address): `curl -6 -m 5 https:\u002F\u002Fregistry.opentofu.org` timing out is the tell, and the fix is the network's, ie `nmcli connection modify \u003Cwifi> ipv6.method disabled` (or `ipv6.ignore-auto-dns yes`) on a link like this one, else a retry.\n\nAN INTERRUPTED APPLY LEAVES TWO MESSES, AND BOTH BLOCK THE RETRY. A deploy killed mid-apply (SIGTERM, a lost terminal, a timeout) leaves (1) a stale state lock and (2) resources that exist in AWS but not in state, because tofu creates them before it persists. The retry then fails twice over: first `Error acquiring the state lock` naming a lock id and the time it was `Created`, then a wall of `EntityAlreadyExists` \u002F `ResourceAlreadyExistsException`. Neither is a code fault and neither self-heals. Recovery, in order:\n\n1. Confirm nothing is actually running (`pgrep -af tofu`), then `tofu -chdir=target\u002Finfra\u002F\u003Capp> force-unlock -force \u003CLOCK_ID>` using the id from the error. The lock is an object in the state bucket (`\u003Ckey>.tflock`); deleting it by hand works but skips the id check.\n2. Diff `tofu -chdir=target\u002Finfra\u002F\u003Capp> state list` against what AWS actually holds, and `tofu import \u003Caddress> \u003Cid>` each orphan. Prefer import to deleting and recreating whenever the resource is live (a schedule that has fired, a log group holding evidence). The ids are per-type: a log group is its name, an IAM role its role name, an inline role policy `\u003Crole>:\u003Cpolicy>`, a policy attachment `\u003Crole>\u002F\u003Cpolicy-arn>`, a lambda its function name, a scheduler schedule `\u003Cgroup>\u002F\u003Cname>` (ie `default\u002F\u003Cname>`).\n3. Re-run the deploy; it should now converge to no-op plus whatever genuinely changed.\n\nCHECK THE REAL EXIT CODE. `just beet-deploy ... | sed ...; echo $?` reports the exit of `sed`, so a deploy killed by a signal reads as success. Redirect instead of piping (`just beet-deploy --stage=prod > log 2>&1; echo \"EXIT=$?\"`) and strip the ANSI afterwards, or set `-o pipefail`. `just` prints `recipe ... was terminated ... by signal 15` on the line above, which is the real tell.\n\nAN APPLY OUTLIVES MOST TOOL DEADLINES; RUN IT DETACHED. A full deploy takes 10-15 minutes, and a deploy driven from a tool with a kill deadline (an agent harness, a CI timeout) can SIGTERM the mid-flight apply, leaving exactly the two messes above. Run it detached and watch the log instead: `setsid nohup sh -c 'just beet-deploy --stage=prod > .agents\u002Ftmp\u002Fdeploy.log 2>&1; echo \"EXIT=$?\" >> .agents\u002Ftmp\u002Fdeploy.log' &`, then tail the log until the `EXIT=` line appears.\n\nREGRESSION GUARD (fixed, 2026-10-23): a detached deploy's 300s watch printed NOTHING between `tailing CloudWatch log group` and `watch timed out`, prod 10-21 and 10-23 alike, while the box's lines did reach CloudWatch. The `aws` cli is python, which block-buffers a stdout that is not a terminal, and the timeout's kill discarded the buffer, so the watch could never show a fatal boot error in exactly the mode this section requires. `AwsWatch` now runs the tail with `PYTHONUNBUFFERED=1` (`crates\u002Fbeet_infra\u002Fsrc\u002Factions\u002Faws_watch.rs`); a detached deploy log with an empty watch on a box that logged is this bug back.\n\nREGRESSION GUARD (fixed): the release step passed a box that never served. `\u003CLightsailRelease\u002F>` confirmed only that the unit was `active` and that `\u002Fproc\u002F\u003CMainPID>\u002Fenviron` carried this deploy's id, but under `Restart=always`\u002F`RestartSec=3` a crash-looping unit ALWAYS has a live `MainPID` carrying the right id, so a deploy exited 0 while the box 502'd and restarted ~340 times. The converge loop is now the gate: an attempt passes only when the unit is active, the running process reports the expected id, `curl -fsS --max-time 5 http:\u002F\u002F127.0.0.1:\u003Capp_port>\u002F` succeeds, AND `NRestarts` is unchanged across the whole attempt (a crash loop that answers one lucky request between restarts still fails). The probe is loopback deliberately: with a domain the firewall opens 80\u002F443 only, so the app port is reachable from the box alone, which is exactly \"the app itself serves\". Covered by `release_proves_the_running_process` and `release_probes_the_declared_port` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`. A release step reporting success on a box whose `NRestarts` is nonzero is this bug back.\n\nDo NOT read a single `curl: (22) The requested URL returned error: 500` in that step's narration as a failure. The script logs the stderr of EVERY attempt, so one failed probe followed by a pass is a converge loop doing its job, and on a fresh box the first request routinely is that failure: the box's very first `\u002F` is served while the instance is still at zero burst capacity, and it 500s on an AWS SDK `dispatch failure` reaching the repo store, the same clamp described under Topology. The tell that it was transient rather than a crash loop is the box log, request `#1 -> 500`, `#2 -> 200 OK`, plus `NRestarts=0` afterwards. A `500` that repeats across attempts fails the gate on its own and the deploy never reaches this line.\n\n## Commands\n\nEvery credential the deploy needs (the AWS pair, `CLOUDFLARE_API_TOKEN`), and the box's ssh host key its apply writes into the stack (`BEET_SSH_HOST_KEY`, see Topology), is a record of the repo's `secrets.toml`, loaded into the process environment by the launch before the entry builds; there is no `.env`. The AWS pair and the Cloudflare token are the repo's **deploy credentials**, declared at the site entry's root (`\u003CAwsDeployCredential\u002F>`, `\u003CCloudflareDeployCredential\u002F>`) and lowered from what the stacks declare at the launch's stage and at prod: the AWS pair is the IAM user `beet-deploy`, one managed policy per app (`beet--deploy`, `beet-site--deploy`, `beet-social--deploy`) and a boundary per app and stage; the Cloudflare token is `beet-deploy`, four zone permission groups on `beet.org` and nothing at the account. Nobody mints either: every deploy checks both against the declarations before it writes anything, and refuses naming `--elevated` when they fall short (a block whose service the policy does not grant, a bucket declared or its retention changed, a deletion of production data, a sealed credential whose record carries no `grants` metadata because it was converged before records carried them). `destroy` passes the same gate, so a refusal blocks a teardown exactly as it blocks a deploy. The elevated deploy asks for the six-digit code and the Cloudflare dashboard login, only as each credential needs it, converges them, and runs the same deploy. An agent cannot answer those prompts: when a deploy refuses, print its message to the operator as it is (it ends with the command to run in a terminal), never paraphrased. A failed command, a refusal included, is reported once, as one `ERROR` line on stderr: `` `\u002Fdeploy` failed with exit code \u003Ccode>: \u003Creport> ``, its cause beside it; stdout carries a success's answer alone, and a failed child the elevated deploy runs reports itself, its parent only `` `deploy` exited with \u003Ccode> `` and the converge report. That command names the running program (`target\u002Fdebug\u002Fbeet ...`), which stays deploy-capable only until something rebuilds `beet-cli` without `infra,extra` (ie the screenshot check's `cargo run -p beet-cli`), so the recipe form (`just beet-deploy --elevated`) is the durable equivalent. `--dry-run` on any deploy says, asking for nothing, what each credential would hold and whether the deploy needs `--elevated`, which is also how you see what the declarations ask of Cloudflare, since a 403 there names no permission group. The provider addresses (the region, the Cloudflare account and zone) are not secrets: they are `{AwsRegion(..)}`, `{CloudflareAccount(\"..\")}` and `{CloudflareZone{..}}` spreads on the entry's root `\u003CRouter>` (or a stack), resolved by ancestry and never read from the environment, so a stack with none fails its render naming the spread. Reading the document needs this machine's age identity (`beet secrets\u002Fcheck` says whether it opens, `beet secrets\u002Fls` lists the records with what each is and how it rolls). Always use the `beet-*` and `site-*` recipes: they build with `--features infra,extra`, without which the deploy routes load as inert tags and the verb does nothing.\n\n`just beet-deploy` is the site's PACKAGE deploy, `all\u002Fdeploy` (built with `atproto` too): the stage stack, the `shared` assets bucket and the `social` handles, in that order, past ONE gate, so a refusal names every stack's reasons and an elevated run asks for each human factor once. The stage stack's own verbs sit under `site\u002F` (`just site-stage deploy|plan|destroy|..`, and the `beet-sync`, `beet-watch`, `beet-destroy`, `beet-validate`, `beet-plan` recipes); `all\u002Fplan` plans all three (`cargo run -p beet-cli --features infra,extra,atproto -- --entry=site all\u002Fplan --stage=prod`). A dev cycle uses the stage stack alone: the package would also apply the real `shared` bucket and stand up a `beet-social--dev` stack that `beet-destroy` leaves behind.\n\n| intent | command |\n| --- | --- |\n| local serve (http+ssh) | `cargo run -p beet-cli -- --entry=site serve --server=http,ssh` |\n| pre-apply safety check | `just beet-validate` then `just beet-plan` (eyeball the plan) |\n| dev deploy (the stage stack alone) | `just site-stage deploy` |\n| re-publish site only (no redeploy) | `just beet-sync` |\n| tail the instance logs | `just beet-watch` |\n| dev destroy | `just beet-destroy` |\n| prod deploy (the package: stage, shared, social) | `just beet-deploy --stage=prod` |\n| prod deploy of the stage stack alone | `just site-stage deploy --stage=prod` |\n| whether a deploy needs `--elevated`, and what each credential would hold | `just beet-deploy --stage=prod --dry-run` |\n| an elevated deploy (the operator, in a terminal) | `just beet-deploy --stage=prod --elevated` |\n\n`just beet-plan --stage=prod` shows the prod plan without applying.\n\n## Verification (IDENTICAL for every step)\n\nEach step verifies its environment with the same five checks. Parameters: a `BASE_URL` (`http:\u002F\u002Flocalhost:\u003Cport>` for local, `https:\u002F\u002Fdev.beet.org` for dev, `https:\u002F\u002Fbeet.org` for prod) and an SSH target (`127.0.0.1` + the local ssh port for local; the DNS-only `app.` subdomain + port 22 for dev\u002Fprod, ie `app.dev.beet.org` \u002F `app.beet.org` -- the bare `dev.beet.org`\u002F`beet.org` are Cloudflare-proxied web-only and do NOT forward ssh). All five must pass.\n\n### a. curl (raw http)\n\nGET each key page; assert HTTP 200 and the expected marker:\n\n- `\u002F` (home) -> 200, renders the landing page\n- `\u002Fdocs` -> 200, and its head carries `\u003Cmeta name=\"robots\" content=\"noindex\" \u002F>`: every docs page is `visibility = \"unlisted\"`, served to whoever holds the url and listed nowhere (no sidebar, sitemap, search index or feed entry), and the header's Docs link and the landing page's Get Started button are `hidden`\n- `\u002Fdocs\u002Fdesign` -> 200\n- `\u002Fsitemap.xml` -> 200 and carries no `\u002Fdocs` url\n- `\u002Fdocs\u002Fdesign\u002Fcounter` -> 200, body contains `Counter` and `You have clicked`\n- `\u002Fdocs\u002Fdesign\u002Fcolor_schemes` -> 200 (the styles page)\n- `\u002Fblog` -> 200, and the body carries a `\u002Fblog\u002F\u003Cslug>` link per post. The listing is generated by `\u003CRouteIndex reverse=\"true\"\u002F>` in `site\u002Froutes\u002Fblog\u002Findex.bsx` rather than maintained by hand, so a scan that found no posts renders an EMPTY page that still answers 200: assert the count, not the status.\n- `\u002Fblog\u002Ffolk-technology` -> 200 (a post reached by its slug, the segment `\u003CRoutesDir\u002F>` derives from the post's own `slug` frontmatter rather than its `\u003Cnumber>-` filename)\n- `\u002Fblog\u002Fpost-6` -> **301** to `\u002Fblog\u002Ffolk-technology`. Every post was renamed from `post-\u003Cn>` to a slug, and `site\u002Fmain.bsx` keeps the old urls alive with a block of `\u003CRedirect path=\"post-\u003Cn>\" redirect=\"\u003Cslug>\"\u002F>`. That block is part of the entry document the box loads out of the repo store, so it is exactly as deployable-and-breakable as a route: sweep all fifteen (`for n in $(seq 1 15); do curl -o \u002Fdev\u002Fnull -w '%{http_code} %{redirect_url}\\n' \"$BASE\u002Fblog\u002Fpost-$n\"; done`) and assert every one is a 301 to a slug that itself answers 200. A `\u003CRedirect\u002F>` carries no `PageRoute`, so it is absent from the sidebar and from `RouteIndex`, and nothing but this check covers it.\n\nAlso fetch `\u002Fdocs\u002Fdesign\u002Fcounter?color-scheme=light` and `?color-scheme=dark` and confirm 200 (the scheme is applied server-side for the screenshot check below).\n\n`\u002Fdeploy` -> **404**. The `Router` is a url space, so a served request can never reach the sibling deploy commands; a 200 here means the site's routes and the stack's have been merged into one namespace.\n\n`\u002Fwasm\u002Fbeet-full.wasm` and `\u002Fassets\u002Fwasm\u002Fbeet-full.wasm` -> **404**, and no served page carries a `.wasm` `src`\u002F`href` or an `application\u002Fvnd.beet.bootstrap` script. The site boots no wasm and neither its repo store nor `site\u002Fassets` holds a build output, so a 200 here means a `\u003CDirCopy\u002F>` list borrowed one again.\n\n`\u002F` with `Accept: application\u002Fjson` -> **200** with an `application\u002Fjson` body (the page serialized by the `TemplateRenderer`), and an unknown path with the same header -> **404**. REGRESSION GUARD (fixed, 2026-09-18 dev): the renderer handed the `TemplateRenderer` an EMPTY accepts list, which it read as a mismatch against nothing, so every request carrying `Accept: application\u002Fjson` was a 500 on every page including the 404 page. Nothing in checks a-d sends that header, so the first evidence was the box log: scanner probes at `\u002Fgraphql` and `\u002Fv2\u002F_catalog` logging `accept mismatch: requested [], available [Json]` beside `500 Internal Server Error` while `\u002Fwp-admin` and friends 404'd. Every render target now receives the media type it was chosen for (`RenderTargets`), covered by `serializes_the_scene` in `crates\u002Fbeet_ui\u002Fsrc\u002Frender\u002Frender_target.rs`. Scan the box log for ` 500 ` after every deploy: a 500 on a path that should 404 is a content negotiation fault, not a scanner (a bare ` 500 ` also matches `in 500 µs` timings, so count `-> 5[0-9][0-9]` instead). One `no component, resource or template registered for tag \u003CSecrets>, building it inert` warning per boot, box and lambda alike, is by design: `site\u002Fmain.bsx` keeps the tag unconditional so the prescan sees it, and the deployed build links no `vault`. The scanners probing port 22 log at INFO as `SSH handshake refused: ..` (`invalid SSH version string`, `No common Key algorithm`) and their dropped sockets at DEBUG, so an ssh `ERROR` line in the box log is a real fault; until 2026-10-23 they logged ~20 `SSH session error` lines a day.\n\n### b. browser verification (navigability, the counter, client errors, mobile layout)\n\nThe counter (`site\u002Froutes\u002Fdocs\u002Fdesign\u002Fcounter.bsx`) renders a document field as \"You have clicked N times.\", with a \"More\" and a \"Less\" button whose `bx:click` scripts mutate it. The browser check asserts first paint only: there is no client interactivity tier until the wasm one lands, so a click in the browser does nothing yet. The whole check is one committed test driving the in-house webdriver (`chromedriver` + a chromium on PATH are the only deps):\n\n```sh\nBEET_BASE_URL=\u003CBASE_URL> cargo test --test site_browser \\\n  --features router,json,testing,webdriver -- --include-ignored\n```\n\n`tests\u002Fsite_browser.rs` runs everything below and exits non-zero on any client error or overflow. The checks:\n\n**Client errors (fail on any).** Before navigating, two collectors attach and the run fails if either fires, so a broken client script cannot ship silently -- exactly the miss that let `crypto.randomUUID is not a function` reach the analytics beacon in production:\n\n- `page.console()` -- `console.error` plus uncaught exceptions and failed-request console messages (BiDi `log.entryAdded`).\n- `page.responses()` -- any 4xx\u002F5xx subresource. A favicon that fails to load raises no console error, so without this a site whose every asset 403s still reports green.\n\n**Asset sweep.** Load a page that actually carries an image (`\u002Fblog\u002Ffolk-technology`), collect every `\u002Fassets\u002F` reference on it (`img[src]`, `link[href]`, `script[src]`, `source[src]`), fetch each following redirects, and assert 200. This is the store-topology check: the app serves assets from its own bucket, and a private bucket handing out a public url turns every asset into a redirect to a 403. Both this and the response collector were added after exactly that shipped past a green run (`S3Store::public_url` claimed a virtual-hosted url for a private bucket; it now returns `None` unless the store is explicitly `with_public(true)`).\n\nIgnore nothing by default; if a message is genuinely benign, match it exactly and log that it was skipped. CAVEAT: some faults only surface in an insecure context -- `crypto.randomUUID`\u002F`crypto.subtle` are gated to secure contexts, and localhost + `https:\u002F\u002F` are both secure, so this check does NOT reproduce that specific bug. The durable fix is keeping secure-context-only APIs out of the client (the beacon now derives its id from `crypto.getRandomValues`, available on plain http); the collectors still catch the broad class of client JS errors on every env.\n\n**Counter + navigability.** Headless chromium: goto `BASE_URL\u002Fdocs\u002Fdesign\u002Fcounter` and assert its first paint (\"You have clicked 0 times\", plus the \"More\"\u002F\"Less\" buttons). Then navigate `\u002F` -> `\u002Fblog` -> a post (`\u002Fblog\u002Fbevys-five-and-beets-alive`) via in-page links at a desktop viewport (proves the site is navigable, not just direct loads; the docs are unlisted, so no visible link leads there). Assert the unlisted docs stay out of sight: `\u002F` shows no visible `a[href^='\u002Fdocs']` (the `hidden` ones have no client rects), the sitemap names no `\u002Fdocs` url, and `\u002Fdocs` carries `noindex`. Then load `\u002Fblog` + the post so the beacon runs on a content page -- the pages the client error was reported on.\n\n**Desktop layout (tables inside the column, a content-independent rail).** At 1280x800 (inside the sidebar rail's shrink range) and 1920x800 (past the column's measure cap), for `\u002Fdocs\u002Fdesign\u002Ftable`, `\u002Fdocs\u002Fcrates` and `\u002Fdocs\u002Fsecrets`, assert every `main table` (its `.table-scroll` wrapper where it has one) sits within the extent of the page's `main h1`, and that `#sidebar` is exactly as wide as on the prose page `\u002Fdocs\u002Fabout`; on `\u002Fdocs\u002Fdesign\u002Fcolor_schemes`, that no `.color-box` swatch overflows its box (a fixed `height` in `site\u002Ftemplates\u002FStyles.bsx` once clipped every two-line label, now `min-height`) and every swatch shares one font size (the `Error` swatch, `class=\"color-box error\"`, once took beet_ui's `.error` box rule and its small type; that class is now `.error-box`, and `no_class_is_named_after_a_color_role` in `crates\u002Fbeet_ui\u002Fsrc\u002Fstyle\u002Fmaterial\u002Fclasses\u002Fmod.rs` keeps every material class off the colour role names). Regression guard: a wide table stretched past the article column, and `\u003Cmain>` sized its flex basis from its content, so a table page drove the rail to its floor while prose shrank it. Fixed by the measure on the table wrapper (`crates\u002Fbeet_ui\u002Fsrc\u002Fstyle\u002Fmaterial\u002Fclasses\u002Ftable.rs`) and the fixed `main_content_basis` (`crates\u002Fbeet_ui\u002Fsrc\u002Fstyle\u002Fmaterial\u002Fclasses\u002Flayout.rs`).\n\n**Mobile layout (no horizontal overflow).** At viewports 375x812 and 320x812, for `\u002F`, `\u002Fblog`, and `\u002Fblog\u002Fbevys-five-and-beets-alive` assert `document.documentElement.scrollWidth \u003C= document.documentElement.clientWidth + 1`, printing the offending elements on failure so the culprit is obvious. Regression guard: a `\u003Cpre>` code block or a wide embed used to blow `\u003Cmain>` past the viewport (`\u003Cmain>` is a flex item, fixed with `min-width: 0`), and the header nav overflowed at 320px (fixed with an `@media screen` app-bar `flex-wrap`).\n\nThe test asserts ZERO collected client errors across every navigation above; extend `tests\u002Fsite_browser.rs` if a deploy needs a check it does not cover, rather than scripting around it.\n\n### c. screenshot (styles + color schemes)\n\nScreenshot the home page, the counter page, and `\u002Fdocs\u002Fdesign\u002Fcolor_schemes`, each in default, `?color-scheme=light`, and `?color-scheme=dark`, via the cli: `cargo run -p beet-cli --features infra,extra -- screenshot '\u003CBASE_URL>\u002Fdocs\u002Fdesign\u002Fcounter?color-scheme=light' --output=.agents\u002Ftmp\u002F\u003Cstep>-counter-light.png` (an installed `beet` works too; the `infra,extra` set reuses the deploy build, where the bare form relinks `target\u002Fdebug\u002Fbeet` without the deploy verbs and again for check e). Save to `.agents\u002Ftmp\u002F`, then `Read` the PNGs and confirm they render styled (typography, buttons, layout present; light vs dark visibly differ), not an unstyled or broken page. The server-side default scheme is dark, so `default` and `dark` are expected to be identical. Also screenshot `\u002Fdocs\u002Fdesign\u002Ftable` at the default 1280 width and with `--width=1920`, confirming every table sits inside the article column (its right edge no further out than the heading's measure) and the sidebar rail keeps its prose width, the visual twin of check b's desktop layout stage.\n\n### d. ssh (the live terminal + multi-tenancy)\n\nThe site is also a navigable charcell TUI over ssh (`SshTuiServer`, multi-tenant). Connect non-interactively over a pty, navigate the listed pages and their history, open the unlisted counter by its url, then prove two clients run at once. The docs are unlisted, so no sidebar or visible link leads there, but a session opens at whatever url its client names as the ssh command (`ssh -t \u003Chost> \u002Fdocs\u002Fdesign\u002Fcounter`), as a browser does on the web.\n\n- connect: `ssh -tt -o StrictHostKeyChecking=no -o UserKnownHostsFile=\u002Fdev\u002Fnull -o ConnectTimeout=15 -p \u003Cssh_port> \u003Cuser>@\u003Chost>` (local: `-p \u003Cport> root@127.0.0.1`; dev\u002Fprod: the `app.` subdomain `app.dev.beet.org` \u002F `app.beet.org` on port 22, any user. The bare `dev.beet.org`\u002F`beet.org` records are Cloudflare-proxied and do not forward ssh; only the DNS-only `app.*` record points straight at the box's static IP. The stable `BEET_SSH_HOST_KEY` gives a consistent fingerprint, so `StrictHostKeyChecking=no` is safe.)\n- the handshake completing + a rendered frame appearing confirms the ssh server is up.\n- multi-tenancy: launch TWO ssh sessions at once (both backgrounded), drive both to different pages, and confirm BOTH render the site and respond independently with no crash\u002Fhang on either.\n- host key: `ssh-keyscan -t ed25519 \u003Chost> 2>\u002Fdev\u002Fnull | ssh-keygen -lf -` (port 22) must print the `BEET_SSH_HOST_KEY` record's fingerprint, computed without printing the key by `beet secrets\u002Fexec --only=BEET_SSH_HOST_KEY -- sh .agents\u002Fskills\u002Finfra-deploy\u002Fhost_key_fingerprint.sh`, which decodes the record into a private temp dir and runs `ssh-keygen -lf` on it. Locally (`-p \u003Cssh_port> 127.0.0.1`) the serve log names its source as `ssh host key from env $BEET_SSH_HOST_KEY`. A fingerprint that differs, or changes across a `systemctl restart beet-site`, means the box is not serving the record (on a box, the stack's write-only parameter the apply fills from it). Never read the parameter to compare: the fingerprint is the check.\n- rolling the host key: the record's own `roll` (`beet secrets\u002Fls`) has the steps. Generate a fresh ed25519 key into a mode 700 temp dir (`ssh-keygen -t ed25519 -N '' -C beet-site -f \u003Cdir>\u002Fkey`), seal it with `base64 -w0 \u003Cdir>\u002Fkey | beet secrets\u002Fset BEET_SSH_HOST_KEY --role=env_var --note=.. --roll=..` (every `set` restates the role, note and roll, and drops any it is not given, so copy them from `secrets\u002Fls`), delete the temp dir, then deploy each live stage. The full apply converges the parameter and `\u003CLightsailRelease\u002F>` restarts the box onto it: no rebuild, and the box is replaced only if its machine config changed anyway. Clients pinning the old key need `ssh-keygen -R app.beet.org`.\n\nREGRESSION GUARD (fixed, 2026-10-15 dev): the rolled record was base64 of the PEM file `ssh-keygen` writes, while the server read only base64 of the binary encoding inside it, so the box logged `ignoring malformed BEET_SSH_HOST_KEY: format encoding error` and the release build fell through to a fresh RANDOM key every start, a new fingerprint per restart with check d still green. Local check d cannot see it: a debug build falls back to a fixed key. The server now reads the PEM file, base64 of it (wrapped or not), or base64 of the binary encoding, and a declared key that parses as none of them fails the ssh server rather than serving under a stranger's fingerprint; covered by `parses_every_host_key_encoding` in `crates\u002Fbeet_net\u002Fsrc\u002Fssh\u002Fimpl_russh_server.rs`.\n\nREGRESSION GUARD (fixed, 2026-10-15): the site box's ssh host key rode its `user_data` env file (`LightsailBlock::with_secret_env_from_process`), so it was readable through the Lightsail api (`GetInstance`), the tofu state and every rendered `main.tf.json`, and a dumped render put it into a transcript and it had to be rolled. No compute block can render a secret any more (the `secret_env` channel is gone from Lightsail and Fargate): the box reads its key from the stack's secret store as above. Covered by `the_host_key_never_renders` (`crates\u002Fbeet_extra\u002Fsrc\u002Finfra\u002Ftemplates.rs`, a site-shaped stack rendered at dev and prod with a known key in the deployer's environment, in every encoding), `the_box_reads_exactly_its_secrets` and `reads_secrets_is_checked_at_render` (`crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`), `the_server_reads_its_key_from_the_store` (`crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Fsecret_block.rs`) and `serves_the_declared_key_or_fails` (`crates\u002Fbeet_net\u002Fsrc\u002Fssh\u002Fimpl_russh_server.rs`). Check after any render: `beet secrets\u002Fexec --only=BEET_SSH_HOST_KEY -- python3 .agents\u002Fskills\u002Finfra-deploy\u002Fhost_key_scan.py target\u002Finfra .agents\u002Ftmp\u002Frender` reads `0 holding key material`. After a package verb, re-render the stage stack first (the shared work directory, under the diagnosis path above), or the scan never sees the box's `user_data`. It looks for the record, its PEM body and every line of it, and the private seed in hex and base64, printing only file names, so it is also how to find (and delete) an old dump still carrying the key; a bare `grep 'BEET_SSH_HOST_KEY='` sees only the env-file form. The fix is itself a machine-config change (the env file lost a line), so the first deploy of each stage carrying it replaces that stage's box and rolls its access key, and needs `--elevated` while the stage's runtime boundary lacks the new parameter grant.\n\nPort **2222** on the same host is the box's own management sshd, not the site. Use it (with the stack's Lightsail key pair) to get a real shell for diagnosis: `systemctl status beet-site`, `journalctl -u beet-site`, `systemctl status caddy`.\n\n#### ssh driver\n\nThe driver lives beside this skill, in `.agents\u002Fskills\u002Finfra-deploy\u002F` (it is COMMITTED there on purpose: `.agents\u002Ftmp` is gitignored, and an earlier copy kept there silently vanished between deploys). `ssh.sh \u003CHOST> \u003CPORT>` runs the whole check (single session, two-client history, two-client counter by url, the no-pty hint, images) and `ssh_pty.py \u003CHOST> \u003CPORT> '\u003CSCRIPT>'` is the underlying pty driver, python3 stdlib only.\n\n- local: `.agents\u002Fskills\u002Finfra-deploy\u002Fssh.sh 127.0.0.1 \u003Cssh_port>` (default 8339; trust the serve output)\n- dev\u002Fprod: `.agents\u002Fskills\u002Finfra-deploy\u002Fssh.sh app.dev.beet.org 22` \u002F `.agents\u002Fskills\u002Finfra-deploy\u002Fssh.sh app.beet.org 22`\n\nThe script scales its waits up for any non-localhost host.\n\nConnection (what the driver runs per session): `ssh -tt -o StrictHostKeyChecking=no -o UserKnownHostsFile=\u002Fdev\u002Fnull -o ConnectTimeout=15 -o LogLevel=ERROR -p \u003Cport> root@\u003Chost> [\u003Cpath>]` on an 80x24 pty, the path being `PTY_PATH` when set.\n\nNavigation recipe. The TUI is a charcell render of the site: a left-click on a sidebar link navigates (focus also moves with Tab\u002FShift+Tab and Enter activates, but clicks are deterministic), and Alt+Left \u002F Alt+Right walk the session's history. The driver feeds SGR mouse press+release at 1-indexed cells and reconstructs the final frame through a small VT emulator, then greps it. At 80x24 the site is in its narrow layout: every page hides the sidebar (the blog posts; the docs are unlisted and appear nowhere) behind a hamburger menu (the `三`\u002F`☰` glyph at the top-left), so the sequence opens the menu before each navigation:\n\n1. click the hamburger menu at cell (col 3, row 1): opens the sidebar overlay.\n2. click \"ECS Router\": loads `\u002Fblog\u002Fecs-router` and closes the overlay.\n3. click the hamburger again, then \"Folk Technology\": loads `\u002Fblog\u002Ffolk-technology`.\n4. Alt+Left (`k:aleft`, ie `ESC [1;3D`): back to `\u002Fblog\u002Fecs-router`.\n\nPost titles render fullwidth (`ＥＣＳ　Ｒｏｕｔｅｒ`), so an ASCII title grep will NOT match: grep a single body word from each post's first screen instead, `bevyfication` for ECS Router and `Wollongong` for Folk Technology (single words, so no wrap can split them), and assert the other is absent so the frame is one page.\n\n**Everything but the hamburger is clicked BY LABEL, not by cell.** The sidebar lists every blog post, so adding one shifts every row beneath it and a pinned `m:col,row` clicks its neighbour instead -- silently, since the driver has no idea it missed. That is exactly what happened in the Phase 1 shakedown: the `Crates` docs section landed above `Design`, so the pinned `(6,6)` opened `\u002Fdocs\u002Fcrates\u002Fbeet_core` and all three checks failed on a page they never asked for, while `(6,15)` in the image check reached the wrong blog post. `ssh_pty.py` therefore takes `t:\u003Ctext>`, which locates `text` in the CURRENT frame (row-major, cell-aligned so a preceding fullwidth title cannot skew the column) and clicks its first cell, exiting with the frame if it is absent. The hamburger keeps its cell, being the one control no content can move.\n\nAs an `ssh_pty.py` script (`w:` is a seconds wait, `m:col,row` a cell click, `t:` a label click, `k:` keys, `u:secs:regex` a drain until the raw stream matches): locally `w:5;m:3,1;w:2;t:ECS Router;w:3;m:3,1;w:2;t:Folk Technology;w:3;k:aleft;w:3` lands back on ECS Router (expect `bevyfication`). Remote hosts double every wait. `ssh_pty.py` accepts `PTY_RULER=1` to print 1-indexed col\u002Frow guides, for reading the layout when a label match is ambiguous, `PTY_USER` to override the `root` user, and `PTY_PATH` to open at a url rather than the home page.\n\nTwo-client recipe: launch two `ssh_pty.py` runs at once (both backgrounded), drive them through the same two navigations to DIFFERENT history positions (A `aleft`, B `aleft;aright`), `wait`, then assert A shows ECS Router and B Folk Technology. Independent pages from one shared prefix prove per-session navigators. `ssh.sh` does exactly this, and calls out the known crash explicitly if a frame comes back \"connection refused\u002Fclosed\u002Freset\".\n\nCounter recipe: `PTY_PATH=\u002Fdocs\u002Fdesign\u002Fcounter` opens the unlisted counter by its url. The page closes the sidebar, so `t:More` clicks the button at the body's left; the title renders fullwidth (`Ｃｏｕｎｔｅｒ`), so grep the body line `You have clicked N times`, which also carries the count. Two concurrent runs click More once and twice and must show `1 times` and `2 times`: independent counts prove the `bx:click` scripts and per-session document state over a live session, beside the navigators the history recipe proves.\n\nRenamed and unknown urls: `PTY_PATH=\u002Fblog\u002Fpost-6` must land on Folk Technology (`Wollongong`), the post its `\u003CRedirect\u002F>` names, and `PTY_PATH=\u002Fno-such-page` must show `Route \u002Fno-such-page not found.` inside the site chrome, as the web answers both. REGRESSION GUARD (fixed, 2026-10-23): a session opened at a url that is not a page showed a raw `No Action\u003CRequest, PageRequest>` (a redirect) or `no route matched` (a miss), since the TUI built every url as a scene route. An in-world navigation now resolves a url as a browser does: a scene route builds live, a miss (or a draft in prod) builds the not-found page live, and anything else is answered through the router, a redirect followed with the history recording where it led. Covered by `follows_a_redirect_into_history` and `opens_an_unknown_url_on_not_found` in `crates\u002Fbeet_router\u002Fsrc\u002Fnavigate\u002Fnavigator.rs`.\n\nNo-pty recipe: a session without a pty has no terminal to draw into, a shell (`ssh -T \u003Chost>`) and a path without `-t` (`ssh \u003Chost> \u002Fblog`) alike. Each must exit `1` with `a terminal is required, add -t: ssh -t \u003Chost>` (the path appended when one was named) on STDERR and nothing on stdout, since the hint is a diagnostic and stdout is what a pipe captures as the answer, rather than sit silent until the pty timeout reaps it. The server builds no page for it either, so the box log carries no `has no page host to render into` error for it.\n\nREGRESSION GUARD (fixed, 2026-10-22): the server disconnected straight after closing a session, and a disconnect is fatal to OpenSSH, which exits `255` and drops output it has not yet written. So the no-pty hint never printed, its exit code read `255`, and every ctrl-c close ended on `Received disconnect`. The server now leaves the hang-up to the client, which answers the close with its own, and disconnects only a peer that ignores the close, after `CLOSE_GRACE` (5s, `crates\u002Fbeet_net\u002Fsrc\u002Fssh\u002Fimpl_russh_server.rs`), which keeps the reap decisive. Covered by `a_closed_session_leaves_the_hang_up_to_its_client` in `crates\u002Fbeet_net\u002Fsrc\u002Fssh\u002Fssh_server.rs`; a no-pty stage reading exit `255` with no hint is this bug back.\n\nImage recipe (the fifth check). The TUI draws real rasters over the cell grid with the kitty graphics protocol, and NONE of the above touches that path: the driver used to advertise a flat `xterm-256color` with a zero-pixel pty, and `KittyGraphicsSupport::from_pty` enables graphics only on a kitty\u002Fghostty term name or a non-zero pixel size. A totally broken image path therefore rendered a clean frame and passed. Three things have to line up, and each one silently produces \"no image\" on its own:\n\n- `PTY_TERM=xterm-kitty`, else the server never transmits at all.\n- Nothing about the window. The check runs at the DEFAULT 80x24: sizing contains a raster within its scroll port and `desired_placements` places the visible part of a partly clipped one, so the default window draws the post-6 image. It used to ask for `PTY_COLS=60 PTY_ROWS=40`, which is now gone.\n- The image scrolled into view (31 `k:down`), since it sits well below the fold. The post itself is reached by label (`t:Folk Technology`, post-6), for the same reason the navigation recipe is.\n- Time to arrive. The transmit runs at the link's pace, so `ssh.sh` drains until the cropped placement lands (`u:300:..`) rather than for a fixed time. Seen 2026-10-15: this machine's direct path to us-west-2 ran at ~40KB\u002Fs (the box's own sshd on 2222 moved 3MB in 75s, while an asset through Cloudflare's edge came at ~880KB\u002Fs), and the old fixed 12s wait cut every transmit off mid-chunk at 300-950KB, prod and dev alike, with no placement and a blank frame. A raw stream ending inside an unterminated `m=1` chunk is the clock, not the server; the same session given 200s placed `c=64,r=23` with `w=1280,h=920`.\n\nAssert on `PTY_RAW`, not the frame: the VT emulator discards APC sequences, which is exactly where the payload lives. `ssh.sh` greps the raw stream for an `ESC _ G a=t` transmit and reports the byte count (a healthy run is ~2.7MB), then for an `a=p` placement carrying the `w=`\u002F`h=` source-rect keys, which ride a placement ONLY when the raster is cropped. The second grep is the standing guard on the blank-hole class below: a placement that never crops means either that regression is back or the raster no longer straddles the port, and both want looking at.\n\nFIXED, AND CONFIRMED LIVE (Phase 10): a raster taller than its scroll port used to render as a silent blank hole, no image and no `[image]: alt` marker. `KittyImage::cell_size` clamped the width axis to the available columns but nothing bounded rows, so the 1280x960 post-6 photo computed to 30 rows at the default 80x24 window, and `desired_placements` dropped any rect the screen or clip did not contain whole. Sizing now bounds rows by the nearest scroll port's height and re-derives the columns to hold the aspect (`CellBounds`, threaded through the measure and layout passes), and a partly clipped placement draws its visible portion through the protocol's source rect instead of disappearing. Covered by `tall_raster_fits_the_default_window`, `raster_bounds_to_its_nested_scroll_port`, `scrolled_raster_places_a_moving_crop` and `every_viewport_places_the_raster` in `crates\u002Fbeet_ui\u002Fsrc\u002Frender\u002Fcharcell\u002Fkitty.rs`. Live over ssh at the default 80x24 the photo places as `c=64,r=23` (bounded by its port, not the 30 rows aspect alone would give) and crops as it scrolls, the source rect walking `h=760` -> `h=920` up to the port's bottom edge and then `y=40` -> `y=120` down the raster.\n\nREGRESSION GUARD (fixed): below the ~90-column breakpoint the sidebar drawer is `display: none` but `position: absolute`, and the charcell layout pass placed out-of-flow nodes without consulting `display`. The invisible drawer therefore kept a full-height rect and won every hit-test in a 20-cell stripe down the left of the screen, so `More` on the counter page was unclickable over ssh (Tab+Enter still worked). Fixed in `crates\u002Fbeet_ui\u002Fsrc\u002Frender\u002Fcharcell\u002Flayout.rs` (hidden subtrees are dropped before positioning, and a node that earns no rect this pass is zeroed rather than left holding a stale one). Covered by `sidebar_collapses_below_breakpoint` there and `narrow_viewport_stays_interactive` in `tests\u002Fbsx_site_tui.rs`. The default ssh window is 80x24, squarely in the affected range, and the counter recipe clicks `More` inside that stripe, so a deploy from a checkout without this fix fails check d.\n\nREGRESSION GUARD (fixed): every click inside the open sidebar overlay landed on the item TWO ROWS BELOW at 80x24. The focus ring is a border, so pressing a link moved focus off the hamburger, its ring dropped, the header shrank by two rows and the overlay rose with it before the release arrived; the release was re-hit-tested against the new geometry and reached the wrong link. `pointer_input` now delivers a release on the pressed cell to the pressed entity (`crates\u002Fbeet_ui\u002Fsrc\u002Frender\u002Fcharcell\u002Fhit_test.rs`, covered by `release_lands_on_the_pressed_entity_after_a_reflow`). The in-process twin is `cargo test --test bsx_site_tui --features router,style,markdown,fs,tui_server,quickjs,testing` (7 tests; `quickjs` is a required feature, since the counter's `bx:click` verbs are scripts, and without it cargo skips the target rather than failing it).\n\nKNOWN, AND NOT SEEN SINCE (multi-tenancy crash): an intermittent native crash (SIGSEGV\u002FSIGABRT, no Rust panic even with `RUST_BACKTRACE=full`) was recorded under two or more CONCURRENT ssh sessions, originally at roughly 20-40% per session pair, and suspected in the russh-on-a-tokio-runtime bridge to the single-threaded bevy world, ie a session despawn racing the per-frame `ssh_write` drain across sessions. Treat the 20-40% figure as STALE: the crash has not been observed since, across ~17 live session pairs (local, dev and prod, including three concurrent sessions streaming a 2.7MB image) and every run of the harness below.\n\nPhase 6 built the instrument that was missing, and it found a real defect on exactly the suspected path. A connection entity's lifetime belongs to its accept loop, which despawns it the moment the client's channel closes; an entity world scope does not flush, so the surface insert queued by the pty observer was still pending when that despawn ran, and `EntityWorldMut::despawn` flushes the command queue itself, AFTER removing the entity. Every client that vanished between its pty request and the next flush therefore raised \"Entity despawned\" through the app's error handler, ie a panic on the server's world thread, and a public port 22 supplies that shape continuously in the form of scanners. The harness hit it ~500 times per 2000-session run. Every command the ssh path aims at a connection is now silenced (`try_insert` \u002F `try_trigger_target` \u002F `try_remove`), pinned by `a_session_that_vanishes_before_its_surface_is_not_an_error` (`crates\u002Fbeet_router\u002Fsrc\u002Fnavigate\u002Fssh_tui_server.rs`) and `try_trigger_target_tolerates_a_despawned_target` (`crates\u002Fbeet_core\u002Fsrc\u002Fbevy_utils\u002Fentity_target_event.rs`); both fail without it.\n\nThe standing instrument is `ssh_stress_multi_tenancy`, at the bottom of `crates\u002Fbeet_router\u002Fsrc\u002Fnavigate\u002Fssh_tui_server.rs`: 2000 real russh sessions through a real listener, 24 concurrent, each dropping its socket while its neighbours are mid-frame, one in four vanishing before its own page has finished building. It is `#[ignore]`d, so the sanctioned test run compiles it and skips it. Run it with\n\n\tcargo test -p beet_router --features=ssh_stress --lib -- --ignored ssh_stress\n\n18,000 session cycles after the fix (12,000 across six debug runs and 6,000 across three release runs, release being what the box runs) produced zero crashes, zero coredumps and zero raised errors. The roughly 10,000 cycles run before the fix produced the same zero crashes and zero coredumps, and ~500 raised errors per run.\n\nThis does NOT prove the historical crash is gone. The harness renders a synthetic page and never exercises the kitty image path's multi-megabyte transmits, and the world-thread blocking fixes that landed earlier may account for the silence on their own. So `systemctl show beet-site -p NRestarts` stays the free canary on every deploy, and `ssh.sh` still calls the crash out by name if a frame comes back \"connection refused\u002Fclosed\u002Freset\". A sighting now is new information: capture the coredump with `coredumpctl` BEFORE restarting the unit.\n\nIf outbound port 22 is unexpectedly blocked at runtime, fall back to confirming the instance is `running` with its ports open via `aws lightsail get-instance-port-states` and record the limitation, but note port 22 was confirmed open from this host at authoring time.\n\n### e. analytics (the cross-transport event log)\n\nThe site records analytics for every transport: a server `Request` event per routed request, a `PageView` (with dwell) per web\u002Fterminal page visit, and `Click` \u002F `Scroll` \u002F `Error` events from the web client beacon. Events buffer into immutable zstd JSONL segments. Verify the visits from checks b-d landed in the store and that prior segments and rollups remain visible. Query with the `beet analytics` subcommand, mounted bare in `site\u002Fmain.bsx`: it reads the store the serving router's `AnalyticsConfig` writes to, since the document loads whole and that config's `StoreRef` resolves the stage and service access of the launch (built with `aws_sdk` so `--service-access=remote` reaches the live S3 bucket):\n\n- local: `cargo run -p beet-cli -- --entry=site analytics summary` (the store the site writes to, `target\u002Fstores\u002Fbeet-site--dev--analytics`)\n- dev\u002Fprod: `cargo run -p beet-cli --features infra,extra -- --entry=site --stage=\u003Cstage> --service-access=remote analytics summary` (the same config, resolved remote; `infra,extra` is the deploy recipes' feature set, so it reuses their build rather than relinking), or name a store outright with `--store s3:\u002F\u002Fbeet-site--\u003Cstage>--analytics`. Against prod it reads every aggregate row remotely (~11.4k objects on 2026-10-21, growing per day and path) and takes 5-6 minutes, so run it in the background rather than under a tool deadline\n\nRecipe (run around the b-d checks so the delta is attributable):\n\n1. BASELINE: query once before the b-d checks and record the total (`N events: ...`). Expect a non-zero baseline even on a brand-new stage: port 80\u002F443 is open to the internet, so scanners start recording `Request` events within a minute of the box serving (a fresh dev box read `288 events`, every one of them a `Web` `Request` for `\u002Fwp-admin` and friends, twelve minutes after the deploy returned). What matters is the DELTA, not the floor. That noise is also the earliest free proof that geoip is live, since a scanner's country resolves exactly like a real visitor's.\n2. Drive the visits: checks b (the browser test: link clicks home -> docs -> counter, then the drawer's menu button at phone widths) and d (ssh: navigate to the counter). These generate page views, `Click` events (the beacon reports clicks on links and buttons) and request events.\n3. DELTA: wait at least a minute after the last visit, then query again. Events buffer in the serving process until the oldest is `segment_max_age` old (60s, `AnalyticsConfig`) before their segment is written, so a query within that minute undercounts and can read as if a whole client kind never landed (locally, every browser beacon from check b was still buffered while the earlier ssh page views showed). Assert, from the summary:\n   - the total went UP (new events recorded) and is `>=` the baseline (prior events retained, since the store is append\u002Fupsert, never truncated).\n   - `PageView` events for the visited paths appear under `pages` (eg `\u002Fdocs\u002Fdesign\u002Fcounter`).\n   - both client kinds are present under `client kinds`: `Web` (the http\u002Fbrowser visits) and `Terminal` (the ssh session).\n   - for dev\u002Fprod (geoip enabled in the deploy build), a country appears under `countries` for the web visits. The geoip database (`assets\u002Fdatabases\u002Fcountry.mmdb`, ~8MB) is gitignored and workspace-owned, so it reaches the repo store by being borrowed into the staging dir by the `\u003CDirCopy\u002F>` under the deploy's `\u003CRepoStage>`: run `just beet-shared pull` AND `just site-shared pull` before deploying (the deploy mirrors the staged `site\u002F` whole, so an unhydrated `site\u002Fassets` would publish a site without its assets), and if `countries` is empty verify `country.mmdb` is present under `s3:\u002F\u002Fbeet-site--\u003Cstage>--repo\u002F\u003Cdeploy id>\u002Frepo\u002Fassets\u002Fdatabases\u002F`. The lookup is switched on by the `GeoIpDb` spread on the serving `\u003CRouter>` in `site\u002Fmain.bsx`, which reads that path out of the repo store like any other asset; without it every country is empty by authorship, and a declared-but-absent database logs `geoip: no country database at ..` on boot.\n\nREGRESSION GUARD (fixed): the deploy and runtime once derived the analytics resource name independently, so a missing app name let the site serve while every event write targeted a resource the deploy never created. The name is no longer derived twice: `site\u002Fmain.bsx` declares the bucket once and both sides compose it through the one resolved `Stack` (pinned by `one_declaration_names_the_bucket_for_both_sides` in `crates\u002Fbeet_extra\u002Fsrc\u002Finfra\u002Ftemplates.rs`). If a summary reports `0 events`, inspect `\u002Fvar\u002Flog\u002Fbeet-site.log` for a segment-write error naming the bucket and region first.\n\n### f. the nightly rollup (archive, aggregate, compact)\n\nThe analytics segment namespace does not grow forever. A `\u003CScheduledJobBlock label=\"rollup-daily\"\u002F>` invokes the `rollup` lambda at 03:00 UTC, which boots the entry's `jobs` verb out of the repo store, at the prefix its own deploy published, and dispatches `rollup` into its router. Each run merges every complete day's segments with its existing `analytics\u002Fraw\u002F\u003Cdate>.jsonl.zst` archive in `beet-site--\u003Cstage>--archive`, writes that day's deterministic `AnalyticsRollup` rows into the JSON-over-blob `analytics\u002Frollup\u002F` prefix of that same `beet-site--\u003Cstage>--analytics` bucket, reads both outputs back, and only then deletes the source segments from `analytics\u002Fraw\u002Fsegments\u002F`. The daily archive is the compact primary raw history; rollups are kept and can be re-derived from it.\n\n- `beet analytics summary` now reports over BOTH stores: aggregates for the days they cover, raws for the recent window they do not. `--raw-only` skips the aggregates, `--rollup \u003Curi>` overrides the aggregate store (it defaults to the events store, the site keeping both under one bucket).\n- The lambda publishes no url, no gateway and no hostname (`LambdaBlock`'s `http=false`), so the only way to run it by hand is `aws lambda invoke --function-name beet-site--\u003Cstage>--rollup-function --payload '\u003Cthe json below>' out.json --cli-binary-format raw-in-base64-out` (the payload is a `ScheduledInvoke`; anything else fails to deserialize and fails the invocation, deliberately). Its logs are `\u002Faws\u002Flambda\u002Fbeet-site--\u003Cstage>--rollup-function`. Note ONE dash before `function`: the label is `rollup` and `LambdaBlock` composes `\u003Capp>--\u003Cstage>--\u003Clabel>-function`, so the doubled form is a name that does not exist.\n- The first ordinary run compacts every complete day represented by segments and repairs aggregate rows for archived-but-uncovered days. Re-invoking continues where a timeout stopped: a failed archive or rollup verification leaves every source segment intact. `--full` (`{\"kind\":\"beet.scheduled_invoke.v1\",\"method\":\"Post\",\"path\":\"rollup?full=true\"}`) re-derives every archived complete day for a new aggregate schema; deterministic archive paths, aggregate IDs, and event-ID deduplication make it idempotent.\n- WATCH FOR: `deleted` may be nonzero only after the same run reports and verifies an archive and aggregate rows for those dates. A failed run must leave its source segments present; treat missing segments without both outputs as a bug, not an operational hiccup.\n- ON DEV, an invoke commonly reports `0 days` because `AnalyticsRollupRun::dates` never covers today and a dev stack exists for less than one UTC day. That proves the function boots and reaches all three stores; the focused fs compaction tests prove archive\u002Fwrite\u002Fdelete ordering. For a live end-to-end check, upload a valid yesterday segment under `analytics\u002Fraw\u002Fsegments\u002F\u003Cdate>\u002F\u003Cwriter-uuid>\u002F\u003Ctimestamp>-\u003Csequence>.jsonl.zst`, invoke, then assert the daily archive and aggregate objects exist and the source segment is gone. Aggregate objects are keyed by row id (`analytics\u002Frollup\u002F\u003Cuuid>`) with the date in the body, so count them against the run's `aggregates: N rows` rather than grepping keys for the date, which always finds nothing. Re-invoking must report `0 days`. Valid means every event's `timestamp` falls on the path's date: the run checks each one (`AnalyticsSegment::read`) and a mismatch fails the whole invoke with a 500, leaving the segment intact, so a today segment merely rekeyed under yesterday is refused. Build the seed by shifting a real segment's timestamps back one day (zstd JSONL, one event per line) and giving its events fresh ids.\n- ON PROD, once the schedule has been firing, `0 days` is the normal daytime result because 03:00 UTC compacted yesterday. Verify coverage independently: every completed date formerly represented by segments has `analytics\u002Fraw\u002F\u003Cdate>.jsonl.zst` in the archive bucket and a site-scope aggregate object under `analytics\u002Frollup\u002F`. The keys are row ids, so derive each date's site row id rather than reading bodies: `AnalyticsRollup::row_id` is a v5 uuid of `\"\u003CVERSION>:\u003Cdate>:site\"` under its `NAMESPACE` (`crates\u002Fbeet_net\u002Fsrc\u002Fstore\u002Fanalytics\u002Frollup.rs`), which python's `uuid.uuid5` reproduces, then match the ids against one `aws s3 ls --recursive` listing. Any leftover complete-day segment should be consumed by the next run.\n- A long-dwell `PageView` can appear in more than one segment with the same ID. Compaction keeps the newest timestamp before archiving and aggregating, so retries and overlapping writes do not double-count it.\n\nA CODEC SPLIT IS INVISIBLE TO THE ROLLUP, BY DESIGN. Analytics writes and reads `AnalyticsSegment::CODEC` alone (`.jsonl.zst`); an object under any other name is another writer's and is never scanned, so a binary writing a different name leaves a store that looks healthy from every summary. Seen live on 2026-09-22: the 09-21 deploy had shipped a binary predating the `.ndjson.gz` -> `.jsonl.zst` change, so for 29 hours the box and that night's lambda wrote objects the current code never saw, and the old lambda never saw the new ones. The three tells together: a complete-day segment prefix with no archive, an archive under a name the code never writes, and a scheduled run whose `deleted` count did not empty the prefix it named. Check for strays by listing, not by rollup: `aws s3 ls s3:\u002F\u002Fbeet-site--\u003Cstage>--analytics\u002Fanalytics\u002Fraw\u002Fsegments\u002F --recursive | grep -v jsonl.zst` (and the archive bucket likewise) must print nothing. The 2026-09-22 legacy objects were compacted once through a temporary gzip-capable binary and none remain (`.agents\u002Freports\u002F2026-09-22-first-deploy-silver-fox.md`); a recurrence is a one-off transcode, never a second format for analytics to contend with. The stale binary itself is not explained by the build guard above (`build_runs_the_declared_process` predates that deploy by weeks); a deploy from a checkout behind the working tree is the remaining suspect, so compare the writer's segment names against `AnalyticsSegment::object_path` whenever a summary's day range or a rollup's `deleted` count looks short.\n\nCross-check the raw namespace with `aws s3 ls s3:\u002F\u002Fbeet-site--\u003Cstage>--analytics\u002Fanalytics\u002Fraw\u002Fsegments\u002F --recursive` and completed days with `aws s3 ls s3:\u002F\u002Fbeet-site--\u003Cstage>--archive\u002Fanalytics\u002Fraw\u002F`; the CLI remains the authoritative event total because each object contains many events and combines segments with rollups. `BlobStore::GET_ALL_CONCURRENCY` bounds remote reads. An automated in-process version of the web half of this flow (http request -> request event, beacon -> page view, prior events retained, the beacon endpoint skipped) lives in `tests\u002Fbeet_site_analytics.rs`; run it with `cargo test --test beet_site_analytics --features \"router,json,fs,testing\"` for a fast pre-deploy check of the wiring. The terminal page-view path is unit-tested in `beet_router\u002Fsrc\u002Fnavigate\u002Fnavigator.rs`.\n\n## Step 1: Local\n\n```sh\ncargo run -p beet-cli -- --entry=site serve --server=http,ssh    # run in background\n```\n\nRead the bound http + ssh ports from the serve output (defaults 8337 \u002F 8339). Run the full verification (a-e; check `f` is cloud-only, its lambda has no local counterpart) against `http:\u002F\u002Flocalhost:\u003Cport>` and `127.0.0.1:\u003Cssh_port>`. This step is also the shakedown: run the browser test and settle the ssh driver here, recording any changes above. While it runs, pre-build both release artifacts in the background (the `cargo-zigbuild build ..` line under \"Changing a hostname's record TYPE\", once with the box's features and once with `,lambda` appended): the deploy's two `building:` steps then relink in seconds instead of cold-building for minutes each, and a zig or target fault surfaces here rather than mid-deploy. Also prove the entry's CLI refuses a typo: `cargo run -p beet-cli -- --entry=site serv --server=http` and `.. serve --sever=http` each exit `64` naming `serve` \u002F `--server` (every `CliServer` is strict), where a silently ignored typo would run a different command. Kill the server when done, by pid (`pgrep -a beet | grep -- '--entry=site serve'`, then `kill \u003Cpid>`): a `pkill -f`, or a `kill $(pgrep -f ..)`, on that argv also matches the shell running it, which then kills itself (exit 144). No cloud or DNS impact.\n\n## Step 2: Dev\n\nPREREQUISITE, ONCE PER ACCOUNT: dev needs its own `beet-site--dev--runtime-boundary`, and the AWS deploy credential cannot create one (it is explicitly denied `iam:CreatePolicy` on `--*--runtime-boundary`, or the cap it wears would be decorative). Without it the stack apply would fail on `NoSuchEntity: Scope ARN ... does not exist or is not attachable` after the storage layer had already created the three dev buckets, so the first dev deploy refuses before it writes anything: the dev boundary is a grant the sealed key does not record. The operator runs that one deploy elevated, which asks for the code and creates the boundary:\n\n```sh\njust site-stage deploy --elevated\n```\n\nA dev deploy, plain or elevated, lowers the credentials at `dev` AND at `prod`, so it never narrows prod's. A converge under `dev` used to be destructive as well: it rewrote the app-wide `beet-site--deploy` from the dev render, which pulled `beet-site--dev--*` into the `IrreversibleNeedsMfa` deny and left a dev teardown unable to delete its own buckets. `irreversible_statement` now excludes `BootstrapConfig::DEFAULT_STAGE` outright, so the stage no longer changes that deny; pinned by `the_disposable_stage_is_never_irreversible` in `crates\u002Fbeet_infra\u002Fsrc\u002Ftypes\u002Faws_deploy_policy.rs`. If a dev teardown ever reports `AccessDenied ... explicit deny in an identity-based policy` on a bucket, that exclusion is gone.\n\nREGRESSION GUARD (fixed, 2026-10-11 prod): an elevated `dev` deploy converged a WRONG prod boundary. The repo store's root was resolved once, at the launch's stage, and `RepoStoreQuery` handed that root to every render, so a dev launch lowering prod named `beet-site--dev--repo` wherever the prod box names its repo store: its read grant, and its certificate backup on `caddy\u002F*`. From the first elevated dev deploy (2026-10-10 03:08 UTC) prod's `caddy-backup.service` failed every run with `AccessDenied ... because no permissions boundary allows the s3:PutObject action`, and the next plain prod deploy refused with `aws: needs beet-site--prod--runtime-boundary \u003Cdigest>` beside a `holds ... which nothing declares now` note for the stale prod digest. The query now projects the declaration against the stack it renders (`ErasedStoreBlock::at`), pinned by `lowers_prod_as_a_prod_launch_does` in `crates\u002Fbeet_infra\u002Fsrc\u002Ftypes\u002Fruntime_boundary.rs`. The by-hand proof is `--dry-run` from both stages: the `beet-site--prod--runtime-boundary` document a dev launch prints must equal the prod launch's. Live, the AWS deploy credential can read the converged document directly (`aws iam get-policy-version --policy-arn arn:aws:iam::\u003Caccount>:policy\u002Fbeet-site--\u003Cstage>--runtime-boundary --version-id \u003Cdefault>`), and every bucket it names must carry the boundary's own stage. Confirmed live by the elevated prod deploy `01a12a01` (2026-10-11): it rewrote the boundary at 08:08 UTC naming only `beet-site--prod--*`, and the next `caddy-backup.service` run uploaded the three certificate `.json` objects the failed runs had been refused.\n\nREGRESSION GUARD (fixed, 2026-10-12 dev): an elevated PROD deploy dropped dev's line from the sealed record. A prod launch renders prod alone, but the key record's merge counted every `beet-site--*` line as its own, so the 2026-10-11 elevated prod deploy resealed `AWS_ACCESS_KEY_ID`'s `grants` without `beet-site--dev--runtime-boundary 16a15f07bc950c9d` while IAM kept that boundary byte for byte, and the next dev `--dry-run` refused with `aws: needs beet-site--dev--runtime-boundary 16a15f07bc950c9d` (a prod dry run beforehand would have printed the tell: `holds ..., which nothing declares now; the next elevated deploy drops it`). The record is now judged and resealed per policy (`crates\u002Fbeet_infra\u002FREADME.md`, the runtime boundary section), pinned by `keeps_the_grants_of_a_stage_it_did_not_render` in `crates\u002Fbeet_infra\u002Fsrc\u002Fcredentials\u002Faws_deploy_credential.rs`. To tell a dropped line from a real declaration change, diff the dry run's boundary document against the live one (`aws iam get-policy-version`, above) and `git show HEAD:secrets.toml` for the line the record lost: identical documents mean the elevated run only reseals. Confirmed live by the elevated dev deploy `01a12ee8` (2026-10-12): afterwards a dev `--dry-run` reports `aws: current` over both stages' boundaries, a prod `--dry-run` reports `aws: current` with no `holds ...` note before and after the dev teardown, and the prod boundary document the dev launch prints equals the prod launch's.\n\n```sh\njust beet-validate            # resolves, no cloud\njust site-stage deploy --dry-run  # asks for nothing; any `needs --elevated` line means the operator goes first\njust beet-plan                # EYEBALL: dev must touch only beet-site--dev--* and dev.beet.org\njust site-stage deploy        # build -> stores -> sync site\u002F + assets\u002F -> replace box -> watch -> purge\n```\n\nThe dry run is the cheap way to learn up front that this step needs the operator. Seen 2026-10-10: the first deploy after credentials began recording their grants refused (exit 70, ~14s, nothing written) with `the sealed AWS_ACCESS_KEY_ID records no grants` and the same for `CLOUDFLARE_API_TOKEN`; that is the gate working, not a fault, and one elevated run seals the grants for every later plain deploy. The `beet-destroy` that followed refused identically, harmless with nothing created, but a credential going stale while dev stands would leave it unremovable without the operator.\n\nRun the full verification (a-f) against `https:\u002F\u002Fdev.beet.org` (ssh on `app.dev.beet.org` port 22), allowing several minutes for cloud-init + Let's Encrypt to settle (retry with a sane budget; a `521` means the origin is not serving yet). Then ALWAYS tear down:\n\n```sh\njust beet-destroy             # removes the dev stack\n```\n\nConfirm teardown: no dev Lightsail instance or static IP (`aws lightsail get-instances`, `aws lightsail get-static-ips`), no `beet-site--dev--*` S3 buckets (`--repo`, `--analytics`, `--archive`), no `beet-site--dev--rollup-daily` schedule (`aws scheduler list-schedules`) and no `beet-site--dev--rollup-function` lambda (ONE dash before `function`, as above: the doubled form is a name that never exists, so checking it always passes), no dev log groups (`aws logs describe-log-groups`: neither `\u002Fbeet-site\u002Fmain-lightsail\u002Fdev` nor `\u002Faws\u002Flambda\u002Fbeet-site--dev--rollup-function`), no dev parameters (`aws ssm describe-parameters --parameter-filters Key=Name,Option=BeginsWith,Values=\u002Fbeet-site\u002Fdev\u002F --query 'Parameters[].Name'` empty: the host key's `\u002Fbeet-site\u002Fdev\u002Fssh-host-key` is a tofu resource destroyed with the stack, and `\u003CStackTeardown\u002F>` sweeps anything a verb parked beside it), and no `dev.beet.org` \u002F `app.dev.beet.org` Cloudflare records. A clean teardown leaves ONLY `beet-site--prod--*`, `beet-site--shared--assets`, `beet--shared--assets`, and `beet-state-\u003Caccount id>` (the state bucket of the account the deploy pair resolves, `aws sts get-caller-identity`, derived from its id and declared by nothing: `beet-state-417392594583` since the repo moved to its own member account `beet` on 2026-10-20, where `beet-state-898915787211` named the account before it). Dev is intentionally not left running.\n\nThe AWS deploy pair is the only AWS identity on the machine, so run the inventory under it (`cargo run -p beet-cli --features infra,extra -- secrets\u002Fexec --only=AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,CLOUDFLARE_API_TOKEN -- \u003Cscript>`, region `us-west-2`). It may list Lightsail, schedules, lambdas and log groups, but NOT `s3:ListAllMyBuckets`, `iam:ListUsers` or `iam:ListRoles`, so probe those by name: `aws s3api head-bucket --bucket \u003Cname>` (`404` gone, `200`\u002F`403` present) for each bucket above, and `aws iam get-user`\u002F`get-role` (`NoSuchEntity` gone) for `beet-site--dev--main-lightsail-runtime-user`, `beet-site--dev--rollup-lambda-role` and `beet-site--dev--rollup-daily-invoke-role`. For the records, `GET \u002Fzones\u002F\u003Czone id>\u002Fdns_records` with the token, asserting `success` before trusting an empty match.\n\nREGRESSION GUARD (fixed, 2026-09-18 dev): `beet-destroy` exited 0 and removed everything except `\u002Fbeet-site\u002Fmain-lightsail\u002Fdev`, recreated unmanaged (no retention) mid-destroy. The instance's `user_data` names the log group as a literal, so tofu saw no edge and destroyed both at once: the group vanished instantly, the box took ~30s to terminate, and its CloudWatch agent's next batch recreated the group. The instance now carries `depends_on` its log group, so the group is created first and destroyed last. Covered by `teardown_removes_the_log_group_after_the_box` in `crates\u002Fbeet_infra\u002Fsrc\u002Fblocks\u002Flightsail.rs`. If it recurs, `aws logs delete-log-group --log-group-name \u002Fbeet-site\u002Fmain-lightsail\u002Fdev` removes it by hand. Note `stack_teardown` narrates only its own state cleanup at INFO (`removed state object`, `removed work directory`, a benign `could not remove state lock: Object not found` warning), so the destroy log alone never proves the resources went: the aws inventory above is the proof.\n\nREGRESSION GUARD (fixed, 2026-10-10 dev): `beet-destroy` exited 0 but warned `could not remove secret store: ... not authorized to perform: ssm:DescribeParameters`. The teardown sweeps the stack's secret store (`\u002Fbeet-site\u002F\u003Cstage>\u002F` in SSM) by listing it, and `AwsDeployPolicy` granted that listing only to a stack RENDERING a parameter, which the site does not, so any secret a verb had parked there would have outlived the stack. The listing is now granted beside the prefix, unconditionally (`the_secret_store_is_granted_without_a_rendered_parameter` in `crates\u002Fbeet_infra\u002Fsrc\u002Ftypes\u002Faws_deploy_policy.rs`). The AWS deploy credential can still read the prefix by path, so `aws ssm get-parameters-by-path --path \u002Fbeet-site\u002Fdev --recursive --query 'Parameters[].Name'` empty is the by-hand proof. Any change to that lowering moves the policy digest the sealed key records, so the first deploy after it refuses for `--elevated`.\n\n## Step 3: Prod\n\n```sh\njust beet-validate --stage=prod\njust beet-plan --stage=prod   # EYEBALL: buckets and the three DNS records refresh-only, see below\njust beet-deploy --stage=prod\n```\n\nEYEBALL the plan for three things specifically: that every existing S3 bucket appears only as a refresh or deliberate in-place update; that the repo store, archive store, instance, and DNS are never replaced (the one exception is a deliberate machine-config change to the instance's `user_data`, which replaces the box); and that DNS changes are exactly the ones expected. During the one-time storage migration, the two Dynamo table destroys and the two same-label S3 bucket creates are deliberate: raw events may expire and rollup rows are re-derived from the archive.\n\nA BASELINE REDEPLOY OF UNCHANGED MAIN PLANS EXACTLY ONE CHANGE. After the storage migration, a code-only deploy reads `Plan: 0 to add, 1 to change, 0 to destroy`: the rollup lambda's `s3_key`, `source_code_hash` and its two `BEET_DEPLOY_*` variables. A stage whose state holds no host key parameter yet also adds `aws_ssm_parameter.beet_site__\u003Cstage>__ssh_host_key` (`1 to add`), and a deploy after a roll of the `BEET_SSH_HOST_KEY` record also updates it in place (`value_wo_version` alone); neither touches the instance, whose new `depends_on` is no diff. Everything else, the app, analytics, and archive buckets, the instance, and all three Cloudflare records, appears as a `Refreshing state...` line and nothing more. The box itself is NOT in the plan at all: the binary reaches it through the release pointer, so `uptime` on the box spans previous deploys and an instance uptime that resets on a code-only deploy means `user_data` moved.\n\nRun the full verification (a-f) against `https:\u002F\u002Fbeet.org` (and confirm `https:\u002F\u002Fwww.beet.org` serves too; ssh on `app.beet.org` port 22). LEAVE PROD UP. Teardown, if ever needed, is `just beet-destroy --stage=prod`.\n\n### Changing a hostname's record TYPE\n\nOnly relevant when a hostname moves between backends whose records differ in type (the Fargate->Lightsail migration moved `beet.org`\u002F`www.beet.org`\u002F`app.beet.org` from `CNAME` at the NLB to `A` at the static IP). Cloudflare rejects an `A` create while a `CNAME` of the same host exists (**error 81054**), and tofu has no ordering edge between destroying the old record and creating the new one, so a single apply races and can fail with the old backend already destroyed and DNS still pointing at it.\n\nDelete the conflicting records first, then deploy immediately:\n\n1. Pre-build so the deploy's build step is a no-op and the window is as short as possible: `cargo-zigbuild build --package beet-cli --bin beet --release --target x86_64-unknown-linux-gnu --no-default-features --features aws_sdk,ssh,geoip`.\n2. Delete each conflicting record through the Cloudflare API (`DELETE \u002Fzones\u002F\u003Czone id>\u002Fdns_records\u002F\u003Cid>`, the id `CloudflareZone` declares in the entry). This starts the outage.\n3. `just site-stage deploy --stage=prod` straight away (the stage stack alone, so the outage lasts one stack's deploy).\n\nTwo gotchas afterwards:\n\n- **Your local resolver will negative-cache the deleted name** for the zone's SOA minimum (1800s). `beet.org` can look like `NXDOMAIN` locally long after it is healthy worldwide. Confirm with `resolvectl query --cache=no beet.org`, a public resolver (`https:\u002F\u002F1.1.1.1\u002Fdns-query?name=beet.org&type=A`), or `curl --resolve` before believing a failure, and do not run check b until local resolution is back, since the browser needs it.\n- **The box is slow for its first few minutes.** On 2 CPUs, direct-origin requests intermittently stall while cloud-init finishes and Let's Encrypt issues. Re-probe before concluding a fault.\n\n## Before any deploy\n\n1. **Hydrate both asset trees** (`just beet-shared pull` for `.\u002Fassets`, `just site-shared pull` for `.\u002Fsite\u002Fassets`). The deploy stages `site\u002F` whole and mirrors the stage, so it publishes whatever the checkout holds. `\u003CRepoStage>` refuses a missing or empty source rather than emptying the store, but a *stale* tree stages happily and silently ships old assets. The trees hold source files only, so a pull never stands in for a build: no wasm binary is stored in either, and one a deploy ships is built by that deploy.\n2. **The apply runs once per layer, and the order matters.** `\u003CTofuApply layer=\"storage\"\u002F>` brings up the stores (the addresses blocks declare under the `storage` layer, an overridable per-block field), `\u003CRepoStage>` and `\u003CRepoSync\u002F>` fill the repo store, then a bare `\u003CTofuApply\u002F>` converges the whole stack and replaces the box against content that is already published. A single apply built the instance first, and it booted with `no entry document found in the --repo backend`. Naming a layer no block declares is a loud error, never a silent skip. Since the box is replaced rather than rolled, there is no health gate and no rollback: `LightsailWatch` is a CloudWatch log tail, not a readiness check, so re-check the site after the deploy returns, not during.\n3. **Diff the rendered configs before\u002Fafter** whenever `beet_infra` or the deploy render changes. Deploys ship from any worktree, and a branch can lack a fix the stage already runs as easily as carry a new one, so \"changed\" is measured against the source the stage's ledger records, never against this checkout's own history: before every prod deploy, `git diff \u003Cledger commit> -- crates\u002Fbeet_infra crates\u002Fbeet_extra\u002Fsrc\u002Finfra site\u002Fmain.bsx` (plus any uncommitted edits there) decides it, and a non-empty diff means a render diff whose baseline is that ledger source. Prod `01a158e8` (2026-10-20) shipped from the `misc` worktree without main's host-key fix and put the key back into the box's `user_data`; its render beside the one before it would have shown the key's line returning. The render diff itself: `.agents\u002Fskills\u002Finfra-deploy\u002Frender_all.sh before` on the clean tree FIRST, then after the change `.agents\u002Fskills\u002Finfra-deploy\u002Frender_all.sh after .agents\u002Ftmp\u002Frender\u002Fbefore` renders all eight stacks and diffs each against the baseline. When the change is already committed, render the baseline from a detached worktree of the commit before it instead (`git worktree add --detach .agents\u002Ftmp\u002Frender-baseline \u003Ccommit>`, its own `CARGO_TARGET_DIR` under `.agents\u002Ftmp\u002F`, then `git worktree remove`): the script writes the checkout root as `\u003Cworkspace>`, so dumps from two checkouts compare. When the change is still UNCOMMITTED and the baseline is the tree without it, build that tree in the same kind of worktree at HEAD: `git diff HEAD --binary | git -C \u003Cworktree> apply`, copy each `git ls-files --others --exclude-standard` file across, then reverse just the change under review (`git -C \u003Cworktree> diff HEAD -- \u003Cfile>` filtered to its hunks, applied with `git apply -R`). A baseline rendered from before a host-key fix carries the key, so scan it with `host_key_scan.py` (check d) and delete the worktree and its target the moment the diff is read. A baseline of what PROD runs starts from the `source` its ledger records (`DeploySource`, read with `beet secrets\u002Fexec --only=AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY -- sh -c 'aws s3 cp s3:\u002F\u002Fbeet-site--prod--repo\u002Fcurrent\u002Fledger.json - | jq .source'`, and printed by `rollback`\u002F`rollforward`): `commit` is the HEAD it deployed from. No `diff_hash` means a clean tree, so that commit IS the baseline, rendered from a detached worktree as above. A `diff_hash` means it also shipped uncommitted work (tracked edits and untracked files alike, the same tree always hashing the same), which the commit alone may not even build (prod `01a12efe`, 2026-10-12, ran on `f5fca99a6` plus uncommitted work that `f5fca99a6` alone fails to compile without), and a ledger published by a binary predating `DeploySource` (before 2026-10-15, or from a branch that never merged it) carries no `source` at all and reads as `\"kind\": \"unknown\"`. Then find the deploying checkout by its artifacts: the ledger's `rollup` `source_hash` is `openssl dgst -sha256 -binary \u003Ccheckout>\u002Ftarget\u002Flambda\u002Fbeet\u002Fbootstrap.zip | base64` of the checkout that built it (each `git worktree list` entry has its own `target\u002F`), and that checkout's reflog names its HEAD at the ledger's `timestamp` (prod `01a158e8`, 2026-10-20, matched the `misc` worktree at `4b5cac780` this way, a branch without main's host-key fix). For either, bracket it: render the nearest building commit after `commit` (or the deploy) and compare it with a dump from before it; when the two agree (modulo the lambda hash), that is the config prod runs, since a deploy whose plan left the instance untouched applied exactly that render, and the ledger's `rollup` `source_hash` is the live lambda's `source_code_hash`. A `DIFFERS` prints through `tf_diff.py` beside the script, one line per changed leaf and per changed `user_data` line, secret-shaped values as digests. Resolving an S3 state backend asks STS for the account, so every render needs the AWS deploy pair; the example entries load no secrets document, and the script hands them the pair through `secrets\u002Fexec`. A `RENDER FAILED` or `UNCOMPARED` line exits non-zero like a `DIFFERS`: before 2026-10-10 a failed render was skipped by the diff, and the six example renders had been failing unnoticed for want of credentials. `HASH-ONLY` means only `source_code_hash` moved, ie a rebuilt binary shipping as a code-only deploy, not a config change; the line is rendered only when a lambda artifact is already built on disk (`target\u002Flambda\u002F`, which only a deploy's build step writes), so a baseline from a fresh worktree shows it as added rather than changed, and after a target cleanup neither side renders it at all. Any other diff must be deliberate and explainable line by line (invariants: no existing physical resource name changes, no replacement of an existing resource). The dumps are disposable and live in `.agents\u002Ftmp\u002F`; nothing is committed.\n4. Never run with `--stage=prod` except in Step 3.\n",{"name":5,"description":7},"main","9b5840ae0d850b477ffc451d20edf49b65c6f6eb",".agents\u002Fskills\u002Finfra-deploy",8,"https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet","https:\u002F\u002Fbeet.org","https:\u002F\u002Fgithub.com\u002Fmrchantey","2026-11-14 20:09:05",{"source":9,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add mrchantey\u002Fbeet --skill infra-deploy",{"tool":59,"command":60},"bunx","bunx skills add mrchantey\u002Fbeet --skill infra-deploy",{"tool":62,"command":63},"pnpm","pnpm dlx skills add mrchantey\u002Fbeet --skill infra-deploy","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Finfra-deploy\u002FSKILL.md",true,[67,73,77,81,85,89],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"host_key_fingerprint.sh","SCRIPT","脚本",421,"https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Finfra-deploy\u002Fhost_key_fingerprint.sh",{"path":74,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":75,"sourceHtmlUrl":76},"host_key_scan.py",2560,"https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Finfra-deploy\u002Fhost_key_scan.py",{"path":78,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":79,"sourceHtmlUrl":80},"render_all.sh",3839,"https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Finfra-deploy\u002Frender_all.sh",{"path":82,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":83,"sourceHtmlUrl":84},"ssh_pty.py",13704,"https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Finfra-deploy\u002Fssh_pty.py",{"path":86,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":87,"sourceHtmlUrl":88},"ssh.sh",8982,"https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Finfra-deploy\u002Fssh.sh",{"path":90,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":91,"sourceHtmlUrl":92},"tf_diff.py",2384,"https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Finfra-deploy\u002Ftf_diff.py",[94,117,129,151,163,177],{"skillNo":95,"name":96,"nameZh":97,"description":98,"descriptionZh":99,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":100,"categories":101,"keywords":108,"publishedAt":40},"01M6BXBJB92PMF5T0GB1GK8CMP","worktree-sync-upstream","Git Worktree 上游分支同步","Sync a detached-HEAD worktree with its upstream branch in the main repo in both directions, rebasing only owned commits and fast-forwarding upstream, with recovery steps for tangled history and helpers for prose and secrets.toml conflicts. Use from inside a worktree.","双向同步主仓库中处于 detached-HEAD 状态的 worktree 与其上游分支：仅对由自己创建的提交进行变基（rebase），对上游分支执行快进（fast-forward）；并提供历史记录混乱时的恢复步骤，以及处理 prose 和 secrets.toml 冲突的辅助工具。需在 worktree 内部使用。","https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fworktree-sync-upstream\u002FSKILL.md",[102,105],{"categoryNo":103,"categoryName":104,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师",{"categoryNo":106,"categoryName":107,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BR5V701HCN066VEP7H4812","代码仓库协作管理",[109,110,111,112,113,114,115,116],"worktree","sync upstream","sync","worktree sync upstream","recovery","commits","secrets","fast",{"skillNo":118,"name":119,"nameZh":120,"description":121,"descriptionZh":122,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":123,"categories":124,"keywords":127,"publishedAt":40},"01M6BXBGPK0T0YWC85M5AZR59N","worktree-sync-all","Git 工作树批量同步","Sync the main branch with every worktree in both directions, applying the worktree-sync-upstream skill to each in turn, then levelling them. Use when asked to sync all worktrees.","将 main 分支与每一个 worktree 进行双向同步，依次对每个 worktree 应用 worktree-sync-upstream 技能，然后将它们拉齐对齐。当被要求同步所有 worktree 时使用。","https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fworktree-sync-all\u002FSKILL.md",[125,126],{"categoryNo":103,"categoryName":104,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":106,"categoryName":107,"taxonomyType":23,"taxonomyTypeDesc":24},[128,109,111],"worktree sync all",{"skillNo":130,"name":131,"nameZh":132,"description":133,"descriptionZh":134,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":135,"categories":136,"keywords":143,"publishedAt":40},"01M6BXBE53M9HRGTWNB1W9VKAT","test-the-works","项目全量测试验证","Maximal project health pass. Run core tests, all tests, the example smoke set, the rsx_site verification and every downstream repo in sequence, fixing every failure and warning surfaced along the way. Use when asked to run 'the works' or fully verify the project.","最大化的项目健康巡检。依次运行核心测试、全部测试、示例冒烟测试集、rsx_site 验证以及每一个下游仓库，并修复过程中出现的每一个失败和警告。当被要求运行全套检查（the works）或完整验证项目时使用。","https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftest-the-works\u002FSKILL.md",[137,140],{"categoryNo":138,"categoryName":139,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQGD5WG86P4AQ5GPSSKBFR","测试工程师",{"categoryNo":141,"categoryName":142,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障",[144,145,39,146,147,148,37,149,150],"test the works","test","run","core","verify","SET","health",{"skillNo":152,"name":153,"nameZh":154,"description":155,"descriptionZh":156,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":157,"categories":158,"keywords":161,"publishedAt":40},"01M6BXBBRK6XD63BKX60WKFDCW","test-run","测试套件运行与修复","Run the core test suite (just test-core) to a clean, warning-free pass, with recipes for hanging tests and mold linker flakes. Use when asked to run or fix the test suite.","运行核心测试套件（just test-core），直至干净、无警告地通过，并提供处理挂起测试和 mold 链接器偶发问题的方案。当被要求运行或修复测试套件时使用。","https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftest-run\u002FSKILL.md",[159,160],{"categoryNo":138,"categoryName":139,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":141,"categoryName":142,"taxonomyType":23,"taxonomyTypeDesc":24},[146,145,162,147],"test run",{"skillNo":164,"name":165,"nameZh":166,"description":167,"descriptionZh":168,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":169,"categories":170,"keywords":173,"publishedAt":40},"01M6BXB90ZEVHBM1R3C4Y95J3X","test-examples","示例冒烟测试运行","Run the workspace example smoke set to catch regressions unit tests miss, covering every feature gate combination with self-terminating examples and curl-probed servers. Use when asked to run or verify the examples.","运行工作区示例冒烟测试集，以捕捉单元测试遗漏的回归问题，覆盖每一种功能开关组合，使用可自动终止的示例和经 curl 探测的服务器。当被要求运行或验证示例时使用。","https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftest-examples\u002FSKILL.md",[171,172],{"categoryNo":138,"categoryName":139,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":141,"categoryName":142,"taxonomyType":23,"taxonomyTypeDesc":24},[174,145,175,176,146,148,149],"test examples","examples","unit tests",{"skillNo":178,"name":179,"nameZh":180,"description":181,"descriptionZh":182,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":183,"categories":184,"keywords":189,"publishedAt":40},"01M6BXB6QDY5NH0TMHWTCXX0C2","test-dependency-audit","Cargo依赖审计与精简","Audit every crate's Cargo.toml for unused, duplicate or misplaced dependencies, moving shared deps to the workspace and feature-gating where sensible. Use when asked to audit or slim dependencies.","审计每个 crate 的 Cargo.toml 中未使用、重复或放置不当的依赖项，将共享依赖移至工作区，并在合理处进行特性门控。在被要求审计或精简依赖时使用。","https:\u002F\u002Fgithub.com\u002Fmrchantey\u002Fbeet\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftest-dependency-audit\u002FSKILL.md",[185,186],{"categoryNo":103,"categoryName":104,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":187,"categoryName":188,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BSNPHVX9Y1H3B2ZX3V06RF","Rust 开发",[190,145,191,192,193],"dependency audit","test dependency audit","audit","deps"]