You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⚠️ This issue has been split into two parts for safe execution
Per the Phase 7 Scope & Split Assessment, this issue requires removing assertResourceAvailable() from 72 per-ID methods in a 2,490-line file. Doing 72 identical one-line deletions in a single pass risks dropped edits. The methods are grouped by resource type, providing natural split points.
This parent issue should be closed when both #156 and #157 are resolved.
Original issue body (preserved for reference)
Summary
Every public method in CSAPIQueryBuilder — including per-ID methods like getDataStream(id), getDataStreamSchema(id), and getControlStream(id) — calls assertResourceAvailable() before constructing the URL. This guard throws EndpointError if the resource type was not discovered as a top-level link during builder construction, even when the caller already has a valid resource ID and the URL pattern is completely deterministic.
This makes the URL builder unusable for Part 2 resources (datastreams, observations, controlStreams, commands) on servers that only advertise these types as nested paths under systems — which is the common case for OGC Connected Systems servers.
Observed Behavior
Server: OpenSensorHub at http://45.55.99.236:8080/sensorhub/api
The OSH server advertises datastreams only as nested links under /systems/{id}/datastreams, not as a top-level /datastreams endpoint. During builder construction, scanCsapiLinks() does not find datastreams as a top-level link, so availableResources does not include it.
// ❌ Throws EndpointError even though the URL would be perfectly valid:builder.getDataStreamSchema('03tbj7mvqg50')// EndpointError: Collection 'csapi-explorer' does not support 'datastreams' resource.// Available resources: systems, deployments, procedures, samplingFeatures, properties// The URL it WOULD construct is completely valid:// → /datastreams/03tbj7mvqg50/schema ← works fine when fetched directly
Root Cause
assertResourceAvailable() conflates two distinct concerns:
"Can I list all resources of this type?" — Requires a top-level collection endpoint. Guard is appropriate.
"Can I construct a URL for a specific resource by ID?" — The URL is deterministic from type + ID. Guard is inappropriate.
Scope of Impact
Of the 87 methods (updated count) that call assertResourceAvailable():
15 are collection/list methods (no ID parameter) — guard is reasonable
Per the Phase 7 Scope & Split Assessment, this issue requires removing
assertResourceAvailable()from 72 per-ID methods in a 2,490-line file. Doing 72 identical one-line deletions in a single pass risks dropped edits. The methods are grouped by resource type, providing natural split points.Split Issues
Execution Order
assertResourceAvailablefrom per-ID methods — Systems, Deployments, Procedures, SamplingFeatures (33 methods) #156 (Part 1) — remove asserts from Part 1 resource per-ID methodsassertResourceAvailablefrom per-ID methods — Properties, Datastreams, Observations, ControlStreams, Commands (39 methods) #157 (Part 2) — remove asserts from Part 2 resource + Properties per-ID methodsThis parent issue should be closed when both #156 and #157 are resolved.
Original issue body (preserved for reference)
Summary
Every public method in
CSAPIQueryBuilder— including per-ID methods likegetDataStream(id),getDataStreamSchema(id), andgetControlStream(id)— callsassertResourceAvailable()before constructing the URL. This guard throwsEndpointErrorif the resource type was not discovered as a top-level link during builder construction, even when the caller already has a valid resource ID and the URL pattern is completely deterministic.This makes the URL builder unusable for Part 2 resources (datastreams, observations, controlStreams, commands) on servers that only advertise these types as nested paths under systems — which is the common case for OGC Connected Systems servers.
Observed Behavior
Server: OpenSensorHub at
http://45.55.99.236:8080/sensorhub/apiThe OSH server advertises
datastreamsonly as nested links under/systems/{id}/datastreams, not as a top-level/datastreamsendpoint. During builder construction,scanCsapiLinks()does not finddatastreamsas a top-level link, soavailableResourcesdoes not include it.Root Cause
assertResourceAvailable()conflates two distinct concerns:Scope of Impact
Of the 87 methods (updated count) that call
assertResourceAvailable():