Add allod site preview, compiled into every build #181
No reviewers
Labels
No labels
blocked
bug
decision
duplicate
enhancement
help wanted
invalid
landed?
question
ready-to-merge
stale
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools!181
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/site-preview"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
allod site previewnow exists in every build of theallodCLI, so a dev machine can serve a site locally with the same zola version its deploy build pins, by runningnix shell --inputs-from <root> nixpkgs#zola --command zola --root <root> servefrom anywhere inside the site repository.deploy,check, andconfigare unchanged and still exist only in a build made with thesitetag; on a dev machineallod site deployis now "unknown site command" rather than an unknown namespace, andallod sitelistspreviewalone. Preview never reads the rclone config, never runs the remote preflight, and takes no--config. Both test shapes and the flake check pass, and a real run against a scratch site with a minimal flake fetched zola and had it accept the argument order. If this is wrong, the dev-machine effect is limited to a local server on loopback; reverting restores the single tagged file. The command arrives on dev machines with their next pin advance; no deployment package change is needed.Closes allod/tools#180. Refs allod/strategy#51.
What changed
cmd/allod/site_common.go(untagged): site root discovery, thesite.tomlparser, the command table type, thesitedispatcher, and the usage generator, moved out of the tagged file unchanged.cmd/allod/site_preview.go(untagged): registers thesitenamespace and thepreviewcommand; builds the argv insitePreviewArgs, which tests never replace, and runs it through a seam at the exec boundary.--port,--interface,--base-url,--drafts,--openpass through only when given;--ends option parsing; unknown options are errors. Usage says preview binds loopback and how to reach it from the host with an SSH tunnel.cmd/allod/site.go(tagged): no longer registers a namespace; itsinit()appendsdeploy,check,configto the shared table. The command table is populated frominit()functions rather than a var literal because a literal would be a Go initialization cycle through the usage generator;previewis prepended so it stays first whatever the file order.site_absent_test.gonow pins the untagged shape (preview present, the three tagged commands unknown, usage naming only preview);site_test.gopins all four in the tagged shape;site_preview_test.gopins the complete argv for the default case, each flag, and--passthrough, plus rejection paths and exit-code propagation.One departure from the issue's literal design: the issue suggested a package-level var literal for the command table, which does not compile (initialization cycle); the code comments say why.
Risk
R1. The relocation of
deploy,check, andconfigis mechanical and their pinned usage substrings still pass, but their code moved files. The new surface reaches nothing beyond a local loopback server. A fullzola servewith live reload against a real site was not run; no site repository with content was reachable on this machine.Validation
go vet ./... && go test ./...andgo vet -tags site ./... && go test -tags site ./...pass;gofmt -l cmd/allod/is empty.nix flake checkpasses (seven checks, including the one that runs both test shapes).site.toml:site,site --help,site deploy,site previewproduce the expected usage or error text and exit codes in both shapes.site.tomland a minimal flake resolved--inputs-from, fetched zola 0.21.0, and zola accepted--root <root> serve, stopping only on the scratch site's missingconfig.toml.zola serve --rootis rejected by zola (verified with zola 0.22.1) and that the original test seam stubbed the whole argv builder; both fixed, and sabotaging the argument order back fails nine preview tests.--interfaceand--port), applied, after whichnix flake checkwas re-run and passes; one pi claim (a leftoversiteUsageTextconstant) was checked against source and is false.Labels are unavailable to this token; none is warranted.