Sync with upstream/main#10
Closed
asabirov wants to merge 15 commits into
Closed
Conversation
Move core logic into a separate BearCLICore library target so it can be imported by tests. Add initial test suite (18 tests) covering models, cache operations, and codable round-trips. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract BearCLICore library and add test infrastructure
CloudKit's records/lookup endpoint can return records without a "fields" key (e.g. not-found or deleted records), causing a keyNotFound decoding error. This adds a custom Decodable init that defaults fields to an empty dictionary, and filters out fieldless records from lookupRecords so the get command correctly falls through to uniqueIdentifier search. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rd-lookup Fix crash when CloudKit returns records without fields
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Swift's padding(toLength:) truncates strings longer than the target length. CloudKit record names can exceed 36 characters, so the hardcoded 38-column width was silently chopping IDs. Compute the column width dynamically from the actual data instead.
Fix truncated record IDs in table output
The modified record-level metadata was passing through the old timestamp from the original record, causing CloudKit to not recognize the update. Now uses the current timestamp for the modified metadata in both updateNote() and trashNote(). Also bumps version to 0.3.3.
Fix modification date not updating after note edit
Two issues prevented Bear from recognizing edits made via the CLI: 1. Vector clock was being replaced instead of updated - incrementVectorClock created a new clock with only "Bear CLI", discarding all other device entries. Bear uses the vector clock to track changes across devices, so losing entries caused it to misinterpret the update. Now uses PropertyListSerialization to properly parse, preserve all device entries, and only increment the "Bear CLI" counter. 2. Text asset field not cleared on edit - when a note stored its content as an external asset (text field with downloadURL), the CLI wrote new content to textADP but left the old asset reference intact. Bear may read from the asset instead of textADP. Now explicitly sets text to null on update. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix Bear app not detecting note changes from CLI
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
69fa951 to
f30f551
Compare
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.
Summary
Sync fork with latest upstream/main. Upstream changes win all conflicts.
Upstream commits
e5fd86aMerge test infrastructurec843a47Extract BearCLICore libraryd32b64cFix edit sync with version/uniqueIdentifier fields and vector clock preservation