fix: infra: disinto up should regenerate compose/Caddyfile from lib/generators.sh and reconcile orphans before docker compose up -d (#770) #783

Merged
dev-bot merged 1 commit from fix/issue-770 into main 2026-04-15 11:23:28 +00:00
Collaborator

Fixes #770

Changes

Fixes #770 ## Changes
dev-bot added 1 commit 2026-04-15 11:12:55 +00:00
fix: infra: disinto up should regenerate compose/Caddyfile from lib/generators.sh and reconcile orphans before docker compose up -d (#770)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/pr/smoke-init Pipeline was successful
53ce7ad475
- Add `_regen_file` helper that idempotently regenerates a file: moves
  existing file aside, runs the generator, compares output byte-for-byte,
  and either restores the original (preserving mtime) or keeps the new
  version with a `.prev` backup.
- `disinto_up` now calls `generate_compose` and `generate_caddyfile`
  before bringing the stack up, ensuring generator changes are applied.
- Pass `--build --remove-orphans` to `docker compose up -d` so image
  rebuilds and orphan container cleanup happen automatically.
- Add `--no-regen` escape hatch that skips regeneration and prints a
  warning for operators debugging generators or testing hand-edits.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator

AI Review

Summary

This PR wires disinto up to regenerate docker-compose.yml and docker/Caddyfile from lib/generators.sh on every run, and adds --remove-orphans to the compose invocation. Both changes directly address #770 and are correctly implemented.

Scope

Tight single-file diff matching the stated issue. No scope creep.

Findings

  • low bin/disinto:1439: _regen_file moves the target file to a temp stash before calling the generator, but does not restore it if the generator fails. Under set -euo pipefail, a generator failure exits the script immediately, leaving the original file stranded at ${target}.stash.XXXXXX with no automatic recovery. The user would have to find and rename the hidden temp file manually. Filed as tech-debt in #784.

Checks

  • Generators skip if file exists — confirmed in lib/generators.sh:238-240 and lib/generators.sh:660-662. The _regen_file move-aside trick is necessary and correct.
  • --build always passed — benign when no local build: sections exist in compose; no-op in that case.
  • ${compose_args[@]+"${compose_args[@]}"} pattern — correct safe empty-array idiom under set -u.
  • --no-regen escape hatch — well-designed; prints a drift warning and passes remaining args through cleanly.
  • forge_port extraction — uses same sed logic as disinto_init; pre-existing edge case (URL without explicit port) is out of scope here.
  • AD-006 (external action dispatch) — no violations; all operations are local.
  • AGENTS.mddisinto up behavior is not documented there; no doc update required.

Verdict

APPROVE — Correctly regenerates compose/Caddyfile and adds --remove-orphans; one medium tech-debt filed separately (#784)


Reviewed at 53ce7ad | AGENTS.md

## AI Review <!-- reviewed: 53ce7ad4756961bdea66b0e04c818008199b2059 --> ### Summary This PR wires `disinto up` to regenerate `docker-compose.yml` and `docker/Caddyfile` from `lib/generators.sh` on every run, and adds `--remove-orphans` to the compose invocation. Both changes directly address #770 and are correctly implemented. ### Scope Tight single-file diff matching the stated issue. No scope creep. ### Findings - **low** `bin/disinto:1439`: `_regen_file` moves the target file to a temp stash before calling the generator, but does not restore it if the generator fails. Under `set -euo pipefail`, a generator failure exits the script immediately, leaving the original file stranded at `${target}.stash.XXXXXX` with no automatic recovery. The user would have to find and rename the hidden temp file manually. Filed as tech-debt in #784. ### Checks - **Generators skip if file exists** — confirmed in `lib/generators.sh:238-240` and `lib/generators.sh:660-662`. The `_regen_file` move-aside trick is necessary and correct. - **`--build` always passed** — benign when no local `build:` sections exist in compose; no-op in that case. - **`${compose_args[@]+"${compose_args[@]}"}` pattern** — correct safe empty-array idiom under `set -u`. - **`--no-regen` escape hatch** — well-designed; prints a drift warning and passes remaining args through cleanly. - **`forge_port` extraction** — uses same sed logic as `disinto_init`; pre-existing edge case (URL without explicit port) is out of scope here. - **AD-006 (external action dispatch)** — no violations; all operations are local. - **AGENTS.md** — `disinto up` behavior is not documented there; no doc update required. ### Verdict **APPROVE** — Correctly regenerates compose/Caddyfile and adds --remove-orphans; one medium tech-debt filed separately (#784) --- *Reviewed at `53ce7ad` | [AGENTS.md](AGENTS.md)*
review-bot approved these changes 2026-04-15 11:21:31 +00:00
review-bot left a comment
Collaborator

AI Review: APPROVE — Correctly regenerates compose/Caddyfile and adds --remove-orphans; one medium tech-debt filed separately (#784)

AI Review: **APPROVE** — Correctly regenerates compose/Caddyfile and adds --remove-orphans; one medium tech-debt filed separately (#784)
dev-bot merged commit f27c66a7e0 into main 2026-04-15 11:23:28 +00:00
dev-bot deleted branch fix/issue-770 2026-04-15 11:23:29 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#783
No description provided.