fix: [nomad-prep] P7 — make disinto init idempotent + add --dry-run (#800) #815
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
cannot-reproduce
in-progress
in-triage
needs-triage
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
rejected
reproduced
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#815
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-800"
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?
Fixes #800
Changes
AI Review
Summary
This PR delivers two things: idempotent token management (preserve tokens across re-runs, regenerate only with
--rotate-tokens) and a--dry-runflag that exits before touching any state. Both are implemented correctly.Key Observations
bug fix
lib/forge-setup.sh:216: The old code generated a randomhuman_passand then tried to authenticate ashuman_user:human_passto create the human token. Sincehuman_user == admin_user == "disinto-admin", this auth always failed silently —human_tokenwas always empty, andHUMAN_TOKENwas never written to.env. The fix (human_pass="$admin_pass") is correct and the token creation section was updated consistently to useadmin_user:admin_passthroughout.idempotency
lib/forge-setup.sh:249-287:FORGE_ADMIN_TOKENis now persisted to.envon first run and preserved on subsequent runs. The_token_exists_in_envhelper at line 44 is straightforward. All bot and llama user tokens follow the same pattern (pre-existing). StoringFORGE_ADMIN_TOKENin.envdoes expand the secret surface, but this was an intentional design choice for operator restartability and the.envwas already carrying other high-privilege tokens.dry-run ordering
bin/disinto:745: The dry-run block is correctly placed after all variable initialization (forge_repoat 678,project_nameat 679,toml_pathat 680,toml_existsat 691) and before all state-mutating operations (generate_compose,prompt_admin_password,setup_forge). Fallback${repo_root:-/home/${USER}/${project_name}}at line 750 matches the real default at line 871. No variables are unbound.dry-run completeness: Help text says "Print every intended action without executing" but the dry-run outputs a summary (e.g.,
[ensure] 8 bot userswithout querying Forgejo for their current state). This is acceptable for a dry-run and the exit-0 + no-state-change contract is what matters. Not blocking.smoke tests
tests/smoke-init.sh:182-237: Dry-run test pipes throughgrep -q "Dry run complete"— correctly detects success and verifies.envis byte-identical afterward. Idempotency test snapshots.env, re-runs, and diffs — this will catch any token churn. Both temp files added to thecleanup()trap. Tests are tight and well-targeted.Verdict
APPROVE — Correct idempotency implementation with proper token preservation; bug fix for human token auth using wrong credentials; dry-run exits cleanly before any mutations; solid smoke test coverage
Reviewed at
9d8f322| AGENTS.mdAI Review: APPROVE — Correct idempotency implementation with proper token preservation; bug fix for human token auth using wrong credentials; dry-run exits cleanly before any mutations; solid smoke test coverage