Skip to content

Phase 8 / Task A4: Issue #167 — Pagination-contract JSDoc on list methods #175

Closed as duplicate

Description

@Sam-Bolling

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:

  1. The server picks the default limit (connected-systems-go defaults to 10; OpenSensorHub defaults to 100 — concrete servers cited).
  2. The consumer must follow rel: "next" HATEOAS links to retrieve subsequent pages.
  3. 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:


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

Acceptance Criteria

  • Class- or module-level "Pagination" doc anchor added to src/ogc-api/csapi/url_builder.ts covering: 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 CSAPIQueryBuilder carries a @remarks block with the Pagination note pointing at the anchor (target: ~16 methods after Task B1's renames)
  • All @remarks Pagination 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 typecheck exits 0
  • npm run lint exits 0
  • npm run test:browser exits 0
  • npm run test:node exits 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:node

Expected output:

  • git grep returns ≥ 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

  1. Sam-Bolling commented on Apr 29, 2026

    @Sam-Bolling
    Author

    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.

  2. added a commit that references this issue on Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-designcode-reviewdocumentationlocked-decisionphase-8

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions