Files
PaperClipAI/tests/e2e
kaluli123123andkaluli123123 68533743a2 fix(ui): settle Files reports and preserve sidebar navigation (#17296)
## Thinking Path

> - Paperclip shows workspace files next to an agent task.
> - The Files browser reports its current folder and search to the task
panel.
> - New callback identities repeatedly report identical state and
rerender the panel.
> - A stale task callback can also replace a new sidebar destination.
> - This pull request fixes notification identity and stale-path
navigation together.
> - Files can stay open without trapping navigation on the task.

## Linked Issues or Issue Description

Fixes: #15620

Thanks to @nunobarrosmir for the local-build diagnosis of both
mechanisms in this Issue. Related merged #17068 stabilizes tab widths,
not this synchronization boundary.

## What Changed

- Use the existing callback-ref pattern so callback identity changes do
not report unchanged browse state. Real state changes reach the latest
callback.
- Reject viewer URL updates from an obsolete pathname. Migrate both
provider and task-panel guard callers.
- Add browser/provider and real TaskSidePanel regression coverage, and
update the development guide.

## Verification

- RED: 4 failed, 88 passed across the three focused files. Failures
included the real panel/browser update loop and stale-path navigation.
- GREEN: from ui, `pnpm exec vitest run
src/components/WorkspaceFileBrowser.test.tsx
src/context/FileViewerContext.test.ts
src/components/task-side-panel/TaskSidePanel.test.tsx` — 92 passed.
- `pnpm check:token-gates` — passed.
- Real Chromium smoke mounted the actual WorkspaceFileBrowser and
FileViewerProvider against local empty-workspace API fixtures. The
inline state-updating parent settled with one report. After clicking
Dashboard, invoking the previous task's saved browse callback left the
browser on Dashboard with no task-path replacement. Temporary fixture
files were removed. This was a focused component/provider surface, not a
complete authenticated task installation.
- Independent read-only review checked latest-callback ordering and all
guard callers; no concrete blockers.
- UI `tsc --noEmit` failed on missing SDK/generated Storybook artifacts
and dependency errors outside the changed files. It did not pass.
- Same-base full checks in the independent SSH-fix worktree hit
test/typecheck deadlines and ENOSPC during build. They are not passes
for this branch and were not repeated here.
- `git diff --check` passed before commit.

## Risks

- The pathname guard intentionally discards late task-state reports
after navigation.
- Same-task folder changes, current search, and close behavior retain
regression coverage.
- Full validation, CI, and Greptile remain gates. Draft, not
merge-ready.

## Model Used

OpenAI `openai-codex/gpt-6.1-sol`, tool use and code execution;
context-window size is not exposed by the harness. TypeSafe `jev-1.14.0`
supplied advisory approach selection.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have linked the existing public Issue
- [x] I have not referenced internal/instance-local Paperclip issues or
links
- [x] My branch name describes the change and contains no internal
ticket id
- [ ] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge


## Append-only follow-up verification

- Appended commit `b14ebe622` without rewriting history. The existing
markdown-file-link fixture mocked a task pathname while jsdom remained
on `/`; it now models the actual browser pathname and restores the
original URL. This fixes the dependent regression without weakening the
stale-path guard.
- Four focused files now pass **102 tests**, including all 10
markdown-availability cases and the existing same-task/stale-path
navigation coverage.
- Original CI UI shard: 4,987 passed / 1 failed (the corrected fixture).
Server shard: 1,803 passed / 1 failed / 13 skipped, with
`login-cleanup-work.test.ts:119` observing active=1 instead of 0. E2E
shard: 15 passed / 1 failed / 1 skipped; `cases-read-only.spec.ts:130`
expected Done but saw All statuses, with an announcement handler also
active. The latter two are unchanged-area failures, not established
baseline failures, and remain gates.
- Replacement CI is pending. Prior UI typecheck/full-build limitations
remain. Draft, not merge-ready.

---------

Co-authored-by: kaluli123123 <295758798+kaluli123123@users.noreply.github.com>
2026-12-05 00:16:33 -08:00
..