fix(client): infer cloud from API_URL+API_KEY when no STORAGE_MODE (fleet-flip)#17
Merged
Merged
Conversation
…leet-flip) The fleet env-flip writes exactly HASNA_<APP>_API_URL + HASNA_<APP>_API_KEY per app and NO explicit STORAGE_MODE (machines FLEET-FLIP.md). resolveClientTransport only switched to cloud on an explicit mode env, so every app using the shared resolver (accounts, attachments, domains, files, logs, sandboxes, secrets, sessions, shortlinks, todos) stayed on local and read its on-box store after a flip. Infer mode=cloud from the joint presence of url+key, mirroring the vendored projects/recordings client fix. Revert removes both vars -> back to local. Bump 0.5.0 -> 0.5.1.
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.
Root cause
The fleet env-flip (
machines flip, see open-machinesdocs/FLEET-FLIP.md) writes exactly two vars per app and noHASNA_<APP>_STORAGE_MODE:But
resolveClientTransportonly switched to cloud when an explicit mode env was present. With url+key only, it fell through tolocal, so every app using the shared resolver (resolveStorageClient/createClientTransport) kept reading its on-box store after a flip — self_hosted was a silent no-op.Proof (before):
resolveClientTransport('todos', { HASNA_TODOS_API_URL, HASNA_TODOS_API_KEY }) => transport:'local'.Fix
Infer
mode=cloudfrom the joint presence of API_URL + API_KEY when no explicit mode env is set — mirroring the already-shipped vendored fix in open-projects/open-recordings (#22). Revert (removing both vars) returns tolocal. ExplicitSTORAGE_MODE=localstill wins.Cascades to all 9 direct-import apps: accounts, attachments, domains, files, logs, sandboxes, secrets, sessions, shortlinks, todos.
Tests
Version
0.5.0 -> 0.5.1 (
CONTRACTS_PACKAGE_VERSIONbumped to satisfy dist smoke).