fix(cable_install): pin firebase, and stop re-adding firestore.rules - #17
Merged
Merged
Conversation
Both found pre-flighting cru-bot's 0.5.0 upgrade (#12). The generator registered a controller whose `import ... from "firebase/app"` had nothing to resolve against: those three pins live in the app's importmap, and 0.5.0 removed the vendoring step that used to bring them along. Following the README from scratch produced a module that throws on load. The generator now writes them (still app-side, so the app owns the SDK version), and the README lists them for apps that don't use importmap. firestore.rules is now opt-in (--rules). The cru-terraform solid-gcp module renders and releases that ruleset -- its template is this file modulo ${collection} -- so a copy in the app is a second source of truth nobody deploys, and 0.5.0 made re-running the generator the supported upgrade path, which kept re-adding the file apps had deleted on purpose. Also drops the claim that preload: false makes the firebase modules load only on pages with a stream element. index.js imports the controller at boot, so they load with it; preload: false only keeps them out of the modulepreload set. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Closes #12.
1. The pins
0.5.0 stopped vendoring the controller, and the three Firebase pins had been riding along with the vendored file. So an app following the new README from scratch got a registered controller whose
import … from "firebase/app"resolved to nothing — the module throws on load. Loud, unlike #9, but broken at install.cable_installnow appends them toconfig/importmap.rb:Still the app's file, not an engine pin, so the app keeps control of the Firebase SDK version — the issue's reason for leaving them app-side holds. Idempotent, and it says so plainly when there's no
config/importmap.rb(esbuild apps). Listed in the README too, for anyone not using importmap.2. The rules
--rulesnow, opt-in. I checked the duplication claim:cru-terraform-modules/applications/solid-gcp/firestore.rules.tftplis byte-identical to the gem's template except${collection}where the template hardcodes the default — so for any app on the default collection they really are the same file, and the app's copy is reference material that only looks deployable. Went with inverting rather than--skip-rulesbecause re-running the generator is now the supported upgrade path and should be idempotent for the common case, which at CruGlobal is terraform owning the ruleset.3. A comment that was wrong
While copying the dummy's pin comment I noticed it claims
preload: falsemeans "the cable client only loads them when a stream element is on the page." It doesn't:controllers/index.jsimports the controller at boot, so the firebase modules load with it on every page of a cable app;preload: falseonly keeps them out of the modulepreload set. Comment corrected in both places rather than propagated.Worth a follow-up if that lazy behavior is actually wanted: the controller would need a dynamic
import()insideconnect(). That's a real change to the connect path (and to emulator-connect ordering), so I left it alone here. It would also mean non-cable pages stop paying for the SDK.Tests
Five added to the generator test — pins written, pins not duplicated on re-run, missing-importmap message, no rules by default,
--ruleswrites the starter — and the two existing tests updated for the new default. Gem 125 runs / 320 assertions, dummy 13 runs, system-with-emulators 3 runs (1 credential-gated skip), all green.Not done here
No version bump; entries under
[Unreleased]. I'll cut v0.5.1 after this merges.🤖 Generated with Claude Code