diff --git a/changelog.d/3326-meeting-date.fixed.md b/changelog.d/3326-meeting-date.fixed.md new file mode 100644 index 000000000..b02aceec4 --- /dev/null +++ b/changelog.d/3326-meeting-date.fixed.md @@ -0,0 +1 @@ +A meeting the Project recorded now shows the day it was opened or decided in the Project board's Meetings and Decisions lists, instead of an empty date column: the board reads the epoch-millisecond stamp the meetings writer stores, not only a readable date string ([#3326](https://github.com/ThinkFlowLab/FlyBot/issues/3326)). diff --git a/docs/subsystems/project.md b/docs/subsystems/project.md index dedf3cea5..388fcade9 100644 --- a/docs/subsystems/project.md +++ b/docs/subsystems/project.md @@ -48,7 +48,7 @@ package owns everything that reads or acts on that record. | `plugins/project/src/install.js` | Puts the seams on the runtime in the core's old `MODULES` order — state reader, Chief, board, dossier, assistant — and marks the runtime so a second `apply()` is a no-op (a second `ctx.tools.register` of the same name would fail the whole plugin). | | `plugins/project/src/host.js` | The helpers this package takes from its host, read at call time so a module-scope arrow (`oneLine`, `capped`) sees the binding: `cut`, `codePoints`, `dirKind`, `defineTool`, `output`, `columnOf`, `priorityOf`, `advanceRefusal`, `workDirFor`, `dayKey`, `MAX_ENTRY`, `ASSISTANT_ROLE` and the quiet-hours reads. `REQUIRED` is the whole list; a host that binds a partial bag fails at `apply()` naming the missing helper. | | `plugins/project/src/project-state.js` | The `project_state` tool: the Project State files of the Session working folder (`PROJECT.md`, `ROADMAP.md`, `docs/governance.md`, `decisions/*.md`, `LESSONS.md`), listed with byte size, a sha256 content hash and mtime, or one file whole up to 200,000 bytes. Answers `absent`, `too large`, `not a repository` or `unreadable: ()` with the reason instead of an empty document; a decision name is one segment under `decisions/` ending in `.md` (`isDecisionPath`), read through `lstat` so a symlink answers absent, and `decisions/` itself must be a real directory (#2055, #2037, #2041, #2461). | -| `plugins/project/src/project-board.js` | The board read model (#1696): `state.tasks`, `state.meetings`, the `decisions/*.md` files and the Project bindings, with the workflow run refs read through the core's provider seam (`rt.onProjectProvider`). Read-only by construction; it writes nothing. Carries the role policy (`rolesOf`, `roleOf`, `roleChoices`, `changeRole` — one Owner, nobody promotes themselves, a Project always keeps its Owner), the queue/lease/blocked groups and the decision card (`decisionCardOf`, `advanceRefusal`). An empty decisions/meetings section carries `empty` beside its `reason` (#2984): `{ key, params }` with the folder as `{dir}`, so the page can say the case in the window's language — `reason` stays the host's own English sentence for whoever reads the read model. | +| `plugins/project/src/project-board.js` | The board read model (#1696): `state.tasks`, `state.meetings`, the `decisions/*.md` files and the Project bindings, with the workflow run refs read through the core's provider seam (`rt.onProjectProvider`). Read-only by construction; it writes nothing. Carries the role policy (`rolesOf`, `roleOf`, `roleChoices`, `changeRole` — one Owner, nobody promotes themselves, a Project always keeps its Owner), the queue/lease/blocked groups and the decision card (`decisionCardOf`, `advanceRefusal`). An empty decisions/meetings section carries `empty` beside its `reason` (#2984): `{ key, params }` with the folder as `{dir}`, so the page can say the case in the window's language — `reason` stays the host's own English sentence for whoever reads the read model. A meeting's date is the writer's own stamp (`decidedAt` / `createdAt`, `Date.now()` epoch milliseconds or a readable string) formatted as the same UTC day the archived `decisions/YYYY-MM-DD-*.md` carries; a value that does not parse reads as no date (#2587, #3326). | | `plugins/project/src/project-chief.js` | The Project Chief (#1859): one hidden Bot per Project, named `Project Chief ()`, bound with `bindProject` and given instructions that name that one Project and forbid answering for any other; retired through the host's own `deleteBot` with the Project. `rt.projectChief` is `{ create, chiefOf, remove }`. | | `plugins/project/src/project-team.js` | The team dossier (#1864), read-only: `rt.projectTeam(projectId)` answers `{ rows }` in the board's order — the Chief, the assistant, then `roles.maintainers` / `roles.members` — with persona (the Bot's instructions), the head and topic names of its own memory, its skills and only this Project's rooms. Every string and list is capped and a deleted Bot is a `null` row, never an error for the whole answer. | | `plugins/project/src/project-metrics.js` | The board's seven numbers (#1829) read from GitHub REST and the local task store, with a five-minute cache and one honest failure answer: a missing credential or an unreadable source is `unavailable` and every value reads `null`, never `0`. The lists are followed page by page under a cap (#2650), a foreign host is never followed with the token, and the day boundary is the caller's zone (`resolveTimeZone`) rather than the host's UTC clock. Its day key is `core/src/host/day-key.js` since #2830. | diff --git a/plugins/project/src/project-board.js b/plugins/project/src/project-board.js index 73e789ecd..0138d8093 100644 --- a/plugins/project/src/project-board.js +++ b/plugins/project/src/project-board.js @@ -110,8 +110,10 @@ const stampOf = value => (Number.isFinite(value) ? value : null) // #2587: `text()` proves only that a stored timestamp is a non-empty string, so a hand-edited // `decidedAt` / `createdAt` reached `toISOString()` and threw for the whole board read. A value // that does not parse reads as no date, like the other unreadable fields. +// #3326: the writer stores `Date.now()` (`meetings.js`), so a recorded meeting's numeric stamp is +// an instant too; only strings go through the parse, and both format by the writer's own UTC day. const dayOf = value => { - const parsed = Date.parse(text(value)) + const parsed = Number.isFinite(value) ? value : Date.parse(text(value)) return Number.isFinite(parsed) ? new Date(parsed).toISOString().slice(0, 10) : '' } diff --git a/plugins/project/test/project-board-meeting-date.test.js b/plugins/project/test/project-board-meeting-date.test.js index a99d53f6d..f6887fcd3 100644 --- a/plugins/project/test/project-board-meeting-date.test.js +++ b/plugins/project/test/project-board-meeting-date.test.js @@ -37,6 +37,10 @@ const seed = () => ({ m2: { id: 'm2', project: 'project-p1', status: 'open', question: 'Still open?', createdAt: 'not-a-time', updatedAt: 11 }, // A readable timestamp still formats, so the guard does not blank every date. m3: { id: 'm3', project: 'project-p1', status: 'decided', question: 'Keep the date?', decidedAt: '2026-11-01T09:00:00.000Z', updatedAt: 12 }, + // What the product itself writes: `meetings.js` stores `stamp() = Date.now()`, epoch milliseconds. + m4: { id: 'm4', project: 'project-p1', status: 'decided', question: 'Adopt the record?', decidedAt: 1_700_000_000_000, updatedAt: 20 }, + // The pending list reads `createdAt`; the writer stamps that one the same way. + m5: { id: 'm5', project: 'project-p1', status: 'open', question: 'Still open?', createdAt: 1_700_000_000_000, updatedAt: 21 }, }, }) @@ -93,3 +97,50 @@ test('#2587: a meetings record with a non-date decidedAt does not break the boar await stop() } }) + +// The meetings writer stores the stamps the board reads as `Date.now()` — epoch milliseconds +// (`core/src/host/meetings.js`). `dayOf()` used to parse strings only, so every meeting the product +// itself recorded listed with no date, unlike the archived `decisions/YYYY-MM-DD-*.md` beside it. +test('a meeting the product recorded (epoch ms stamps) lists with its day', async () => { + const { rt, call, stop } = await start() + try { + const board = await rt.projectBoard('project-p1') + const decided = board.meetings.decided.find(meeting => meeting.id === 'm4') + assert.ok(decided, 'the decided meeting is listed') + assert.equal(decided.date, '2023-11-14', 'a numeric decidedAt reads as its UTC day, as the archived file name does') + const pending = board.meetings.pending.find(meeting => meeting.id === 'm5') + assert.ok(pending, 'the pending meeting is listed') + assert.equal(pending.date, '2023-11-14', 'a numeric createdAt reads as its UTC day too') + // The endpoint the page draws from answers the same rows. + const served = await call('project-board', { id: 'project-p1' }) + assert.equal(served.ok, true, JSON.stringify(served)) + assert.equal(served.value.meetings.decided.find(meeting => meeting.id === 'm4').date, '2023-11-14') + } finally { + await stop() + } +}) + +// The same gap, end to end: a meeting the product itself opens and decides, then the board read the +// page draws. No seed touches the stamps here — `meetings.js` writes them. +test('a meeting opened and decided by the product lists with the day it closed', async () => { + const { rt, stop } = await start() + const dir = mkdtempSync(join(tmpdir(), 'ds-bot-board-decide-')) + try { + const opened = await rt.meetingEndpoint('open', { question: 'Adopt the record?', participants: ['Chief', 'Writer'], project: 'project-p1' }) + const id = /meeting-[0-9a-f]+/.exec(opened)?.[0] + assert.ok(id, 'the meeting is open') + await rt.meetingEndpoint('position', { meeting: id, as: 'Chief', stance: 'agree', text: 'yes' }) + await rt.meetingEndpoint('position', { meeting: id, as: 'Writer', stance: 'agree', text: 'yes' }) + await rt.meetingEndpoint('decide', { meeting: id, owner: 'Chief', decision: 'Adopt it.', dir }) + const stored = rt.state.meetings[id] + assert.equal(typeof stored.decidedAt, 'number', 'the writer stores epoch milliseconds') + const board = await rt.projectBoard('project-p1') + const row = board.meetings.decided.find(meeting => meeting.id === id) + assert.ok(row, 'the decided meeting is on the board') + const day = new Date(stored.decidedAt).toISOString().slice(0, 10) + assert.equal(row.date, day, 'the board names the day the meeting closed, as the archived file name does') + } finally { + rmSync(dir, { recursive: true, force: true, maxRetries: 5 }) + await stop() + } +})