This repository was archived by the owner on Sep 23, 2026. It is now read-only.
Repository navigation
Support GitHub-shaped resources: array pagination, PATCH updates, configurable identity - #7
Merged
Merged
Conversation
…figurable identity Three changes a GitHub Issues client needs that the generic path didn't cover: - Paginated reads now treat a top-level-array response body as the page's items (mirroring the non-paginated path), instead of only looking inside an envelope — so a bare-array list with Link-header pagination collects items across pages instead of coming back empty. (#6) - Background updates send the method the item path declares: PUT when the path offers a put (replace), otherwise PATCH. GitHub exposes no PUT for issues or comments, so updates must be PATCH. Derived from the document at discovery time; PUT-declaring resources (e.g. Google Calendar) are unchanged. (#5) - A resource's identity field is configurable via `identityField` (default `id`), used for local storage keys, create reconciliation, and the item-URL path value. GitHub issues are addressed by `number`, not the global `id` the payload also carries. (#4) Adds a GitHub-shaped end-to-end test covering all three, plus discover tests for PUT/PATCH selection. Existing behaviour (id-keyed, PUT updates, enveloped lists) is unchanged; full suite green (103 tests), lint and prettier clean. Closes #4 Closes #5 Closes #6 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BdadF8jAvK2e8Fmis3hLJF
This was referenced Aug 18, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What
Three changes so a generic, document-driven client can sync a GitHub-shaped API (issues + comments), each closing one of the feature requests filed earlier. All are backward compatible — the existing
id-keyed, PUT-updating, enveloped-list behaviour is unchanged.1. Top-level-array list responses paginate correctly — closes #6
fetchAllItemsonly extracted items from an envelope when a scheme applied, so a bare-array response ([ {...}, {...} ]) collected zero items even while walkingLink-header pages. It now treats a top-level array body as the page's items, mirroring the non-paginated path. This is the shape of GitHub'sGET /…/issuesand…/comments.2. Updates use PUT or PATCH per the document — closes #5
attemptWritehardcodedPUT.ResourceRoutenow carries anupdateMethodderived at discovery time: PUT when the item path declares aput(replace), otherwise PATCH. GitHub exposes no PUT for issues/comments; Google Calendar (which declaresput) is unchanged.3. Configurable identity field — closes #4
New
identityFieldclient option (defaultid), used for local storage keys, create-response reconciliation, and the item-URL path value. GitHub issues are addressed bynumber, not the globalidin the payload. Reflector already derives this field from its crud-causality overlay and can now pass it through.Tests
__tests__/unit/client/github-shape.test.ts— a GitHub-shaped document + fakefetchproving: a bare-array list paginates across aLinkheader keyed bynumber; a create reconciles onto the server-assignednumber; an update is sent asPATCHand neverPUT.discovertests for PUT-vs-PATCH selection.Follow-on
Unblocks Reflector pointing its generic flow at GitHub issue trackers (localthought/reflector#23, #25, #27, #28). Reflector will bump its pinned
syncablesdependency to include this and passidentityFieldfrom the overlay's identity binding.🤖 Generated with Claude Code
https://claude.ai/code/session_01BdadF8jAvK2e8Fmis3hLJF
Generated by Claude Code