Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions changelog.d/3203-standing-dissent.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A meeting's Dissent section and its archived `dissent:` line now follow the positions as they stand: a participant who withdraws an objection takes it off the record, and when two participants dissent both objections stay on the record under their own names ([#3203](https://github.com/ThinkFlowLab/FlyBot/issues/3203)).
55 changes: 48 additions & 7 deletions core/src/host/meetings.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,44 @@ export function proxyRefusal(meeting) {
return undefined
}

// #3203: what the meeting's dissent *is* gets read back from the positions as they stand now,
// not stamped once when the first participant dissents. A participant who changes their stance
// takes their objection with them, and every participant who still dissents stays on the record
// under their own name — one owner per objection, so a second dissenter does not overwrite the
// first.
const recordedDissent = participant => {
const position = participant?.position
if (position?.stance !== 'dissent') return undefined
const text = oneLine(position.text, TEXT_MAX)
return text === '' ? undefined : { text, owner: participant.name }
}

const standingDissents = meeting => (Array.isArray(meeting.participants) ? meeting.participants : [])
.map(recordedDissent)
.filter(record => record !== undefined)

// What the view and the archived file print: the standing dissents, plus an explicit `dissent` a
// `decide` set (the override the tool offers) when it names an objection the positions do not
// already carry. A decided record keeps that line as history; an open one reads only the
// positions, so a stale stamp from an older build cannot outlive the stance behind it.
const dissentRecords = meeting => {
const standing = standingDissents(meeting)
const recorded = meeting.status === 'decided' ? meeting.dissent : undefined
const text = oneLine(recorded?.text, TEXT_MAX)
if (text === '') return standing
const owner = oneLine(recorded.owner, NAME_MAX)
if (standing.some(record => record.owner === owner && record.text === text)) return standing
return [{ text, owner }, ...standing]
}

// The stored single `dissent` follows the positions: the first objection that still stands, or
// none at all. It stays the shape the governance check and older readers know.
const syncDissent = meeting => {
const [first] = standingDissents(meeting)
if (first === undefined) delete meeting.dissent
else meeting.dissent = first
}

export function governanceRefusal(meeting) {
if (!OPEN_STATES.has(meeting.status)) return `the meeting is ${meeting.status}, not open or deliberating`
const proxied = proxyRefusal(meeting)
Expand Down Expand Up @@ -202,9 +240,10 @@ const decisionBody = (meeting, file, at) => {
lines.push(`- **${participant.name}** — ${said}${proxy === '' ? '' : ` (speaks for ${proxy})`}`)
}
lines.push('', '## Dissent', '')
lines.push(meeting.dissent === undefined
? 'none recorded'
: `${oneLine(meeting.dissent.text, TEXT_MAX)} — **${oneLine(meeting.dissent.owner, NAME_MAX)}**`)
const dissents = dissentRecords(meeting)
if (dissents.length === 0) lines.push('none recorded')
else if (dissents.length === 1) lines.push(`${dissents[0].text} — **${dissents[0].owner}**`)
else for (const record of dissents) lines.push(`- ${record.text} — **${record.owner}**`)
lines.push('', '## Status', '', 'accepted', '')
lines.push('## Links', '', `- Decision file: ${file}`)
if (meeting.issue !== undefined) lines.push(`- Issue: #${meeting.issue}`)
Expand Down Expand Up @@ -278,9 +317,7 @@ export function install(rt) {
if (spokenFor === '') delete participant.speaksFor
else participant.speaksFor = spokenFor
participant.position = { stance: chosen, text: oneLine(text, TEXT_MAX), at: now, ...(spokenFor === '' ? {} : { speaksFor: spokenFor }) }
if (chosen === 'dissent' && oneLine(text, TEXT_MAX) !== '') {
meeting.dissent = { text: oneLine(text, TEXT_MAX), owner: name }
}
syncDissent(meeting)
if (meeting.status === 'open') meeting.status = 'deliberating'
meeting.updatedAt = now
return meeting
Expand Down Expand Up @@ -384,6 +421,10 @@ export function install(rt) {
const ownerName = oneLine(args.dissent?.owner, NAME_MAX)
if (text === '') throw refuse('invalid', 'a dissent needs the objection it records')
candidate.dissent = { text, owner: ownerName }
} else {
// #3203: the record follows the positions at the moment it is written, so a dissent that
// was withdrawn before `decide` never reaches the file.
syncDissent(candidate)
}
const reason = governanceRefusal(candidate)
if (reason !== undefined) throw refuse('governance', reason)
Expand Down Expand Up @@ -521,7 +562,7 @@ export function install(rt) {
lines.push(`level: ${level}${(meeting.recipients ?? []).length === 0 ? '' : ` | recipients: ${(meeting.recipients ?? []).join(', ')}`}`)
const paused = advanceRefusal(meeting)
if (paused !== undefined) lines.push(`paused: ${paused}`)
if (meeting.dissent !== undefined) lines.push(`dissent: ${meeting.dissent.text} — ${meeting.dissent.owner}`)
for (const record of dissentRecords(meeting)) lines.push(`dissent: ${record.text} — ${record.owner}`)
if (meeting.blockingQuestion !== undefined) lines.push(`blocking: ${meeting.blockingQuestion}`)
if (meeting.blockingAnswer !== undefined) lines.push(`answer: ${meeting.blockingAnswer}`)
if (meeting.decisionFile !== undefined) lines.push(`decision file: ${meeting.decisionFile}`, `tasks: ${meeting.taskIds.join(', ') || 'none'}`)
Expand Down
58 changes: 58 additions & 0 deletions core/test/meetings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,61 @@ test('#1861: the decision card exposes the participants and their proxies', asyn
{ name: 'Owner', speaksFor: null, stance: null, silent: false },
])
})

