Skip to content

FE-674: Show pending review rows in the patch overlay#116

Open
kostandinang wants to merge 7 commits into
ka/fe-674-cascade-producerfrom
ka/fe-674-cascade-pending-review
Open

FE-674: Show pending review rows in the patch overlay#116
kostandinang wants to merge 7 commits into
ka/fe-674-cascade-producerfrom
ka/fe-674-cascade-pending-review

Conversation

@kostandinang
Copy link
Copy Markdown
Contributor

@kostandinang kostandinang commented May 8, 2026

What

Surfaces the pending reconciliation needs that #115 started writing. The old "deferred — coming in V3" banner is gone.

Stacked on #115.

How

  • New GET /api/specifications/:id/reconciliation-needs returns open needs scoped to the spec.
  • Non-suspending React Query hook + invalidation helper.
  • patch-list-overlay: deferred banner removed; new Pending review region per need showing kind chip (supersedes / confirm) plus source → target refs.
  • The three overlay sections (staged, pending review, saved toast) now stack cleanly instead of fighting for top: 0.

Test plan

  • CI green
  • After a hard-impact edit, Pending review shows one row per downstream item
  • Cross-spec needs do not leak

@cursor
Copy link
Copy Markdown

cursor Bot commented May 8, 2026

PR Summary

Medium Risk
Moderate risk: adds a new API endpoint and client query path plus changes the hard-impact apply contract/overlay UI, which could affect edit apply/undo behavior and caching if the new invalidation/query wiring is off.

Overview
Adds the first reader for the reconciliation_need queue: a new GET /api/specifications/:id/reconciliation-needs endpoint (with 400/404 handling and spec scoping) plus a shared ReconciliationNeedRecord type for client consumption.

Updates the client to fetch and invalidate these open needs via new specificationQueryKeys.reconciliationNeeds, useSpecificationOpenReconciliationNeeds, and invalidateOpenReconciliationNeeds, and changes hard-impact edit apply results to drop the V2 deferred: true banner shape in favor of returning openedNeedIds.

Reworks PatchListOverlay to remove the hard-impact deferred banner and instead stack a new Pending review section (listing open needs) alongside the staged-changes bar and the saved-toast; tests are updated/added to cover the new endpoint, hook usage stubbing, and overlay rendering behavior.

Reviewed by Cursor Bugbot for commit 994c3f3. Bugbot is set up for automated code reviews on this repo. Configure here.

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 8, 2026

🤖 Augment PR Summary

Summary: This PR adds the first UI “reader” for V3.0 hard-impact reconciliation needs and removes the legacy V2 deferred banner.

Changes:

  • Server: adds GET /api/specifications/:id/reconciliation-needs to list open reconciliation_need rows (400 on non-numeric id, 404 on missing spec).
  • Shared: introduces ReconciliationNeedRecord in src/shared/reconciliation-need.ts so the client doesn’t import server DB types.
  • Client: adds a reconciliation-needs query key + non-suspending hook (useSpecificationOpenReconciliationNeeds) and invalidation helper.
  • UI: updates PatchListOverlay to render a “Pending review” section listing open needs; removes the deferred banner path.
  • Edit apply: hard-impact applies now return { impact: 'hard', previousContent, previousRationale, openedNeedIds } (no deferred: true) and invalidate the reconciliation-needs query to refresh the overlay.
  • Tests: adds route tests for listing open needs and updates overlay/side-chat tests to stub the new hook and assert the new UI surface.

Technical Notes: The reconciliation needs list is scoped by specification and excludes resolved rows; the overlay fetch is non-blocking (initial data []) so it doesn’t suspend rendering.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/client/components/patch-list-overlay.tsx Outdated
Comment thread src/client/lib/edit-applier.ts Outdated
Comment thread src/client/routes/specification/$id/-specification-data.ts
Comment thread src/client/lib/edit-applier.ts
@kostandinang kostandinang force-pushed the ka/fe-674-cascade-producer branch from 9755778 to 9944024 Compare May 11, 2026 09:47
@kostandinang kostandinang force-pushed the ka/fe-674-cascade-pending-review branch 2 times, most recently from 6bc0376 to fa2e56b Compare May 11, 2026 09:49
@kostandinang kostandinang requested a review from lunelson May 11, 2026 09:54
…V3.0 card 2)

The V3.0 hard-impact apply contract no longer carries a `deferred: true` shape
or any "Hard impact — coming in V3" banner copy. Open reconciliation_need rows
opened by card 1 now render in a "Pending review" section inside the patch
list overlay, satisfying the second clause of invariant I112 ("never returns
deferred: true") and the read side of the queue.

Server:
- New GET /api/specifications/:id/reconciliation-needs (handler in
  src/server/reconciliation-needs-route.ts) returns { openNeeds: [...] } for
  the spec; resolved rows excluded; cross-spec leakage prevented at the
  application layer; 404 / 400 on missing or non-numeric spec id.

Shared:
- New src/shared/reconciliation-need.ts — ReconciliationNeedRecord type so
  the client doesn't import server types.

Client:
- specificationQueryKeys gains `reconciliationNeeds(specId)`.
- New useSpecificationOpenReconciliationNeeds hook (non-suspending; initial
  data []) and invalidateOpenReconciliationNeeds() helper.
- edit-applier: hard-impact apply returns
  { impact: 'hard', previousContent, previousRationale, openedNeedIds }
  with no `deferred: true` field. Undo for hard apply remains a no-op (card 3
  ships real resolve semantics). Hard apply now also invalidates the
  reconciliation-needs query so the Pending review section refreshes.
- patch-list-overlay: deferred-banner code path removed. New "Pending review"
  region renders open needs with a kind chip (supersedes / confirm) and
  source/target item references. Region only shows when openNeedsCount > 0.
  Saved-toast continues to fire after any apply (including hard).

Tests:
- 6 new cases in reconciliation-needs-route.test.ts cover empty list, scoped
  list, resolved-row exclusion, cross-spec isolation, 404, 400.
- patch-list-overlay tests replace deferred-banner cases with Pending-review
  cases (rendering, empty state, co-existence with staged-changes, no V3
  banner copy, saved-toast after hard apply).
- side-chat-host tests stub the open-needs hook so PatchListOverlay can render
  without router/query scaffolding.
- -specification-data test asserts the new query-key list shape.
- edit-applier tests assert the new hard-impact applied shape and no-op undo.

Verified: npm run verify (1053 tests, 0 lint warnings).

SIDE_CHAT.md §5.1 soft-tier wording clarified to note no durable needs are
opened for the soft path (only hard fires Path 1).
Drop the private invalidateOpenReconciliationNeedsAfterApply copy and
import the body-identical invalidateOpenReconciliationNeeds already
exported from -specification-data.ts. specificationQueryKeys was already
imported from that module, so this is a one-line import addition with no
new dependency surface.
The staged-changes, Pending review, and saved-toast sections all used
sticky top-0 z-30 individually, which made them fight for the same
sticky offset when more than one was visible at a time (a real co-
occurrence: an open need plus the post-apply saved toast). Result: bars
visibly overlapped or covered each other while scrolling.

Wrap the three sections in a single sticky flex column so they share
one sticky context and stack vertically as one block — children no
longer need sticky/z-index themselves.
initialData: [] inherits the global staleTime: 30_000, which made React
Query treat the empty seed as fresh and skip the first fetch for 30s —
existing open needs were invisible in the Pending review section until
the stale window expired. initialDataUpdatedAt: 0 marks the seed as
stale so a background fetch runs immediately on mount.
@kostandinang kostandinang force-pushed the ka/fe-674-cascade-pending-review branch from fa2e56b to 7bade11 Compare May 11, 2026 10:04
Comment thread src/client/lib/edit-applier.ts
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fc59404. Configure here.

Comment thread src/client/components/patch-list-overlay.tsx Outdated
The class `text-text-sub` doesn't match any defined token; the theme
exposes `--color-sub` (utility `text-sub`). The misnamed class was
silently dropped, so the pending-review `<ul>` inherited `text-ink`
instead of the intended subdued gray.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kostandinang kostandinang changed the title FE-674: Surface open reconciliation_need rows; drop deferred banner (V3.0 card 2) FE-674: Show pending review rows in the patch overlay May 11, 2026
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.

1 participant