Skip to content

feat(documents): a document trashed in Linear leaves the copy on a plain sync - #15

Merged
leemour merged 2 commits into
mainfrom
feat/documents-deletions
Nov 24, 2026
Merged

leemour merged 2 commits into
mainfrom
feat/documents-deletions

Conversation

@leemour

@leemour leemour commented Nov 24, 2026

Copy link
Copy Markdown
Member

Task

A document moved to Linear's trash should leave the local copy on a plain sync, not only on sync --rescan. This uses cli-core's new deletions feed (WireCatLabs/cli-core#3282, released in 0.744.0).

Why

Trashing a Linear document does not change its updatedAt. The changes round lists documents by updatedAt, so it missed any document trashed after its last edit. Checked live on 2026-11-24 against the test workspace:

  • After documentDelete, the document has trashed: true and archivedAt set, and updatedAt stays the same.
  • auditEntries with type eq documentDeleted returns one entry per trash, with the document id at metadata.entityId.
  • documentUnarchive (restore) also leaves updatedAt unchanged and writes no audit entry.

What

  • Bumps cli-core to 0.744.0. cli-base stays at 0.132.0, which is its latest version. Regenerating changed nothing.
  • src/documents/manifest.ts: a deletions entry that reads auditEntries (type documentDeleted, createdAt on or after the round's start), with the time at createdAt and the id at metadata.entityId.
  • src/commands/documents.ts: the run's warn is passed through to the source. When the audit log is refused, the sync succeeds and reports the warning source.deletions-unchecked.
  • src/testing/fake-documents.ts: trash() works as Linear does: it sets trashed and archived, keeps updatedAt and writes one audit entry. auditEntries answers only the source's own filter and variables and refuses anything else. refuseAudit() makes the audit log refuse the call.
  • README: a trashed document leaves on the next sync. A key without audit-log access gets the warning on each sync. A restored document comes back only with sync --rescan (cli-core #3283).
  • scripts/live.sh: a new deletion round trip. It creates a project and a document, syncs, trashes the document, then syncs again. It expects the document removed with no warning, and the audit log naming it. Then it trashes the project. If a step fails, the cleanup finds the project by its unique name.

Not covered

  • Linear's error for a key without audit-log access is unknown. cli-core warns only on permission_error, which GraphQL FORBIDDEN maps to. If Linear refuses a non-admin key with another code, every plain sync fails instead of warning. The test key is an admin's, so this could not be checked. linear-cli's error mapping is left unchanged. A live call with a non-admin key should decide whether linear-cli's error hook needs to map that code.
  • A trash followed by a restore within the 10-minute overlap still removes the copy until sync --rescan.

Testing

  • vitest run: 620 passed. test:matrix:check, docs:check, typecheck and biome check pass. The 2 biome warnings are pre-existing ones about generated file size.
  • Removing the deletions entry makes both trash tests in src/documents/source.test.ts fail. So they test the audit feed, not the listing's trashed flag.
  • Ran scripts/live.sh through bin/live against the Linear test workspace and it passed: "trashed document left the copy on a plain sync". The live check record is not committed, because it names a commit before the squash. The release needs its own record.

🤖 Generated with Claude Code

leemour and others added 2 commits November 24, 2026 09:54
cli-core 0.744.0 lets a manifest document source read a list of deleted documents in each changes round
(cli-core #3282). cli-base stays at 0.132.0, its latest. Regenerating changed nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ain sync

Trashing a Linear document keeps its updatedAt (checked live on 2026-11-24), so the changes round, which filters
documents by updatedAt, missed a document trashed after its last edit until sync --rescan. The source now names
Linear's audit log as its deletions feed (auditEntries, type documentDeleted, createdAt since the round's start):
cli-core reads it in each changes round and removes each metadata.entityId as deleted.

The run's warn reaches the source, so a key without audit-log access gets source.deletions-unchecked and the sync
still succeeds. A restore from the trash keeps updatedAt too and writes no audit entry, so a restored document
comes back only with sync --rescan; the README says so.

The fake now trashes as Linear does (trashed, archived, updatedAt kept, one documentDeleted entry) and answers
auditEntries only for the source's own filter, refusing any other. scripts/live.sh makes a project and a document,
syncs, trashes the document, syncs again and expects it removed with no warning and named in the audit log, then
trashes the project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​wirecat/​cli-core@​0.736.0 ⏵ 0.744.097100100 +19670

View full report

@leemour
leemour merged commit 479c97b into main Nov 24, 2026
16 checks passed
@leemour
leemour deleted the feat/documents-deletions branch November 24, 2026 09:15
@leemour leemour mentioned this pull request Nov 24, 2026
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