// #3203: the Dissent record is read back from the positions as they stand now, not stamped once
// when someone first dissents. A withdrawn objection leaves the record (the Dissent line and the
// participant's own row agree), and every objection that still stands is named with its author.
test('#3203: a withdrawn dissent leaves the record, and the participant row agrees with it', async (t) => {
const { rt, dir, meeting, open, stop } = await boot()
t.after(stop)
const id = await open('Should Stage 4 reuse the existing store?', ['Chief', 'Dev', 'Reviewer'])
await meeting({ action: 'position', meeting: id, as: 'Chief', stance: 'agree', text: 'the existing store is fine' })
await meeting({ action: 'position', meeting: id, as: 'Dev', stance: 'agree', text: 'the existing store' })
const stance = await meeting({ action: 'position', meeting: id, as: 'Reviewer', stance: 'dissent', text: 'a second store is cleaner to audit' })
assert.match(stance, /dissent: a second store is cleaner to audit — Reviewer/, 'the live dissent is on the view')
const view = await meeting({ action: 'position', meeting: id, as: 'Reviewer', stance: 'agree', text: 'the existing store is fine after all' })
assert.doesNotMatch(view, /a second store is cleaner to audit/, 'the withdrawn objection is no longer the meeting dissent')
assert.doesNotMatch(view, /^dissent:/m, 'the view names no standing dissent')
assert.match(view, /- Reviewer: agree — the existing store is fine after all/, 'the participant row says agree')
await meeting({ action: 'decide', meeting: id, owner: 'Chief', decision: 'Keep the existing store.', evidence: [{ pr: 3203 }] })
assert.equal(rt.state.meetings[id].dissent, undefined, 'the withdrawn dissent is not stored')
const body = readFileSync(join(dir, rt.state.meetings[id].decisionFile), 'utf8')
assert.match(body, /## Dissent\n\nnone recorded/)
assert.doesNotMatch(body, /a second store is cleaner to audit/)
assert.match(body, /\*\*Reviewer\*\* — agree — the existing store is fine after all/)
})

test('#3203: two dissenters are both on the record with their own authors', async (t) => {
const { rt, dir, meeting, open, stop } = await boot()
t.after(stop)
const id = await open('Should Stage 4 reuse the existing store?', ['Chief', 'Dev', 'Reviewer'])
const first = await meeting({ action: 'position', meeting: id, as: 'Chief', stance: 'dissent', text: 'two people must sign' })
assert.match(first, /dissent: two people must sign — Chief/)
const second = await meeting({ action: 'position', meeting: id, as: 'Dev', stance: 'dissent', text: 'a second signature is a second risk' })
assert.match(second, /dissent: two people must sign — Chief/, 'the first dissenter stays on the view')
assert.match(second, /dissent: a second signature is a second risk — Dev/, 'the second dissenter is on the view too')
await meeting({ action: 'position', meeting: id, as: 'Reviewer', stance: 'agree', text: 'the existing store' })
await meeting({ action: 'decide', meeting: id, owner: 'Chief', decision: 'Keep the existing store.', evidence: [{ pr: 3203 }] })
const body = readFileSync(join(dir, rt.state.meetings[id].decisionFile), 'utf8')
assert.match(body, /two people must sign — \*\*Chief\*\*/, 'the first objection is archived with its author')
assert.match(body, /a second signature is a second risk — \*\*Dev\*\*/, 'the second objection is archived with its author')
})

test('#3203: decide keeps the explicit dissent override, and an empty one is still refused', async (t) => {
const { rt, dir, meeting, open, stop } = await boot()
t.after(stop)
const id = await open('Should Stage 4 reuse the existing store?', ['Chief', 'Dev'])
await meeting({ action: 'position', meeting: id, as: 'Chief', stance: 'agree', text: 'the existing store' })
await meeting({ action: 'position', meeting: id, as: 'Dev', stance: 'agree', text: 'no second store' })
await assert.rejects(
meeting({ action: 'decide', meeting: id, owner: 'Chief', decision: 'Keep the existing store.', dissent: { text: ' ' }, evidence: [{ pr: 3203 }] }),
/a dissent needs the objection it records/,
)
await meeting({
action: 'decide', meeting: id, owner: 'Chief', decision: 'Keep the existing store.',
dissent: { text: 'the objection raised in the thread still stands', owner: 'Chief' }, evidence: [{ pr: 3203 }],
})
assert.deepEqual(rt.state.meetings[id].dissent, { text: 'the objection raised in the thread still stands', owner: 'Chief' })
const body = readFileSync(join(dir, rt.state.meetings[id].decisionFile), 'utf8')
assert.match(body, /the objection raised in the thread still stands — \*\*Chief\*\*/)
})
12 changes: 9 additions & 3 deletions docs/subsystems/core-host.md
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,15 @@ no second store, no UI-only path and no cron.
positions, options and evidence, writes the `blockingAnswer`, clears the blocked stamp and moves
the meeting back to `deliberating`. `decided` is terminal — `resume` on it is refused `closed`.
- **Positions.** An invited participant records `agree`, `dissent` or `abstain` with a line of text.
A name that was not invited is refused `not-invited`; a dissent with text is also kept as the
meeting's standing dissent, owned by the participant who recorded it. A participant who never
answers and is not recorded `silent` keeps the meeting from closing.
A name that was not invited is refused `not-invited`; a dissent with text is the meeting's
standing dissent, owned by the participant who recorded it. Since #3203 that dissent is read back
from the positions as they stand now instead of stamped once: a participant who later records
another stance takes their objection with them (once nobody dissents, the Dissent section and the
archived file print `none recorded`), and when two participants dissent both objections are on the
record under their own names. The stored single `dissent` follows the positions (the first
objection that still stands); an explicit `dissent` passed to `decide` stays an override that is
printed beside the standing ones, and a `decide` without one recomputes the record before writing
it. A participant who never answers and is not recorded `silent` keeps the meeting from closing.
- **The governance check is code.** `governanceRefusal(meeting)` is the one refusal `decide` runs
before it writes anything: every invited participant has a position or is recorded silent, the
decision names an `owner`, a dissent carries its own `owner`, and the decision states what was
Expand Down
55 changes: 48 additions & 7 deletions patches/ds-bot/files/src/host/meetings.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,44 @@ export function proxyRefusal(meeting) {
return undefined
}

// #3203: what the meeting's dissent *is* gets read back from the positions as they stand now,
// not stamped once when the first participant dissents. A participant who changes their stance
// takes their objection with them, and every participant who still dissents stays on the record
// under their own name — one owner per objection, so a second dissenter does not overwrite the
// first.
const recordedDissent = participant => {
const position = participant?.position
if (position?.stance !== 'dissent') return undefined
const text = oneLine(position.text, TEXT_MAX)
return text === '' ? undefined : { text, owner: participant.name }
}

const standingDissents = meeting => (Array.isArray(meeting.participants) ? meeting.participants : [])
.map(recordedDissent)
.filter(record => record !== undefined)

// What the view and the archived file print: the standing dissents, plus an explicit `dissent` a
// `decide` set (the override the tool offers) when it names an objection the positions do not
// already carry. A decided record keeps that line as history; an open one reads only the
// positions, so a stale stamp from an older build cannot outlive the stance behind it.
const dissentRecords = meeting => {
const standing = standingDissents(meeting)
const recorded = meeting.status === 'decided' ? meeting.dissent : undefined
const text = oneLine(recorded?.text, TEXT_MAX)
if (text === '') return standing
const owner = oneLine(recorded.owner, NAME_MAX)
if (standing.some(record => record.owner === owner && record.text === text)) return standing
return [{ text, owner }, ...standing]
}

// The stored single `dissent` follows the positions: the first objection that still stands, or
// none at all. It stays the shape the governance check and older readers know.
const syncDissent = meeting => {
const [first] = standingDissents(meeting)
if (first === undefined) delete meeting.dissent
else meeting.dissent = first
}

export function governanceRefusal(meeting) {
if (!OPEN_STATES.has(meeting.status)) return `the meeting is ${meeting.status}, not open or deliberating`
const proxied = proxyRefusal(meeting)
Expand Down Expand Up @@ -202,9 +240,10 @@ const decisionBody = (meeting, file, at) => {
lines.push(`- **${participant.name}** — ${said}${proxy === '' ? '' : ` (speaks for ${proxy})`}`)
}
lines.push('', '## Dissent', '')
lines.push(meeting.dissent === undefined
? 'none recorded'
: `${oneLine(meeting.dissent.text, TEXT_MAX)} — **${oneLine(meeting.dissent.owner, NAME_MAX)}**`)
const dissents = dissentRecords(meeting)
if (dissents.length === 0) lines.push('none recorded')
else if (dissents.length === 1) lines.push(`${dissents[0].text} — **${dissents[0].owner}**`)
else for (const record of dissents) lines.push(`- ${record.text} — **${record.owner}**`)
lines.push('', '## Status', '', 'accepted', '')
lines.push('## Links', '', `- Decision file: ${file}`)
if (meeting.issue !== undefined) lines.push(`- Issue: #${meeting.issue}`)
Expand Down Expand Up @@ -278,9 +317,7 @@ export function install(rt) {
if (spokenFor === '') delete participant.speaksFor
else participant.speaksFor = spokenFor
participant.position = { stance: chosen, text: oneLine(text, TEXT_MAX), at: now, ...(spokenFor === '' ? {} : { speaksFor: spokenFor }) }
if (chosen === 'dissent' && oneLine(text, TEXT_MAX) !== '') {
meeting.dissent = { text: oneLine(text, TEXT_MAX), owner: name }
}
syncDissent(meeting)
if (meeting.status === 'open') meeting.status = 'deliberating'
meeting.updatedAt = now
return meeting
Expand Down Expand Up @@ -384,6 +421,10 @@ export function install(rt) {
const ownerName = oneLine(args.dissent?.owner, NAME_MAX)
if (text === '') throw refuse('invalid', 'a dissent needs the objection it records')
candidate.dissent = { text, owner: ownerName }
} else {
// #3203: the record follows the positions at the moment it is written, so a dissent that
// was withdrawn before `decide` never reaches the file.
syncDissent(candidate)
}
const reason = governanceRefusal(candidate)
if (reason !== undefined) throw refuse('governance', reason)
Expand Down Expand Up @@ -521,7 +562,7 @@ export function install(rt) {
lines.push(`level: ${level}${(meeting.recipients ?? []).length === 0 ? '' : ` | recipients: ${(meeting.recipients ?? []).join(', ')}`}`)
const paused = advanceRefusal(meeting)
if (paused !== undefined) lines.push(`paused: ${paused}`)
if (meeting.dissent !== undefined) lines.push(`dissent: ${meeting.dissent.text} — ${meeting.dissent.owner}`)
for (const record of dissentRecords(meeting)) lines.push(`dissent: ${record.text} — ${record.owner}`)
if (meeting.blockingQuestion !== undefined) lines.push(`blocking: ${meeting.blockingQuestion}`)
if (meeting.blockingAnswer !== undefined) lines.push(`answer: ${meeting.blockingAnswer}`)
if (meeting.decisionFile !== undefined) lines.push(`decision file: ${meeting.decisionFile}`, `tasks: ${meeting.taskIds.join(', ') || 'none'}`)
Expand Down
Loading
Loading