Repository navigation
Description
Task
Rename the internal SystemTypeUris constant in formats/constants.ts to SYSTEM_TYPE_RECOGNITION_VALUES to eliminate the name collision with the public SystemTypeUris in model.ts.
Finding Reference: D-1 from CSAPI-CODE-AUDIT-PHASE-6.md, investigated in F70 Design Findings Investigation
Severity: Moderate
Category: Naming collision / API-surface ambiguity
Implementation Branch: phase-6
Problem Statement
Two different modules export the same symbol name SystemTypeUris with different values:
model.ts(line ~81): 5 entries — full URI forms only (http://www.w3.org/ns/sosa/Sensor, etc.)formats/constants.ts(line ~120): 10 entries — both CURIE forms (sosa:Sensor) AND full URI forms
The barrel file (csapi/index.ts) only re-exports the model.ts version, so the collision is not consumer-facing today. However, the identical naming creates maintainer confusion and is a latent hazard if the barrel ever changes.
Evidence:
// model.ts — 5 entries, full URIs only (PUBLIC via barrel)
export const SystemTypeUris = [
'http://www.w3.org/ns/sosa/Sensor',
'http://www.w3.org/ns/sosa/Actuator',
'http://www.w3.org/ns/sosa/Platform',
'http://www.w3.org/ns/sosa/Sampler',
'http://www.w3.org/ns/sosa/System',
] as const;
// constants.ts — 10 entries, CURIEs + full URIs (INTERNAL only)
export const SystemTypeUris = [
'sosa:Sensor', 'http://www.w3.org/ns/sosa/Sensor',
'sosa:Platform', 'http://www.w3.org/ns/sosa/Platform',
// ... 6 more
] as const;Impact: Maintainer confusion — two SystemTypeUris with different values/purposes. Latent consumer-facing risk if barrel exports change. Code audit Priority 2 (#4).
Files to Create or Modify
| File | Action | Est. Lines | Purpose |
|---|---|---|---|
src/ogc-api/csapi/formats/constants.ts |
Modify | ~5 changed | Rename SystemTypeUris → SYSTEM_TYPE_RECOGNITION_VALUES and SystemTypeUri → SystemTypeRecognitionValue |
Internal consumers of SystemTypeUris from constants.ts |
Modify | ~2-5 per file | Update import references |
Proposed Fix
Rename the internal constant in constants.ts:
// Before
export const SystemTypeUris = ['sosa:Sensor', 'http://...', ...] as const;
export type SystemTypeUri = (typeof SystemTypeUris)[number];
// After
export const SYSTEM_TYPE_RECOGNITION_VALUES = ['sosa:Sensor', 'http://...', ...] as const;
export type SystemTypeRecognitionValue = (typeof SYSTEM_TYPE_RECOGNITION_VALUES)[number];Then update all internal import sites (grep for SystemTypeUris in formats/ to find them — likely geojson.ts, classification.ts, or similar).
Why this approach:
- Zero public API change — the barrel export stays
SystemTypeUrisfrommodel.ts - Self-documenting —
SYSTEM_TYPE_RECOGNITION_VALUEScommunicates "matching table, not canonical type set" SCREAMING_CASEconvention signals module-internal constant (consistent withSIMPLE_COMPONENT_TYPES,CSAPI_CONTENT_TYPESalready inconstants.ts)model.tsand the public barrel are untouched
Scope — What NOT to Touch
- ❌ Do NOT modify
model.ts— itsSystemTypeUrisis the public API and is correct - ❌ Do NOT modify
csapi/index.ts(the barrel) — the public re-export is unaffected - ❌ Do NOT consolidate the two into a single definition — they serve different purposes (public type discrimination vs internal parsing recognition)
- ❌ Do NOT modify files outside the
formats/directory tree - ❌ Do NOT change any CSAPI business logic — this is a rename only
Acceptance Criteria
-
constants.tsno longer exportsSystemTypeUris— renamed toSYSTEM_TYPE_RECOGNITION_VALUES - All internal import sites updated — zero TypeScript compilation errors (
npx tsc --noEmit) - The public barrel (
csapi/index.ts) still exportsSystemTypeUrisfrommodel.ts— no change - Existing tests still pass (
npm run test:browser) - No lint errors (
npm run lint) - All modified files pass
npx prettier --check -
git grep 'SystemTypeUris' src/ogc-api/csapi/formats/returns 0 matches (old name fully eliminated fromformats/)
Dependencies
Blocked by: Nothing
Blocks: Nothing
Operational Constraints
⚠️ MANDATORY: Before starting work on this issue, reviewdocs/governance/AI_OPERATIONAL_CONSTRAINTS.mdand the CSAPI Code Audit.
Key constraints:
- Precedence: OGC specifications → AI Collaboration Agreement → This issue description → Existing code → Conversational context
- No scope expansion: Rename the collision, nothing more
- Minimal diffs: Only rename + update import references
- Zero business logic changes: The recognition logic is unchanged — only the symbol name changes
References
| # | Document | What It Provides |
|---|---|---|
| 1 | CSAPI Code Audit — D-1 | Finding definition and recommendation |
| 2 | F70 Investigation Report | Fact-check and evidence for D-1 |
| 3 | D-1/D-3/D-4 Fix Recommendations | Detailed fix approach |
| 4 | src/ogc-api/csapi/formats/constants.ts |
File containing the collision |
Activity
docs: add D-1/D-3/D-4 fix recommendations and update issue template
Sam-Bolling commentedon Feb 25, 2026
Provenance Analysis: The
constants.tsSystemTypeUrisWas Deliberately EngineeredFollow-up research reveals that the content of the
constants.tsSystemTypeUris(both CURIE and full URI forms) was a deliberate engineering response to real server behavior differences discovered during live testing — not an accidental duplication. The name collision withmodel.tswas the accident; the dual-form content was intentional.Evidence Chain
1. Live server testing proved both URI forms exist in the wild
Smoke Test #10 (Phase 3.1,
live-server-smoke-test-post-phase-3.1.md) — Vocabulary Inventory:featureTypeformhttp://www.w3.org/ns/sosa/Sensorsosa:Sensor(CURIE) for procedures,http://www.w3.org/ns/sosa/Deployment(full URI) for deploymentsFinding F44 documented this explicitly: "52North uses both CURIE and full URI forms... The handler's
toSosaLocalName()function correctly handles both forms."2. The
constants.tsversion was created specifically to satisfy this needIssue #29 (Phase 3, "Format Constants") specified both forms:
The JSDoc on
constants.tsitself states: "CSAPIfeatureTypevalues use either the full URI form or the compact CURIE prefix form. Both are equivalent."3. The timeline explains the collision
model.tsdefinedSystemTypeUriswith 5 full URIs — the canonical OGC spec values for the public type system.constants.tswas created with 10 entries (CURIEs + full URIs) as an internal recognition vocabulary. Same name was used without noticing the collision.4. The actual classification logic uses neither array directly
geojson.tsuses a more robusttoSosaLocalName()function that strips namespace prefixes, handling both forms inherently — matching against local name sets likeSet(['System', 'Sensor', ...]). NeitherSystemTypeUrisarray feeds directly into classification.Implications for This Issue
The rename approach in this issue is still correct:
constants.tsarray serves a real purpose (internal recognition vocabulary for both CURIE and full URI forms)SYSTEM_TYPE_RECOGNITION_VALUESto reflect its actual purposeThis provenance context should be preserved so future implementers understand why two arrays with overlapping values exist — the content divergence is by design, only the naming collision is technical debt.
Cross-References
featureType vocabulary | Full URIs | Mixed: null / CURIEs / full URIsfeatureType: nullworkaroundrefactor(D-1): rename SystemTypeUris in constants.ts to SYSTEM_TYPE_R…
docs: update research strategy to v2 with boundary conditions and ext…
docs(phase-6): add scope alignment review and implementation scope gates
docs: complete Research Plan 02 findings — EDR vs CSAPI Integration P…
docs(phase-6): add P6 contribution goal and definition
docs: add deferred issues Phase 6 scope assessment
feat: add intro description above connection diagram\n\nDescribes CSA…
docs: full-scope contribution review — PR #136 readiness gate
docs(phase-8): add P8-contribution-goal-and-definition.md (trio doc 1…
docs(phase-8): add P8-ROADMAP.md (trio doc 3 of 3)
docs(phase-8): finding 017 - URL-builder framing in module docs (Task…
refactor(csapi): rename DataStream -> Datastream throughout module (B…
Merge upstream/phase-8 into csapi-explorer
research(phase-9): rework COAs around actual donation workflow
research(phase-9): rewrite Courses of Action in plain English