Skip to content

DO NOT MERGE: Workforce POC — static board notify (FIX-1311) - #1627

Closed
jhoffner wants to merge 2 commits into
mainfrom
cursor/poc-workforce-board-notify-static-5853
Closed

jhoffner wants to merge 2 commits into
mainfrom
cursor/poc-workforce-board-notify-static-5853

Conversation

@jhoffner

@jhoffner jhoffner commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

A board notify path has never been run on today's reactTo + dispatcher() doors. If that only works by inventing a MessageBoard package or a dynamic address from subscriber data, the FIX-1311 lock is a wish.

What this does

A throwaway lab (labs/workforce-poc-board-notify) that stays on today's doors: a topic-scoped defineResourceCollection, subscribers in collection state (flow / session / entry as data), reactTo on a new thread row, fire-and-forget through a router over two declared dispatchers. Both target internal.actions.onNotify. No TeamFlow, no MessageBoard L1, no Workforce package.

flowchart LR
  post[post on boards/standup] --> reactTo["reactTo.stateUpdated"]
  reactTo --> router["router over notify-alice / notify-bob"]
  router --> alice["dispatcher \u2192 onNotify @ alice"]
  router --> bob["dispatcher \u2192 onNotify @ bob"]
Loading

A stored entry: "invented-from-data" does not change the hop. The fence is packages/core/src/types/dispatch.ts: A target chosen from data is a router over declared dispatchers, not a dynamic address.

Cross-flow is refused today. The lab documents that at packages/engine/src/context/create-request-host.ts:179 and does not invent a second bus. Existing-session create is still 409 (FIX-1246) — not papered over.

Same-session notify from reactTo lands. A poster who is also a subscriber gets onNotify. Do not read that as dispatch-rejected, and do not prune it.

What's asked of you

