Add named config, hosting layouts and credential lifecycle to allod site #167
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools!167
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/site-config-path"
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 sitegains three things at once: a--config <path>option that selects one explicit rclone configuration, a compile-time hosting layout chosen by the deployment package, and credential lifecycle commands (check,config show,config update,config replace).Named configs let activation-managed hosting credentials survive machine recreation; deploy and setup read and write the same path, and rotation during a build may hand sync newer contents.
The hosting layout is fixed when the binary is built:
directadminby default,public-htmlwhen the deployment sets a linker flag. No flag, environment variable, orsite.tomlkey can move the destructive sync target.The lifecycle commands verify a credential against the server without building or publishing, show its safe fields, update one field in place, or replace all three; a rejected FTP login reports username-or-password because the protocol cannot say which.
Without
--config, without the linker flag, and for existingdeployandconfiginvocations, behavior and generated rclone arguments are unchanged;config --forcestill works as the compatibility spelling ofreplace.Sabotage tests cover option swallowing, unsafe terminal text, rotation, FIFOs, symlinks, unreadable files, a sabotaged layout table, and duplicate credential stanzas; the full tagged and untagged Go matrix and
nix flake checkpass on the merged tree.Rollback is to omit
--config, drop the linker flag and rebuild, and keep using the existing per-user rclone configuration, which remains valid.This branch carries the work of three stacked PRs, now targeting master alone: #167 (named config path), #168 (deployment-selected hosting layout, merged into this branch) and #169 (credential lifecycle, merged into #168's branch). The review findings raised on all three are carried unchanged. Master's copy of #166 is byte-identical to the base this branch was built on, so the catch-up merge took the branch side of the four
cmd/allod/site*.gofiles and master's side of everything else.Closes allod/tools#164
Closes allod/tools#165
Closes allod/tools#163
Issues #163 and #165 already show as closed because their PRs merged into this stack's branches rather than into master; their code lands only when this PR merges.
Contract
Named config path
--config <path>and--config=<path>work onallod site deploy,allod site check, and everyallod site configform, in any order with their other options. A separated value beginning with-is rejected so it cannot swallow another option; use--config=<path>for a relative path that itself begins with a dash. An explicit path overridesRCLONE_CONFIG, rclone's reported path, and the XDG/HOME fallback.Config:path so no message recommends a default-config command for a named config.Deployment-selected hosting layout
siteHostingProfileNamedefaults todirectadmin; a deployment selectspublic-htmlwithldflags = [ "-X main.siteHostingProfileName=public-html" ]in itsbuildGoModule.public-htmltargetsshared:public_html/<domain>with no filter file.directadminkeeps the exact prior destination, exclusion filter, and rclone argv.<domain>placeholder, a safe relative docroot with no empty,.,.., or control segments, and single-line exclusion-only filter rules. An invalid compiled value or table fails before credential checking, building, or syncing.Credential lifecycle
allod site check [--config <path>]reuses the deploy preflight's read-onlylsd shared:probe and failure reporter; it never resolves a site repository, builds, syncs, verifies HTTPS, or publishes.allod site config showprints Config, Remote, Type, Host, and User only, rejects missing or duplicate required keys, non-FTP remotes, and configurations without explicit TLS, and never prints the password field.allod site config update {host|user|password}takes no value in argv, asks one terminal question, and replaces only that field's byte range. Both rclonekey = valueandkey: valueseparators work; other bytes, directives, line endings, and stanzas survive unchanged. Update requires an existingsharedstanza.allod site config replaceis the discoverable full replacement;allod site config --forceremains its compatibility spelling; bareallod site configkeeps create-and-refuse-existing behavior. Replacement refuses duplicatesharedstanzas before prompting or writing.Risk
public-html's empty exclusion list assumes ACME is served elsewhere.Validation
Run on the merged tree at the catch-up merge commit:
gofmt -lclean oncmdandinternalnix develop -c bash -c 'go vet ./... && go test -count=1 ./... && go vet -tags site ./... && go test -count=1 -tags site ./...'nix build .#checks.x86_64-linux.go-checks .#checks.x86_64-linux.allod-parity --no-link, with build logs showing both Go matrices and all 704 parity tests passingnix flake checkpasses in full. Theallod-parityexpectation failure that the three PRs previously had to disclose is fixed on master.--configswallowing an option, invalid UTF-8, U+0085, U+2028 and U+2029 at every boundary, credential rotation between preflight and sync, FIFO, symlink, non-regular, missing and unreadable config paths, an invalid compiled layout and a sabotaged layout table observing zero remote, build, sync and verification calls, duplicatesharedstanzas through both replace spellings, and mixed=/:byte-preserving updates.Independent review found three code/interface issues and one claim that needs narrowing. Please address these additively before merge; the full tagged/untagged Go test and vet suites otherwise pass.
--configaccepts another option as its value.site config --config --forcecan write a credential to a file named--force, whiledeploy --config --dry-runcan swallow the dry-run flag. Reject option-looking separated values and keep--config=<path>as the spelling for a leading-dash path.site configcan block on a FIFO and atomically rename over a symlink. Define and enforce file-type semantics before lifecycle commands build on this: regular files are mutable, non-regular files fail before prompting, and activation-managed symlinks should be read-only rather than silently severed.Addressed additively in
a6deff1after merging the updated preflight base atb705cb0.--confignow rejects an option-looking value;--config=<path>remains the explicit escape for a leading-dash path.O_NOFOLLOW, refuses symlinks/non-regular files before prompting, and rechecks the destination before atomic rename.The full tagged and untagged Go test and vet matrix passes. The PR body records the prior unrelated
nix flake checkfailure precisely and does not claim that gate passed.Scoped stability review confirms the four prior findings are resolved and found one remaining low-severity output-safety mismatch.
--configpromises a printable single-line path but currently reusesvalidConfigValue, which rejects only ASCII C0/DEL. Invalid UTF-8, C1 controls, and U+2028/U+2029 can survive validation and are later printed raw inConfig:and error lines. Strengthen the shared printable-value check (or consistently quote path output) and add sabotage cases for invalid UTF-8, a C1 control, and Unicode line/paragraph separators.Addressed additively in
4c212e2.validConfigValuenow requires valid UTF-8 and rejects every Unicode control plus U+2028/U+2029, while keeping ordinary printable Unicode valid.Focused tests and the full tagged/untagged Go test and vet matrix pass. The PR Validation section now names this coverage.
Owner asked for this branch to be rebased after
#166merged to master and#168and#169merged down into this branch. Recording what the rebase found, and why it is not pushed here yet.This branch now carries three PRs, not one.
#169merged intoagent/hosting-layout-profileand#168merged into this branch, soagent/site-config-pathholds the work of#167,#168and#169and targets master alone. The title and body still describe only the named-config-path change.A literal rebase is not available. The forge refuses it:
force-push is not permitted on branch 'agent/site-config-path'. Add commits instead.Replaying the eleven commits is also not a mechanical operation, because each PR in the stack was written against a different base,#168branched fromcf384e8before either#166or#167existed, and the integration merges that reconciled them are exactly what a linear rebase discards. Attempting it stops on the first commit with conflicts insite.goandsite_test.go.The equivalent merge is deterministic and was verified. Master carries
#166under different hashes from the forge's rebase-merge, andgit diff 4215e60 b705cb0across all four site sources is empty, so master's copy of#166is byte-identical to this branch's. That makes the resolution mechanical: the four conflicted files take this branch's version, which is that same#166base plus the#167,#168and#169work, and every other file takes master's side.README.mdauto-merges, keeping both sides.The result was checked against an independently constructed clean rebase of this branch onto master, built as three tree snapshots one per originating PR. The two trees are identical, and both are byte-identical to the reviewed tip
a61b3dfacrosssite.go,site_config.go,site_test.goandsite_config_test.go. No new code was written; the review findings raised on all three PRs are carried unchanged.Validation on the merged tree.
gofmtclean,go vetandgo testpass both tagged and untagged,nix build .#checks.x86_64-linux.go-checks .#packages.x86_64-linux.allodbuilds, andnix flake checknow passes in full. Theallod-paritybaseline red that all four PRs had to disclose is gone: master'sf7c57b8fixed the section-prompt expectation.Why it is not pushed. A
vnprcagent has no write access toallod/*; the push is refused by the pre-receive hook.allod patch receivecannot carry the merge either, because it exports withformat-patchand refuses non-linear history. So this needs an agent onallod-dev, or the owner running the merge directly. The exact resolution is above and reproduces in four commands.One issue-state defect worth a look.
allod/tools#163andallod/tools#165are already marked closed. They closed when their PRs merged into this stack's branches rather than into master, so their code is still unlanded and is in this PR. If this PR were abandoned, both would be wrongly closed.Let site commands use a named rclone configto Add named config, hosting layouts and credential lifecycle to allod siteMerged origin/master into this branch as
5a97b20, reproducing the resolution above: the fourcmd/allod/site*.gofiles take this branch's side (byte-identical toa61b3df), everything else takes master's side, andREADME.mdauto-merged keeping both. Verified on the merged tree: gofmt clean, go vet and go test pass tagged and untagged, the go-checks and allod-parity check derivations build with passing logs, andnix flake checkpasses in full. Title and body now describe the whole stack (#167, #168, #169) and close #164, #165 and #163.