[BUG]: Auto-load re-resolve inside varlock run fails when an @internal value came from the shell
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 43/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- bun, typescript
Research direction
Start by tracing how varlock run strips @internal values and how JavaScript auto-load re-resolves after an env file change; the issue names the auto-load integration and the varlock run -- bun check.ts reproduction, but no source files or tests. Reproduce both steps and inspect the injected env blob and child process handling. Done when the second command still resolves SERVICE_URL from the shell-provided SUBDOMAIN.
Written by the indexing model from the issue text.
Description
varlock version
1.21.0
Steps to reproduce
.env.schema:
# @defaultSensitive=false
# ---
# Comes from the shell, only used to build SERVICE_URL.
# @internal
SUBDOMAIN=
SERVICE_URL=https://${SUBDOMAIN}.example.com
check.ts:
await import("varlock/auto-load");
console.log("SERVICE_URL =", process.env.SERVICE_URL);
SUBDOMAIN=api varlock run -- bun check.tsSUBDOMAIN=api varlock run -- sh -c 'echo "# edited" >> .env.schema; bun check.ts'
What is expected?
Both print SERVICE_URL = https://api.example.com. The second is the watch-mode case the JavaScript guide describes: an env file changes while the app runs under varlock run (for example varlock run -- bun run --watch src/index.ts), and auto-load re-resolves instead of reusing the blob.
What is actually happening?
1 works. 2 fails:
❓ SUBDOMAIN* 🔩internal
└ undefined
- Value is required but is currently empty
⛔ SERVICE_URL* 🔐sensitive
└ undefined
- Dependency SUBDOMAIN is invalid
varlock run strips @internal items from the child env, including values that came from the ambient environment (as documented). When the child's auto-load then re-resolves because an env file changed, the internal value is no longer there to resolve from, so the load fails. The same happens to a secret-zero passed in from the shell, for example an OP_TOKEN of type opServiceAccountToken: editing an env file during a watch session breaks every op() item. Without @internal, step 2 works.
Possible fixes: carry internal ambient values in the (encrypted) blob for re-resolution only, or have auto-load re-resolve through the parent varlock run, or document that re-resolution in a child cannot see internal items.
System Info
macOS 27.0 (arm64)
Bun 1.4.2
varlock 1.21.0
Any additional comments?
Hit in a Bun monorepo where a value set by the shell per checkout feeds other items; we had to drop @internal from it so a watch session survives an env edit.
- Dominant language
- TypeScript
- Stars
- 4.9k
- Forks
- 140
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 35
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dmno-dev/varlock
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
dmno-dev/varlock#1279 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
dmno-dev/varlock#1100 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 78/100
dmno-dev/varlock#1278 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
dmno-dev/varlock#1275 · 1 comment ·
Maintainers usually reply within 1 day
-
core:varlock RFC
Difficulty 5/5 Over a week Newbie friendliness 28/100
dmno-dev/varlock#1258 · 1 comment ·
Maintainers usually reply within 1 day
All issues in dmno-dev/varlock
Similar issues
-
documentation good first issue roadmap
Difficulty 1/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
resend/react-email#3876 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
siyuan-note/siyuan#21324 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
himynameisdave/bsky-profanity-counter#59 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100