I have a complete picture now. Here is the full inventory report.
Pathland Web/SSR Path — Inventory & Gap List
1. The web client (app.js)
Copies found (both byte-for-byte identical, verified via diff):
/Users/michael/Development/michaelkrog/Pathland/lib/java/pathland-quarkus-demo/src/main/resources/META-INF/resources/app.js (289 lines)
/Users/michael/Development/michaelkrog/Pathland/lib/java/pathland-spring-boot-demo/src/main/resources/static/app.js (289 lines)
What it does (line numbers refer to the Quarkus copy; Spring copy is identical):
| Concern | Location | Detail |
|---|
| Hydration | app.js:26-29 | Builds byId = new Map() from all [data-pathland-id] elements in the SSR DOM. |
| PLPL batch decode | applyBatch() app.js:39-127 | Reads opcodeCount at header offset 12, walks 16-byte opcodes from offset 16, reads trailing string section; readString() app.js:32-37 decodes [u32 len][bytes]. |
| Delta application | app.js:54-125 | STYLE only — SET_TEXT (writes input[type=text] / textarea / .pathland-text span / element textContent), SET_DATE (writes input[type=date]), SET_PROPERTY for a fixed subset of props: LABEL, PROMPT, SELECTED, VALUE, SELECTION, COLOR_VALUE, BORDER_COLOR. TREE-category opcodes are silently ignored — no CREATE/DELETE/INSERT/REMOVE/MOVE handling; the client cannot apply structural tree mutations. |
| Event senders | encodeEvent() app.js:144-159, encodePointerUp :201, encodeValueChanged :162, encodeValueBits :168, encodeDateChanged :173, encodeTextChanged :179 | Each builds a single-event HOST_TO_GUEST PLPL batch (magic 0x504c504c, version 1, flag 1). |
| DOM listeners | click app.js:211-234 (buttons → POINTER_UP; stepper +/− → VALUE_CHANGED with clamped next value), change :238-266 (toggle → VALUE_CHANGED 0/1, select → VALUE_CHANGED index, color → VALUE_CHANGED packed ARGB, date → DATE_CHANGED days), input :270-290 (range → VALUE_CHANGED, textarea/text → TEXT_CHANGED). | |
| WebSocket | app.js:205-207 | const ws = new WebSocket(\ws://${location.host}/ws`); ws.binaryType = "arraybuffer"; ws.onmessage = (event) => applyBatch(...)`. |
Reconnection / heartbeat / backoff / session-resync: None. Grep for onclose|onerror|reconnect|heartbeat|ping|pong|backoff|retry returns zero matches in the whole file. There is exactly one new WebSocket with one onmessage handler.
Server-disconnect handling: None. On disconnect the socket is dead and never re-created; every input handler guards with ws.readyState === WebSocket.OPEN and simply returns, silently dropping events. The page never learns the connection is gone and no fallback to HTTP/SSE exists.
Error handling: None. No onerror, no onclose, no try/catch around applyBatch (a malformed batch throws inside onmessage). readString/applyBatch do no bounds-checking (the GRANT.md WP3 item "TS stringAt bounds fix" refers to this JS surface).
Self-contained versioned artifact or demo helper? Demo helper, unversioned. Two byte-identical hand-copied files; global consts (no module/IIFE); no version marker; header version hardcoded to 1 at app.js:148,184; injected into SSR pages via <script src="/app.js" defer> in SessionApp.renderHtml() (Spring SessionApp.java:132, Quarkus SessionApp.java:143). No build step, no package manifest, no SRI.
Events the client can send vs. the full event catalog: sends only POINTER_UP, VALUE_CHANGED, TEXT_CHANGED, DATE_CHANGED. The spec (spec/EVENTS.md:100-238) also defines KEY_DOWN/UP, POINTER_MOVE (hover), FOCUS_CHANGED, EDITING_CHANGED, SUBMIT, SCROLL, WHEEL — none are emitted by the JS client.
2. SSR HTML renderers
2a. Java — lib/java/pathland-render-html/src/main/java/com/pathland/render/html/HtmlRenderer.java
Retained-node model: applyFrame (line 66) handles TREE (create/delete/insert/remove/move) + STYLE (SET_TEXT, SET_DATE, SET_PROPERTY incl. string props). render()/renderFragment() (138/169) emit HTML. escape() (435) handles & < > " '.
Component → HTML element mapping (from renderNode, lines 189-339):
| Component (spec ID) | HTML element | Attributes / structure | Line |
|---|
| VSTACK (0x10) / LAZY_VSTACK (0x1B) | <div> | style="display:flex;flex-direction:column;gap:…px;align-items:center;…" | 190, 273, 342-350 |
| HSTACK (0x11) / LAZY_HSTACK (0x1C) | <div> | flex-row, same | 191, 274 |
| TEXT (0x01) | <span> | data-pathland-id + inline style | 194 |
| BUTTON (0x20) | <button> | text body | 198 |
| COLOR (0x03) | <div> | style="flex:1 1 auto;align-self:stretch;background-color:rgba(…)" | 203 |
| SHAPE (0x04) | <div> | background-color + border-radius:50% (circle) / …px (rounded rect) | 219 |
| TOGGLE (0x24) | <label class="pathland-toggle"> + <input type="checkbox"> | role="switch" when SWITCH style; checked | 226-228 |
| DIVIDER (0x05) | <hr> | — | 231 |
| PROGRESS_VIEW (0x07) | <progress> or <div class="pathland-spinner"> | max="1" value="…" | 239 |
| GAUGE (0x08) | <div class="pathland-gauge"><div style="width:…%"> | — | 248 |
| TEXT_EDITOR (0x22) | <textarea> | value as text content | 253 |
| STEPPER (0x26) | <div class="pathland-stepper"> + 2 <button data-step> + <span> + hidden range meta | data-min/max/step on hidden span | 260-265 |
| GRID (0x13) / LAZY_VGRID (0x15) / LAZY_HGRID (0x16) | <div> | style="display:grid;gap:…px" | 267, 352-360 |
| SCROLLVIEW (0x14) | <div> |
Form semantics: none. No name=, form=, for=, autocomplete, required, maxlength, pattern anywhere (grep confirms; only name hit is <meta name="viewport"> at line 141). Label association is implicit only (input nested inside <label>); no for/id pairing.
ARIA / role: minimal. Only role="switch" on the toggle SWITCH variant (line 223). The ROLE/STATE/ENABLED protocol properties are not mapped to ARIA/disabled in the Java renderer at all (the Rust renderer does this; Java does not).
Style coverage: inline CSS for border (borderStyle, 363-390), background/padding/opacity (decorStyle, 393-411), spacing/alignment on stacks. Not applied: FONT_SIZE/WEIGHT/FAMILY, COLOR (text), WIDTH/HEIGHT, Z_INDEX, LINE_LIMIT, TEXT_ALIGNMENT, TRUNCATION_MODE, CONTENT_MARGINS, ALIGNMENT on stacks (hardcoded align-items:center), IS_SECURE (no password input), SET_DESIGN_TOKEN (not handled — confirmed by status.md).
2b. Rust — lib/rust/crates/pathland-render-html/src/lib.rs
Component mapping (render_node, lines 490-793) — strictly fuller than Java:
| Component | Element | Notes | Line |
|---|
| TEXT | <span> | + event/aria attrs | 514-517 |
| BUTTON | <button> | composite override (children → custom body) | 518-526 |
| TOGGLE | 3 styles: switch <input type="checkbox" role="switch">, checkbox, button (aria-pressed) | composite body support | 527-552 |
| SPACER | <div style="flex:1"> | | 553-556 |
| SLIDER | <label class="pathland-slider"><input type="range"> | | 557-572 |
| TEXT_FIELD | <label class="pathland-textfield"><input type="text"/"password"> | IS_SECURE → password | 573-595 |
| TEXT_EDITOR | <textarea rows="4"> | | 596-599 |
| IMAGE | <img src="…"> | from IMAGE_SOURCE string | 600-608 |
| COLOR | <div> | | 609-617 |
| SHAPE | <div> / <svg><rect> | kinds incl. capsule/ellipse/path-svg-placeholder | 618-645 |
| DIVIDER | <div> border-top | (not <hr> like Java) | 646-657 |
| PROGRESS_VIEW | <progress> / <div class="pathland-spinner"> | | 658-670 |
| GAUGE | <div class="pathland-gauge"> | | 671-683 |
| GRID/LAZY_V/HGRID | <div style="display:grid"> | grid-template-columns | 684-701 |
| SCROLLVIEW | <div style="overflow:auto"> | | 702-704 |
| ZSTACK | <div position:relative> + absolute children | | 705-721 |
|
Event surfacing: event_attrs() (299-313) emits data-event-listeners, data-action-id, data-binding-id. ARIA: aria_attrs() (316-351) maps ROLE → role= (button/link/heading/textbox/slider/switch/checkbox/tab/scrollbar/menuitem), STATE → aria-disabled/current/pressed/selected, ENABLED=0 → disabled.
Form semantics: none (grep for name=|form=|for= yields nothing; only meta name="viewport"). No alt, no aria-label on controls, no for/id label pairing (implicit nesting only).
Is the Rust renderer used by any runnable demo? No. It is a workspace member (lib/rust/Cargo.toml:12) with only pathland-core/pathland-core-transport deps and tests. No binary or example depends on it; pathland-render-gtk-demo does not reference it. The runnable web demos both use the Java renderer.
3. Demos (transport + sessions)
Spring Boot (lib/java/pathland-spring-boot-demo)
- WS path:
/ws, registered in WebSocketConfig.java:19 with .setAllowedOrigins("*") — no origin restriction.
- Session handling:
PathlandSocket.java — afterConnectionEstablished resolves the session id from the session cookie (resolveSessionId, lines 73-90), fallback UUID.randomUUID(); memoized per-connection in sessionIds map (line 25). handleMessage (39-43) → service.dispatch; handleTransportError closes (51-53).
- Session registry:
PathlandService.java — single-thread daemon actor (25-29), ConcurrentHashMap<String, SessionApp> (31), MAX_EVENT_BATCH = 1<<16 inbound size guard (23, 61-63), open() replaces any previous session (50-53). State store: redisOrFallback (90-100).
- Per-session app:
SessionApp.java — PersistentState(store, sessionId) (48), KitchenSinkView root, FrameOpcodeSink.endFrame override applies each frame to HtmlRenderer and immediately sends it as its own single BinaryMessage (51-66, 86-98). Frames emitted before connect are buffered in pending and replayed on connect (43, 78-84). Inbound dispatch decodes events and routes to tapActions/textInputs/valueInputs/dateInputs registries (100-128). renderHtml() injects <script src="/app.js" defer> (130-133).
- SSR entry:
IndexController.java:25-37 — sets session cookie with no HttpOnly / SameSite / Secure (ResponseCookie.from("session", sessionId).path("/").build(), line 32).
- Config: only
src/main/resources/static/app.js — no application.properties.
Quarkus (lib/java/pathland-quarkus-demo)
- WS path:
@WebSocket(path = "/ws") PathlandSocket.java:22; @OnOpen (33-42) resolves cookie from handshake header (resolveSessionId, 70-81, no origin/auth checks); @OnBinaryMessage (49-52) → PathlandApp.dispatch.
- Session registry:
PathlandApp.java — identical actor + sessions map pattern (34-40, 66-100), MAX_EVENT_BATCH = 1<<16 (32), redisOrFallback (111-121).
- SessionApp.java — mirror of the Spring one;
sendBinary(...).subscribe() (94-107), pending replay (85-91), event dispatch (110-138), script injection (141-144).
- SSR entry:
IndexResource.java:28-38 — NewCookie.Builder("session")… with no SameSite / Secure / HttpOnly.
- Config:
application.properties — quarkus.http.port=8080, quarkus.http.host=0.0.0.0, com.pathland log level INFO. No heartbeat/idle-timeout config.
Batching policy
- Rust has a real batching policy:
batching.rs — BatchPolicy (4 ms / 1400 B defaults, lines 17-19), Batcher with time + size triggers and arena-delta tracking (109-159), plus a bare NetBatchEncoder (net.rs:23-60). None of this is used by the demos.
- Java demos: one WebSocket binary message per emitted frame, sent immediately (Spring
SessionApp.java:51-66, Quarkus :57-71). The client also sends one message per event. There is no server-side coalescing or flush timer.
- Codec validation exists:
FrameCodec.java parse() (145-176) checks magic + version + truncation before decode; inbound event batches larger than 64 KiB are dropped by both registries.
Observability / metrics / logging
Plain System.out.println("[pathland] …") only — PathlandService.log (102-104), SessionApp.log (Spring 141-143 / Quarkus 153-155). No metrics (no Micrometer, MP-Metrics, Prometheus), no structured logging, no session counters, no WS lifecycle events, no request tracing, no health endpoints.
Security on the WS / HTTP surface
- Spring:
setAllowedOrigins("*") (only origin control) — effectively none.
- Quarkus: no origin/host-header checks configured.
- No CSRF protection, no auth/token checks, no subprotocol checks, no heartbeat on either.
- Cookie: not
HttpOnly, not SameSite, not Secure in both demos.
- Session takeover: the
session cookie is the only credential; any client replaying a stolen cookie joins that session 1:1.
- No CSP / X-Frame-Options / nonce / SRI headers anywhere (grep returned zero hits across
lib/java).
4. Existing tests
| Surface | Coverage | Location |
|---|
| Java HTML renderer | 5 tests, contains(...) assertions (not golden): VStack/Text/Button, live delta in place, styled button, controls (toggle/slider/picker/progress/hr/textarea/date), escaping | lib/java/pathland-render-html/src/test/java/com/pathland/render/html/HtmlRendererTest.java (117 lines) |
| Rust HTML renderer | 22 tests in-module: components, composite override, event attrs, aria, alignment, secure field, network-decoded frame, days_to_date, grid, scrollview/zstack, progress, date/picker/color | lib/rust/crates/pathland-render-html/src/lib.rs:840-1502 |
| app.js / JS client | NO tests at all. No *.test.js, no package.json, no JS runner anywhere in the repo (globs returned empty). | — |
| Rust transport | 25 tests: batching.rs (5), batch.rs (11), net.rs (1), conformance.rs (3), ring.rs (5) | lib/rust/crates/pathland-core-transport/src/*.rs |
| Java transport | No dedicated transport test file. FrameCodec round-trips are exercised inside EmitterTest (frameCodecRoundTrips :197, eventCodecRoundTrips :209, opcodeByteLayout :291) | lib/java/pathland-view/src/test/java/com/pathland/view/EmitterTest.java |
| Golden vectors | 14 vectors in spec/CONFORMANCE.md (12 opcodes + 2 network batches). No HTML golden vectors. | spec/CONFORMANCE.md |
| Demo tests | CounterViewTest, KitchenSinkViewTest (views only). No WS/session endpoint tests. CI (ci.yml) runs Java tests with -pl '!pathland-quarkus-demo,!pathland-spring-boot-demo' — demo modules are excluded. | lib/java/pathland-demo-views/src/test/... |
5. Repo conventions / where a reusable client would live
docs/ directory exists but contains exactly one file: docs/GRANT.md (the NLnet grant proposal, which explicitly lists "WCAG/ARIA compliance on the SSR HTML renderer" as planned work package WP5, and the JS decoder hardening as WP3).
- No
lib/js, no Node/npm tooling, no package.json anywhere in the repo. The only JS is the duplicated app.js.
- Top-level
README.md structure: Overview → Project Status → The Three Elements → Execution & Deployment Models → Core Principles → Documentation → Rust Workspace → Java Libraries → Build/Run → Web Client (SSR HTML + app.js) (line 257) → Components & Properties → Design Tokens → POC Goals → Versioning → Contributing → License.
spec/ holds the authoritative protocol docs: OPCODE.md, PRIMITIVES.md, MODIFIERS.md, EVENTS.md, CONFORMANCE.md, DSL.md (informative).
- Per-project
status.md convention is mandated by AGENTS.md. Web-relevant ones: lib/rust/crates/pathland-render-html/status.md, lib/java/pathland-render-html/status.md, lib/java/pathland-view/status.md, lib/java/pathland-demo-views/status.md, lib/rust/crates/pathland-core-transport/status.md.
SECURITY.md:36-37 explicitly declares app.js (PLPL batch decode + hydration) in scope for security hardening.
CONTRIBUTING.md:87 also names app.js as a surface to keep in sync.
Gap list
A. Transport resilience (client + server)
- No reconnect / backoff / retry in
app.js — single new WebSocket at line 205, no onclose/onerror handlers.
- No heartbeat / ping-pong on either side (client none; Spring
WebSocketConfig sets no heartbeat; Quarkus configures no idle timeout).
- No session-resync protocol — after reconnect there is no mechanism to rebind the socket to the existing
SessionApp or to request a full frame replay (the pending replay at connect only covers frames emitted before the first connection).
- No fallback transport (SSE / long-poll / HTTP refresh) on disconnect.
- Client drops events silently whenever
ws.readyState !== OPEN.
- Server sends one WS message per emitted frame — the Rust
Batcher time/size policy exists but is unused by both demos; no coalescing on the wire.
- No frameCount/last-applied sequencing — batches carry a
frameCount field but neither the JS client nor the demos use it for ordering, dedup, or gap detection.
- No outbound size guard on frames sent to the client (only the inbound
MAX_EVENT_BATCH guard exists).
B. Accessibility
- Java renderer: no
role=/aria-* mapping at all (except toggle role="switch"), no ROLE/STATE/ENABLED handling → no aria-disabled/current/pressed/selected, no disabled.
- Rust renderer: partial —
aria_attrs() maps ROLE/STATE/ENABLED, but no aria-label, no for/id label pairing, no aria-valuemin/max/now on slider/progress/gauge, no aria-live for dynamic text.
- Both renderers: no keyboard/focus semantics for
MENU (CSS-hover popover), no alt/role="img" for IMAGE, no heading structure, no skip/focus management, no aria-expanded for menus, no focus trap. This is a known gap — GRANT.md WP5 plans WCAG/ARIA compliance.
C. Form semantics
- No
<form> wrapper, no name=, form=, for=, id= pairing in either renderer — server-driven forms cannot be submitted natively and screen-reader label association is only implicit.
- No
autocomplete, required, maxlength, pattern, readonly, multiple on TEXT_FIELD/TEXT_EDITOR.
- Java renderer's
TEXT_FIELD always emits type="text" — the IS_SECURE password variant exists in Rust only.
- Slider emits
step="any" (both renderers) — no discrete step on the actual input; stepper values don't reflect STEP_VALUE.
- Java
STEPPER is a div + buttons, not a real <input type="number"> (Rust uses number input) — no native keyboard/AT semantics.
- No client-side form validation surfacing (the protocol has no validation-error path to the client).
D. Observability
- No metrics of any kind (no Micrometer/MP-Metrics/Prometheus), no counters for sessions/events/frames/bytes.
- No structured logging — only
System.out.println("[pathland] …"); no WS lifecycle, reconnect, dropped-batch counters beyond ad-hoc strings.
- No request/WS tracing, no session registry introspection, no health endpoints.
- The
Batcher exposes diagnostics (pending_opcodes(), pending_bytes(), batching.rs:98-105) but nothing consumes them.
E. Security
- WS origin/host checks: Spring uses
setAllowedOrigins("*"); Quarkus has none.
- No CSRF protection for the WS handshake; the
session cookie is not HttpOnly, not SameSite, not Secure in both demos — session-id replay/takeover is trivial.
- No authentication — any client that knows/predicts a session id (UUID v4 fallback mitigates but not for cookie-replay) can attach to a live session 1:1.
- No rate limiting / abuse control on events beyond the 64 KiB
MAX_EVENT_BATCH size drop.
- No CSP / X-Frame-Options / SRI / nonce headers;
app.js is served plain with no integrity pin.
- JS batch decoding is unbounded (
readString/applyBatch do no bounds checks) — explicitly in scope per SECURITY.md and GRANT WP3.
- No server-side opcode validation beyond
FrameCodec.decodeEvents magic/version/truncation checks; malformed inbound batches are caught and logged, but there is no per-opcode range validation.
F. Client artifact / versioning
app.js is duplicated byte-for-byte in two demos with no single source of truth, no build, no minification, no package, no semver, no SRI.
- No version negotiation — client hardcodes protocol version 1 (
app.js:148,184) and never reads/checks the version field in incoming batches.
- Client supports only a subset of the delta surface: STYLE
SET_TEXT/SET_DATE/SET_PROPERTY with 7 property IDs; no TREE structural opcodes, so runtime add/remove/move of nodes cannot be applied.
- Client emits only 4 of the 12+ event types defined in
spec/EVENTS.md (no keys, hover, focus, submit, scroll, wheel).
- No JS test infrastructure at all — the only JS fuzz/bounds work is planned (GRANT WP3).
- No HTML golden conformance vectors — renderer tests use
contains(...) assertions only, and the two renderers already diverge (Java lacks IMAGE/ZSTACK/password/aria/event-attrs; STEPPER differs).