Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fe485fc
wip(shift-manager): FIX-2775 screens off the snapshot
claude Nov 20, 2026
a86d6eb
wip: allowlist, reads.ts and derive.ts shrink
claude Nov 20, 2026
69cbf78
wip(react): pin topicPrefix live paths, held read mode by value, fail…
claude Nov 20, 2026
e152d89
wip: tests onto the directory reads
claude Nov 20, 2026
eb836e2
wip: more tests onto the package reads
claude Nov 20, 2026
57700a1
wip: changeset, leftover snapshot fields, tests
claude Nov 20, 2026
90017e8
wip: unexport what only its module uses
claude Nov 20, 2026
b06ef99
wip: directory test, goal controls retargeted, shell test waits for t…
claude Nov 20, 2026
02a24f2
wip: frame waits for the directory's first reads; keys bound at commi…
claude Nov 20, 2026
1c5a7fd
wip: shell test (FIX-2775)
claude Nov 20, 2026
baa400f
test(shift-manager): usage reads wait for both answers, not 20 ms (FI…
claude Nov 20, 2026
d789611
refactor(shift-manager): the directory's reads name entries and value…
claude Nov 20, 2026
096798b
docs(shift-manager): the directory's comments name workers and entrie…
claude Nov 20, 2026
b8d86d9
goal(shift-manager): one answer leg and status-from-snapshot control …
claude Nov 20, 2026
82c99e4
goal(shift-manager): one answer reads the page's states with a script…
claude Nov 20, 2026
8ee63f4
goal(shift-manager): it-shows-who-is-on-shift verdicts for FIX-2775 PR 3
claude Nov 20, 2026
30f36df
fix(shift-manager): R reads again each screen's own reads (FIX-2775)
claude Nov 20, 2026
b9be665
fix(shift-manager): one definition per moved name, no import cycle, n…
claude Nov 20, 2026
44ff6ed
docs(shift-manager): page-reads names the user, not a person (FIX-2775)
claude Nov 20, 2026
68da78f
goal: import Worker and toWorker from workers.ts, not reads.ts (FIX-2…
claude Nov 20, 2026
c235eb9
fix(shift-manager): the frame waits for the roster, shows a failed se…
claude Nov 20, 2026
25b6080
check(FIX-2775): the built census lets FIX-2777's allowlist shrink, n…
claude Nov 20, 2026
a449098
goal(realtime): app-views-read-on-notice verdicts for FIX-2775 PR 3
claude Nov 20, 2026
2dc5566
goal(shift-manager): it-opens-a-lab grades the task frame's title onc…
claude Nov 20, 2026
d797775
Merge origin/main into fix-2775-screen-migration
claude Nov 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/shift-manager-directory-follows-changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@flow-state-dev/shift-manager": patch
---

Shift Manager's directory screens follow changes made elsewhere (FIX-2775). Roster, the sidebar's TEAMS, PROJECTS and counts, Jump to, a project, Messages, Routines, Usage and Settings read the Lab's views and collections directly and stay current on their own: a hire, a new project, a paused routine or a new message from another tab or a worker's turn shows when its read hears it, not on the next whole-Lab read. A worker's on-shift status moves in the same update as the Inbox, so the two always agree. Lists show every row past 200, Retry and R read again what the screen shows, and a Lab that refuses Shift Manager or can't be reached gets the same page and words as before.

Docs: packages/shift-manager/README.md (the directory screens read live; R reads what the page holds again)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** The Lab, scripted: no client calls, no snapshot. See `../shared.ts`. */
export * from "../../../lib/lab-data";
const lab = { client: { userId: "alice" }, refresh: async () => undefined, answered: undefined, snapshot: undefined };
const lab = { client: { userId: "alice" }, refresh: async () => undefined, snapshot: undefined };
export const useLab = () => lab as never;
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { Conversation } from "../../components/Conversation";
import { toWorker } from "../../lib/reads";
import { toWorker } from "../../lib/workers";
import { TaskSession } from "../../surfaces/TaskSession";
import "../../styles.css";
import { exposeGoal, script } from "../script";
Expand Down
3 changes: 2 additions & 1 deletion goals/harness-manager/a-runs-changes-wait-for-review/run.mts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ import { LAB_ORG_ID, LAB_USER_ID, openLab, type Lab } from "../../../packages/sh
import { commitAll, createBareRemote } from "../../../packages/shift-manager/teams/devteam/scratch-repo.mts";
import { LIST_TASKS_ACTION } from "../../../packages/shift-manager/src/lib/conversation-tasks.ts";
import { connect } from "../../../packages/shift-manager/src/lib/connection.ts";
import { CONVERSATION_BOARD_COLLECTION, createLabReader } from "../../../packages/shift-manager/src/lib/reads.ts";
import { createLabReader } from "../../../packages/shift-manager/src/lib/reads.ts";
import { CONVERSATION_BOARD_COLLECTION } from "../../../packages/shift-manager/src/lib/boards.ts";

stripIntentOverrides();

Expand Down
4 changes: 3 additions & 1 deletion goals/realtime/app-views-read-on-notice/goal.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
**Signal:**
- `a:within-1s` — after another client sends a slow turn into the watched session, the claude-code-style thread and the Teammates conversation report it running, Shift Manager's conversation shows its reply; after a pin the pins view shows it; after a message is logged the Talk panel and Shift Manager's message log show it; and after a workstream entry is written the project view lists it; each less than 1000 ms after the write.
- `a:within-1s` (task screen) — the task screen shows the run the board links less than 1000 ms after the link's write.
- `a:lab-read` — a Lab read (Shift Manager's Refresh) reads the message log and the project's entries again, each within 1000 ms.
- `a:lab-read` — a Lab read (Shift Manager's R, which reads again what the page holds; its snapshot Refresh before FIX-2775) reads the message log and the project's entries again, each within 1000 ms.
- `a:idle-0-reads` — over a 10 s idle window, each of the eight views makes 0 reads; and over 10 s waiting on its run's link, the task screen makes 0 board reads.
- `b:as-short` — during a 200-item reply each request view (thread running turn, Teammates answering, divider) makes the same number of reads as during a 2-item reply that takes as long, and Shift Manager's conversation makes none. The two replies last the same time so they differ only in items: how a request's own notices coalesce depends on how far apart they land.
- `c:within-poll` — with no crossing bus, the pins view shows a pin within 3 s + 1 s, the Teammates conversation a turn and the Talk panel a message within 1.5 s + 1 s, Shift Manager's message log a message and its project view an entry within 5 s + 1 s, and the task screen its run link within 2 s + 1 s.
Expand Down Expand Up @@ -53,3 +53,5 @@
| 2026-11-19 | fix/FIX-2846-fallback-read (pre-push) | n/a | FAIL (red) | Scratch edit: the task-list view given `pollIntervalMs: null`, so the waiting screen has no timer. `c:fallback-reads`: task run link made no read over 6 s |
| 2026-11-19 | fix/FIX-2846-fallback-read (pre-push) | n/a | FAIL (expected) | `timer`: `a:idle-0-reads` (task run link 3 board reads while waiting; 4, 4, 7, 14, Talk 7, entries 2, log 2 idle) |
| 2026-11-19 | fix/FIX-2846-fallback-read (pre-push) | n/a | FAIL (expected) | `every-kind`: `b:as-short` (102/105/106 reads for 200 items against 5/5/8 for 2) |
| 2026-11-20 | fix-2775-screen-migration on 8ee63f43e0 (FIX-2775 PR 3) | n/a | FAIL | Before R read the screens' own reads: *"a:lab-read: Shift Manager message log read never after a Lab read (bound 1000)"*, and the same for the project entries. The log and the entries no longer re-read on the snapshot's `readAt`, and R read only the directory and the Inbox |
| 2026-11-20 | fix-2775-screen-migration on 25b6080c9f | n/a | PASS | `a:lab-read` now presses Shift Manager's R (`useReadPageAgain`): *"a: read again after a Lab read: Shift Manager message log 0 ms, Shift Manager project entries 0 ms · a: 0 reads over 10 s idle in each of 8 views"* |
33 changes: 18 additions & 15 deletions goals/realtime/app-views-read-on-notice/run.mts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* id), both read by the conversation's follower, and its Talk lines (`useTalk`,
* workforce's worker messages view), under its `AppProvider`, and Shift Manager's worker
* conversation (the client's `sessionFeed`, which its shared session feed holds), its message log
* (`useMessages`), a project's entries (`useProjectRead`) and a task screen
* (`useMessages`), a project's entries (`useProjectWorkstreams`) and a task screen
* waiting on its run's link (`TaskProvider`), the last three under the real
* `LabProvider`, rendered by react-dom over happy-dom. Each view has its own
* client, whose fetcher counts the reads it makes.
Expand Down Expand Up @@ -68,9 +68,10 @@ import type { ConversationView } from "../../../labs/teammates/src/lib/conversat
import { useTalk } from "../../../labs/teammates/src/lib/talk.ts";
import { kitchenSinkWorkforce } from "../../../apps/kitchen-sink/lib/workforce-kit.ts";
import { LabProvider, useLab } from "../../../packages/shift-manager/src/lib/lab-data.tsx";
import { useProjectRead } from "../../../packages/shift-manager/src/lib/projects.ts";
import { useProjectWorkstreams } from "../../../packages/shift-manager/src/lib/projects.ts";
import { useMessages } from "../../../packages/shift-manager/src/lib/messages.ts";
import { conversationBoardRef } from "../../../packages/shift-manager/src/lib/reads.ts";
import { PageReadsProvider, useReadPageAgain } from "../../../packages/shift-manager/src/lib/page-reads.tsx";
import { conversationBoardRef } from "../../../packages/shift-manager/src/lib/boards.ts";
import { TaskProvider, useTask } from "../../../packages/shift-manager/src/lib/task.tsx";

const CONTROL = process.env.GOAL_CONTROL ?? "";
Expand Down Expand Up @@ -377,23 +378,25 @@ function mountViews(on: Host, sessionId: string) {
pageReads.set(smToken, smReads);
const smProject = record<ProjectShown>();
const smMessages = record<string[]>();
let labRead: () => Promise<void> = async () => {};
let labRead: () => void = () => {};
function ProjectProbe() {
const { snapshot, refresh } = useLab();
labRead = refresh;
const { snapshot } = useLab();
// FIX-2775: R reads again what the page holds, each screen's own reads included.
labRead = useReadPageAgain();
const loaded = snapshot !== undefined && snapshot.refused === undefined && snapshot.unreachable === undefined ? snapshot : undefined;
const { read } = useProjectRead({ visibility: "shared", id: PROJECT }, loaded !== undefined, loaded?.readAt ?? 0);
const entries = read !== undefined && "value" in read && read.value !== null ? read.value.entries.map((e) => e.id) : undefined;
// FIX-2775: the entries are read on their own, by the project's prefix, from the moment the view draws them.
const { value } = useProjectWorkstreams({ visibility: "shared", id: PROJECT });
const entries = value === undefined ? undefined : value.entries.map((e) => e.id);
const key = entries === undefined ? null : entries.join(",");
useEffect(() => {
if (entries !== undefined) smProject.push({ at: Date.now(), value: { entries } });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [key]);
// The Messages view reads the log once the snapshot has landed, on its `readAt`.
return loaded === undefined ? null : createElement(MessagesProbe, { readAt: loaded.readAt });
// The Messages view reads the log once the Lab has let Shift Manager in.
return loaded === undefined ? null : createElement(MessagesProbe);
}
function MessagesProbe({ readAt }: { readAt: number }) {
const { rows } = useMessages(readAt);
function MessagesProbe() {
const { rows } = useMessages();
const ids = rows == null ? undefined : rows.map((m) => m.id);
const key = ids === undefined ? null : ids.join(",");
useEffect(() => {
Expand All @@ -403,7 +406,7 @@ function mountViews(on: Host, sessionId: string) {
return null;
}
const smRoot: Root = createRoot(happy.document.createElement("div") as unknown as Element);
smRoot.render(createElement(LabProvider, { connection: { userId: "alice", bearerToken: smToken, baseUrl: on.base }, children: createElement(ProjectProbe) }));
smRoot.render(createElement(LabProvider, { connection: { userId: "alice", bearerToken: smToken, baseUrl: on.base }, children: createElement(PageReadsProvider, { children: createElement(ProjectProbe) }) }));
const stops = [
() => ccRoot.unmount(),
() => tmRoot.unmount(),
Expand Down Expand Up @@ -432,7 +435,7 @@ function mountViews(on: Host, sessionId: string) {
const logReads = () => smReads.filter((r) => r.url.includes("workforce/messages"));
return {
shown: { ccThread, ccPins, tmConversation, smItems, tmTalk, smProject, smMessages },
labRead: () => labRead(),
labRead: async () => labRead(),
reads: {
"claude-code-style thread (running turn)": () => turnReads(cc.reads),
"claude-code-style pins": () => pinsClient.reads,
Expand Down Expand Up @@ -618,7 +621,7 @@ await runGoal(async (failures, tell) => {
else if (waitReads === 0) evidence.push(`a: task screen read its board 0 times over ${IDLE_MS / 1000} s waiting, and showed the run link ${linkShown} ms after its write`);
task.close();

// A Lab read (the snapshot read again, here as the user's Refresh) reads the log and the entries again, as it did before.
// A Lab read (Shift Manager's R, which reads again what the page holds) reads the log and the entries again, as it did before.
await quiet(views.all);
const onLabRead = ["Shift Manager message log", "Shift Manager project entries"];
const readsBefore = new Map(onLabRead.map((name) => [name, views.reads[name]!().length]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { REPO_ROOT, goalTmpDir, loadFixture, runGoal, silentLogger, sleep } from
import { assertPatched, describePatches, modulePatchEnv, type ModulePatch } from "../../lib/module-patch.mts";
import * as contract from "../../../labs/test-support/contract.ts";
import type { ScriptedCall, ScriptedStep } from "../../../labs/test-support/contract.ts";
import type { Routine } from "../../../packages/shift-manager/src/lib/routines.ts";
import type { ListedRoutine as Routine } from "@flow-state-dev/workforce/browser";
import { build } from "esbuild";
import { openTeammates } from "../../../labs/teammates/host.mts";
import { openClaudeCodeStyle } from "../../../labs/claude-code-style/host.mts";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import { LAB_ORG_ID, LAB_USER_ID, openLab, type Lab } from "../../../packages/sh
import { commitAll, createBareRemote } from "../../../packages/shift-manager/teams/devteam/scratch-repo.mts";
import { LIST_TASKS_ACTION } from "../../../packages/shift-manager/src/lib/conversation-tasks.ts";
import { connect } from "../../../packages/shift-manager/src/lib/connection.ts";
import { CONVERSATION_BOARD_COLLECTION } from "../../../packages/shift-manager/src/lib/reads.ts";
import { CONVERSATION_BOARD_COLLECTION } from "../../../packages/shift-manager/src/lib/boards.ts";
import { inboxViewRef } from "@flow-state-dev/workforce/browser";

stripIntentOverrides();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import type { SessionSummary } from "@flow-state-dev/client";
import type { OutputItem } from "@flow-state-dev/core/items";
import { useWorkerConversation as useStoredConversation, type WorkerConversation } from "../../../../packages/shift-manager/src/lib/conversation.ts";
import type { Worker } from "../../../../packages/shift-manager/src/lib/reads.ts";
import type { Worker } from "../../../../packages/shift-manager/src/lib/workers.ts";

export * from "../../../../packages/shift-manager/src/lib/conversation.ts";
export * from "../../../../packages/shift-manager/src/lib/deliver.ts";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Lab holds. The goal must fail at "a project's four tabs".
*/
import { EmptyState, Tabs } from "../../../../packages/shift-manager/src/components/ui";
import type { LoadedSnapshot } from "../../../../packages/shift-manager/src/lib/derive";
import { navigate, PROJECT_TABS, type ProjectTab, type Route } from "../../../../packages/shift-manager/src/lib/routes";
import type { Gaps } from "../../../../packages/shift-manager/src/gaps";

Expand All @@ -24,7 +23,7 @@ const GAP_COPY: Record<ProjectTab, { title: string; body: string }> = {
brief: { title: "No project brief yet", body: "A project's brief arrives with FIX-1650." },
};

export function ProjectView({ route }: { snapshot: LoadedSnapshot; route: Extract<Route, { level: "project" }>; gaps: Gaps }) {
export function ProjectView({ route }: { route: Extract<Route, { level: "project" }>; gaps: Gaps }) {
const { projectId, tab } = route;
const gap = GAP_COPY[tab];
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/**
* Control `unread`: Shift Manager that never groups by the Lab's projects.
*
* Built into the control page in place of `src/lib/derive.ts`. Everything is
* the real module except `projectsOf`, which ignores the project rows.
* `ProjectsView` is the project list alone, so the control returns none of
* them. The goal must fail at "PROJECTS equals the store's rows".
* Built into the control page in place of `src/lib/directory.tsx`. Everything
* is the real module except `useProjects`, which ignores the project rows: a
* projects read that landed holds none of them. The goal must fail at
* "PROJECTS equals the store's rows".
*/
import { projectsOf as groupedAsWritten, type LoadedSnapshot } from "../../../../packages/shift-manager/src/lib/derive.ts";
import { useProjects as readAsWritten } from "../../../../packages/shift-manager/src/lib/directory.tsx";

export * from "../../../../packages/shift-manager/src/lib/derive.ts";
export * from "../../../../packages/shift-manager/src/lib/directory.tsx";

/** No projects: the stored rows are never read into the grouping. */
export function projectsOf(snapshot: LoadedSnapshot): ReturnType<typeof groupedAsWritten> {
if (!snapshot.projects.ok) return snapshot.projects;
return { ok: true, value: { projects: [] } };
export function useProjects(): ReturnType<typeof readAsWritten> {
const read = readAsWritten();
return read.section?.ok === true ? { ...read, section: { ok: true, value: [] } } : read;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

**Controls:** the page controls rebuild Shift Manager with one source module swapped for one under `controls/`, as `it-opens-a-lab` does; the build fails if the swap never fired. The server controls load the Lab with a Node module hook (`controls/swap-hook.mjs`) that swaps one source module, and the run fails if no import was swapped.

- `GOAL_CONTROL=unread`: `projectsOf` ignores the stored project rows and returns none. Must fail at **PROJECTS equals the store's rows** (the sidebar draws no project against the stored rows). With no project grouped, every project's page is "No such project", so the four tabs and the entries leg fail with it. `ProjectsView` is only `{ projects }`, so this control no longer draws a flat `:unassigned` workstream list. Verdict rows before 2026-10-11 that say `PROJECTS draws :unassigned[...]` are that older shape.
- `GOAL_CONTROL=unread`: `useProjects` (`src/lib/directory.tsx`; `projectsOf` in `derive.ts` before FIX-2775) ignores the stored project rows and returns none. Must fail at **PROJECTS equals the store's rows** (the sidebar draws no project against the stored rows). With no project grouped, every project's page is "No such project", so the four tabs and the entries leg fail with it. `ProjectsView` is only `{ projects }`, so this control no longer draws a flat `:unassigned` workstream list. Verdict rows before 2026-10-11 that say `PROJECTS draws :unassigned[...]` are that older shape.
- `GOAL_CONTROL=gap-tabs`: the project level as it was before projects, every tab a FIX-1650 empty state. Must fail at **a project's four tabs**; with no Stream to ask in, the entries leg fails with it.
- `GOAL_CONTROL=no-gate`: `membership-gate.ts` answers yes for everyone. Must fail at **the outsider's open is refused**, and only there.
- `GOAL_CONTROL=no-tool`: the Lab's `host.mts` is swapped for one whose `openLab` leaves the project tools out of the catalog the Shift Coordinator's turn is built with and out of every worker's `tools:`, as before the Shift Coordinator had them. The Lab boots as before. Must fail at **shift-coordinator**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
*
* Controls (each must fail; the run fails if a swap never fired):
*
* unread projectsOf returns no projects (Vite swap of derive.ts).
* unread useProjects answers no projects (Vite swap of directory.tsx).
* Must fail at "PROJECTS equals the store's rows".
* gap-tabs the project level as it was before projects (Vite swap of
* Project.tsx). Must fail at "a project's four tabs".
Expand Down Expand Up @@ -158,7 +158,7 @@ const diff = (want: Iterable<string>, got: Iterable<string>) => {

/** The page control's module swap: which Shift Manager source, for which module under `controls/`. */
function pageSwapFor(control: string): { target: string; with: string } | undefined {
if (control === "unread") return { target: join(SHIFT_MANAGER, "src", "lib", "derive.ts"), with: join(HERE, "controls", "unread.ts") };
if (control === "unread") return { target: join(SHIFT_MANAGER, "src", "lib", "directory.tsx"), with: join(HERE, "controls", "unread.ts") };
if (control === "gap-tabs") {
return { target: join(SHIFT_MANAGER, "src", "surfaces", "Project.tsx"), with: join(HERE, "controls", "gap-tabs.tsx") };
}
Expand Down
Loading
Loading