Repository navigation
Conversation
|
🚨 SLOP COP 🚨 · I am the SlopCop. I am reviewing this change for security, code quality, performance, architecture, and end-to-end behavior. |
| // Reaching the bottom after the native-anchor guard above is an | ||
| // authoritative bottom position. A pending prepend restore must not | ||
| // survive and reinterpret a later follow-up as older-page growth. | ||
| cancelPendingPrependAnchor(); |
There was a problem hiding this comment.
🚨 slopcop/review — Real user scrolls bypass this cancellation.
The guard above returns while wheel, touch, keyboard, or pointer intent is recent. A manual scroll to the bottom therefore never reaches this new cancellation. The new test fires only a scroll event, so it misses this path. Later height growth can still apply the stale prepend anchor. Check the bottom position before the guard, or cancel the anchor inside the guarded bottom path.
| pendingScrollRestoreRef.current = null; | ||
| }, []); | ||
|
|
||
| const cancelPendingPrependAnchor = useCallback(() => { |
There was a problem hiding this comment.
🚨 slopcop/review — Failed older-page loads leave the stale anchor active.
The loader captures a prepend anchor before each request. Its rejection path only disables automatic loads. This cancel operation stays private, so that path cannot clear the anchor. A later timeline height increase can then look like older-page growth and move the viewport. Provide a paired cancel operation or a request-scoped anchor transaction, and cancel it when the load fails.
| let lastWidth: number | null = null; | ||
| let pendingVisibilitySnap = false; | ||
| const snapState: SnapState = { savedDuration: null, restoreFrame: null }; | ||
| applyHeight( |
There was a problem hiding this comment.
🚨 slopcop/review — Exit animations now snap too.
This call also handles visible changes from true to false. applyHeight treats that decrease as a snap and sets transitionDuration to 0s. This disables both the height and opacity exit transitions. The old code assigned the height directly, and snapOnEnter only promises an entry snap. Keep the direct assignment for normal exits, or pass a snap rule that affects entry only. Add an exit test because the new test covers only entry.
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
Plain-English summary
This change prevents long threads from jumping after a user loads older messages and sends a follow-up.
It clears old scroll positions and adds immediate layout updates for new prompts and work indicators.
Findings
I found three medium issues.
- A manual bottom scroll can bypass the new stale-anchor cancellation.
- A failed older-page request can keep its stale anchor active.
- Every
HeightTransitionexit now skips its height and opacity animation.
I left an inline comment for each issue.
The security review found no security, privacy, or trust-boundary risks.
The scan found no exact copy of this change. However, two height components repeat observer, visibility, snap, and cleanup logic.
A shared measured-height controller could reduce future policy differences after these fixes.
Validation
- All 52 focused tests passed.
- The
@bb/apptype check passed. - All GitHub checks passed.
- The browser test loaded 191 rows and then sent a follow-up after an older-page load.
- The viewport stayed within one pixel of the bottom during that primary path.
The synthetic fixture rejected provider execution because its workspace was unavailable. The optimistic user-row path still ran.
Please address the three inline findings before merge.
Summary
Testing
pnpm exec turbo run test --filter=@bb/app --force -- --run src/components/ui/bottom-anchored-scroll-body.scroll-preservation.test.tsx src/components/ui/height-transition.test.tsx src/components/thread/timeline/ThreadTimelineRows.actions.test.tsxpnpm exec turbo run typecheck --filter=@bb/app