Repository navigation
feat(documents): a document trashed in Linear leaves the copy on a plain sync - #15
Merged
Merged
Conversation
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>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Merged
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.
Task
A document moved to Linear's trash should leave the local copy on a plain
sync, not only onsync --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 byupdatedAt, so it missed any document trashed after its last edit. Checked live on 2026-11-24 against the test workspace:documentDelete, the document hastrashed: trueandarchivedAtset, andupdatedAtstays the same.auditEntrieswithtype eq documentDeletedreturns one entry per trash, with the document id atmetadata.entityId.documentUnarchive(restore) also leavesupdatedAtunchanged and writes no audit entry.What
src/documents/manifest.ts: adeletionsentry that readsauditEntries(typedocumentDeleted,createdAton or after the round's start), with the time atcreatedAtand the id atmetadata.entityId.src/commands/documents.ts: the run'swarnis passed through to the source. When the audit log is refused, the sync succeeds and reports the warningsource.deletions-unchecked.src/testing/fake-documents.ts:trash()works as Linear does: it sets trashed and archived, keepsupdatedAtand writes one audit entry.auditEntriesanswers only the source's own filter and variables and refuses anything else.refuseAudit()makes the audit log refuse the call.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
permission_error, which GraphQLFORBIDDENmaps 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.sync --rescan.Testing
vitest run: 620 passed.test:matrix:check,docs:check,typecheckandbiome checkpass. The 2 biome warnings are pre-existing ones about generated file size.deletionsentry makes both trash tests insrc/documents/source.test.tsfail. So they test the audit feed, not the listing's trashed flag.scripts/live.shthroughbin/liveagainst 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