This project is for developers who can edit HTML and JavaScript and want to test an interactive visualization, node map, or small scene built with a coding agent. The example uses a 2D canvas to project points with depth. It has no WebGL renderer, mesh assets, backend, or model API. You can inspect every part in one file and apply the same state and interaction checks to a larger renderer.
Run the starter and inspect the baseline
Download the Signal Garden starter v1.1 and extract it into an empty directory. The archive contains index.html, smoke.mjs, a README, a historical test record, and a screenshot. The page itself needs no npm packages. With Python 3 installed, open a terminal in the extracted directory and run:
python3 -m http.server 8080 --bind 127.0.0.1
Open http://127.0.0.1:8080/. Use a desktop window first so the controls leave room for the field. You should see six nodes, a 40% minimum confidence, and SG-03 selected. In the browser's developer console, run:
window.__SIGNAL_GARDEN__.getState()
The baseline snapshot has this shape. The animation value depends on the motion preference detected when the page loads:
{
version: 2,
scene: "baseline",
selectedId: "SG-03",
confidenceFilter: 0.4,
camera: { yaw: 0, pitch: 0.16, distance: 620 },
visibleNodeIds: ["SG-01", "SG-02", "SG-03", "SG-04", "SG-05", "SG-06"],
animation: "reduced" // or "full"
}
If the hook is undefined, confirm that you opened the extracted starter's index.html, rather than the article or an empty parent directory. If port 8080 is occupied, choose another port and use it in both the browser URL and test command. Stop the local server with Ctrl+C when finished.
Design the scene around a specific inspection task
For Signal Garden, the task is to find a signal above a chosen confidence threshold, select it, and keep track of it while moving the view. Each record therefore needs a stable ID, coordinates, and a confidence value. The controls need a filter, a way to choose a node, camera movement, and a reset action.
Decide whether a spatial view helps your reader. A table may be easier if the whole task is sorting confidence values or reading IDs. A scene becomes useful when position and visual grouping help someone inspect the data. Keep a text selector alongside the drawing so a crowded or obscured point can still be selected.
Write down what each action changes before adjusting colors and motion:
| Action | State rule | Interface check |
|---|---|---|
| Orbit | Dragging changes yaw and pitch; pitch stays between -0.7 and 0.7 radians. | The field and camera readout move together. Selection remains associated with the same ID unless a selection action occurs. |
| Filter | Keep nodes whose confidence is greater than or equal to the threshold. | The canvas, count, and selection menu contain the same filtered set. |
| Select | The selected ID belongs to the filtered set. | Canvas highlight, menu value, and selected-signal readout agree. |
| Reset | Restore the baseline data, 40% filter, SG-03 selection, and documented camera. | The controls and drawing return to the opening state without reloading. |
Decide what happens when filtering removes the selected node. This starter chooses the first remaining node in data order; if none remain, selection becomes null. An inspection tool might instead preserve the hidden selection and label it as filtered out. Either behavior needs an explicit rule, because silently showing details for a hidden node makes the scene difficult to interpret.
The camera's distance is fixed at 620 in this starter. If you add zoom, define the nearest and farthest allowed distances and the reset value. Then check that a selected point stays selected and its hit target follows its new screen position at both limits.
Keep data, projection, and controls consistent
Follow the functions in index.html in this order: scenes creates point data; visiblePoints() applies the filter; project() converts world coordinates to screen positions; draw() paints them; and updateReadout() updates the HTML. These functions form a useful starting structure when asking an agent to build another scene.
The projection rotates each point using yaw and pitch, then scales its position by distance / (distance + z + 380). The screen origin is 56% of the viewport width and 50% of its height. The renderer sorts projected points by depth before drawing. Use these same transforms when calculating where a known point should appear or accept a click.
The connecting lines in this demo are decorative: draw() joins pairs whose projected centers are less than 160 CSS pixels apart. Moving the camera can change which pairs connect. If you adapt it into a dependency map, store links as source and target IDs, and draw only those links whose endpoints pass the filter. Otherwise the picture can imply relationships that your data never contained.
Keep the filtered node set in one function. Reimplementing the threshold separately in the menu and renderer invites mismatches at equality boundaries. In this example, a 40% node remains visible at a 40% threshold. If an agent changes one comparison to >, a boundary test should fail.
Canvas is a reasonable choice while your scene consists of projected points, lines, and labels. If you need mesh intersections and real 3D picking, Three.js Raycaster provides ray intersection queries. Keep the same ID and selection rules around that renderer; replace the projection and picking implementation where the project requires it.
For a larger project, move scene data, state transitions, rendering, and interface handlers into separate modules. Start that refactor after one complete interaction works. A module split is useful when it makes a filter or reset rule testable without constructing the renderer.
Expose the values a test needs to read
The starter exposes window.__SIGNAL_GARDEN__ with a version, getState(), loadTestScene(name), and reset(). This is its state contract: a documented set of values and methods that tests can rely on. The returned snapshot includes both the scene name and version. Check them first so a test written for an older interface fails clearly when that interface changes.
getState() constructs a new object with a new camera object and ID array. Editing that returned snapshot does not update the scene. The other two methods do mutate scene state and remain callable in this demo. For your own application, expose fixture loading only in a development or test build if public callers should not have that capability.
Describe the fields precisely. Here, visibleNodeIds means nodes that pass the confidence filter. It does not mean that every node is inside the viewport, unobscured by a panel, or readable. The starter's narrow-screen problem illustrates this distinction. If your application needs to assert actual visibility, add separate projected bounds and occlusion checks with their own definitions.
Return only the fields the tests use. Tests usually need stable IDs, values that affect behavior, and a way to tell whether loading and drawing have finished. A project that loads models could add loadStatus, assetError, and a frame or render-ready marker. Add those fields when the loader exists, and increment the contract version when their meaning or existing field semantics change.
State inspection also needs an independent interface check. A test that calls a selection setter and immediately reads its value can pass while the pointer handler is broken. Use fixture hooks to arrange the scene, then trigger the behavior through a button, keyboard event, or canvas click.
Start each test with repeatable data
A fixture is a saved set of test data. The starter has four, each chosen to exercise a different problem. Call reset() before loading one so its camera and filter start at the documented values:
const garden = window.__SIGNAL_GARDEN__;
garden.reset();
garden.loadTestScene("dense");
garden.getState();
loadTestScene() preserves the current camera and confidence threshold. Clicking Baseline while the filter is 100% still produces zero visible baseline nodes. Reset restores the threshold as well as the dataset. Mixing up these operations can make a deterministic fixture appear random.
| Fixture after reset | Expected state in v1.1 | What to inspect |
|---|---|---|
baseline | Six filtered nodes, SG-03 selected, 40% threshold. | Selection agreement and the opening camera. |
dense | 30 generated points from seed 17; 25 pass the 40% threshold. | Hit targets, overlap, and whether selection remains identifiable. The renderer hides most unselected labels once there are ten or more projected points. |
empty | One point with confidence 0.1; none pass the 40% threshold. | A disabled selection menu, no selection, and a readable recovery action. |
boundary | Three filtered points; the long label is selected. One point has confidence exactly 0.4. | Equality filtering, long text, edges, and panel overlap after camera movement. |
The Empty fixture represents records hidden by a filter. Lower its threshold to 0% and its one point appears. Boundary also needs a separate camera check: loading it does not move the camera to its limits. Reach both pitch limits explicitly to test them.
To add a dataset with no records, open index.html and insert this member inside the existing scenes object, before baseline. Keep the trailing comma:
noData: () => [],
Save and reload the page, then run this in the developer console:
const garden = window.__SIGNAL_GARDEN__;
garden.reset();
garden.loadTestScene("noData");
The returned snapshot should show scene: "noData", visibleNodeIds: [], and selectedId: null. The selection menu should be disabled. Lower Minimum confidence to 0%; it should still show zero nodes. Finally, press Reset scene and confirm that all six baseline nodes return. This change was checked in a separate local copy; it is an exercise to apply to v1.1, rather than an extra fixture already included in the ZIP.
When extending a fixture, fix the data order as well as its random seed. Selection falls back to the first remaining point, so a reordered dataset can change the selected ID even when it contains the same points. A useful regression record keeps the fixture name, filter, camera, selected ID, viewport, and motion preference together.
Test keyboard and pointer selection through the interface
Reset, focus the Selected signal menu, and press ArrowDown once. SG-04 should become selected. Then reset again and click SG-04 in the canvas. The menu, selected-signal readout, and highlighted point should return to that same ID. This path passed at 1440 × 900 in the Chrome setup listed at the end of the guide.
A confidence sequence catches another class of inconsistency. Starting from reset, 85% leaves SG-01 and SG-03 visible and keeps SG-03 selected. At 90%, SG-01 is the only remaining node and becomes selected. At 100%, the baseline has no results, the selected ID becomes null, and the menu is disabled. Confirm that Reset recovers from this state.
Canvas picking needs a coordinate convention. This starter fills the viewport and compares pointer clientX/clientY with projected positions in CSS pixels. If you place the canvas inside a card, account for its offset. getBoundingClientRect() gives the element's rectangle relative to the viewport. For a borderless, untransformed canvas whose projection uses its displayed width and height:
const rect = canvas.getBoundingClientRect();
const x = event.clientX - rect.left;
const y = event.clientY - rect.top;
Use those local CSS coordinates for hit testing. If the projection uses a different logical size, scale by the logical-to-displayed size ratio as well. Keep backing-store pixels separate from pointer coordinates; multiplying one side by device pixel ratio while leaving the other unchanged shifts the clickable region.
The starter uses a 16-CSS-pixel hit radius and checks nearer projected points first. Test crowded points and edges before changing that policy. Also check dragging separately from clicking: its handlers do not track a movement threshold to suppress a click after a drag, or clear drag state on pointercancel. Add those cases before relying on touch interactions. The source lacks those handlers; physical-device gesture testing remains open.
Run a browser check you can reproduce
The archive's smoke.mjs covers the original basic path. It needs Node.js and the playwright package, which the ZIP does not include. In the extracted folder, install the test dependency and its Chromium browser:
npm init -y
npm install --save-dev playwright
npx playwright install chromium
node smoke.mjs http://127.0.0.1:8080/
Keep the Python server running in a second terminal. The bundled script prints its result and writes signal-garden-tested.png in the current directory, replacing a file with that name. Its bundled test-results.json is a historical record; running the script does not update that JSON automatically.
For a smaller check focused on selection and filter recovery, save the following as check-scene.mjs in the extracted folder and run node check-scene.mjs http://127.0.0.1:8080/. The click coordinate belongs to the unmodified v1.1 baseline at the specified viewport; recalculate it when camera or projection rules change.
import { strict as assert } from "node:assert";
import { chromium } from "playwright";
const browser = await chromium.launch({
executablePath: process.env.CHROME_PATH || undefined
});
try {
const page = await browser.newPage({
viewport: { width: 1440, height: 900 },
deviceScaleFactor: 1, reducedMotion: "reduce"
});
page.setDefaultTimeout(10000);
const errors = [];
page.on("pageerror", error => errors.push(error.message));
await page.goto(process.argv[2] || "http://127.0.0.1:8080/");
await page.waitForFunction(() => window.__SIGNAL_GARDEN__?.version === 2);
const read = () => page.evaluate(() => window.__SIGNAL_GARDEN__.getState());
const initial = await read();
assert.equal(initial.selectedId, "SG-03");
assert.equal(initial.visibleNodeIds.length, 6);
assert.equal(initial.animation, "reduced");
await page.locator("#signalSelect").focus();
await page.keyboard.press("ArrowDown");
assert.equal((await read()).selectedId, "SG-04");
await page.getByRole("button", { name: "Reset scene", exact: true }).click();
await page.mouse.click(876.283, 390.835);
assert.equal((await read()).selectedId, "SG-04");
assert.equal(await page.locator("#signalSelect").inputValue(), "SG-04");
assert.equal(await page.locator("#selected").innerText(), "SG-04");
await page.locator("#confidence").fill("100");
assert.equal((await read()).selectedId, null);
assert.deepEqual((await read()).visibleNodeIds, []);
assert.equal(await page.locator("#signalSelect").isDisabled(), true);
await page.getByRole("button", { name: "Baseline", exact: true }).click();
assert.equal((await read()).confidenceFilter, 1);
await page.keyboard.press("r");
assert.deepEqual(await read(), initial);
assert.deepEqual(errors, []);
await page.screenshot({ path: "scene-check.png", fullPage: true });
console.log("PASS: selection, empty state, reset, and page errors");
} finally {
await browser.close();
}
This uses the Playwright library and Node assertions, so it does not need a Playwright Test configuration. It checks page exceptions. Also inspect failed network requests and console messages: a missing image can leave the drawing incomplete without throwing a page exception. A missing favicon.ico on the local static server can produce a separate 404; check the failed URL before treating it as a scene failure.
For an asynchronous loader, wait for its documented ready condition before reading state. A fixed sleep can inspect an unfinished render on a slower machine. If you adopt Playwright Test, its retrying assertions and expect.poll() can wait for a locator or changing state value. Plain Node assertions in the example evaluate once.
Find the cause when a scene check fails
Read the state, the HTML controls, and the canvas separately. If the selected ID is correct but the highlight is wrong, inspect drawing. If the menu works but a click does nothing, inspect pointer coordinates and the element receiving the click.
| Symptom | Check first | Change to try |
|---|---|---|
| Baseline loads with zero nodes. | Read confidenceFilter. A scene button retains its current value. | Use Reset scene before comparing with the opening screenshot; use a scene button when deliberately preserving the filter. |
| The menu selects a node, but clicking it does nothing. | Compare its projected center with local CSS pointer coordinates. Check whether the panel lies over that position. | Subtract the canvas rectangle's offset; reserve scene space outside the panel. Recalculate the fixed test click after changing the layout. |
| The selected ID changes, but the menu or highlight stays behind. | Trace the input handler after it updates selectedId. | Update the HTML readout and redraw from the same state. Avoid keeping a second selection value inside the renderer. |
| The field stretches or clicks shift after resize. | Compare the canvas CSS rectangle, backing-store dimensions, drawing transform, and projection origin. | Use the same CSS dimensions for projection and hit testing; resize the backing store with the chosen pixel ratio and restore its transform. |
| Arrow keys change selection when the test expects camera movement. | Inspect the focused element. This starter's selector handles arrows, while the global camera handler skips form controls. | Test each action from its intended focus location. For your application, provide a visible, focusable way to move the camera. |
| State checks pass, but an image comparison fails. | Compare viewport, camera, selected ID, fonts, browser, and device scale before inspecting pixels. | Restore the intended setup. If it still differs, review the changed labels, nodes, and panels before accepting a new reference image. |
Use screenshots to catch what state checks miss
A saved screenshot adds visual evidence, but the script above does not compare it with an approved reference. When you introduce image comparisons, fix the dataset, selection, camera, viewport, device scale factor, fonts, and motion state. Wait for rendering and fonts before capture. Inspect the reference image yourself before accepting it.
Playwright's visual comparison documentation explains that screenshots vary across operating systems and browsers. Maintain references for your chosen environment. When a comparison fails, inspect the changed area before increasing a tolerance or updating the reference; a clipped label can otherwise become the newly accepted image.
Review dense and boundary screenshots for specific questions: can you identify the selected point, read its complete ID, and reach overlapping targets? Does the label leave the visible area when the camera moves? Does the panel cover a node while the state still counts it as visible? A correct count cannot answer any of these.
The animation field reports the motion preference sampled at load. Signal Garden redraws on interaction and has no continuous animation loop, so the field alone proves no animation reduction. For a scene with auto-orbit or transitions, implement and inspect the alternate behavior. prefers-reduced-motion communicates the user's preference; the application still has to respond. Reload this starter after changing the emulated preference because it samples the value only at startup.
Check narrow layouts, keyboard behavior, and zoom

