fix(compose): keep DAG mounts writable#2245
Conversation
📝 WalkthroughWalkthroughThis PR updates Docker Compose configurations to mount the DAG directory as read-write instead of read-only, enabling first-run seeding and persistent DAG edits. Documentation explains the mount behavior, and a test verifies the configuration change persists. ChangesDocker DAG mounts made writable
🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/packaging/container_init_test.go (1)
126-129: ⚡ Quick winStrengthen coverage by asserting DAG mount count per file.
This currently proves “no
:ro+ at least one writable mount,” but it won’t catch accidental mount removal from some services incompose.prod.yaml. Assert expected occurrence counts per file.🔧 Suggested hardening
func TestDockerComposeDAGMountsStayWritable(t *testing.T) { t.Parallel() - files := []string{ - "deploy/docker/compose.minimal.yaml", - "deploy/docker/compose.prod.yaml", - } + expectedMountCounts := map[string]int{ + "deploy/docker/compose.minimal.yaml": 1, + "deploy/docker/compose.prod.yaml": 4, + } root := repoRoot(t) - for _, file := range files { + for file, expectedCount := range expectedMountCounts { t.Run(file, func(t *testing.T) { t.Parallel() content := readFile(t, filepath.Join(root, file)) require.NotContains(t, content, "./dags:/var/lib/dagu/dags:ro", "%s must keep the DAG directory writable for first-run seeding and DAG edits", file) require.Contains(t, content, "./dags:/var/lib/dagu/dags", "%s must mount the local DAG directory", file) + require.Equal(t, expectedCount, strings.Count(content, "./dags:/var/lib/dagu/dags"), "%s must keep DAG mounts on all expected services", file) }) } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/packaging/container_init_test.go` around lines 126 - 129, The test should also assert the expected number of DAG mounts per file to catch accidental removals: after reading content := readFile(t, filepath.Join(root, file)) use strings.Count(content, "./dags:/var/lib/dagu/dags") and require.Equal(t, expectedCount, count, "%s must contain %d DAG mounts", file, expectedCount) (and optionally assert strings.Count(content, "./dags:/var/lib/dagu/dags:ro") == 0) — update the test where require.Contains/NotContains are used to compute count via strings.Count and compare to the expected occurrence for that compose file.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/packaging/container_init_test.go`:
- Around line 126-129: The test should also assert the expected number of DAG
mounts per file to catch accidental removals: after reading content :=
readFile(t, filepath.Join(root, file)) use strings.Count(content,
"./dags:/var/lib/dagu/dags") and require.Equal(t, expectedCount, count, "%s must
contain %d DAG mounts", file, expectedCount) (and optionally assert
strings.Count(content, "./dags:/var/lib/dagu/dags:ro") == 0) — update the test
where require.Contains/NotContains are used to compute count via strings.Count
and compare to the expected occurrence for that compose file.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7e6d842a-4288-4317-ab3e-f5f3f68efe65
📒 Files selected for processing (4)
deploy/docker/README.mddeploy/docker/compose.minimal.yamldeploy/docker/compose.prod.yamlinternal/packaging/container_init_test.go
There was a problem hiding this comment.
No issues found across 4 files
Tip: cubic could auto-approve low-risk PRs like this, if it thinks it's safe to merge. Learn more
Re-trigger cubic
Summary
Testing
Summary by cubic
Keep Docker Compose DAG mounts writable so Dagu can seed first-run examples and persist DAG edits.
Written for commit 65e631b. Summary will update on new commits.
Summary by CodeRabbit
Documentation
Configuration Changes
Tests