Skip to content

Add canopy browse get handler - #22

Merged
noha merged 4 commits into
mainfrom
add-canopy-browse-get-handler
Jul 23, 2026
Merged

Add canopy browse get handler#22
noha merged 4 commits into
mainfrom
add-canopy-browse-get-handler

Conversation

@noha

@noha noha commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

No description provided.

noha and others added 4 commits July 23, 2026 17:47
Second of two planned HTTP endpoints (Canopy roadmap, HTTP Browse & Edit
Handler): a CanopyVisitor that serialises any node (branch or leaf) to JSON,
needed for the upcoming GET browse handler.

Required a small prerequisite fix: acceptCanopy: never returned the visitor's
result (missing ^), which the stream-based CanopyPrometheusVisitor never
needed but a value-building visitor does. Also added the previously-missing
acceptCanopy: for CanopyCell/CanopyDictionaryAccessor - both leaf types could
not be visited at all before (doesNotUnderstand), since only CanopyAccessor/
CanopyBranchNode implemented it. Both changes are behaviour-preserving for
existing visitors (Canopy-Metrics-Tests: 12/12 still green).

Write-only accessors (no readSelector) serialise as JSON null rather than
being omitted, unlike the Prometheus visitor - a browse client should still
see the leaf exists.

CanopyMetricGroup/CanopyMetricMap (Canopy-Metrics) are not yet covered by
this visitor - out of scope here to avoid a Core->Metrics dependency; can be
added later as a Canopy-Metrics extension method if the browse endpoint ever
needs to expose metrics domains too.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Third of the planned HTTP endpoints (Canopy roadmap, HTTP Browse & Edit
Handler): a plain Zinc handleRequest: handler (no HOP dependency, mountable
anywhere per the earlier scoping) that walks a Canopy tree by request path
segments (GET /domain/key1/key2) and returns the resolved node via
CanopyJsonVisitor. Empty path browses the whole root.

404 on an unknown key or on continuing past a leaf (CanopyLeafNode has no /),
405 on non-GET - PUT support (2.2, single value or JSON-object branch write)
follows in a separate PR on the same class.

root defaults to Canopy instance but is overridable, so a handler instance can
browse an arbitrary subtree without touching the global singleton.

Stacked on add-canopy-json-visitor (needs CanopyJsonVisitor from that PR) -
merge that one first.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
NeoJSON isn't loaded/available in the target image - STON already is and
ships an explicit JSON-compatibility mode (STON toJsonString:) that produces
byte-identical output to what NeoJSONWriter produced for all our cases
(plain Dictionary/String/Number/Boolean/nil - no STON-specific class tags
involved here). No test changes needed, Canopy-Core-Tests: 60/60 still green.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@noha
noha merged commit 7b97a2a into main Jul 23, 2026
4 checks passed
@noha
noha deleted the add-canopy-browse-get-handler branch July 27, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant