Repository navigation
Description
Phase 8 Task
Task ID: A4
Title: Issue #167 — Pagination-Contract JSDoc on List Methods
Source: Repo issue #167
Severity: P3-Minor
Category: Documentation / API Design
Ownership: Ours (CSAPI module — csapi/url_builder.ts)
Phase 8 phase: A — Documentation & Type-Hardening
Goal
Every list method on CSAPIQueryBuilder carries JSDoc that explicitly documents the pagination contract: server picks the default page size, and the consumer follows next HATEOAS links to retrieve subsequent pages. A centralized "Pagination" doc anchor on the module/class docblock is the single source of truth; per-method @remarks blocks point at it.
Acceptance criterion (from P8-contribution-goal-and-definition.md): B2 — pagination contract documented on every list method.
Locked Decision
⚠️ This decision is locked. Do not re-litigate in this issue. Surface deviations to the user; do not silently re-decide.
Decision: Adopt the docs-only fix from issue #167 — add a centralized "Pagination" anchor in the csapi/url_builder.ts module/class docblock, plus a @remarks block on every list method that points at the anchor. Do NOT add an auto-pagination helper or async-iterator in Phase 8 — those are deferred to issue #170 and explicitly out of scope here.
The @remarks block must call out, in plain language, that:
- The server picks the default
limit(connected-systems-godefaults to 10; OpenSensorHub defaults to 100 — concrete servers cited). - The consumer must follow
rel: "next"HATEOAS links to retrieve subsequent pages. - A future async-iterator helper is deferred (cite Future-enhancement (deferred): async-iterator helpers for paginated CSAPI list methods — out-of-scope until upstream broadens scope #170 by URL).
Locked in:
- P8-contribution-goal-and-definition.md §3 — Phase 8 design rails
- P8-implementation-guide.md §3 — execution-level rails
- Issue #167 — authoritative finding
- Issue #170 — deferred enhancement that this task explicitly does NOT pre-empt
Problem Statement
connected-systems-go defaults to limit=10; OpenSensorHub defaults to limit=100. A consumer who only tested against the high-default server may silently process only the first page in production against a low-default server. The OGC API Common spec lets servers choose the default; the library's job is to make that contract impossible to miss in the JSDoc.
Affected code: src/ogc-api/csapi/url_builder.ts — every list method (getSystems, getDeployments, getProcedures, getSamplingFeatures, getDatastreams, getDatastreamObservations, getDatastreamSystems, getDatastreamProcedures, getDatastreamHistory, getSystemDatastreams, getSystemSubsystems, getProcedureDatastreams, getControlStreams, getCommands, getCommandStatus if it returns a list, getObservations if exposed) currently lacks the explicit pagination contract in its JSDoc.
Impact: Silent data loss in consumer code that processes only the first page. Pure DX/correctness-of-usage gap; no library-side runtime bug.
Files to Modify
| File | Action | Est. Lines | Purpose |
|---|---|---|---|
src/ogc-api/csapi/url_builder.ts |
Modify | ~80 | Class/module-level "Pagination" doc anchor + @remarks Pagination block on each list method (~16 methods) |
Cross-reference P8-implementation-guide §5.2 for the canonical files-modified list. If you find yourself adding a file that isn't in the implementation guide, stop — surface the question.
Implementation Approach
Pull the canonical sketches from P8-implementation-guide §5.2.
Centralized "Pagination" anchor (class/module docblock in csapi/url_builder.ts):
/**
* ...
*
* ## Pagination
*
* All list methods (`get*` returning collection URLs) follow the
* [OGC API Common](https://docs.ogc.org/is/19-072/19-072.html#_pagination)
* pagination contract:
*
* - **The server chooses the default page size** if `limit` is unspecified.
* Defaults vary by implementation — `connected-systems-go` defaults to
* `limit=10`; OpenSensorHub defaults to `limit=100`. Code that processes
* only the first response may silently lose data on low-default servers.
*
* - **The server returns `next` HATEOAS links** in the response body's
* `links` array (`rel: "next"`) when more pages are available. The
* consumer is responsible for following them; this library does not
* auto-paginate.
*
* - **A future enhancement** (deferred — see issue
* [#170](https://github.com/OS4CSAPI/ogc-client-CSAPI_2/issues/170))
* may add an opt-in async-iterator / `followNext` helper. Until then,
* consumer code MUST follow `next` links explicitly to avoid data loss.
*
* ...
*/Per-method @remarks tag — apply verbatim shape to every list method:
/**
* Builds the URL for a paginated list of datastreams.
*
* @remarks
* **Pagination:** server picks the default `limit` if unspecified; the
* consumer must follow `next` HATEOAS links from the response body to
* retrieve subsequent pages. See the
* [Pagination section of this module's docs](#pagination).
*
* @param options - Optional query parameters (limit, bbox, datetime, etc.).
* @returns The fully-formed URL string.
*/
public getDatastreams(options?: DatastreamQueryOptions): string { ... }Sequencing note: A4 should be executed after Task B1 (the Datastream rename) so JSDoc bodies are written against the final method names. If A4 runs before B1, the JSDoc will be re-touched in B1; mechanically valid but creates churn. Either order works; post-B1 is recommended.
Test impact: none for behavior. An optional snapshot/lint test asserting every public list method's JSDoc matches /Pagination:.*next.*links/i MAY be added if it does not increase friction; otherwise skip.
Scope — What NOT to Touch
- ❌ Do NOT modify files outside the "Files to Modify" table above
- ❌ Do NOT add an auto-pagination helper, async-iterator, or
followNextmethod (deferred to Future-enhancement (deferred): async-iterator helpers for paginated CSAPI list methods — out-of-scope until upstream broadens scope #170 — explicitly rejected for Phase 8) - ❌ Do NOT change method signatures, return types, or runtime behavior — this is a docs-only task
- ❌ Do NOT add
@deprecatedtags anywhere in Phase 8 (locked decision; PR unmerged ⇒ no consumers) - ❌ Do NOT absorb consumer-side ergonomic helpers (Phase 8 hard scope fence; Closed (wontfix): library is spec-correct; server-side root cause tracked at connected-systems-go#11; institutional knowledge preserved in references.md #168 / Closed (wontfix): heuristic coordinate extraction not adopted; architecturally correct path tracked at #171 #169 stay closed wontfix)
- ❌ Do NOT re-open a Phase 8 deferred finding (020, 025, 026) or a deferred CS-Go issue (Future-enhancement (deferred): async-iterator helpers for paginated CSAPI list methods — out-of-scope until upstream broadens scope #170, Deferred enhancement: SWE Common–aware result-vector extraction (out-of-scope until upstream broadens scope) #171) inside this task
- ❌ Do NOT pre-emptively rename
getDataStreams→getDatastreamsoutside this task's JSDoc body — that's Task B1's job. (If A4 lands before B1, write the JSDoc against current method names; B1 will rename them in lockstep.) - ❌ Do NOT touch error-throwing patterns,
availableResourcestyping,CSAPICollectionRef, or factory shape — those are A2/A3/B2/D1
Acceptance Criteria
- Class- or module-level "Pagination" doc anchor added to
src/ogc-api/csapi/url_builder.tscovering: server-picks-default contract, concrete defaults (CS-Go=10, OSH=100),next-link-follow responsibility, deferred-helper note citing Future-enhancement (deferred): async-iterator helpers for paginated CSAPI list methods — out-of-scope until upstream broadens scope #170 - Every public list method on
CSAPIQueryBuildercarries a@remarksblock with the Pagination note pointing at the anchor (target: ~16 methods after Task B1's renames) - All
@remarksPagination blocks use consistent wording (template above) - No source code changes (signatures, runtime behavior, return types) — docs only
- All modified files pass
npx prettier --check -
npm run typecheckexits 0 -
npm run lintexits 0 -
npm run test:browserexits 0 -
npm run test:nodeexits 0
Acceptance Gate (verification command)
The Phase 8 roadmap defines a specific verification command for this task (P8-ROADMAP §Phase A Task A4). Paste the output of these commands on the issue before closing:
# 1. Manual review confirmation — paste a one-paragraph statement listing every
# list method touched and confirming each carries the @remarks Pagination
# block, plus citing the line range of the centralized anchor.
# 2. Spot-check via grep — every list method should have a Pagination remark.
git grep -n "Pagination:" -- src/ogc-api/csapi/url_builder.ts
# Expected: one match per list method + 1 anchor heading
# 3. Full upstream QA suite (must mirror .github/workflows/qa.yml)
npm run format:check
npm run typecheck
npm run lint
npm run test:browser
npm run test:nodeExpected output:
git grepreturns ≥ 16 matches (one per list method) plus the anchor section heading- All five upstream QA commands exit 0
- Manual review paragraph confirms uniform coverage + anchor presence
Dependencies
Mandatory. Walk the P8-ROADMAP dependency graph and fill in every applicable row.
Blocked by: Nothing hard. Soft dependency on Task B1 (the Datastream rename) — recommended sequencing is to run A4 after B1 so JSDoc bodies are written against final method names. Either order works mechanically; post-B1 placement avoids re-touching the same JSDoc blocks.
Blocks: Nothing directly
Related: Task B1 (the rename — see soft dependency above); Task A1 (the module docblock added there can cross-link to the Pagination anchor); Issue #170 (the deferred async-iterator helper that this task's "deferred enhancement" note must cite)
Roadmap dependency row: P8-ROADMAP §Phase A Task A4: "Effort: Small (~1.5 hours, mostly mechanical). Risk: None. Dependencies: Logically depends on Task B1 (the rename) for final method names, but the JSDoc bodies can be written first against the old names and renamed in lockstep with B1. Recommended to run A4 after B1 to avoid double-touching the same methods."
References
| # | Document | What It Provides |
|---|---|---|
| 1 | P8-contribution-goal-and-definition.md | Phase 8 goal, scope, acceptance criteria, locked decisions |
| 2 | P8-implementation-guide.md §5.2 | Authoritative execution-level guide (this task) |
| 3 | P8-ROADMAP.md §Phase A Task A4 | Task ordering, dependencies, acceptance gate |
| 4 | Issue #167 | Authoritative "why" for this task |
| 5 | Issue #170 | Deferred async-iterator enhancement — cited in the anchor |
| 6 | OGC API Common §Pagination | Spec authority for the contract |
| 7 | src/ogc-api/csapi/url_builder.ts |
Receives the anchor + per-method @remarks blocks |
Activity
Sam-Bolling commentedon Apr 29, 2026
Superseded by #167 — Phase 8 absorbed Task A4 in place per the P8-ROADMAP.md Roadmap Summary directive: "Existing issues #166 and #167 already cover Tasks 7 and Task A4 respectively — those issues should be referenced in the corresponding Phase 8 task issue rather than duplicated."
Filing this as a separate Phase 8 wrapper issue was a process error. Issue #167 has been retitled and its body merged with the Phase 8 Task A4 specification (original finding preserved verbatim below the separator). Closing as duplicate.
docs(phase-8): cross-reference GitHub issues #166-#181 in P8-ROADMAP