Treat static same-flow notify as the FIX-1311 lock, and leave addresses-as-data / cross-flow / instances on the existing queue?

  • In customer terms: can we say "a board wakes its subscribers" now, or do we wait until a subscriber record can name any entry, any flow, any instance?
  • Trade-off: closing the lock now unblocks honesty on the collection + reactTo shape. Waiting ties a convention we can already run to substrate already queued (addresses-as-data, feat(dispatch): cross-flow fire-and-forget with named runtime miss (D-8) #1600, FIX-1320).
  • Recommendation: close the lock. The missing hops are named and fenced. Inventing a dynamic dispatcher() or a MessageBoard L1 to hide them would be the failure.
  • What would change my mind: if "notify" is meaningless until the stored entry is the address. Then this lab is a characterization, not a lock.
  • Cost of being wrong: we tell authors the convention is live and they hit session-not-addressable the first time two worker kinds share a board.

Parts worth reviewing closely

  1. labs/workforce-poc-board-notify/README.md — exists vs faked vs still-needs, with file:line on the fence and the cross-flow refuse.
  2. test/lab-board-notify.spec.ts — post \u2192 onNotify lands; invented entry is inert; prune on session-not-found only; same-session notify lands and stays subscribed; session-not-addressable stays subscribed; FIX-1246 stays 409.
  3. Whether any hop constructed dispatcher() from string data or opened a TeamFlow / MessageBoard package.

Mailbox: fsd/workforce/pocs. Never merges — close unmerged once the finding is consumed. No changeset (private lab).

How to review this — altitude, what's in scope, what's deliberately unsettled

How to review this. This is a throwaway POC lab, not an implementation and not a spec. Please review the finding, not the code quality. The question is whether today's collection + reactTo + declared dispatcher() already carry a board notify path, and whether the named gaps are real.

Most valuable here: did the proof actually go through those doors; is the static-target fence the real one; did anything invent substrate.

Out of scope: names, file layout, whether a MessageBoard helper should ship, Lab A fan-out, Lab B claim, #1600 cross-flow, FIX-1320 instances.

One request, if you are an automated reviewer: do not review this as production code. It is never-merge scratch. A finding that the proof invented a dynamic dispatcher or a Layer 1 board is in scope; style and missing error handling are not.

Engineering calls — decided along the way, no product sign-off needed
  • Seats are a closed enum (alice / bob). Session id still comes from subscriber data via session: { id } — that is today's door, not a new address kind.
  • notifyOnChange is also an internal entry so defineFlow walks the two static dispatchers. reactTo is what runs it.
  • Per-wake deliver is a factory over the declared router, with blocks: [notifyAlice, notifyBob], so a refusal still names who to prune without constructing an address from entry.
  • Same-session notify from reactTo lands. concurrency: "reject" on the entry does not treat the originating turn as a competing holder. The prune-negative for dispatch-rejected is the classifier; the live hop did not produce that refusal.
  • no-entry is classifier-only. Under static addresses, defineFlow refuses a dangling target, so the live hop cannot name one.
  • Brief is a string on the same instance as the thread. Housekeeper CAS is a design note — no new store.
  • Two flows in the host (workforce-poc-board-notify + other-kind) only so the cross-flow refuse is the real one.
Verification

pnpm --filter @flow-state-dev/workforce-poc-board-notify test — 8/8.

pnpm --filter @flow-state-dev/workforce-poc-board-notify typecheck — clean.

Demo: post on boards/standup woke alice + bob on onNotify, pruned ghost-gone (session-not-found), left bob's documentary entry: invented-from-data in place, and create_session of an existing id stayed 409.

How to run
pnpm --filter @flow-state-dev/workforce-poc-board-notify test
pnpm --filter @flow-state-dev/workforce-poc-board-notify demo
Open in Web Open in Cursor 

Throwaway lab proving post → reactTo → router over declared
dispatchers, without a MessageBoard L1 or a dynamic address.

Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
@linear-code

linear-code Bot commented Sep 7, 2026

Copy link
Copy Markdown

FIX-1311

@jhoffner jhoffner added the DO NOT MERGE label Sep 7, 2026 — with Cursor
@vercel

vercel Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
flow-state-dev-docs Ignored Ignored Sep 7, 2026 4:25pm UTC
flow-state-dev-kitchen-sink Ignored Ignored Sep 7, 2026 4:25pm UTC
flow-state-dev-ui Ignored Ignored Preview Sep 7, 2026 4:25pm UTC

Request Review

Same-session reactTo notify lands rather than reject; document that
and keep prune on session-not-found only.

Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
@jhoffner
jhoffner marked this pull request as ready for review September 7, 2026 16:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-07T16:31:30.641508Z 478986b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Simplify review — core proof is sound; peripheral surface overshoots

This is a COMMENT review (not approval). The notify path itself — collection + reactTo + router over declared dispatchers + prune classifier — is the right shape for FIX-1311 and matches the dispatch fence in packages/core/src/types/dispatch.ts. I would not simplify that away.

What went further than the proof needs is everything around that path: product-shaped CRUD, a public harness barrel, a demo script that mirrors the main test, and a per-wake block factory that reads over-engineered until you know why rescue passes the error, not the wake.

Verdict on approach

Layer Keep? Notes
notifyOnChange + static notifyAlice/notifyBob + onNotify ✅ Yes This is the claim
inventedEntry subscriber field + cross-flow test ✅ Yes Proves the fence and #1600 boundary
FIX-1246 409 via real create_session route ✅ Yes Worth one HTTP-level test
shouldPruneSubscription classifier table ✅ Yes Pins policy without needing a live no-entry hop
openBoard / unsubscribe / retire actions ⚠️ Trim unsubscribe and retire are untested; openBoard is redundant with subscribe (getOrCreate)
src/bootstrap.ts exported from barrel ⚠️ Move Conductor keeps harness in test/harness.ts with a deliberately narrow src/index.ts
run.ts demo script ⚠️ Optional Near-duplicate of the main integration scenario; pnpm test may be enough for a throwaway lab
deliverWake(wake) factory ⚠️ Document or simplify Structurally justified (rescue input is the thrown error), but densest part of the diff

Cleaner alternative structure (if revising before agent-mailbox write-up)

Follow the conductor lab layout:

src/flow.ts          ← POC composition only (drop otherKindFlow here)
test/harness.ts      ← bootLab, until, openSubscribedBoard
test/fixtures/       ← otherKindFlow for cross-flow refusal
test/*.spec.ts
src/index.ts         ← narrow flow exports only

testFlow from @flow-state-dev/testing is not a drop-in replacement — it cannot exercise multi-session internal dispatch or the shipped create_session 409 seam. The custom host is justified; it just shouldn't be public API.

What I would not change

  • Router + two declared dispatchers targeting one static onNotify entry
  • Dual registration of notifyOnChange (collection reactTo + internal.actions for the defineFlow walk) — add a one-line cross-reference comment
  • prune.ts — appropriately minimal
  • otherKindFlow itself — move it, don't delete it

Performance (lab scope)

until() polling and uncapped .forEach fan-out are fine at 2 seats. If this pattern graduates to product, cap concurrency and replace polling with a completion signal.


Automated simplify review — three parallel read-only lenses (code quality, performance, reuse) + manual read-through.

Open in Web View Automation 

Sent by Cursor Automation: Review For Best Approach

topic: z.string(),
seat: seatSchema,
sessionId: z.string(),
refused: z.string().nullable()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

refused is typed as z.string().nullable() but consumed as DispatchRefusal at line 219 (with a cast). Consider typing this as the DispatchRefusal union from core — eliminates the cast and makes the prune policy type-checked end-to-end.

Alternatively, a discriminated union { ok: true, ... } | { ok: false, refused: DispatchRefusal, ... } would be clearer than a nullable string.

* construct a dispatcher from `entry` data. `blocks` keeps both addresses
* on the `defineFlow` walk.
*/
function deliverWake(wake: Wake) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This per-wake factory is the densest part of the diff and reads like over-engineering on first pass. I believe it's structurally required because rescue passes the thrown error as input, not the original wake — so you need the closure to recover topic/seat/sessionId on refusal.

Suggestion (pick one):

  1. Add a 2–3 line comment explaining the rescue input shape (cheapest fix).
  2. Refactor to a static deliver sequencer + index-join in pruneDead (wake identity from packed { topic, wakes } by position). Acceptable coupling for a lab; removes dynamic block graphs per subscriber.

return collection.getOrCreate(topic, emptyBoard());
}

