Repository navigation
Rename env var prefix GPTDIFF_ → PATCHLING_ - #22
Merged
Merged
Conversation
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.
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.
What
Every configuration environment variable is renamed from the
GPTDIFF_prefix (a leftover from the project's gptdiff days) toPATCHLING_, mirroring 255BITS/patchling-py#41 so both implementations share one naming scheme:GPTDIFF_MODELPATCHLING_MODELGPTDIFF_LLM_BASE_URLPATCHLING_LLM_BASE_URLGPTDIFF_LLM_API_KEYPATCHLING_LLM_API_KEYGPTDIFF_FILTER_MODELPATCHLING_FILTER_MODELGPTDIFF_LIVEPATCHLING_LIVECall sites,
landing/libcopies (kept byte-identical per the sync tests), docs, README, landing pages,package.jsonscripts and tests all use the new names. Note: this repo never had theGPTDIFF_SMARTAPPLY_*variables — those exist only in patchling-py; the JS smartapply model resolves through the shared LLM settings.Compatibility
src/env.jsresolves the legacyGPTDIFF_*spelling whenever thePATCHLING_*name is unset;PATCHLING_always wins when both are set. Overrides registered viasetEnvare consulted across both spellings beforeprocess.env, exactly as in patchling-py. Existing environments keep working with no changes.Hermetic tests
test/setup.js, loaded vianode --importin thetestscript, deletes every ambientPATCHLING_*/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 requiredfailed withGPTDIFF_LLM_API_KEYplanted). Thetest:live*scripts are untouched: they read the ambient key on purpose.Tests
test/env-prefix.test.js: new-name reads, legacy fallback, precedence when both are set,setEnvoverrides under either spelling, unprefixed names untouched.npm test): 281 passed, 5 skipped, 0 failed — including runs withGPTDIFF_LLM_API_KEYplanted in the ambient environment, and withPATCHLING_LLM_API_KEY+GPTDIFF_MODEL+PATCHLING_LLM_BASE_URL+GPTDIFF_FILTER_MODELplanted together.