Skip to content

fix(app): scroll active tab into view and validate USERNAME patch paths#1

Open
Copilot wants to merge 3 commits intodevfrom
copilot/verify-pull-request-fixes
Open

fix(app): scroll active tab into view and validate USERNAME patch paths#1
Copilot wants to merge 3 commits intodevfrom
copilot/verify-pull-request-fixes

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 28, 2026

Issue for this PR

Fixes anomalyco#11674
Fixes anomalyco#11687

Type of change

  • Bug fix

What does this PR do?

  • Fixes tab scroll behavior so a right-overflowed active tab scrolls the minimum needed distance into view.
  • Adds a Windows-only test for rejecting paths containing literal USERNAME in apply_patch.

How did you verify your code works?

  • Reviewed scroll math for both overflow directions.
  • Added a Windows-gated test for USERNAME path validation.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Copy Markdown

Hey! Your PR title [WIP] Verify and review recent pull request fixes doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

Copilot AI changed the title [WIP] Verify and review recent pull request fixes Fix tab scroll direction and add USERNAME path validation test Feb 28, 2026
Copilot AI changed the title Fix tab scroll direction and add USERNAME path validation test fix(app,opencode): scroll active tab into view on click and validate Windows USERNAME paths Feb 28, 2026
@Geralt4 Geralt4 changed the title fix(app,opencode): scroll active tab into view on click and validate Windows USERNAME paths fix(app): scroll active tab into view and reject Windows USERNAME paths Feb 28, 2026
@github-actions
Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown

Thanks for updating your PR! It now meets our contributing guidelines. 👍

# Conflicts:
#	packages/app/src/pages/session/session-side-panel.tsx
@Geralt4 Geralt4 changed the title fix(app): scroll active tab into view and reject Windows USERNAME paths fix(app): scroll active tab into view and validate USERNAME patch paths Mar 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 1, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Geralt4 Geralt4 marked this pull request as ready for review March 1, 2026 09:55
Copilot AI review requested due to automatic review settings March 1, 2026 09:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses two reported bugs: improving the Session side-panel tab strip auto-scroll so the newly-activated tab is scrolled the minimum distance into view, and adding coverage to ensure apply_patch rejects Windows paths containing a literal USERNAME.

Changes:

  • Adjust tab-list scrolling logic to scroll just enough left/right when the active tab is outside the visible area.
  • Add a Windows-gated test asserting apply_patch rejects patch paths containing the literal USERNAME.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/opencode/test/tool/apply_patch.test.ts Adds a Windows-only regression test for rejecting USERNAME in patch paths.
packages/app/src/pages/session/session-side-panel.tsx Updates the scroll math to minimally scroll the active tab into view depending on overflow direction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +77 to +83
test.if(process.platform === "win32")("rejects Windows path with unexpanded USERNAME on win32", async () => {
const { ctx } = makeCtx()
const patch = "*** Begin Patch\n*** Add File: C:\\Users\\USERNAME\\Documents\\file.txt\n+content\n*** End Patch"
await expect(execute({ patchText: patch }, ctx)).rejects.toThrow(
'Path contains "USERNAME" which may indicate an unexpanded',
)
})
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

bun:test in this repo commonly uses test.skipIf(...) or a runtime if (...) return for conditional execution, but this new test uses test.if(...) (which isn’t used elsewhere in the codebase). If test.if isn’t supported by the Bun version in CI, this will throw at module-eval time and fail the entire test file. Prefer test.skipIf(process.platform !== "win32")(...) (or an early-return inside the test body) to gate this on Windows while keeping the test registered/typed consistently.

Suggested change
test.if(process.platform === "win32")("rejects Windows path with unexpanded USERNAME on win32", async () => {
const { ctx } = makeCtx()
const patch = "*** Begin Patch\n*** Add File: C:\\Users\\USERNAME\\Documents\\file.txt\n+content\n*** End Patch"
await expect(execute({ patchText: patch }, ctx)).rejects.toThrow(
'Path contains "USERNAME" which may indicate an unexpanded',
)
})
test.skipIf(process.platform !== "win32")(
"rejects Windows path with unexpanded USERNAME on win32",
async () => {
const { ctx } = makeCtx()
const patch = "*** Begin Patch\n*** Add File: C:\\Users\\USERNAME\\Documents\\file.txt\n+content\n*** End Patch"
await expect(execute({ patchText: patch }, ctx)).rejects.toThrow(
'Path contains "USERNAME" which may indicate an unexpanded',
)
},
)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants