Skip to content

feat(web): show project in session header - #1635

Open
swear01 wants to merge 2 commits into
tiann:mainfrom
swear01:feat/session-header-project-path
Open

feat(web): show project in session header#1635
swear01 wants to merge 2 commits into
tiann:mainfrom
swear01:feat/session-header-project-path

Conversation

@swear01

@swear01 swear01 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add configurable Project metadata to the session header (enabled by default)
  • derive worktree projects from metadata.worktree.basePath and simple sessions from metadata.path
  • keep project and worktree branch independent on desktop; prioritize project on mobile
  • reuse the project label formatter in the session sidebar and share metadata
  • add English/Chinese labels and regression coverage

Closes #1395

Testing

  • bun typecheck
  • bun run test
  • CI=1 PLAYWRIGHT_WEB_PORT=5187 bun run test:e2e -- terminal-wrap-fidelity.spec.ts composer-copy.spec.ts

@github-actions github-actions 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.

Findings

  • [Minor] Blank worktree base paths fall through to the checkout path — basePath || metadata.path treats a worktree with an empty/whitespace basePath as a simple session. The header, share image, and sidebar then expose/group by the worktree checkout path instead of hiding an unknown repository project, contrary to this helper's worktree-vs-simple contract. Evidence web/src/lib/sessionProjectLabel.ts:11.
    Suggested fix:
    export function getSessionProjectPath(metadata: SessionProjectMetadata | null | undefined): string | null {
        if (metadata?.worktree) return metadata.worktree.basePath?.trim() || null
        return metadata?.path?.trim() || null
    }

Summary

  • Review mode: initial
  • One minor correctness issue found in project-path fallback handling. No blocker or major issue found in the modified lines.

Testing

  • Not run (automation; PR code was not executed).
  • Add a regression case where worktree.basePath is blank and metadata.path points at the checkout; expect no project path rather than the checkout path.

HAPI Bot

Comment thread web/src/lib/sessionProjectLabel.ts Outdated
/** Use the repository path for worktrees and the session path otherwise. */
export function getSessionProjectPath(metadata: SessionProjectMetadata | null | undefined): string | null {
const basePath = metadata?.worktree?.basePath?.trim()
const path = basePath || metadata?.path?.trim()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MINOR] Blank worktree base paths fall through to the checkout path

Because basePath and metadata.path are combined with ||, a worktree whose basePath is empty/whitespace is treated like a simple session. That makes all three consumers show/group by the checkout path even though the helper contract says worktrees use the repository base path and simple sessions use metadata.path.

Suggested fix:

if (metadata?.worktree) return metadata.worktree.basePath?.trim() || null
return metadata?.path?.trim() || null

Please also cover a blank worktree.basePath with a nonblank checkout path in sessionProjectLabel.test.ts.

@github-actions github-actions 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.

Findings

  • None.

Summary

  • Review mode: follow-up after new commits
  • No blocker, major, minor, or nit findings in the latest full diff. The previous blank-worktree-base-path issue is fixed at web/src/lib/sessionProjectLabel.ts:10, with regression coverage at web/src/lib/sessionProjectLabel.test.ts:25.
  • Residual testing gap: no browser-level assertion covers the rendered mobile project priority or project metadata in the share preview; the selector/helper coverage limits the remaining risk.

Testing

  • Not run (automation; source-only review).
  • Suggested: add a focused UI assertion for mobile project rendering and share-preview project inclusion when those paths are next exercised.

HAPI Bot

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.

feat(web): show project/path in configurable session header

1 participant