Skip to content

Rename env var prefix GPTDIFF_ → PATCHLING_ - #22

Merged
mikkel merged 2 commits into
mainfrom
feat/patchling-env-prefix
Nov 28, 2026
Merged

mikkel merged 2 commits into
mainfrom
feat/patchling-env-prefix

Conversation

@mikkel

@mikkel mikkel commented Nov 28, 2026

Copy link
Copy Markdown
Member

What

Every configuration environment variable is renamed from the GPTDIFF_ prefix (a leftover from the project's gptdiff days) to PATCHLING_, mirroring 255BITS/patchling-py#41 so both implementations share one naming scheme:

Before After
GPTDIFF_MODEL PATCHLING_MODEL
GPTDIFF_LLM_BASE_URL PATCHLING_LLM_BASE_URL
GPTDIFF_LLM_API_KEY PATCHLING_LLM_API_KEY
GPTDIFF_FILTER_MODEL PATCHLING_FILTER_MODEL
GPTDIFF_LIVE PATCHLING_LIVE

Call sites, landing/lib copies (kept byte-identical per the sync tests), docs, README, landing pages, package.json scripts and tests all use the new names. Note: this repo never had the GPTDIFF_SMARTAPPLY_* variables — those exist only in patchling-py; the JS smartapply model resolves through the shared LLM settings.

Compatibility

  • src/env.js resolves the legacy GPTDIFF_* spelling whenever the PATCHLING_* name is unset; PATCHLING_ always wins when both are set. Overrides registered via setEnv are consulted across both spellings before process.env, exactly as in patchling-py. Existing environments keep working with no changes.

Hermetic tests

  • New test/setup.js, loaded via node --import in the test script, deletes every ambient PATCHLING_*/GPTDIFF_* variable in each test-runner child process — the mirror of patchling-py's autouse conftest scrub. Without it, a CI secret exported under the legacy name leaks through the alias resolution into tests that assume a variable is unset (missing api key throws only when a call is required failed with GPTDIFF_LLM_API_KEY planted). The test:live* scripts are untouched: they read the ambient key on purpose.

Tests

  • New test/env-prefix.test.js: new-name reads, legacy fallback, precedence when both are set, setEnv overrides under either spelling, unprefixed names untouched.
  • Full suite (npm test): 281 passed, 5 skipped, 0 failed — including runs with GPTDIFF_LLM_API_KEY planted in the ambient environment, and with PATCHLING_LLM_API_KEY + GPTDIFF_MODEL + PATCHLING_LLM_BASE_URL + GPTDIFF_FILTER_MODEL planted together.

Nova (Muse) added 2 commits November 28, 2026 07:37
Mirror of patchling-py PR #41 so both implementations share one naming
scheme: PATCHLING_MODEL, PATCHLING_LLM_BASE_URL, PATCHLING_LLM_API_KEY,
PATCHLING_FILTER_MODEL, PATCHLING_SMARTAPPLY_MODEL, PATCHLING_LIVE.

src/env.js resolves the legacy GPTDIFF_* spelling whenever the
PATCHLING_ name is unset (PATCHLING_ wins when both are set); landing/lib
copies kept byte-identical per the sync tests. Docs, README, package.json
scripts and tests updated.

Tests: npm test — 280 passed, 0 failed, incl. new test/env-prefix.test.js.
Mirror patchling-py's autouse conftest fixture: a host or CI value
exported under the legacy GPTDIFF_ name (e.g. GPTDIFF_LLM_API_KEY)
otherwise leaks through the new legacy-alias resolution into tests
that assume a variable is unset — 'missing api key throws only when
a call is required' failed with the legacy key planted. test/setup.js
deletes every PATCHLING_*/GPTDIFF_* variable and is loaded via
node --import in the npm test script, so it runs in each test-runner
child process before the test file itself. The test:live* scripts
are untouched: they read the ambient key on purpose.

Tests: npm test — 281 passed, 5 skipped, 0 failed, including with
GPTDIFF_LLM_API_KEY planted in the ambient environment.
@mikkel
mikkel merged commit 9e08992 into main Nov 28, 2026
8 checks passed
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