Skip to content

DEFERRED — getCommandStatus() uses string concatenation instead of buildResourceUrl() for query string (F45) #111

@Sam-Bolling

Description

@Sam-Bolling

Task

Refactor getCommandStatus() to pass query options through buildResourceUrl() instead of concatenating buildQueryString() output, for consistency with all other builder methods.

Finding Reference: F45 from Phase 5.5 Code Review
Severity: Low
Category: Design gap (pattern deviation)
Ownership: Ours


Problem Statement

In url_builder.ts, getCommandStatus() appends the query string via manual concatenation rather than passing options to buildResourceUrl():

// Current (getCommandStatus — concatenation):
getCommandStatus(id: string, options?: CommandStatusQueryOptions): string {
  this.assertResourceAvailable('commands');
  return this.buildResourceUrl('commands', id, 'status') + this.buildQueryString(options);
}

All other methods pass options to buildResourceUrl() which internally calls buildQueryString():

// Established pattern (every other method):
getDataStreamObservations(id: string, options?: ObservationQueryOptions): string {
  this.assertResourceAvailable('datastreams');
  return this.buildResourceUrl('datastreams', id, 'observations', options);
}

Impact: Zero functional impact — both approaches produce identical URLs. The deviation is a pattern consistency concern. Both code paths use the same buildQueryString() method internally.

Files to Create or Modify

File Action Est. Lines Purpose
src/ogc-api/csapi/url_builder.ts Modify ~2 Change getCommandStatus() to pass options via buildResourceUrl()

Proposed Fix

Option A: Modify getCommandStatus() to pass options as the 4th argument to buildResourceUrl() — requires verifying that buildResourceUrl() handles options correctly for sub-resource-of-per-ID paths (commands/{id}/status).

Option B: Leave as-is — the concatenation is functionally correct and arguably more explicit about what's happening.

Recommended: Option B (leave as-is) — See deferral rationale below.

Scope — What NOT to Touch

  • ❌ Do NOT modify buildResourceUrl() internals
  • ❌ Do NOT modify any other builder method signatures
  • ❌ Do NOT modify files outside the "Files to Create or Modify" table above
  • ❌ Do NOT refactor existing code unless required to complete this task

Acceptance Criteria

  • getCommandStatus() produces identical URLs before and after the change
  • All 1282 existing CSAPI tests still pass
  • No lint errors
  • tsc --noEmit compiles cleanly

Dependencies

Blocked by: Nothing
Blocks: Nothing


Operational Constraints

⚠️ MANDATORY: Before starting work on this issue, review docs/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 pattern deviation, nothing more
  • Minimal diffs: Prefer the smallest change that satisfies the acceptance criteria

References

# Document What It Provides
1 Phase 5.5 Code Review Finding F45 description and context
2 src/ogc-api/csapi/url_builder.ts Affected source file — getCommandStatus() at line ~2330
3 src/ogc-api/csapi/url_builder.spec.ts Existing tests for getCommandStatus()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions