Repository navigation
feat(api): opt-in cursor pagination and truncation metadata (API-01), 3.6.0 - #182
Merged
Merged
Conversation
API-01: templates, recipes and weight entries keep their capped bare-array bodies for requests without page parameters, announce a bite only via x-result-limit/count/truncated headers, and gain an opt-in { items, nextCursor } envelope that walks a stable keyset bound to the authenticated user.
/stats keeps its full-history aggregates and body, reporting x-daily-totals-* and x-smoothed-weight-trend-* when the newest-1000-row chart windows truncate. Internal session RPCs keep the legacy array builders.
Describe the opt-in limit/cursor envelope and truncation headers in the API docs table and page, pin the checked-in OpenAPI parameters and headers in the parity test, and cover legacy-array compatibility, page walking, invalid parameters, cross-user cursors and header presence through the API proxy. Bump @macro-tracker/web and APP_VERSION to 3.6.0. Review fix: allowlist docs example bearer tokens (mtk_v1_your_token placeholder, audit triaged) via inline gitleaks:allow and .gitleaksignore so the docs publish without tripping the secrets gate. No behavior change.
Merge resolution for pagination + DATA184: stats_page_data_json now returns StatsPageData (data + window counts) for pagination metadata. Update data_integrity zero-calorie test to read stats.data. No DATA logic changed; pagination metadata still derives from daily.
…ion-staging # Conflicts: # apps/web/lib/api-v1-openapi.ts # apps/web/tests/unit/openapi-parity.test.ts
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.
Independent pagination review and staging integration for API-01 (user-approved 3.6.0).
HOLD MERGE pending DATA and API contract PRs. Parent resumes after prerequisite merges, then merges latest staging semantically and reruns combined tests/CI before normal merge/Railway. No force/admin bypass/main/production.
Owned commits (cherry-picked from feat/audit-api-pagination, rebased on origin/staging 6a2146a):
Scope: backwards-compatible default bare arrays, truthful x-result/x-daily-totals/x-smoothed-weight-trend headers with CORS exposure, bounded keyset limit 1-1000, owner-bound cursors, deterministic ties, complete enumeration, unchanged internal RPC, stats windows that do not hide DATA-03, additive OpenAPI.
Checks (disposable DB macro_tracker_pagination_review_test on 127.0.0.1:55446, never user DB; backend on 127.0.0.1:41447 hidden with finally cleanup):
Dependencies: requires DATA-03 (stats eaten-day fix, goal-hit denominator) and API-02/03 contract PRs to land first or together; OpenAPI date/uuid/format and leaderboard changes are disjoint but must be re-applied on merge. Stats metadata derives from daily/weight counts and follows DATA-03 automatically.
See pr-pagination.md for full findings/PR/checks/dependencies.