Skip to content

Commit fedff8e

Browse files
committed
project board: a recorded meeting shows the day it was opened or decided
The board read model sent every meeting stamp through Date.parse, which accepts only strings, while the meetings writer stores Date.now() epoch milliseconds — so a meeting the product itself recorded listed with an empty date column beside decision files that showed their YYYY-MM-DD day. A finite number is now the instant, and both kinds format by the writer's own UTC day, so a meeting and its archived decisions/YYYY-MM-DD-*.md always name the same day. A non-parseable string still reads as no date (#2587); this fixes #3326.
1 parent 352a6f0 commit fedff8e

4 files changed

Lines changed: 56 additions & 2 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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)).

‎docs/subsystems/project.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ package owns everything that reads or acts on that record.
4848
| `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). |
4949
| `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. |
5050
| `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: <path> (<reason>)` 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). |
51-
| `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. |
51+
| `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). |
5252
| `plugins/project/src/project-chief.js` | The Project Chief (#1859): one hidden Bot per Project, named `Project Chief (<name>)`, 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 }`. |
5353
| `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. |
5454
| `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. |

‎plugins/project/src/project-board.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ const stampOf = value => (Number.isFinite(value) ? value : null)
110110
// #2587: `text()` proves only that a stored timestamp is a non-empty string, so a hand-edited
111111
// `decidedAt` / `createdAt` reached `toISOString()` and threw for the whole board read. A value
112112
// that does not parse reads as no date, like the other unreadable fields.
113+
// #3326: the writer stores `Date.now()` (`meetings.js`), so a recorded meeting's numeric stamp is
114+
// an instant too; only strings go through the parse, and both format by the writer's own UTC day.
113115
const dayOf = value => {
114-
const parsed = Date.parse(text(value))
116+
const parsed = Number.isFinite(value) ? value : Date.parse(text(value))
115117
return Number.isFinite(parsed) ? new Date(parsed).toISOString().slice(0, 10) : ''
116118
}
117119

‎plugins/project/test/project-board-meeting-date.test.js‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ const seed = () => ({
3737
m2: { id: 'm2', project: 'project-p1', status: 'open', question: 'Still open?', createdAt: 'not-a-time', updatedAt: 11 },
3838
// A readable timestamp still formats, so the guard does not blank every date.
3939
m3: { id: 'm3', project: 'project-p1', status: 'decided', question: 'Keep the date?', decidedAt: '2026-11-01T09:00:00.000Z', updatedAt: 12 },
40+
// What the product itself writes: `meetings.js` stores `stamp() = Date.now()`, epoch milliseconds.
41+
m4: { id: 'm4', project: 'project-p1', status: 'decided', question: 'Adopt the record?', decidedAt: 1_700_000_000_000, updatedAt: 20 },
42+
// The pending list reads `createdAt`; the writer stamps that one the same way.
43+
m5: { id: 'm5', project: 'project-p1', status: 'open', question: 'Still open?', createdAt: 1_700_000_000_000, updatedAt: 21 },
4044
},
4145
})
4246

@@ -93,3 +97,50 @@ test('#2587: a meetings record with a non-date decidedAt does not break the boar
9397
await stop()
9498
}
9599
})
100+
101+
// The meetings writer stores the stamps the board reads as `Date.now()` — epoch milliseconds
102+
// (`core/src/host/meetings.js`). `dayOf()` used to parse strings only, so every meeting the product
103+
// itself recorded listed with no date, unlike the archived `decisions/YYYY-MM-DD-*.md` beside it.
104+
test('a meeting the product recorded (epoch ms stamps) lists with its day', async () => {
105+
const { rt, call, stop } = await start()
106+
try {
107+
const board = await rt.projectBoard('project-p1')
108+
const decided = board.meetings.decided.find(meeting => meeting.id === 'm4')
109+
assert.ok(decided, 'the decided meeting is listed')
110+
assert.equal(decided.date, '2023-11-14', 'a numeric decidedAt reads as its UTC day, as the archived file name does')
111+
const pending = board.meetings.pending.find(meeting => meeting.id === 'm5')
112+
assert.ok(pending, 'the pending meeting is listed')
113+
assert.equal(pending.date, '2023-11-14', 'a numeric createdAt reads as its UTC day too')
114+
// The endpoint the page draws from answers the same rows.
115+
const served = await call('project-board', { id: 'project-p1' })
116+
assert.equal(served.ok, true, JSON.stringify(served))
117+
assert.equal(served.value.meetings.decided.find(meeting => meeting.id === 'm4').date, '2023-11-14')
118+
} finally {
119+
await stop()
120+
}
121+
})
122+
123+
// The same gap, end to end: a meeting the product itself opens and decides, then the board read the
124+
// page draws. No seed touches the stamps here — `meetings.js` writes them.
125+
test('a meeting opened and decided by the product lists with the day it closed', async () => {
126+
const { rt, stop } = await start()
127+
const dir = mkdtempSync(join(tmpdir(), 'ds-bot-board-decide-'))
128+
try {
129+
const opened = await rt.meetingEndpoint('open', { question: 'Adopt the record?', participants: ['Chief', 'Writer'], project: 'project-p1' })
130+
const id = /meeting-[0-9a-f]+/.exec(opened)?.[0]
131+
assert.ok(id, 'the meeting is open')
132+
await rt.meetingEndpoint('position', { meeting: id, as: 'Chief', stance: 'agree', text: 'yes' })
133+
await rt.meetingEndpoint('position', { meeting: id, as: 'Writer', stance: 'agree', text: 'yes' })
134+
await rt.meetingEndpoint('decide', { meeting: id, owner: 'Chief', decision: 'Adopt it.', dir })
135+
const stored = rt.state.meetings[id]
136+
assert.equal(typeof stored.decidedAt, 'number', 'the writer stores epoch milliseconds')
137+
const board = await rt.projectBoard('project-p1')
138+
const row = board.meetings.decided.find(meeting => meeting.id === id)
139+
assert.ok(row, 'the decided meeting is on the board')
140+
const day = new Date(stored.decidedAt).toISOString().slice(0, 10)
141+
assert.equal(row.date, day, 'the board names the day the meeting closed, as the archived file name does')
142+
} finally {
143+
rmSync(dir, { recursive: true, force: true, maxRetries: 5 })
144+
await stop()
145+
}
146+
})

0 commit comments

Comments
 (0)