Give chores an optional NFC tag, separate from their key - #162
Merged
Merged
Conversation
A chore saved without a tag used to get a random UUID as its tag_id, which then showed as if it were a tag id and could not be cleared, and a tag could never be unlinked because tag_id is also the key scans, snoozes and widget pins point at. tags gains a nullable, unique nfc_id: tag_id stays the chore's hidden key, nfc_id is the id its tag carries, null for no tag. schema.sql adds and fills the column once (typed ids become the tag, minted UUIDs become no tag), and private chores get the same one-time split on the phone. - NFC taps and the chore list resolve a tag by nfc_id. - The chore sheet shows the tag or "No tag", with Unlink; the edit sheet lets the tag be cleared, typed, or scanned as it is. - Settings > NFC tags lists nfc ids, filters by linked, and can unlink chores. - Writing a tag for a chore with none mints a readable id and links it only after the write succeeds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012JXsTCx1diwMZeYcW5Hu8g
A chore's tag is now its nfc_id, not its key, so the test's chore carries one, and a tagless chore is added to show its key is never taken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012JXsTCx1diwMZeYcW5Hu8g
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.
Why
A chore saved without a tag got a random UUID as its
tag_id. That UUID then showed up everywhere a tag id is shown (the chore sheet, Settings › NFC tags), so a chore with no tag looked like it had one. The UUID couldn't be cleared, and a tag couldn't be unlinked either, becausetag_idis also the key thatscans, snoozes, "Show from" and widget pins point at.What changes
Schema (
supabase/schema.sql)tags.nfc_id text UNIQUE.tag_idstays the chore's key: it never changes and is never shown.nfc_idis the id its tag carries, and null means no tag.DOblock adds the column and fills it only on the run that creates it. Typed ids (plant-airplant) become the chore's tag, and app-made UUIDs become "no tag". Later deploys leave the column alone, so a tag the user unlinked stays unlinked.nfcIdsSplitflag on the stored document.App
nfc_id. An unknown tag no longer tries to log a scan against a nonexistent key.nfc_idor "No tag". The chips filter on whether a chore is linked, and chores get Unlink like tag-alarms already have.book-santa). The chore is linked only after the write succeeds (NfcWriteRequest.linkChore), so a cancelled write leaves it with no tag.nfc_idgoes into a PATCH only when it changed, and inserts leave it out when it's null. That keeps edits working on a database that doesn't have the column yet.Tests:
TagsUiStateTest,SheetDraftTest,PrivateItemsTest,ChorePayloadTest,ChoreModelTest,SchemaSyncTest.Docs: CLAUDE.md map, README data section, LESSONS #67.
Caveat
A chore whose app-made UUID was actually written to a sticker comes out of the migration unlinked. Scanning that sticker from the chore's edit sheet re-links it.
🤖 Generated with Claude Code
https://claude.ai/code/session_012JXsTCx1diwMZeYcW5Hu8g
Generated by Claude Code