Address cursor round-3 review feedback
- Group sweep cards and resolve project titles by scoped (environmentId, projectId) key — bare project ids can collide across connected environments. - Withdraw a settle recommendation from the card when the apply-time canSettle guard refuses it, instead of leaving a CTA the guard will keep rejecting. - Document why summarizeThread's two projection reads are ordered transcript-then-shell: reading the activity view last catches sessions that start mid-read, and the reverse skew only affects summary staleness — settles are re-validated at apply time and by the decider, so no consistency window can settle live work. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
b806ba34c2
commit
c68e9fa23c
3 files changed
+30
-10
No files matched your search
@@ -203,6 +203,12 @@ export const make = Effect.gen(function* () {
|
||||
// Never trust the client's canSettleNow alone: re-derive activity from the
|
||||
// server's own projection so a session that started (or approval/input
|
||||
// that appeared) after the client read its shell still blocks settling.
|
||||
// The shell is deliberately read AFTER the transcript: the two reads are
|
||||
// separate transactions, and reading the activity view last means a
|
||||
// session starting in between is still caught. The reverse skew (activity
|
||||
// ending in between) only staleness-affects the summary text — an actual
|
||||
// settle is re-validated by the client at apply time and by the decider's
|
||||
// thread.settle guards, so a recommendation can never settle live work.
|
||||
const shellOption = yield* projectionSnapshotQuery
|
||||
.getThreadShellById(input.threadId)
|
||||
.pipe(Effect.mapError(mapProjectionError));
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { scopedThreadKey } from "@t3tools/client-runtime/environment";
|
||||
import type { ProjectId } from "@t3tools/contracts";
|
||||
import {
|
||||
scopedProjectKey,
|
||||
scopedThreadKey,
|
||||
scopeProjectRef,
|
||||
} from "@t3tools/client-runtime/environment";
|
||||
import { Link } from "@tanstack/react-router";
|
||||
import { ArrowRightIcon, ListChecksIcon, RotateCcwIcon, XIcon } from "lucide-react";
|
||||
import { useMemo, useState } from "react";
|
||||
@@ -255,10 +258,15 @@ export function ReviewSweepView() {
|
||||
const truncatedCount = useReviewSweepStore((state) => state.truncatedCount);
|
||||
const projects = useProjects();
|
||||
|
||||
// Projects are only unique per (environmentId, projectId) — ids can
|
||||
// collide across connected environments.
|
||||
const projectTitles = useMemo(() => {
|
||||
const titles = new Map<ProjectId, string>();
|
||||
const titles = new Map<string, string>();
|
||||
for (const project of projects) {
|
||||
titles.set(project.id, project.title);
|
||||
titles.set(
|
||||
scopedProjectKey(scopeProjectRef(project.environmentId, project.id)),
|
||||
project.title,
|
||||
);
|
||||
}
|
||||
return titles;
|
||||
}, [projects]);
|
||||
@@ -271,13 +279,14 @@ export function ReviewSweepView() {
|
||||
[items, order],
|
||||
);
|
||||
const groups = useMemo(() => {
|
||||
const byProject = new Map<ProjectId, SweepItem[]>();
|
||||
const byProject = new Map<string, SweepItem[]>();
|
||||
for (const item of visibleItems) {
|
||||
const group = byProject.get(item.projectId);
|
||||
const key = scopedProjectKey(scopeProjectRef(item.ref.environmentId, item.projectId));
|
||||
const group = byProject.get(key);
|
||||
if (group) {
|
||||
group.push(item);
|
||||
} else {
|
||||
byProject.set(item.projectId, [item]);
|
||||
byProject.set(key, [item]);
|
||||
}
|
||||
}
|
||||
return [...byProject.entries()];
|
||||
@@ -361,10 +370,10 @@ export function ReviewSweepView() {
|
||||
were skipped this run.
|
||||
</p>
|
||||
) : null}
|
||||
{groups.map(([projectId, groupItems]) => (
|
||||
<section key={projectId} className="flex flex-col gap-2">
|
||||
{groups.map(([projectKey, groupItems]) => (
|
||||
<section key={projectKey} className="flex flex-col gap-2">
|
||||
<h2 className="text-xs font-medium uppercase tracking-wider text-muted-foreground/70">
|
||||
{projectTitles.get(projectId) ?? "Unknown project"}
|
||||
{projectTitles.get(projectKey) ?? "Unknown project"}
|
||||
<span className="ms-2 font-normal normal-case tracking-normal">
|
||||
· {groupItems.length} {groupItems.length === 1 ? "thread" : "threads"}
|
||||
</span>
|
||||
|
||||
@@ -276,6 +276,11 @@ export async function applySweepSettle(key: string): Promise<boolean> {
|
||||
description: "This thread picked up new activity since the review, so it stays active.",
|
||||
}),
|
||||
);
|
||||
// The recommendation is now known-stale — withdraw it so the card stops
|
||||
// advertising a settle the live guard just refused.
|
||||
store.patchItem(key, {
|
||||
result: { ...item.result, recommendSettle: false, settleReason: null },
|
||||
});
|
||||
return false;
|
||||
}
|
||||
const result = await runAtomCommand(
|
||||
|
||||
Reference in new issue
Block a user