Skip to content

Sync with upstream/main#10

Closed
asabirov wants to merge 15 commits into
mainfrom
sync/upstream-main
Closed

Sync with upstream/main#10
asabirov wants to merge 15 commits into
mainfrom
sync/upstream-main

Conversation

@asabirov
Copy link
Copy Markdown
Owner

@asabirov asabirov commented Apr 8, 2026

Summary

Sync fork with latest upstream/main. Upstream changes win all conflicts.

Upstream commits

  • e5fd86a Merge test infrastructure
  • c843a47 Extract BearCLICore library
  • d32b64c Fix edit sync with version/uniqueIdentifier fields and vector clock preservation

asabirov and others added 15 commits March 28, 2026 16:04
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>
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