Repository navigation
fix(#840): do not apply the --local COUCH_URL check to --archive mode - #841
Open
dylanpulver wants to merge 1 commit into
Open
dylanpulver wants to merge 1 commit into
dylanpulver wants to merge 1 commit into
Conversation
--archive never connects to a database (ArchivingDB and archiving-api replace both), but getApiUrl handled it in the same branch as --local, so the localhost assertion written for --local also fired for --archive. Any COUCH_URL pointing at a remote server made --archive fail with an error that says --local was specified when it was not. Archive mode now takes the default local placeholder URL and ignores COUCH_URL. The resulting apiUrl host, port and path are unchanged for the cases that work today, so the archive output is byte-identical.
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.
Description
Fixes #840.
--archivefails whenCOUCH_URLpoints at a remote server, withERROR --local was specified but COUCH_URL env var is set to '<host>'— and--localwas not specified.getApiUrlhandled both modes in one branch, so the localhost assertion written for--localalso fired for--archive. That was accidental: the assertion arrived with--localin5b8f893, andf1ab876(#397) later widened the condition tocmdArgs.local || cmdArgs.archiveto give archive mode a placeholder URL, taking the assertion with it. Archive mode never connects to a database —db.jsreturnsArchivingDB,api.jsreturnsarchivingApi— so it now takes the default local placeholder and ignoresCOUCH_URL. Same principle as #434/#437.The smaller alternative — keep parsing
COUCH_URL, only throw whencmdArgs.local— leaves a remote URL inenvironment.instanceUrl, which makesenvironment.isProduction()true in archive mode, socheck-gitand the production-instance warning inmain.jswould start prompting for input. Archive mode mostly runs unattended, so that trades an error for a hang. Happy to switch if you prefer it.Blast radius measured, not assumed: with
COUCH_URLunset or set to localhost, the archive output is byte-identical before and after (diff -ron the destination, both cases). Only the unused credentials in the placeholder differ — host, port and path are the same, sowarn-upload-overwrite's environment key and hash filename are unchanged.--localstill errors on a remoteCOUCH_URL.get-api-url.spec.jshad no--archiveblock at all, and the one test covering the throwing branch passes{ local: true }, so it could not see this. The three new tests assert the returned URL rather than just "does not throw", which is what separates this fix from the alternative above. 886 → 889 passing locally, eslint clean.AI Disclosure: prepared with Claude Code — it found the bug and wrote the fix and the tests.
Code review items
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.