Skip to content

[fix] stack redeploy rebuilds an edited build context - #106

Closed
malickyeu wants to merge 1 commit into
docs/post-merge-truthingfrom
fix/stack-redeploy-build
Closed

[fix] stack redeploy rebuilds an edited build context#106
malickyeu wants to merge 1 commit into
docs/post-merge-truthingfrom
fix/stack-redeploy-build

Conversation

@malickyeu

Copy link
Copy Markdown
Contributor

Summary

StackRedeploy ran a plain docker compose up -d, so a CLI-discovered stack that
declares build: kept running the image from its first deploy however much its
Dockerfile or build context changed on the host — while the CLI reported
Container Running and exited 0.

This is the same staleness bug fixed for Projects in #99, on the other code
path. A project deploys through the API handler; a CLI stack deploys through
StackRedeploy. Fixing one didn't fix the other, and nothing pointed that out —
it surfaced while auditing the docs against the merged code, because the doc I was
about to write said up -d and I checked why.

Redeploy now passes --build, which is a no-op for services that only pull an
image.

Stacked on #104 (docs/post-merge-truthing), which introduced the NEXT.md
entry this PR removes. Merge #104 first, or retarget this to main and expect a
one-line NEXT.md conflict.

Type of change

  • Bug fix
  • New feature
  • Docs only
  • Refactor / chore

Checklist

  • go test -short ./... and go vet ./... pass
  • gofmt gate is clean (gofmt -l $(git ls-files '*.go') after staging)
  • Frontend type-checks (cd web && npx tsc --noEmit)
  • Rebuilt and committed web/dist
  • Added/updated tests for the change
  • Updated docs/ and added a CHANGELOG.md entry

Notes for reviewers

The test creates the stack with the real docker compose CLI, not with
hand-written labels. That matters here: labels are the only thing
StackRedeploy has to work from — project name, config_files, working_dir
so a fixture that writes them by hand would be testing my idea of what compose
stamps rather than what it actually stamps. It then edits the context on disk and
redeploys through the app.

Mutation-verified, per the discipline recorded in #104: dropping --build
fails the test with marker is "v1", expected "v2". It fails for the right
reason — the image genuinely wasn't rebuilt — rather than on an unrelated error.

Also updated the UI's confirm dialog, which promised docker compose up -d.
It now says up -d --build and mentions that build: services are rebuilt, so
the dialog still describes what the button does.

Not given an opt-out, unlike the project deploy's {"build": false}: the
stack redeploy endpoint takes no body, and inventing one for a case that costs
nothing on image-only stacks seemed worse than the consistency. Easy to add if a
large-context stack over a slow link ever makes it worth it.

Test data: the stack (dctest-stackredeploy) and its built image are removed
in t.Cleanup, and the whole project label is swept with freeStack before and
after — the pattern added in #100 after a failed guard left containers behind.
Verified zero dctest* leftovers across the run.

StackRedeploy ran a plain `docker compose up -d`, so a CLI-discovered
stack declaring build: kept running the image from its first deploy no
matter what changed in its Dockerfile or context on the host — the same
staleness bug fixed for Projects in #99, on the other code path.

Found while auditing the docs against the merged code: the two deploy
paths are separate, and only one had been corrected.

The test builds the stack with the real compose CLI so the labels
StackRedeploy works from are genuine, then edits the context and
redeploys through the app. Verified by mutation: without --build it
fails with marker "v1".
Copilot AI review requested due to automatic review settings July 31, 2026 09:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@malickyeu
malickyeu deleted the branch docs/post-merge-truthing July 31, 2026 09:47
@malickyeu malickyeu closed this Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants