docs(rest): pagination total count (Prefer: count=) and exactCount option - #623
Conversation
There was a problem hiding this comment.
Code Review
This pull request documents the new pagination and total count feature introduced in version 5.3.0, including updates to headers, configuration options, and querying guides. The review feedback focuses on improving technical accuracy and consistency, specifically by clarifying the description of the Prefer header, using the correct =ct= operator notation, and correcting references to global configuration rather than per-mount settings.
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-623 This preview will update automatically when you push new commits. |
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-623 This preview will update automatically when you push new commits. |
Addresses review feedback on #623: - Drop the confusing/inaccurate "per REST mount" / "on a given mount" scope wording for exactCount. It is not a global setting — it is read only from a component's `rest:` config (server/REST.ts), so describe it as configured "in an application's REST configuration" rather than a mount or a global option. - Refer to the header as the `Prefer` request header (`Prefer: count=exact`). - Use the `=ct=` operator spelling for the contains example, matching the operators table. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-623 This preview will update automatically when you push new commits. |
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-623 This preview will update automatically when you push new commits. |
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-623 This preview will update automatically when you push new commits. |
|
Now that the companion merged, @cb1kenobi can you fix the merge conflicts? |
kriszyp
left a comment
There was a problem hiding this comment.
Cool, a few minor comments, but looks good.
🤖 Reviewed with Codex
…tion Documents the REST pagination total-count feature shipping in Harper v5.3.0: - reference/rest/querying.md: new "Pagination and Total Count" section covering Prefer: count=exact|estimated, the Content-Range / Range-Unit / Preference-Applied response headers, the unavailable-total (.../*) case, HEAD pre-flight, CORS exposure, and disabling exact counts per mount. - reference/rest/overview.md: adds the `exactCount` rest-mount option. - reference/rest/headers.md: adds the Prefer request header and notes the count response headers. Version badges assume v5.3.0 (next minor after 5.2) — adjust if the feature lands in a different release. Pairs with the harper core branch feat/rest-pagination-total-count. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A count request without a limit() is served normally with no count headers (the core feature falls through to streaming rather than counting the whole collection). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Addresses review feedback on #623: - Drop the confusing/inaccurate "per REST mount" / "on a given mount" scope wording for exactCount. It is not a global setting — it is read only from a component's `rest:` config (server/REST.ts), so describe it as configured "in an application's REST configuration" rather than a mount or a global option. - Refer to the header as the `Prefer` request header (`Prefer: count=exact`). - Use the `=ct=` operator spelling for the contains example, matching the operators table. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…d limit
Follows the harper #2147 review outcome: exact counting is now off by default and
enabled per mount with `rest: { exactCount: true }`; count=exact is otherwise served
as an estimate. Also note that counting applies to GET/HEAD only and requires a
limit() within a supported page size.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Dawson Toth <dawson@harperdb.io>
- Document the count page-size bounds (limit ≤ 10,000, window ≤ 1,000,000) and name the exact-scan guardrail (1M-row / ~1s budget) that yields an unavailable total. - Frame HEAD + count=exact as bandwidth-saving, not a low-cost counting shortcut (still scans the matched set). - Clarify estimated counts don't require exactCount, and their total can still be unavailable (*). - Scope exactCount to the REST interface rather than a per-mount setting. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0cc334f to
28bd76e
Compare
|
Rebased on Conflicts — three files, all keep-both:
Review feedback addressed:
Verification: 🤖 Generated by Claude (Opus 4.8) |
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-623 This preview will update automatically when you push new commits. |
🧹 Preview CleanupThe preview deployment for this PR has been removed. |
Documents the REST pagination total-count feature — companion to harper HarperFast/harper#2147.
Changes
Prefer: count=exact|estimated, theContent-Range/Range-Unit/Preference-Appliedresponse headers, the unavailable-total (.../*) case,HEADpre-flight, CORS exposure, and disabling exact counts per mount.exactCountoption to therest:config block.Preferrequest header and notes the count response headers.Version
Version badges assume v5.3.0 (next minor after 5.2). If the feature lands in a different release, it's a find/replace of
v5.3.0across the three files.Verification
npm run format:write+format:check— clean.npm run build— passes (onBrokenLinks: throw); new cross-links/anchors resolve. The only broken-anchor warnings are pre-existing pages, not these.🤖 Generated with Claude Code