HydraIssues

hydranps: Unity prefab so an experience captures NPS in front of its ending screen (#565 Phase 6)
open feature Project: experiencenet Parent: #565 Reporter: 27 Oct 2026 09:58

Description

Sub-issue of #565 (master: HydraNPS end of experience rating). Phase 6: the experience
side. The full card design lives on #565, and this issue holds everything specific to an
experience that asks the question itself.

Why

#565 asks the question on the head, after the visitor taps "Exit experience". An
experience developer cannot reach that card and cannot ask inside the world they built.
The ask here is the opposite direction: a Unity developer drops one prefab in front of
their own ending screen and the experience captures the score.

What is in the repository now (hydranps, commit on main)

  • unity/com.experiencenet.hydranps: a UPM package with the HydraNPSCard prefab, the
    card built in code from the spec, a procedural five point star mesh (no sprite, no font
    asset), the HydraNPS.Ask(callback) one line entry point, settings read from disk,
    two transports and a bounded offline queue.
  • docs/design/rating-card.md: the card spec file that Phase 1 (#579) owes. Copy, colors,
    geometry, star shape, timings and behavior. Every renderer follows it.
  • docs/guides/unity-rating-card.md: the integration guide for experience developers.
  • Both are served by the docs viewer at /docs/card and /docs/unity, because the people
    who need them are outside this private repository. Verified locally, 200 on all three
    sections.

Correction to #565 while writing the spec: the card spec says the star shape is "the SVG
path already shipped in inject.go". There is no such path. inject.go draws the Unicode
character U+2605 in the page font. The spec file now defines the geometry (outer points
on the box, inner radius 0.382 of the outer) and says a text only renderer may use
U+2605.

What is NOT built, and blocks the fleet path

A submit token cannot go into a Unity build. The developer ships the build, a build is
readable, and #565 already rules that the token is never baked into an IPA, an APK or a
DMG. The same rule applies harder here, because a third party holds the artifact.

So the default transport posts to hydrabody on the loopback interface of the body, and the
body forwards the record with the credential it already holds:

POST http://127.0.0.1:47991/api/v1/nps/rating
{"source":"experience","experience":"rizeof","score":8,"score_scale":"5-star",
 "experience_version":"1.4.2","session_hint":"exp-3f91ab02-1761590400123"}

The body fills session_id, head_id, body_id, district, venue and duration_ms
from the stream session it is already running. Reaching the loopback interface already
proves the caller runs on the body, so the relay takes no credential.

That endpoint does not exist. It needs:

  1. hydrabody: the route on the existing :47991 server (pkg/provider/httpserver.go),
    loopback only, which forwards to hydranps.
  2. hydracluster: nps_url and nps_token on BodyConfig, the same wiring as
    experience_library_url, which BodyConfig already carries
    (hydraclusterapi/types.go:164). Phase 2 (#580) adds the nps: block for heads
    already, so this is one more consumer of the same block.
  3. hydranps (#579): accept source on POST /api/v1/ratings, and validate it next to
    score_scale. Today unknown fields are decoded and dropped, so the direct transport
    already stores score, experience and session id.

Until then a developer uses the direct transport with a hydranps.json beside the build.
That path works against the live service today and is the test path in the guide.

Owner rulings needed

  1. Two prompts for one visit. An experience with the prefab asks inside the world, then
    the head asks again after exit. Recommended: the experience wins, the body reports that
    the visit was already rated, hydracluster carries it on the session, the head skips its
    card. That chain is all existing plumbing (POST /api/v1/body/status, then
    headConfigResponse).
  2. Two records for one visit. The head mints <head_id>-<milliseconds> and the
    experience cannot know it, so the records never merge and rated against total counts the
    visit twice. Same fix as above, or the session id handover #565 already flagged as out
    of scope.
  3. end_reason for an experience record. The experience knows it reached its own
    ending, which is none of quit, timeout, error, shutdown, watchdog. The package
    sends no end_reason and lets the body or the cluster label the end. The NPS average is
    over end_reason: quit only, so an experience record sits outside the headline metric
    until the body labels it. Either the body labels the relayed record, or the design adds
    a value.

Verify

  • Direct transport: put hydranps.json beside a build, tap three stars, then
    GET /api/v1/ratings?experience=<name> returns score: 6.
  • Relay transport, once it exists: the same tap with no file and no token anywhere in the
    build, and the stored record carries the session id and the venue the body knew.
  • The card against docs/design/rating-card.md, the same step every head testbook gets.

Not in scope

  • A comment box, a second question, any 0 to 10 wording. One question, five stars, per
    #565.
  • The Unreal version of the package. The same contract applies and the relay makes it a
    small job once the endpoint exists.
  • XR rendering. The package has a world space mode, written and not measured on a device.

Sub-issues (1)

open #1164 hydrahellounity: our own Unity experience to validate the HydraNPS rating card end to end

Comments (4)

claude-code 27 Oct 2026 10:05

Distribution: an experience developer cannot install the package by git URL, because
every cederikdotcom/hydra* repository is private. The release now packs the UPM
tarball and publishes it with the binaries, and the release server serves a plain public
download (verified: a 302 to the mirror, then 206 with no credential):

https://releases.experiencenet.com/hydranps/production/<service version>/com.experiencenet.hydranps-<package version>.tgz

Window > Package Manager > + > Add package from tarball. The package version in
package.json moves on its own, apart from the service version.

Release CI, found by the first tag since 2026-07-28 and fixed in the same session
(hydraissue #822 for this repository): the workflow had no module credential, so
go test could not read hydraapi, and SCALE_REGISTRY_TOKEN predated the 2026-08-28
rotation so the image job got a 401. Both halves are fixed with the netrc pattern the
other hydra repos use, GO_PRIVATE_TOKEN is new on this repository, and the registry
token is refreshed from the registry host. v0.3.0 is burned, because a tag cannot be
re-pointed.

claude 27 Oct 2026 12:54

A developer now has a page to land on: https://hydranps.experiencenet.com/unity

Shipped in v0.3.3 (commit de6796f) and v0.3.4 (commit 2d23803). Both runs green in both jobs.

/unity is a page of its own, not a markdown section in the docs viewer:

  • the card rendered in the colors and the geometry of docs/design/rating-card.md, with the stars filling under the pointer, so the developer sees the card before installing anything
  • a Download button, the four no-code steps, the one line of code, the prefab settings table, the promises (no block, no freeze, no EventSystem of yours, the pointer comes back, no token), both transports, and the 1 to 10 wire score
  • links on to /docs/unity and /docs/card for the long form

/unity/package.tgz asks the release API which version is in production at the click, then redirects to the tarball on the release server. An instance running a version behind still hands out a current package, and no document has to carry a version number by hand. internal/unitypackage holds the package version, with a test that fails if it drifts from package.json.

/ is the hydranps landing page again, this repository's own template, with "Add the card to a Unity experience" as the first button. The shared hydrawebcomponents landing offers only Documentation and Admin Login, and the audience for the public face of this service is an experience developer.

Wording: the copy called a visit a "streaming session". The streaming is how the experience reaches the visitor; what gets rated is the experience session. The landing page, the docs tagline, the runbook, the testbook, the dashboard empty state and the Unity copy all say experience session now.

Testbook: 5a now covers / and /unity as well as the three docs sections, and a new 5a2 checks that the redirect lands on a tarball whose root is package/, which is what Unity needs for "Add package from tarball". Two pass criteria rows added.

Still true, and still open: the body relay endpoint POST /api/v1/nps/rating does not exist, so a developer uses the direct transport with a hydranps.json beside the build. The three rulings on this issue are unchanged.

Not verified yet: the live instance still answers v0.2.3 and picks up the new release on its next six hour check, so /unity returns 404 on the public host until then. The release itself is verified: releases.experiencenet.com reports 0.3.4 and the tarball downloads with no credential.

claude 27 Oct 2026 19:50

LIVE. https://hydranps.experiencenet.com/unity serves the page, /, /docs/unity, /docs/card and /docs/runbook all 200, /unity/package.tgz redirects to the current tarball and it downloads with a package/ root. The 208 stored ratings survived the rebuild.

The service does not auto-update, and the runbook said it did. The public instance is an Incus scale and the image sets HYDRA_AUTO_UPDATE=off on purpose, because the built-in updater would restart a systemd unit that is not in a container. The instance had been on v0.2.3 for 57 days. The image is the unit of update: a release is published and then deployed by hand, or it is not deployed at all. Corrected in the runbook in v0.3.5, with the node, the mesh address, the state path, the exec channel and the command.

Where it runs: scale hydranps on pi-node-003-nvme (node-6bf57aed), mesh 10.10.100.19:8080, state /srv/scales/hydranps -> /root/.hydranps, routed by the edge at 141.227.136.199. The Pi nodes take no SSH, so the way in is hydracluster exec, which runs as root.

How it was deployed: hydraskin update hydranps --tag v0.3.4 as a dry run, then --apply. 12 seconds. It preserves the state disk, the hydraskin-expose proxy on the same host port and every user.hydra.* label, and verifies health through the proxy before it is done. The edge returned 503 for a few seconds while traefik caught up. Repeated for v0.3.5.

Worth knowing for any hydra service: a scale name is not unique in the fleet. There is a second hydranps scale on pi-node-001 (node-2b224f6a), left from the 2026-08 cutover, still running v0.2.3 with nothing routed to it and no domain label. I did not touch it. Check routes.json on the edge for which node really serves a domain before updating anything.

Releases: v0.3.3 the page, v0.3.4 the experience session wording, v0.3.5 the deployment runbook. All three green in both jobs.

api 9 Nov 2026 18:10

Filed #1164: our own Unity experience to validate this package end to end. Nothing has imported the tarball into a Unity project yet, so the integration is unproven and a third party developer would be the first to exercise it. #1164 also carries the reproduction the three open rulings here need (the experience and the head both ask, so the visitor answers twice).