Repository navigation
Conversation
Licenses and certificates on the property compliance tab usually arrive as
PDFs, but properties/** in storage.rules only allowed images. A sibling match
on properties/{pid}/compliance/** now also accepts application/pdf under the
same 10 MB cap; Storage ORs matching rules, so every other properties/** path
stays image-only. test:rules now boots the storage emulator too, and the first
Storage rules test covers the allow and the denies.
Refs: TURNWRK-749
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
practical-bot
left a comment
There was a problem hiding this comment.
✅ Approve
The focused rules test and exact-head CI provide sufficient pre-merge evidence; production upload remains a post-merge verification after the dispatch sync and deploy.
| Check | Result | Ref |
|---|---|---|
| PR metadata and diff | ✅ base main, 4 files, 106 additions and 2 deletions (108 changed lines); working tree clean | gh pr view 47; git diff origin/main...HEAD |
| CI typecheck and unit | ✅ all steps including typecheck, test:run, build, and vendored checks succeeded on head 16b72f3 | GitHub Actions run 47037011267 |
| CI rules tests | ✅ test:rules succeeded on head 16b72f3 | GitHub Actions run 47037011267 |
| CI secret scan | ✅ secret scan succeeded on head 16b72f3 | GitHub Actions run 47037011267 |
| Local focused rules test | npm run test:rules | |
| Mutation claims | PR body mutation table; npm run test:rules |
Review record
DESIGN: DESIGN: Put the MIME-type exception in firebase/storage.rules under properties/{propertyId}/compliance/, preserving the existing properties/ image-only rule and 10 MB cap.
DESIGN: DESIGN: Keep all non-compliance properties paths image-only and preserve authentication and size restrictions.
DESIGN: DESIGN: Add emulator-backed tests for compliance PDF allow, non-compliance PDF deny, retained image behavior, size, type, and auth guards, and run them in the declared rules test command.
ADVERSARIAL: ADVERSARIAL: The strongest case against approval is that the new sibling match could accidentally broaden PDFs across properties or the regression tests could be weak; the exact-head CI rules job passed, its test file covers compliance allow and non-compliance denial plus auth/type/size guards, and the diff leaves the broad image-only match unchanged.
NEEDS VERIFICATION: After merge, vendor-sync shared into dispatch, deploy the Storage rules, widen the dispatch compliance input in PR 2, and upload a PDF from the compliance sheet on a deployed property.
REVIEW VERDICT: approve
REVIEWED DIFF: base=main files=4 lines=108
REVIEW RUN: dispatch=rev-sweep-turnwrk-shared-47-16b72f3 thread=a4a8e379-8ac4-4996-91e3-cb7320abcc13 model=codex/gpt-5.6-luna
NOT READ: none
Legend: ✅ approve or pass · ❌ changes requested or fail · 👤 a person approves too ·
Why
PR 1 of 2: shared storage rule + rules test (PR 2 is the dispatch file input, after sync + rules deploy).
The property compliance tab stores licenses and certificates under
properties/{pid}/compliance/{itemId}/. Those documents usually arrive as PDFs, but theproperties/{propertyId}/{allPaths=**}match infirebase/storage.rulesallowedimage/*only. So the tab could take images only.What changed
Net source lines vs main: +15 (tests excluded): one
isPdf()helper, one compliance match, andtest:rulesnow boots the storage emulator too. Nothing is replaced.firebase/storage.rules: a siblingmatch /properties/{propertyId}/compliance/{allPaths=**}allows writes ofimage/*orapplication/pdfwhen the user is signed in, under the existingisValidSize()cap (< 10 * 1024 * 1024). Storage ORs every matching statement, so the broadproperties/**rule is left exactly as it was. A PDF anywhere else underproperties/still matches only that rule, so it is still denied. Reads are unchanged, because the broad rule already covers them.tests/rules/propertyStorage.rules.test.ts: the repo's first Storage rules test (@firebase/rules-unit-testing, storage emulator on 9199).package.jsontest:rules:--only firestorebecomes--only firestore,storage. CI'srulesjob already runsnpm run test:rules, so the new test runs in CI with no workflow edit.vitest.rules.config.ts: the header comment now names both rule files.What deliberately did NOT change
properties/**rule and every other path instorage.rules..github/workflows/. Therulesjob's name and comment still say "firestore". They are stale but harmless, and editing them would make this a human merge.ComplianceItemSheet.tsxfile input toimage/*,application/pdfis PR 2, after the vendor sync and the rules deploy.Proof
On the old rules (52f0a92), the new test fails for the right reason. That run had 6 tests; the "image elsewhere" case was added afterwards.
Mutation table. Each one-line break ran the single test file on the storage emulator, and the rules were then restored.
(isImage() || isPdf())→isImage()&& isValidSize()isImage()→(isImage() || isPdf())isAuthenticated() &&isPdf()→return trueVerification
npm run test:rules: 7 files, 70 tests passed. That is the 6 existing Firestore files plus the new Storage file of 7 tests: PDF under compliance allowed, image under compliance allowed, image under photos allowed, PDF under photos/ and at the property root denied, a 10 MB PDF denied, text/plain denied, signed-out denied. It was re-run green after the last edit.npm run typecheck: clean. src/ is untouched.wt/worktree. I rancommit-msgby hand and it passed (exit 0).pre-pushis a dispatcher with no repo.guardrails/pre-push, so it does nothing here.git ls-remote origin turnwrk-749-compliance-pdf-storage-rulematches local HEAD.Before merge / after merge
image/*,application/pdf.Live check after deploy. Upload a PDF from the compliance sheet on a deployed property. This is the card's Done-when, and it needs the rules deploy plus PR 2.
Refs: TURNWRK-749
🤖 Generated with Claude Code