Skip to content

fix(api): close the Notes API gaps that break Iotas - #29

Merged
gnacho merged 1 commit into
mainfrom
fix/issue-28-iotas-compat
Sep 13, 2026
Merged

gnacho merged 1 commit into
mainfrom
fix/issue-28-iotas-compat

Conversation

@gnacho

@gnacho gnacho commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Closes #28.

Reviewing the Iotas client (the GNOME app this backend targets) against the deployment found four mismatches, all verified with its exact requests.

Capabilities answered XML only, while Iotas asks for JSON (Accept: application/json) and parses the body, so it reported the Notes app as missing. It now returns JSON when the client asks for it, with api_version as a JSON array, keeping XML as the default.

favorite was only accepted as a boolean, while Iotas always sends 1|0 in PUT /notes/{id}, which failed with 400 invalid json. It now accepts a boolean or 0/1.

readonly was never returned: the list is built by hand and the single-note responses omitted it when false. Iotas reads the key directly, so it raised KeyError. It is now always present.

pruneBefore omitted the unchanged notes instead of returning {"id":N} stubs, so the recently modified notes disappeared from the response. Iotas computes remote deletions as local ids - response ids, marks those as locally deleted and deletes them on the server, so the notes edited since the last sync would have been lost on the second sync. The store no longer filters, the handler emits stubs, and Last-Modified now reflects the newest note instead of the current time.

Verification:

  • go build ./..., go vet ./... and go test -race ./... pass, with new handler tests covering JSON/XML capabilities, favorite as 1/0/true/absent, a mismatched If-Match returning 412, readonly presence and the pruneBefore stubs plus Last-Modified
  • Reproduced Iotas exact requests against the deployment: capabilities parse as JSON, PUT favorite=1 answers 200, readonly is present in list and single-note responses, and with pruneBefore every id is returned (old ones as stubs, the newest in full) so the client remote-deletion set is empty

Reviewing the Iotas client against the deployment found four mismatches.

Capabilities answered XML only, while Iotas asks for JSON and parses it, so it
reported the Notes app as missing. It now returns JSON when the client asks for
it (Accept: application/json or format=json), keeping XML as the default.

PUT /notes/{id} only accepted a boolean favorite, while Iotas sends 1|0, which
failed with 400. It now accepts a boolean or 0/1.

readonly was never returned: the list is built by hand and the single-note
responses omitted it when false. Iotas reads it directly, so it raised
KeyError. It is now always present.

pruneBefore omitted the unchanged notes instead of returning {"id":N} stubs,
so the recently modified notes disappeared from the response. Iotas treats
missing ids as remote deletions and deletes them on the server, so the notes
edited since the last sync would have been lost on the second sync. The store
no longer filters, the handler emits stubs, and Last-Modified now reflects the
newest note instead of the current time.

Closes #28
@gnacho
gnacho merged commit e7704cf into main Sep 13, 2026
@gnacho
gnacho deleted the fix/issue-28-iotas-compat branch September 13, 2026 11:53
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.

Fix the Notes API compatibility gaps that break Iotas

1 participant