Skip to content

Give chores an optional NFC tag, separate from their key - #162

Merged
mapgie merged 2 commits into
mainfrom
claude/chore-tag-auto-assign-maro3w
Sep 27, 2026
Merged

mapgie merged 2 commits into
mainfrom
claude/chore-tag-auto-assign-maro3w

Conversation

@mapgie

@mapgie mapgie commented Sep 26, 2026

Copy link
Copy Markdown
Owner

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, because tag_id is also the key that scans, snoozes, "Show from" and widget pins point at.

What changes

Schema (supabase/schema.sql)

  • New nullable tags.nfc_id text UNIQUE. tag_id stays the chore's key: it never changes and is never shown. nfc_id is the id its tag carries, and null means no tag.
  • A DO block 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.
  • Private (on-device) chores get the same one-time split through a nfcIdsSplit flag on the stored document.

App

  • NFC taps (background auto-log and foreground) and the chore list look a chore up by nfc_id. An unknown tag no longer tries to log a scan against a nonexistent key.
  • Chore sheet: shows the tag or "No tag", with an Unlink chip behind a confirm dialog.
  • Edit sheet: the tag field works for both new and existing chores. You can clear it (Unlink/Clear) or type an id, and Scan links a sticker as it is, without rewriting it.
  • Settings › NFC tags: rows show the nfc_id or "No tag". The chips filter on whether a chore is linked, and chores get Unlink like tag-alarms already have.
  • Writing a tag for a chore that has none mints a readable id from its name (book-santa). The chore is linked only after the write succeeds (NfcWriteRequest.linkChore), so a cancelled write leaves it with no tag.
  • nfc_id goes 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

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
@mapgie
mapgie marked this pull request as ready for review September 27, 2026 10:56
@mapgie
mapgie merged commit 8a36900 into main Sep 27, 2026
7 checks passed
@mapgie
mapgie deleted the claude/chore-tag-auto-assign-maro3w branch September 27, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants