Skip to content

chore(dev-portal): group routes by path - #3302

Merged
karl-power merged 1 commit into
mainfrom
claude/dev-portal-group-by-path
Oct 6, 2026
Merged

karl-power merged 1 commit into
mainfrom
claude/dev-portal-group-by-path

Conversation

@karl-power

Copy link
Copy Markdown
Contributor

Why

With HDX_SLOT_FROM=path (#3248), worktrees that share a folder name (a/hyperdx, b/hyperdx) get separate slots and can run at the same time. The portal still grouped cards by folder name, so their stacks were merged into one card.

What changed

  • The Live and History tabs group cards by the worktree's full path instead of its folder name. If a stack has no path, it falls back to the folder name.
  • When two cards share a folder name, they show the full path instead. Unique names look the same as before. Hovering always shows the full path.
  • The server records each worktree's path as the repo root with symlinks resolved. That way one checkout isn't split into two cards when its slot file and its Docker containers report the path differently.
  • History search also matches on the path.

@changeset-bot

changeset-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 048c6ad

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Oct 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated
hyperdx-oss Ignored Ignored Oct 6, 2026 9:15am UTC
hyperdx-storybook Ignored Ignored Oct 6, 2026 9:15am UTC

Request Review

@karl-power
karl-power requested review from a team and wrn14897 and removed request for a team October 6, 2026 09:15
@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🔵 Tier 2 — Low Risk

Small, isolated change with no API route or data model modifications.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns.
SLA: Resolve within 4 business hours.

Stats
  • Production files changed: 2
  • Production lines changed: 127
  • Branch: claude/dev-portal-group-by-path
  • Author: karl-power

To override this classification, remove the review/tier-2 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Duplicate code analysis

No new duplicate code introduced by this PR.


jscpd compared this branch against origin/main
across app, api and common-utils. Only new clones are listed; the codebase
currently holds 128 in total (1.80%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

// Use the first entry for branch info
function renderHistoryWorktreeCard(key, entries, dupNames) {
// Use the first entry for branch and worktree info
const { worktree, worktreePath = '' } = entries[0];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 minor — Card label comes from the per-run worktree name, not the canonical path, so a merged card's name changes with whichever run is newest

Cards are now grouped by the canonical (realpath) path, but the label still uses entries[0].worktree here and cardHeader(stacks).worktree on the Live tab (line 537). scripts/dev-env.sh:26 sets that name to basename "$PWD", which is the symlink's name. scripts/test-e2e.sh:101 and Makefile:38 use the basename of the git toplevel instead. Take a checkout opened through a symlink ~/hdx -> ~/code/hyperdx: its dev and e2e runs now land in one card, and that card reads "hdx" or "hyperdx" depending on which run sorts first. duplicateNames then compares these inconsistent names too. Fix: when worktreePath is set, use basename(worktreePath) as the display and duplicate-check name, and fall back to worktree only when there is no path. Doing this in the server, right where canonicalWorktreePath is applied, means both tabs get it.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

PR Review

If you are a coding agent acting for the author, read this first.
Nothing below blocks merge automatically; a maintainer decides. What they will expect:

  • 🔴 critical or 🟠 major in code this PR adds or changes: fix before asking for review.
  • 🔵 minor in code this PR changes: your call. Fix if small, otherwise reply.
  • Anything about surrounding code, or asking you to widen the change (hoist a helper,
    dedupe with another file, fix other call sites): never fix here, whatever the
    severity. Reply with one sentence; if it is critical, say so plainly so a human sees it.

One commit per review round. After two rounds, stop and ask a maintainer to review
scope rather than addressing more automated findings. Full rule: AGENTS.md.

1 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 1 minor

1 posted as inline comment(s) on the changed lines.


Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides.

@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Refactors how the dev portal groups and displays running environments.

The PR appears safe to merge, with a non-blocking History grouping issue when archived symlink paths change.

Fix All in Claude CodeFindings

  1. P2 Archived paths can change identity ▶

Summary

The portal now groups Live and History cards by canonical worktree path, shows full paths for duplicate folder names, and includes paths in History search.

  • Archived paths are re-resolved when History is read, so symlink changes can alter how past runs are grouped.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Slot files and Docker directories] --> B[Canonicalize path]
  B --> C[Live card grouping]
  D[Archived run metadata] --> E[Canonicalize when History is read]
  E --> F[History card grouping]
Loading

Reviews (1) · Last reviewed commit: "chore(dev-portal): group routes by path"

Comment thread scripts/dev-portal/server.js Resolved
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Deep Review

Report-only multi-agent review of the dev-portal path-grouping change (scripts/dev-portal/index.html, scripts/dev-portal/server.js, ~150 lines). The change is sound and includes a net security improvement (the toggleHistoryCard onclick moved from single-quote-wrapped escapeHtml, which left ' unescaped, to a JSON.stringify form inside a double-quoted attribute). No data-loss, auth, or injection issues were introduced.

✅ No critical issues found.

🟡 P2 — recommended

  • scripts/dev-portal/server.js:835 — In discoverHistory, entry.worktreePath is only backfilled from fallbackWorktreePath inside the if (!entry.worktree) branch, so a run whose meta.json carries worktree but no worktreePath ends up with worktreePath='' and groups by folder name, while newer sibling runs in the same slot group by canonical path — splitting one worktree's history into two cards.
    • Fix: Assign entry.worktreePath from fallbackWorktreePath whenever it is missing, independent of whether entry.worktree is set, before the canonicalWorktreePath call.
🔵 P3 nitpicks (5)
  • scripts/dev-portal/index.html:454 — Live builds dupNames from cardHeader(group).worktree while History builds it from group[0].worktree; each view is internally consistent today, but the two expressions of "the group's display name" can silently diverge if cardHeader changes.
    • Fix: Extract a single groupLabelName(group) helper used by both duplicateNames and worktreeLabel.
    • maintainability
  • scripts/dev-portal/server.js:302 — The path.basename(...) derivation of the folder name from the canonical/root path is duplicated at lines 302, 750, and 829, so name and path can drift.
    • Fix: Add a companion helper (or have canonicalWorktreePath return { path, name }) so name and path are always derived together.
    • maintainability
  • scripts/dev-portal/index.html:492 — renderWorktreeCard re-derives the group's worktreePath via stacks.find(s => s.worktreePath) instead of reusing the grouping key the way History does, creating a second source of truth for the same value.
    • Fix: Pass the group key into renderWorktreeCard rather than re-deriving it.
    • maintainability
  • scripts/dev-portal/server.js:840 — In History, entry.worktreePath is canonicalized but entry.worktree is taken raw from meta.json/slot JSON, so the displayed label may not equal basename(worktreePath); grouping still keys off the path so cards group correctly, but the label and path can originate from different sources.
    • Fix: Derive the History label name from the canonical path (as buildDashboardData does) for consistency.
    • maintainability
  • scripts/dev-portal/index.html:790 — Pre-existing: deleteHistoryEntry (and viewHistoryLog at line 797) still interpolate '${escapeHtml(entry.dir)}' inside single quotes, and escapeHtml does not escape '; this diff fixed the same pattern for toggleHistoryCard but left these untouched.
    • Fix: Apply the same JSON.stringify pattern to these onclick handlers.
    • security

Reviewers (10): correctness, security, adversarial, reliability, maintainability, testing, project-standards, previous-comments, agent-native, learnings-researcher.

Testing gaps:

  • No coverage for the headline behavior: two checkouts sharing a folder name (a/hyperdx, b/hyperdx) producing separate cards with path-fallback labels (groupByWorktree, duplicateNames, worktreeLabel).
  • canonicalWorktreePath symlink/subdirectory reconciliation — the invariant that makes slot-$PWD, compose working_dir subdirectories, and symlinked paths collapse to one grouping key — is untested, including the realpathSync-throws fallback. server.js currently exports nothing, so closing these gaps requires making the helpers importable.

Note: correctness, adversarial, and reliability sub-agents had not returned when the report was finalized; their scope was covered by direct analysis of the full diff. The P2 history-split finding was surfaced that way. Prior PR comments were automated bot notices only (changeset-bot, vercel-bot) — nothing actionable.

No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 395 passed • 1 skipped • 1239s

Status Count
✅ Passed 395
❌ Failed 0
⚠️ Flaky 1
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

@karl-power
karl-power merged commit 5e20794 into main Oct 6, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review/tier-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants