Skip to content

fix(dar): strip DPM_RESOLUTION_FILE from nested build env - #266

Merged
zheli merged 3 commits into
mainfrom
fix-localnet-dar-build-upload
Jul 12, 2026
Merged

fix(dar): strip DPM_RESOLUTION_FILE from nested build env#266
zheli merged 3 commits into
mainfrom
fix-localnet-dar-build-upload

Conversation

@zheli

@zheli zheli commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes bug: cannot call "dpm localnet dar build-upload" inside a daml project #230: dpm localnet dar build-upload fails inside a Daml project with open /var/folders/.../T/<n>.yaml: file exists.
  • Root cause: under dpm localnet …, DPM injects DPM_RESOLUTION_FILE pointing at a temp resolution file it already wrote. DevKit shells out to a nested dpm build, which inherits the var and aborts trying to re-create the existing file. The standalone canton-devkit … --project path works only because that var is absent from its ambient env.
  • Fix strips DPM_RESOLUTION_FILE from the child build's environment so it re-resolves fresh from daml.yaml, matching the working standalone behaviour.

Changes

  • internal/cli/localnet/dar/buildupload.go: add buildEnv() helper (drops only DPM_RESOLUTION_FILE); runBuild sets c.Env = buildEnv().
  • internal/cli/localnet/dar/watch.go: runBuildCtx (same latent bug) sets c.Env = buildEnv().
  • internal/cli/localnet/dar/buildupload_test.go: TestBuildEnv unit regression test (pure go test, no DPM/Docker).
  • .gitignore: add .tmp/ for local scratch (per AGENTS.md).

Notes

  • Verified locally: make build, make lint (0 issues), and make test (all packages) pass.
  • The shell-based dpm localnet e2e suite is intentionally not in this PR; it lands in a dedicated follow-up PR reimplemented on bats-core, to keep this change focused on the fix.

zheli added 3 commits July 12, 2026 08:50
Under `dpm localnet dar build-upload`, DPM injects DPM_RESOLUTION_FILE
pointing at a temp resolution file it already wrote. build-upload and
watch shell out to a nested `dpm build`, which inherited that var and
aborted with "open <path>: file exists" because it tried to re-create
the existing file. The standalone `canton-devkit ... --project` path
worked only because that var is absent from its ambient env.

Strip DPM_RESOLUTION_FILE from the child build environment so the nested
build re-resolves from daml.yaml, matching the standalone behaviour.
Apply to both runBuild (build-upload) and runBuildCtx (watch).

Add a unit regression test (TestBuildEnv) plus a per-test e2e suite for
`dpm localnet` (mirroring the Milestone 1 split): scripts/e2e/dpm-*.sh,
a hermetic local-path component builder, a composite action, and a new
self-hosted workflow. DPM-DAR-001 is the first case and runs
--build-only, so no LocalNet is required.

Fixes #230
All e2e jobs run on the same single, non-concurrent self-hosted runner,
so passing the built binary between jobs via upload/download-artifact
added GitHub storage/bandwidth cost for no benefit. Remove the separate
setup job and build the binary inside the test job's composite action
(make build) right before it assembles the local component.
Keep PR #266 focused on the issue #230 fix (buildEnv) and its unit
regression test. The shell-based dpm localnet e2e scaffolding
(scripts/e2e/dpm-*.sh, the composite action and workflow) moves to a
dedicated PR that reimplements it on bats-core.
@zheli
zheli merged commit fa540ae into main Jul 12, 2026
6 checks passed
@zheli
zheli deleted the fix-localnet-dar-build-upload branch July 12, 2026 07:46
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.

bug: cannot call "dpm localnet dar build-upload" inside a daml project

1 participant