Repository navigation
Description
Task
Fix query parameter name serialization — buildQueryString() must remap 6 TypeScript property names to their OGC-spec wire names so that filters work on spec-compliant servers.
Finding Reference: Demo app finding from ogc-csapi-explorer#35 — currentStatus filter silently ignored by server
Severity: Moderate
Category: Code bug
Ownership: Ours
Findings Report: docs/testing/demo-app-findings/issue-105-query-parameter-name-mismatches.md
Problem Statement
buildQueryString() in url_builder.ts serializes TypeScript property names verbatim as URL query parameter names. Six property names in the QueryOptions interfaces don't match the parameter names defined in the OGC Connected Systems API specifications (OGC 23-001 §16 and OGC 23-002 §13). This causes silent filter failures on spec-compliant servers — the server ignores the unrecognized parameter and returns unfiltered results with HTTP 200 (no error indication).
Evidence:
The currentStatus filter was sent as ?currentStatus=PENDING but the spec (OGC 23-002 §13.5.3) requires ?statusCode=PENDING. The server returned HTTP 200 with unfiltered results — no error was raised.
| TypeScript Property | Current Wire Name | OGC Spec Wire Name | Spec Reference |
|---|---|---|---|
currentStatus |
?currentStatus=PENDING |
?statusCode=PENDING |
OGC 23-002 §13.5.3 |
foiId |
?foiId=x |
?foi=x |
OGC 23-001 §16.5.4 |
observedPropertyId |
?observedPropertyId=x |
?observedProperty=x |
OGC 23-001 §16.5.5 |
controlledPropertyId |
?controlledPropertyId=x |
?controlledProperty=x |
OGC 23-001 §16.5.6 |
systemId (DeploymentQueryOptions) |
?systemId=x |
?system=x |
OGC 23-001 §16.6.3 |
procedureId |
?procedureId=x |
?procedure=x |
OGC 23-001 §16.5.3 |
Note: systemId in DatastreamQueryOptions and ControlStreamQueryOptions is an OSH-specific extension parameter (not defined in the OGC spec) and is not included in this fix.
Impact: Silent data loss — all 6 filters are silently ignored on spec-compliant servers. Callers receive unfiltered results with no indication of failure.
Files to Create or Modify
| File | Action | Est. Lines | Purpose |
|---|---|---|---|
src/ogc-api/csapi/url_builder.ts |
Modify | ~12 | Add PARAM_NAME_MAP and apply remapping in buildQueryString() |
src/ogc-api/csapi/url_builder.spec.ts |
Modify | ~17 | Update expected URL strings in test assertions |
Proposed Fix
Add a static PARAM_NAME_MAP dictionary and apply it during query string serialization:
private static readonly PARAM_NAME_MAP: Readonly<Record<string, string>> = {
currentStatus: 'statusCode',
systemId: 'system',
observedPropertyId: 'observedProperty',
controlledPropertyId: 'controlledProperty',
foiId: 'foi',
procedureId: 'procedure',
};In buildQueryString(), resolve the wire name before appending:
const wireName = CSAPIQueryBuilder.PARAM_NAME_MAP[key] ?? key;
params.append(wireName, ...);Why not rename TypeScript properties? That would be a breaking API change for all library consumers. The remapping layer keeps the TypeScript API stable while fixing the wire format.
Scope — What NOT to Touch
- ❌ Do NOT rename TypeScript interface properties in
model.ts— that would be a breaking API change - ❌ Do NOT change model property names on parsed resource objects (
Command.currentStatus,DataStream.systemId, etc.) - ❌ Do NOT modify parser logic in
part1.ts,part2.ts, or their test files - ❌ Do NOT modify integration test fixtures or command/observation JSON fixtures
- ❌ Do NOT modify any method in
url_builder.tsbesidesbuildQueryString()(and adding the static map) - ❌ Do NOT modify existing method signatures or return types
- ❌ Do NOT address Issue Missing Part 2 query option fields: foi, controlStream, sender, issueTime on ControlStreams, CommandStatusQueryOptions #106 (missing query option fields) or Issue DX: 12 nested builder methods accept base QueryOptions instead of type-specific options #107 (nested builder method types) in this issue
Acceptance Criteria
-
PARAM_NAME_MAPstatic dictionary added toCSAPIQueryBuilderwith all 6 remappings -
buildQueryString()resolves wire names via the map beforeparams.append() - Test assertions in
url_builder.spec.tsupdated to expect corrected parameter names (~17 assertions) - All existing tests still pass (
npm test) - No lint errors
- TypeScript interface property names in
model.tsare unchanged - Model property names on parsed objects (
Command.currentStatus, etc.) are unchanged
Dependencies
Blocked by: Nothing
Blocks: #106 — Missing Part 2 query option fields (new params should use correct wire names from the start)
Operational Constraints
⚠️ MANDATORY: Before starting work on this issue, reviewdocs/governance/AI_OPERATIONAL_CONSTRAINTS.md.
Key constraints:
- Precedence: OGC specifications → AI Collaboration Agreement → This issue description → Existing code → Conversational context
- No scope expansion: Fix the 6 confirmed mismatches, nothing more
- Minimal diffs: Only
buildQueryString()logic changes + test assertion updates - No refactoring: Do not rename, restructure, or "improve" code outside this issue's scope
References
| # | Document | What It Provides |
|---|---|---|
| 1 | Findings Report — Issue #105 | Full analysis with complete parameter verification table |
| 2 | OGC 23-001 §16 — Advanced Filtering | Normative query parameter definitions for Systems, Deployments, Procedures, SamplingFeatures, Properties |
| 3 | OGC 23-002 §13 — Advanced Filtering | Normative query parameter definitions for DataStreams, Observations, ControlStreams, Commands, CommandStatus |
| 4 | docs/governance/AI_OPERATIONAL_CONSTRAINTS.md |
Mandatory operational constraints |
| 5 | ogc-csapi-explorer#35 | Demo app issue where filter failure was observed |
| 6 | src/ogc-api/csapi/url_builder.ts |
Code containing buildQueryString() |
Activity
docs: add findings report for Issue #105 query parameter name mismatc…
docs: add Phase 5.5 code review (Issues #99-#110 post-smoke-test)
fix: remap 6 query parameter names to OGC spec wire names (Fixes OS4C…
merge: sync with upstream ogc-client-CSAPI_2 (Phase 5.5/5.6)