docs(core): document enableCap contract; remove console dev-features guard#8802
Merged
simeng-li merged 2 commits intoMay 14, 2026
Conversation
COMPARE TO
|
| Name | Diff |
|---|---|
| .changeset/logs-enable-cap-docs.md | 📈 +360 Bytes |
| packages/console/src/components/AuditLogTable/index.tsx | 📈 +97 Bytes |
| packages/core/src/routes/hooks.openapi.json | 📈 +1.46 KB |
| packages/core/src/routes/log.openapi.json | 📈 +2.24 KB |
0743a15 to
d3b4d09
Compare
d3b4d09 to
f2d4efd
Compare
f2d4efd to
8f3fa15
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR finalizes the GA rollout for capped-count pagination on large audit-log datasets by (1) having Console always opt into enableCap=true for /api/logs, and (2) documenting the enableCap contract plus capped-mode headers/Link behavior in the core OpenAPI specs, with an accompanying changeset.
Changes:
- Console Audit Logs now always includes
enableCap=truewhen fetching/api/logs. - OpenAPI specs document
enableCap,Total-Number-Is-Capped, and capped-mode paginationLinksemantics for/api/logsand/api/hooks/{id}/recent-logs. - Adds a changeset entry for the release note/version bump.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/core/src/routes/log.openapi.json | Documents enableCap and capped pagination headers/Link behavior for /api/logs. |
| packages/core/src/routes/hooks.openapi.json | Mirrors the capped pagination documentation for hook recent logs. |
| packages/console/src/components/AuditLogTable/index.tsx | Removes dev-features gating so enableCap=true is always sent. |
| .changeset/logs-enable-cap-docs.md | Adds a changeset entry describing the rollout. |
Comments suppressed due to low confidence (3)
packages/core/src/routes/log.openapi.json:33
enableCapdescription mixes the 10,000 threshold with the10001saturation sentinel, which may confuse consumers about what value to expect inTotal-Number. Suggest clarifying that the cap threshold is 10,000 matching rows, and when exceeded the server returnsTotal-Number=10001as the sentinel and emitsTotal-Number-Is-Capped: true.
"name": "enableCap",
"in": "query",
"description": "When `true`, the underlying `count(*)` query short-circuits at 10,000 rows to avoid `statement_timeout` on tenants with very large log volumes. `Total-Number` then saturates at `10001` and `Total-Number-Is-Capped: true` is emitted; the `Link` header omits `rel=\"last\"` and `rel=\"next\"` because the real total is unknown. Default `false`; recommended `true` for any client whose tenant volume may exceed 10,000 matching logs."
}
packages/core/src/routes/log.openapi.json:45
- The
Total-Numberheader description implies counts are exact only whenenableCap=false, butenableCap=truestill returns an exact count when it does not hit the cap. Also, the “lower-bounded by 10,000” / “treat as ≥ 10,000” wording doesn’t match the actual sentinel value10001used when capped. Please update these descriptions to key off presence ofTotal-Number-Is-Cappedand reference10001consistently.
"Total-Number": {
"description": "Exact match count when `enableCap=false`; lower-bounded by 10,000 when `enableCap=true` and the cap is hit. Inspect `Total-Number-Is-Capped` to distinguish.",
"schema": { "type": "integer" }
},
"Total-Number-Is-Capped": {
"description": "Present and set to `true` only when `enableCap=true` and the count saturated at the cap. Consumers should treat `Total-Number` as `≥ 10,000` when this header is present.",
"schema": { "type": "string", "enum": ["true"] }
packages/core/src/routes/hooks.openapi.json:154
- Similar to
/api/logs:Total-Numberis still exact whenenableCap=trueand the cap is not hit, so the current header description is misleading. Also, “lower-bounded by 10,000” doesn’t match the10001sentinel used when capped. Recommend describingTotal-Numberas exact unlessTotal-Number-Is-Cappedis present, and referencing10001consistently for the capped sentinel value.
"Total-Number": {
"description": "Exact match count when `enableCap=false`; lower-bounded by 10,000 when `enableCap=true` and the cap is hit.",
"schema": { "type": "integer" }
},
"Total-Number-Is-Capped": {
"description": "Present and set to `true` only when `enableCap=true` and the count saturated at the cap.",
"schema": { "type": "string", "enum": ["true"] }
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c4e6b04 to
f6e563a
Compare
8f3fa15 to
e437e40
Compare
e437e40 to
15a13f0
Compare
f6e563a to
8eb031a
Compare
15a13f0 to
01d6db4
Compare
8eb031a to
6ec18b6
Compare
01d6db4 to
fc5b21b
Compare
6ec18b6 to
4fe126d
Compare
fc5b21b to
1700915
Compare
4 tasks
4fe126d to
57b7eae
Compare
1700915 to
149c016
Compare
Base automatically changed from
simeng-log-13417-console-adopt-enablecaptrue-on-the-audit-logs-page-to-render
to
master
May 13, 2026 08:11
…guard
Updates the OpenAPI specs for `GET /api/logs` and
`GET /api/hooks/{id}/recent-logs` to document the `enableCap` query
parameter, `Total-Number-Is-Capped` response header, and the capped-mode
`Link` rel behavior introduced in LOG-13415.
Also removes the `isDevFeaturesEnabled` gate on the Console Audit Logs
page so capped mode is the production default — the backend (#8796) and
console UI (#8799) have both validated.
Refs LOG-13434
149c016 to
1c81ceb
Compare
update changeset
charIeszhao
approved these changes
May 14, 2026
gao-sun
approved these changes
May 14, 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 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.
Summary
Refs LOG-13434. Stacked on top of #8799.
This is the GA step for the audit-logs count-cap work. The runtime behavior shipped in #8796 (backend) and #8799 (console behind
isDevFeaturesEnabled); this PR:?enableCap=truetoGET /api/logsin production.enableCapquery param,Total-Number-Is-Cappedresponse header, and the capped-modeLinkrel behavior in the OpenAPI specs.@logto/corechange.What changed
packages/console/src/components/AuditLogTable/index.tsx— drops theisDevFeaturesEnabledimport and the...conditional(isDevFeaturesEnabled && { enableCap: 'true' })spread. The URL builder now always includesenableCap: 'true'.packages/core/src/routes/log.openapi.json—/api/logs: adds theenableCapquery parameter, documentsTotal-Number,Total-Number-Is-Capped, andLinkresponse headers, and adds a "Pagination on large result sets" subsection to the endpoint description.packages/core/src/routes/hooks.openapi.json—/api/hooks/{id}/recent-logs: same set of doc additions, with a one-liner noting that this endpoint is already scoped to one hook over the last 24h so the cap rarely triggers in practice..changeset/logs-enable-cap-docs.md—@logto/core: patchnoting the OpenAPI updates.Backward compatibility
enableCapsemantics shipped in feat(core): add enableCap query param to bound countLogs scan #8796).GET /api/logs(noenableCap) still returns the exact count. Existing third-party clients are unaffected.statement_timeout. Smaller tenants see no visible change.Reviewer notes
Total-Number-Is-Cappedheader schema is{ "type": "string", "enum": ["true"] }— the header is only present when the count is capped, and its value is always the literal string"true". Absent otherwise.masteronce those merge.Testing
Tested locally
Checklist
.changeset