Skip to content

fix(sim-setup): stop doctor --fix from turning ${VAR} references into literals - #9868

Merged
waleedlatif1 merged 4 commits into
stagingfrom
fix/sim-setup-env-mirror-refs
Nov 11, 2026
Merged

waleedlatif1 merged 4 commits into
stagingfrom
fix/sim-setup-env-mirror-refs

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Follow-up to fix(sim-setup): quote env values containing $ so dotenv, Bun, and Compose don't expand them #9861. doctor --fix mirrors values from apps/sim/.env into the realtime and db env files. Since fix(sim-setup): quote env values containing $ so dotenv, Bun, and Compose don't expand them #9861 it escaped a hand-written ${VAR} reference into the literal "\${VAR}", so the copy stopped expanding
  • A value written with an unescaped $ reference is no longer auto-mirrored. Copied to another file, a reference resolves against that file's variables, so neither a literal copy nor a verbatim copy is safe. The consistency finding now says to copy it, and the variables it uses, by hand. Seeding a new file and the missing-key autofix skip these values too
  • The same rule covers values upsertEnv cannot write safely, such as a $ mixed with a backslash. Every copy path checks it first: seeding, the missing-key fix, and both consistency mirrors. Doctor reports these values instead of throwing, and never generates a shared secret in place of one it couldn't copy
  • The consistency check compares values as written whenever a $ reference is involved, so it catches a file an earlier --fix already escaped. Plain values, including escaped \$ literals, mirror exactly as before
  • reset with Docker stopped and no install detected also suggests switching kubectl to the cluster's context, since an undetected Kubernetes install looks the same

Type of Change

  • Bug fix

Testing

  • checks.test.ts runs doctor's real consistency autofixes against env files in a temp root:
    • a ${VAR} DATABASE_URL against a different URL
    • a ${VAR} DATABASE_URL against the same reference already escaped into a literal
    • a ${VAR} DATABASE_URL written the same way in both files
    • a referenced shared secret missing from realtime
    • an unwritable \$-plus-backslash value
  • The first two must report a finding with no autofix and leave the db file byte-for-byte unchanged; they fail on staging's code. The third must not be flagged. checks, env-files and lifecycle tests pass 33/33; the last two fail on the previous commit
  • bun run type-check in packages/sim-setup, biome, check:unused-exports; full suite in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 11, 2026 1:13am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues remain.

Summary

Prevents doctor --fix from turning environment references into literal values.

  • The setup doctor leaves unsafe env values for a hand copy.
  • Reset suggests checking kubectl's context when no install is detected.

All four earlier, unnumbered findings are addressed by the current code.

Reviews (4) · Last reviewed commit: "fix(sim-setup): give a placeholder share..." · Reviewed by Greptile

Comment thread packages/sim-setup/src/checks.ts Resolved
Comment thread packages/sim-setup/src/checks.ts Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread packages/sim-setup/src/checks.ts Resolved
Comment thread packages/sim-setup/src/checks.ts Resolved
Comment thread packages/sim-setup/src/checks.ts Resolved
Comment thread packages/sim-setup/src/checks.ts Resolved
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@waleedlatif1 waleedlatif1 changed the title fix(sim-setup): mirror env values as written so ${VAR} references survive doctor --fix fix(sim-setup): stop doctor --fix from turning ${VAR} references into literals Nov 11, 2026
Comment thread packages/sim-setup/src/checks.ts Resolved
Comment thread packages/sim-setup/src/checks.ts Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread packages/sim-setup/src/checks.ts Resolved
… report unwritable values instead of aborting
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread packages/sim-setup/src/checks.ts Resolved
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

This branch was previously deployed

1 inactive deployment
Preview — acca16f3 Deployed Nov 11, 2026 by vercel[bot]
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.

1 participant