fix(progress): return the document in /syncs/progress/:document#18
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ChangesProgress response
Estimated code review effort: 1 (Trivial) | ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
nperez0111
left a comment
There was a problem hiding this comment.
Thanks, does look like I missed this from the reference implementation. I think I went off an OpenAPI spec of it, but I can't be bothered to find the link for it now
document in /syncs/progress/:document
|
no worries and thanks for picking it up in main! |
The bug
GET /syncs/progress/:documentnever returns adocumentfield.The handler in
src/index.tsxselects only five columns:and returns that row verbatim (
return c.json(progress)). The reference KOReader syncserver includes
documentin its progress response; this server does not.Why it matters
Readest validated a pulled progress payload on the presence of
data.document:Against this server that turns a perfectly valid
200intonull. Readest then treatsthe pull as "nothing to apply", marks the book as synced, and ~5s later auto-pushes its
own older local position over the newer remote one. A silent pull failure that also
arms an overwrite — the reading position from the other device is destroyed, whatever
sync strategy the user picked.
Two independent reports, both traced back to this server:
Readest has since worked around it client-side (readest/readest#5090, merged), but the
response remains non-conformant with the reference API and other kosync clients can trip
over the same thing.
The fix
Backfill
documentfrom the path parameter, which is already in scope. No SQL change,no schema change, no migration. The
404/{"status":"not found"}branch is untouched.Testing
Verified against a self-hosted instance (Docker, SQLite) with KOReader on a Kindle
Paperwhite and Readest 0.11.18 on iOS sharing one account:
GET /syncs/progress/<hash>now returnsdocumentalongsideprogress,percentage,device,device_id,timestampoverwriting the server with its own stale position
Summary by CodeRabbit