feat(config): resolve variable substitution in extends paths#256
Conversation
✅ Deploy Preview for devsydev canceled.
|
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
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 |
Apply local-scope variable substitution (localEnv, localWorkspaceFolder, localWorkspaceFolderBasename) to extends ref strings before resolving them. This enables using environment variables and workspace paths in devcontainer.json extends references, matching the devcontainer spec's variable substitution behavior.
Use os.LookupEnv instead of os.Getenv so that an env var set to empty string is returned as-is, and the default value is only used when the variable does not exist. Adds test for default value syntax. Also resolves pre-existing merge conflict in cmd/root.go.
Cover localEnv, localWorkspaceFolder, default-value fallback, and missing-env-var error scenarios for extends path resolution.
c9af992 to
e94c1ed
Compare
…older Adding extendsVarReplacer introduced two more string literal occurrences of "localEnv" and "localWorkspaceFolder", crossing the goconst threshold. Extracted varLocalEnv and varLocalWorkspaceFolder constants shared across substitute.go and parse.go to satisfy the linter.
Summary
Applies local-scope variable substitution (
${localEnv:VAR},${localWorkspaceFolder},${localWorkspaceFolderBasename}) toextendsref strings before resolving them. Previously, variables in extends paths were used literally because extends resolution ran before the general variable substitution pass.The fix adds a restricted replacer (
extendsVarReplacer) that handles only process-local variables — container-scoped variables are left as literals since the container doesn't exist at extends-resolution time.Spec Compliance
localEnv,localWorkspaceFolder,localWorkspaceFolderBasenameare available during configuration resolutioncontainerEnv,containerWorkspaceFolder) correctly excluded since the container doesn't exist at extends-resolution time${localEnv:VAR:default}) supported per specdevcontainer-cli Alignment
Aligns with devcontainer-cli reference implementation which applies
substitute()before resolving extends.E2E Test Coverage
${localEnv:VAR}in extends path${localWorkspaceFolder}in extends path${localEnv:UNSET:default}fallback