Skip to content

One Item module makes every new Item and decides which changes fit - #120

Merged
NiallJoeMaher merged 2 commits into
mainfrom
arch-item-module
Oct 27, 2026
Merged

NiallJoeMaher merged 2 commits into
mainfrom
arch-item-module

Conversation

@NiallJoeMaher

Copy link
Copy Markdown
Contributor

Candidate #1 from docs/architecture.md, the part about an Item's shape and which changes fit it.

What changed

  • New packages/db/src/item-doc.ts holds newItem (the whole new-Item document), replucked, statusFields and misfit (which changes fit an Item: text, Kind, Done).
  • All five writers now build the Item with newItem: pluckLink, createFileItem, createTextItem, createEmailItem and importLink. Re-pluck in items.ts and email-in.ts uses replucked. Ticking a Todo in a List uses statusFields.
  • isTask and TASK_KINDS are now in shared-schemas. lists.ts, digest.ts, items.ts, ItemBar, ItemList and the iPhone ItemsScreen use them, so the "todo" || "thing" check isn't written out in each file any more.
  • updateItem asks misfit instead of repeating the three checks. The error messages are the same as before.

Edit and batch now agree: batch refuses

Before, /items/batch and batch_update skipped any Item a change didn't fit and said nothing about it. Now the whole call is refused with the same 400 and message an edit gives, and details.itemIds names the Items that don't fit. Nothing changes, and no tags move either: the change is checked before tags are applied.

Why refuse instead of skip:

  • batch_update already refuses the whole call for an unknown tag.
  • The MCP layer passes details back to the AI, so it can resend without those Items. Under the old behaviour it could report Items as moved when they weren't.
  • The web and iPhone apps already filter before they send Done, so they keep working.

docs/mcp.md describes the new behaviour.

Done also follows the Kind the Item ends with in batch now, as it already did in edit. {kind: "todo", status: "done"} on a Note is allowed; before, batch skipped it.

Tests

  • item-doc.test.ts: a table test of misfit with 15 rows, plus statusFields.
  • triage.test.ts: the batch test covers all-or-none, the refused ids, and two users (B's Items are never changed or named, even ones that wouldn't fit).
  • apps/web items.test.ts: a refused batch is a 400 with details.itemIds, and its tags don't move.
  • pnpm typecheck, pnpm lint and pnpm test pass (71 files, 461 tests). I didn't run e2e or design.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Per4f8yL5A7nL9frZVDJj7

@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pluck Ready Ready Preview Oct 27, 2026 7:35am UTC

Request Review

NiallJoeMaher and others added 2 commits October 27, 2026 07:32
…o an edit and a batch refuse a misplaced Done the same way

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Per4f8yL5A7nL9frZVDJj7
Signed-off-by: NiallJoeMaher <nialljoemaher@gmail.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Per4f8yL5A7nL9frZVDJj7
Signed-off-by: NiallJoeMaher <nialljoemaher@gmail.com>
@NiallJoeMaher
NiallJoeMaher merged commit 6c2d170 into main Oct 27, 2026
1 of 5 checks passed
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.

1 participant