Skip to content

refactor: format JSON snapshot files and add initial setup UI#257

Merged
PhenX merged 5 commits into
mainfrom
claude/ux-audit-onboarding-4iojuy
Jul 16, 2026
Merged

refactor: format JSON snapshot files and add initial setup UI#257
PhenX merged 5 commits into
mainfrom
claude/ux-audit-onboarding-4iojuy

Conversation

@PhenX

@PhenX PhenX commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

What & why

This PR makes two main changes:

  1. JSON formatting: Reformats database migration snapshot files to use compact single-line arrays instead of multi-line formatting. This is a pure formatting change with no functional impact — arrays like ["token_hash"] are now on one line instead of spread across three lines.

  2. Initial setup UI: Adds a first-admin setup form to the login page for fresh instances with auth enabled and zero users. This mirrors the existing POST /api/auth/setup API but makes it discoverable from the UI rather than requiring curl commands. The setup flow:

    • Checks /api/auth/setup on mount to determine if setup is needed
    • Shows a setup form instead of login when needsSetup is true
    • Validates username, password confirmation, and optional name
    • Creates the admin account and automatically logs in on success
    • Provides clear error messages for validation or API failures
  3. Supporting changes:

    • Added GET /api/auth/setup endpoint to check if initial setup is needed
    • Updated POST /api/auth/setup to use the new needsInitialSetup() helper
    • Added needsInitialSetup() function to check if users table is empty
    • Updated docs and README with Docker permission guidance for Linux hosts
    • Fixed typos ("initialising" → "initializing")
    • Added runUrl() helper for building dashboard URLs in the reporter
    • Improved error handling in HTTP client and various components
    • Updated GetStartedWizard to show API key config when auth is enabled
    • Enhanced home page to distinguish load errors from "no projects yet"

How was it tested?

  • Existing unit and E2E tests pass
  • Setup flow validated with manual testing on fresh instances
  • JSON formatting is purely cosmetic and verified by inspection

Checklist

  • PR title follows Conventional Commits
  • Tests added for new auth setup endpoints
  • Docs updated (getting-started.md, README.md with Docker permission guidance)

https://claude.ai/code/session_017ftWMgeiHBdLbMeE7WBZ2Z

claude added 5 commits July 16, 2026 06:31
Evidence-based audit of the full new-user funnel: first load, wizard,
reporter install (auth on/off), failure modes, and docs quick starts.
Includes terminal captures, screenshots, and a prioritized punch list.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ftWMgeiHBdLbMeE7WBZ2Z
New users had no way to jump to their run from the terminal, a
"not a git repository" warning leaked into every non-git test run, and
every run reported "Piwi vunknown" because the bundled reporter
resolved its own package.json from the wrong relative path.

A missing API key on an auth-enabled server produced an unreadable
stack dump instead of telling the user what to do; the "Get started"
wizard never mentioned auth at all. A fresh instance with auth enabled
had no UI path to create the first admin account, only a documented
curl call — /login now offers a first-admin setup form when the users
table is empty.

On the home page, a project's first (partial) run was hidden by the
default "Full runs only" filter with no indication anything had
arrived, a failed API load rendered the onboarding wizard as if the
instance were simply new, and the setup wizard sat below four
marketing cards instead of leading the page. The projects list/detail
empty states pointed at "the API" instead of the reporter, and the
in-app API reference went blank with no error when its CDN script
failed to load.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ftWMgeiHBdLbMeE7WBZ2Z
The README and getting-started quick starts skipped the chown needed
for the container's non-root UID on Linux hosts (already documented in
DOCKER.md/docs/deployment.md, but not at the two entry points most
users follow). getting-started.md also taught the raw REST API before
the recommended reporter integration; the reporter section now comes
first and the curl example moves under an "optional" REST API section.
The findings have been applied; the report and its supporting
screenshots were a working document, not a permanent artifact.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ftWMgeiHBdLbMeE7WBZ2Z
execOpts.stdio was inferred as a readonly tuple via `as const`, which
doesn't satisfy execSync's mutable StdioOptions parameter type. Same
runtime behavior, now explicitly typed instead of relying on const
inference.
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report for Reporter (./reporter)

Status Category Percentage Covered / Total
🔵 Lines 63.89% 1446 / 2263
🔵 Statements 62.25% 1643 / 2639
🔵 Functions 70.43% 243 / 345
🔵 Branches 58.69% 1188 / 2024
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
reporter/src/internal/collect/metadata-collector.ts 88.41% 74.78% 100% 97.05% 49, 69, 71, 72, 73, 74, 75, 77-81, 83, 84, 85, 86, 87, 88, 89, 90, 97, 150, 202
reporter/src/internal/streaming/stream-manager.ts 68.94% 52.17% 78.57% 75.14% 134-173, 215-224, 233, 246, 256, 281, 299, 310, 326, 359-361, 372-424, 430-431, 433, 436, 446-448
reporter/src/internal/submit/run-submitter.ts 84.21% 76.92% 100% 82.85% 97-98, 186-187, 199-208, 213-215, 258-259
reporter/src/internal/submit/uploader.ts 90.29% 75% 83.33% 93.54% 151, 209-216, 230, 246, 264
reporter/src/internal/support/reporter-version.ts 100% 87.5% 100% 100%
reporter/src/internal/support/run-url.ts 100% 100% 100% 100%
reporter/src/internal/transport/http-client.ts 97.22% 82.22% 100% 97.1% 157, 199
Generated in workflow #884 for commit 10cb5ba by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report for Application (./application)

Status Category Percentage Covered / Total
🔵 Lines 23.57% 1815 / 7699
🔵 Statements 23.46% 2105 / 8970
🔵 Functions 22.53% 317 / 1407
🔵 Branches 20.14% 1437 / 7133
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
application/server/utils/auth.ts 2.91% 0% 0% 2.91% 15-162, 177-306
Generated in workflow #884 for commit 10cb5ba by the Vitest Coverage Report Action

@PhenX
PhenX merged commit 2303e28 into main Jul 16, 2026
7 checks passed
@PhenX
PhenX deleted the claude/ux-audit-onboarding-4iojuy branch July 16, 2026 11:20
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