Cloud: Firebase SDK foundation, emulator suite, and cost guardrails
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 38/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- firebase, github-actions, typescript, vite
Direzione di ricerca
Start by reading vite.config.ts, vitest.config.ts, src/test/setup.ts, and the existing firebase.json to understand current build, test, and Hosting configuration. Then map the requested src/firebase/ module, rules files, emulator settings, environment example, and docs/cloud-storage.md against the acceptance criteria. Done means the typed Firebase plumbing, emulator isolation, deny-all rules, CI configuration, documentation, typecheck, and coverage requirements are all verified.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Foundation issue for the Cloud Accounts & Storage milestone. Adds the Firebase SDK, client
configuration, security-rule files, the Emulator Suite for testing, and the cost guardrails that
must be in place before anything writes to a live project.
This is the first code in the repo to use runtime environment variables. Today vite.config.ts
only injects build-time constants via define (__BUILD_COMMIT__ etc., typed in
src/build-info.d.ts) and there is no .env anywhere.
Scope
- Add the
firebasedependency tolua-learning-website. - New
src/firebase/module exporting lazily-initialisedapp,auth,db,storage
singletons, readingVITE_FIREBASE_*config. Configure Firestore with
persistentLocalCache— this gives offline reads and offline write queuing for free and is
what makes repeat page loads cost zero Firestore reads. - Set
authDomainto the app's own origin (adventuresinlua.web.app), not the default
*.firebaseapp.com. See #788 for why this is load-bearing. - Add
firestore.rules,storage.rules,firestore.indexes.json, andfirestore/storage/
emulatorssections tolua-learning-website/firebase.json(currentlyhostingonly). - Wire the Emulator Suite into vitest so no test can touch a live project. Emulator host/port
detection must be automatic in dev/test and inert in production builds. - Add
.env.example, add.env*to.gitignore(not currently ignored), and add the
VITE_FIREBASE_*values as GitHub Actions secrets for the Hosting deploy workflows. - Document the Blaze upgrade and configure a GCP billing budget alert. Optionally wire the
alert to a Pub/Sub function that disables billing as a runaway kill switch.
Non-goals
- No auth UI (#788), no data model or real rules content (#789) — this issue lands the
plumbing and a deny-all default ruleset.
Acceptance criteria
-
firebaseadded as a dependency;src/firebase/exports typedauth/db/storage - Firestore configured with
persistentLocalCache -
authDomainpoints at the app's own origin -
firebase.jsondeclaresfirestore,storage, andemulatorsalongsidehosting - COOP/COEP headers in
firebase.jsonare unchanged (same-origin/require-corp) -
firestore.rulesandstorage.rulesexist and default to deny-all - Emulators start for tests; a test asserts the SDK is pointed at the emulator, not production
-
.env.examplecommitted,.env*gitignored, CI secrets documented -
docs/cloud-storage.mdstubbed with the Blaze prerequisite and console setup steps - Billing budget alert configured (manual console step, documented)
-
npx tsc -p lua-learning-website/tsconfig.app.json --noEmitclean - Scoped mutation coverage >= 80% for new code
Implementation notes
- Config module belongs in
lua-learning-website/src/firebase/. Keep it side-effect-light so
importing it in a test does not open network connections. - The Firebase client config is not a secret (it ships in client JS), but keeping it in env
vars still lets preview/prod point at different projects. Real protection comes from security
rules and App Check (#798). vitest.config.tsalready aliases mocks forstylua-wasm; follow that pattern if a
Firebase mock is needed for pure unit tests that should not spin up emulators.src/test/setup.tsis currently minimal (jest-dom + a ResizeObserver stub) — emulator wiring
goes here or in a dedicated setup file.
Blaze plan prerequisite
Cloud Functions require the Blaze plan, and Cloud Storage requires it for projects created after
approximately October 2024. Verify whether adventuresinlua already has a Storage bucket before
assuming an upgrade is needed. Set the budget alert in the same sitting as the upgrade.
Branching
This issue is part of the Cloud Accounts & Storage
milestone, which uses feat/cloud as its integration branch.
Branch from feat/cloud, and open the PR against feat/cloud. Never against main.
Create the branch (the --base flag also sets the default PR target for this branch):
gh issue develop <number> --base feat/cloud --checkout
Open the PR:
python3 scripts/issue-review.py <number> --base feat/cloud \
--summary "<summary>" --test-plan "<test-plan>"
feat/cloud merges to main in a single PR once the milestone is complete.
Why both flags are required: gh issue develop without --base branches from the repository
default branch (main), and scripts/issue-review.py falls back to main when --base is
omitted — both for the gh pr create target and for the changed-file list in the PR body.
- Lingua principale
- TypeScript
- Stelle
- 1
- Fork
- 0
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di jcollard/LuaInTheWeb
-
tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
jcollard/LuaInTheWeb#752 ·
-
tech-debt
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
jcollard/LuaInTheWeb#690 ·
-
tech-debt
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
jcollard/LuaInTheWeb#590 ·
-
tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
jcollard/LuaInTheWeb#518 ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
jcollard/LuaInTheWeb#235 ·
Tutte le issue di jcollard/LuaInTheWeb
Issue simili
-
Contrib indemnité de départ à la retraite : faire le pont avec le simulateur sur la page génériqueApertaP1
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
SocialGouv/code-du-travail-numerique#7561 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
kubernetes-sigs/headlamp#7950 ·
I maintainer di solito rispondono entro 3 giorni
-
README for cliForse già presa @Janvi-kapoor l’ha presa oggi. ApertaOSCI'26
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
GauravKarakoti/SecureFlow#1308 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
vitest-dev/vitest#11577 ·
I maintainer di solito rispondono entro 1 giorno