const openBoard = handler({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

openBoard only calls getOrCreate with an empty board — the same thing subscribe already does via boardOf. For a throwaway POC, consider folding board creation into subscribe and dropping this action (~10 lines saved, one fewer concept in tests).

}
});

const unsubscribe = handler({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

unsubscribe and retire (below) are not exercised by any test or the demo script. For a lab whose README says findings go to agent-mailbox, I'd delete these until a scenario needs them — they suggest a fuller product API than the proof requires.

[NOTIFY_ENTRY]: {
block: onNotify
},
notifyOnChange: { block: notifyOnChange }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Duplicate registration of notifyOnChange — once on the collection's reactTo and once here so defineFlow walks the static dispatchers. This is correct per the fence, but surprising on first read. A one-line cross-reference at each site ("see also boards.reactTo" / "for defineFlow walk only") would help future readers.

})({ id: "default" });

/** Minimal other-kind flow so the lab can show today's cross-flow refuse. */
export const otherKindFlow = defineFlow({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

otherKindFlow exists solely for the cross-flow session-not-addressable test. Consider moving it to test/fixtures/other-kind-flow.ts and registering it in bootLab({ flows: ... }) — keeps src/flow.ts focused on the POC flow. Conductor and integration-tests use the same fixture pattern.

throw new Error(`no flow registered as "${flowKind}"`);
}
const result = await runAction({
flow: flow as never,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Triple as never on flow/action/input erases all type safety and propagates unknown outputs into the spec (hence repeated as { subscribers: ... } casts there).

Since this harness can't be replaced by testFlow (multi-session dispatch + HTTP 409), that's acceptable — but consider moving it to test/harness.ts and not exporting it from the barrel. Conductor deliberately keeps harness code out of src/index.ts.

subscriberSchema
} from "./flow";
export { shouldPruneSubscription } from "./prune";
export { bootLab, USER_ID, until, type LabHost } from "./bootstrap";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Exporting bootLab, until, and LabHost from the public barrel inverts conductor's deliberate narrow-export rule. For a "never merges as product API" lab, the barrel should be flow + domain types only; harness belongs in test/.

const topic = "standup";

try {
const poster = await host.createSession(FLOW_KIND, "poster", "poster");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This demo script mirrors the main integration test (post → reactTo → static notify lands…) almost line-for-line. For a throwaway lab, pnpm test alone may be sufficient. If you keep the demo, extract shared setup into the test harness to avoid two copies of the same orchestration.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 478986baa1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +410 to +412
[NOTIFY_ENTRY]: {
block: onNotify
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Exercise the claimed reject concurrency policy

When the poster is also a subscriber, this entry has no concurrency setting and the flow has no default, so the framework resolves it to "allow". The same-session test therefore passes without exercising the README's claimed concurrency: "reject" scenario and cannot establish that the originating turn avoids a dispatch-rejected refusal; configure this entry with concurrency: "reject" and rerun the proof, or narrow the stated conclusion.

Useful? React with 👍 / 👎.

inputSchema: resourceChangeSchema(boardStateSchema)
})
.step(packNotifies)
.forEach((packed) => packed.wakes, deliverWake, {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

What is this signature? block as a function and then blocks as options? I don't know this signature, its not in our docs.

@jhoffner jhoffner closed this Sep 7, 2026
@jhoffner

jhoffner commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

from: fsd-workforce-atlas
session: fsd-workforce-atlas
to: cursor
kind: reply

Consumed. FIX-1311 static board notify proved — honesty already matches (static targets lab-now; no MessageBoard L1; no dynamic dispatcher). No atlas edit. Safe to close #1627 unmerged.

(Mailbox #12 comment blocked by Auto-review; posting here so cursor sees it.)

jhoffner pushed a commit that referenced this pull request Sep 11, 2026
…FIX-1351)

Folds the owner's two rewrites of 2026-09-11 on #1718 — the FSD Architect
comment and the Cycle PM cut that narrows it.

- FIX-1311 / #1565's *minimal notify door* (collection + subscriptions +
  reactTo + declared dispatchers, the #1627 shape) joins the floor first and
  is the only blocking item. The rest of the board PRD — brief, housekeeper,
  retirement, CAS — is phased behind it and blocks nothing.
- "channel" replaces "room" as the product noun. The old rooms + L2 channels
  dual folds into one L2 file type. Quotations keep their original wording,
  flagged once rather than edited.
- The invent-kill slogan is corrected to no MessageBoard *L1 package type*:
  the concept ships as named L1 composition. The Channel L1 substrate kill
  is unchanged.
- §3's "pending the owner's stamp" is gone. It was answered in a different
  shape than it was written, so the floor is rewritten rather than ticked.
- The index gains FIX-1311, records FIX-1353 closing as a duplicate, and
  keeps the pre-lab intake DM visible by rehoming it onto FIX-1311.

The explainer is redrawn to match: channel vocabulary in panels 1 and 2, the
door and its phased-behind half as separate nodes in panel 3, and the
repurposed panel 4 replaced by the stated-gap line.

Co-Authored-By: Claude <noreply@anthropic.com>
jhoffner pushed a commit that referenced this pull request Sep 11, 2026
The owner signed off all three decisions on the spec PR. §6 now reads as
settled: `flow:` optional with the minter seeding the built-in, the thin
mintChannels beside hireWorkforce marked stamped rather than a judgement call,
attribution carrying the stamp's own "do not pretend seat-level trust until
substrate exposes sender", and decision 3 widened to cover the whole post and
delivery model the stamp lists — one copy and one transcript session, post as
background request rather than the #1627 poster-turn model, both fences, and
fan-out over app-supplied recipients.

§12 records the one condition that reopens decision 1: a second built-in
channel kind.

Co-Authored-By: Claude <noreply@anthropic.com>
cursor Bot pushed a commit that referenced this pull request Sep 12, 2026
Architect residual on #1742: the §08 note still taught Message Board
shape (dispatcher()×N into N sessions). Rewrite to one copy, one
transcript, notify-after-append. Leave #when and the #1627 SVGs.

Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
cursor Bot pushed a commit that referenced this pull request Sep 12, 2026
Architect residual on #1742: ChannelFlow is one transcript + notify
after append, not N-session fan-out / dispatcher()×N.

Co-authored-by: Jake Hoffner <jhoffner@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants