Skip to content

Web: a guided 60-second tour for judges - #34

Merged
HelloOjasMutreja merged 4 commits into
mainfrom
feat/web-tour
Oct 18, 2026
Merged

HelloOjasMutreja merged 4 commits into
mainfrom
feat/web-tour

Conversation

@Dang-ctrl

@Dang-ctrl Dang-ctrl commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #32.

Why

Judges should understand Sthira in about a minute without anyone presenting. The page tells a story (what you decided, then an agent about to act, then the verdict), but a first-time visitor has to find it alone.

What

All in web/static/index.html, styled to Ojas's design (his CSS variables, Bricolage/Newsreader, hard-shadow buttons, ink arrow):

  • "Take the tour" button under the hero lede.
  • 7-step driver.js tour (driver.js@1.3.1 from jsDelivr, exact version, crossorigin="anonymous"):
    1. The wall: what you decided (first settled card).
    2. The check area: an agent is about to act. Next fills in the page's own MongoDB example (EXAMPLES[0], so the recorded fallback still matches), runs the existing runCheck() flow and waits for the verdict. While it runs the button says "Checking…" and repeated clicks are ignored.
    3. The verdict: highlights the cited decision and scrolls so the OVERRULED stamp stays in view.
    4. It learns from you (learning panel).
    5. While you were away (watcher feed).
    6. Feed it your history (import).
    7. What every agent reads (AGENTS.md / MCP).
  • One-time nudge for first-time visitors: a dismissible card in the toast stack ("Start the tour" / "Not now" / ×). The choice is saved in localStorage inside try/catch.
  • Popover themed with popoverClass: "sthira-tour", and resets the page's global footer rule so it doesn't leak into driver's popover footer.
  • prefers-reduced-motion: driver animation and smooth scroll are turned off, and the nudge doesn't animate in.
  • All tour text is static and inserted with textContent. No data goes in as HTML.
  • Small layout fix: at 375px the learning panel (.two grid and the three dials) made the page 409px wide. min-width:0 on grid children plus a shrinkable ring fixes it.

Test plan

  • PYTHONPATH=. python -m pytest -q: 57 passed
  • node --check on the extracted page script
  • Ran the app with the model unreachable (recorded fallback). Clicked through all 7 steps with real clicks at 1280×800 and at 375×812. Step 2 ran the check, showed "Checking…", ignored a second click, and moved on to the OVERRULED verdict.
  • The nudge appears on first visit, starts the tour, and doesn't come back after a reload.
  • No console errors, and no horizontal scroll at 375px
  • Not tested with prefers-reduced-motion: reduce turned on (the code path is there)
  • Not tested against a live model

🤖 Generated with Claude Code

Summary by ShipWright

  • Added a verdict cache to POST /api/check keyed on normalized text plus a fingerprint of settled entries and feedback, with a 600-second TTL and a 256-entry cap.
  • Cached responses include a "cached": true field, and the UI shows "· cached" next to the model name.
  • Added a driver.js-based guided tour to web/static/index.html with a "Take the tour" button and a dismissible nudge toast.
  • Added web/tests/test_verdict_cache.py covering cache hits, invalidation after /api/correct, and that fallback verdicts are not cached.

Change: Feature · Merge risk: 🟢 Low · updated on each push

Dang-ctrl and others added 2 commits October 18, 2026 14:56
POST /api/check now reuses a real model verdict for the same normalized text
against the same settled ledger and feedback for 10 minutes (256 entries max)
and marks it "cached": true. Fallback verdicts are never cached. The UI
appends " · cached" to the model name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A "Take the tour" button in the hero and a one-time nudge for new
visitors start a 7-step driver.js tour themed to the page: the wall,
the check (Next runs the MongoDB example for real and waits for the
verdict), the OVERRULED receipt, learning, the watcher, import and
AGENTS.md. Also stops the learning panel overflowing at 375px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shipwright-agent

shipwright-agent Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

✅ Shipwright · Approve

Recommendation: approve PR #34 · Tier T1

Next step: ready to merge.

Walkthrough

The PR adds a short in-memory cache for /api/check verdicts keyed by normalized text and a ledger/feedback fingerprint, and adds a driver.js guided tour to the web UI with a launch button and a nudge toast.

Area / files Summary
Verdict cache
web/app.py
Added VERDICT_TTL, VERDICT_CACHE_MAX, _verdict_cache, and _ledger_fingerprint, and made /api/check return a cached verdict with "cached": true when a matching entry is under the TTL; real model verdicts are stored and fallbacks are not.
API contract docs
docs/CONTRACTS.md
Updated the /api/check row to document the "cached": true field and the 10-minute window.
Guided tour UI
web/static/index.html
Added driver.js CSS/JS includes, tour styling, a "Take the tour" button, a nudge toast, and a 7-step tour that runs an example check and highlights the wall, ask box, verdict, learning, away, import, and agents sections.
Verdict cache tests
web/tests/test_verdict_cache.py
New tests assert repeated checks reuse the model verdict, a /api/correct call invalidates the cache, and fallback verdicts are not cached.

Estimated review effort: 3 (Moderate) · ~20 minutes
Change: Feature
Merge risk: 🟢 Low · tier T1

Review

7 findings are in the Shipwright check instead of an inline comment.

✅ Full review input coverage: 10/10 changed files · 4 review shard(s) · 638 changed lines.

Open the Shipwright check for full evidence and the audit bundle. Use /shipwright rerun to verify again.

@shipwright-agent shipwright-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ShipWright reviewed this commit. See the ShipWright summary comment in the conversation for the walkthrough and findings.

HelloOjasMutreja and others added 2 commits October 18, 2026 16:48
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@shipwright-agent shipwright-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ShipWright reviewed this commit. See the ShipWright summary comment in the conversation for the walkthrough and findings.

@HelloOjasMutreja
HelloOjasMutreja merged commit 7af1453 into main Oct 18, 2026
3 checks passed
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.

2 participants