At 390 × 844 in local Chrome, the starter had no horizontal document overflow, and its control panel fit inside the viewport. The screenshot still showed the panel covering the selected node and part of the field. The canvas uses the whole viewport for projection while the panel occupies its lower portion. A media query that stacks HTML controls cannot reserve space in the canvas projection by itself.
For a phone layout, give the scene its own region above the controls. Size the backing store from that region, project around its center, and convert pointer coordinates relative to it. Let the document scroll when controls need more height. Then repeat canvas selection, filter, and reset checks in that layout. Apply these changes in your own copy; the v1.1 download retains its original layout.
Check a short landscape viewport and browser zoom as separate cases. The starter sets body { overflow: hidden; }; verify that every control stays reachable when text occupies more space. Look at actual control bounds and focus visibility, not only scrollWidth. Test a physical touch device before claiming the gestures work there.
Canvas pixels do not provide a node-by-node semantic interface, which is why the labeled HTML selector matters. The Canvas API documentation describes this accessibility limitation. The selector gives users a way to reach the same selected ID without aiming at pixels, but a usable inspection tool may also need a text list of signal values or details.
Walk the page with Tab, Shift+Tab, arrows, and the reset control. In this starter, global camera arrows are ignored while an input, button, or select has focus; the selector has its own arrow handler. Avoid assuming that a script's selectOption() call proves the keyboard journey. Check focus order and whether a user can discover how to move the camera. Visible camera buttons are one possible addition.
WCAG's keyboard guidance concerns access to functionality through a keyboard interface. Passing the one selector check covers only that interaction. Screen-reader announcements, focus visibility, contrast, zoom, and the complete workflow still need review. In particular, this starter's live status reports scene name and count; it does not announce the selected ID in that status message.
Extend the cases when the scene gains real data or assets
The local demo has no asynchronous loading or remote assets. Add the following cases only when those features enter your project. Give each case a named fixture or controlled response so it can be reproduced without waiting for a real outage.
| Situation | Implementation decision | Useful test |
|---|---|---|
| Loading data | Define when interaction becomes available and whether old data remains visible. | Hold the response, inspect the loading message, then resolve it and verify exactly one transition to ready. |
| Empty response | Distinguish no data from a filter that hides existing data. | Return an empty array; confirm that clearing the filter does not claim to restore unavailable nodes. |
| Image or model fails | Choose a fallback or an explicit failure state. | Fail the exact asset request; verify the message and that retry starts a new attempt rather than duplicating the scene. |
| Malformed or duplicate IDs | Reject or normalize the dataset before constructing selection controls. | Supply duplicates and missing IDs; confirm that a menu choice cannot ambiguously select two objects. |
| Refresh removes selection | Define whether selection clears or moves to a surviving node. | Replace the dataset while a removed node is selected; compare details, menu, and highlight afterward. |
| Older response arrives late | Ensure an obsolete request cannot overwrite a newer filter or scene. | Resolve the second request before the first and verify that the current request still owns the displayed data. |
Keep loading and failure status separate from the scene's logical node count. Zero nodes during a pending request and zero nodes after a successful empty response require different messages and recovery actions. Add the distinction to the state contract before writing tests that depend on it.
Measure slow interactions before changing the renderer
Signal Garden redraws after input and resize. Its line renderer compares every pair of projected nodes, so the pair count grows from 435 for 30 visible nodes to 44,850 for 300 and 499,500 for 1,000. These are calculated loop counts, not measured render times. The default dense fixture has only 25 filtered nodes and cannot establish performance for a large graph.
Measure the interaction you plan to ship: filter while dragging, select inside a crowded region, and resize at the target display scale. Record input size, browser, device, and the duration of the relevant work. A static scene needs responsive interactions; an animated scene also needs frame timing under sustained activity. The checks reported here include no render-time or frame-rate measurements.
Profile before replacing the renderer. If edge construction dominates, reduce the edge set or use a spatial lookup. If label drawing dominates, consider label prioritization or cached text. MDN's Canvas optimization guidance covers techniques including batching drawing and scaling the backing store for high-resolution displays. Choose an optimization for the cost you observed.
The starter caps backing-store scale at 2. A larger scale increases pixel work and memory; doubling both dimensions produces four times as many pixels. Test the actual scale you intend to support. A clear desktop screenshot says little about touch-device responsiveness or the cost of a future animated scene.
Give a coding agent a verifiable change request
When asking a coding agent to adapt the starter, name the behavior it must preserve and the checks it must run. For example:
Revise the local Signal Garden copy for a narrow viewport.
Keep contract v2, all four datasets, selection fallback, and reset values.
Give the canvas a scene region that controls cannot cover.
Convert pointer coordinates relative to that region.
Keep controls reachable at 390 x 844 and in a short landscape window.
Run baseline, dense, filtered-empty, boundary, pointer selection,
keyboard selection, filter recovery, and reset checks.
Recalculate any click coordinate affected by the new projection.
Return state snapshots, screenshots, console failures, and unresolved cases.
Do not publish the files.
Ask the agent to run the unchanged checks before editing, then the same checks after editing. If a test is changed to match a new layout, review that change separately from the feature. An agent's completion message should point to recorded outputs; inspect the selected node and control layout in those outputs yourself.
If you are adding a timer, win conditions, or loss states, continue with the browser game workflow.
Know what the starter checks cover before publishing
On October 15, 2026, the downloaded v1.1 starter passed 11 functional checks in Chrome 155.0.8059.40 at 1440 × 900, device scale factor 1, with reduced motion requested. These covered selection through both input paths, filtering, reset, repeatable datasets, camera dragging, and application errors. The public ZIP matched the local archive used for those checks. The separate no-data exercise above was tested in a modified local copy.
| Area | Recorded result | Work still required |
|---|---|---|
| Desktop function | 11 named checks passed in local Chrome at 1440 × 900 with reduced motion. | Run the checks against your changed files and intended browsers. |
| Narrow layout | 390 × 844 screenshot shows controls covering part of the scene. | Reserve a scene region, then repeat selection and layout checks. |
| Visual regression | Screenshots captured and inspected. | Approve environment-specific references if automated image comparison is needed. |
| Accessibility and touch | One keyboard selection path confirmed; code-level gaps documented. | Review the full keyboard journey, assistive technology, zoom, and physical-device gestures. |
| Performance | Loop structure inspected; no timing benchmark. | Measure representative data and devices against your interaction requirements. |
After publishing your own scene, open its public URL and repeat node selection, filtering to zero results, and reset. Check that the deployed JavaScript and data are the files you tested, especially if a cache or CDN is involved.
