fix(docker): revert NODE_RED_CLI_DEFAULT_USERDIR; add /data auto-probe + --docker-userdir override - #34
Merged
Merged
Conversation
…e + --docker-userdir override Reverts the NODE_RED_CLI_DEFAULT_USERDIR env-var convention from #31/#32, which required community image authors to opt in and was confirmed dead-on-arrival for the motivating agentic-workflow-dev-env image. Replaces it with: - a best-effort /data auto-probe (sandbox entrypoint only) that validates node_modules/* and node_modules/@*/* (following symlinks) for a package.json declaring a "node-red" key before trusting the path - an explicit --docker-userdir <path> CLI flag as a reliable, zero-guessing override for any convention - a 4-level userDir precedence: --user-dir > --docker-userdir > auto-probed /data > ephemeral default - a clearer --node-modules preflight error when combined with --docker-userdir/auto-probe without an explicit --user-dir Closes #33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues fixed
Closes #33
Summary
Reverts the
NODE_RED_CLI_DEFAULT_USERDIRenv-var convention (#31/#32), which required community image authors to opt in and was confirmed dead-on-arrival for the motivatingagentic-workflow-dev-envimage.Replaces it with:
/dataauto-probe (sandbox entrypoint only, never on the host) that validatesnode_modules/*andnode_modules/@*/*(following symlinks — real npm installs often symlink packages) for apackage.jsondeclaring a"node-red"key before trusting the path.--docker-userdir <path>CLI flag as a reliable, zero-guessing override for any image convention.--user-dir>--docker-userdir> auto-probed/data> ephemeral default.--node-modulespreflight error when combined with--docker-userdir/the auto-probe without an explicit--user-dir.agentic-workflow-dev-envexample now uses the auto-probe with zero flags).A real bug was caught during e2e validation and fixed before merge: the initial
Dirent.isDirectory()-based scan missed symlinked npm packages, which is exactly how the realagentic-workflow-dev-envimage installs@tbrandenburg/node-red-agents— the probe silently failed against the actual motivating image until fixed to stat (following symlinks) instead of trustingDirentflags.Files changed
src/run-envelope.js— newresolveContainerDefaultUserDir(the/dataprobe) andresolveEffectiveUserDir(4-level precedence), replacing the reverted env-var logic.bin/node-red-cli-sandbox-entry.js— setsprobeContainerDefault: true(auto-probe is sandbox-only).bin/node-red-cli.js— new--docker-userdir <path>flag, updated help text, extended--node-modulesguard.test/unit/run-envelope.unit.test.js— unit tests for the probe (true/false positive, symlinks, absent baseDir) and the 4-level precedence.test/integration/docker.integration.test.js— real Docker integration tests: auto-probe true/false positive,--docker-userdiroverride,--user-dirprecedence.test/integration/run-envelope.integration.test.js—dockerUserDiroption equivalents.test/e2e/agentic-workflow-dev-env.e2e.test.js(new) — real, non-mocked e2e test against the actualghcr.io/tbrandenburg/agentic-workflow-dev-env:latestimage, proving the auto-probe discovers the real symlinked package with zero flags. Skips gracefully if Docker/network is unavailable.README.md— replaced env-var docs with auto-probe +--docker-userdirdocs.Validation commands run
make format— clean (Prettier)make lint— clean (ESLint)make test(node --test) — 141/141 passing, 0 failed, 0 skippedmake ci(format + lint + test + audit, via pre-push hook) — all green,npm audit: 0 vulnerabilitiesE2E coverage
test/e2e/agentic-workflow-dev-env.e2e.test.js: builds a throwaway image derived from the realghcr.io/tbrandenburg/agentic-workflow-dev-env:latest+ this branch's ownbin/src, confirms--docker <image>(no flags) discovers the real, symlinked@tbrandenburg/node-red-agentspackage via the/dataauto-probe. Ran successfully in this environment (Docker + ghcr.io reachable).--docker-userdiroverride + precedence.Risks / follow-ups
NODE_RED_CLI_DEFAULT_USERDIR— acceptable per the issue (release-notes-worthy, but intentional).--docker-userdiris documented as ignored outside--dockermode and only threaded into the--dockerenvelope path, matching its stated container-path-override semantics.