mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-30 20:04:15 +01:00
v1.103.1.0 First versions: a ruled-out owner line counts only when he said it (GST-3646) (#4789)
A first version's plan can now mark a quote `ruled out : ""`, and that line beats a reviewer only when one of the owner's recorded replies holds the ruling. Why: the line is written by whoever wrote the plan, so a misremembered ruling could hide a real gap; when the ruling isn't on record, the owner is asked once, with the ruling and the finding side by side and his ruling recommended. Nothing to do: plans without a ruled-out line read exactly as before. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=specialist-batched Review-Finding: p1/red-team#1 reader=red-team Review-Finding: p1/red-team#2 reader=red-team Review-Finding: p1/red-team#3 reader=red-team
This commit is contained in:
1 parent
f34b7aac22
commit
5278bb4e1a
16 files changed
+166
-46
No files matched your search
@@ -145,7 +145,7 @@ describe('replay: a reviewed app plan whose product challenges were hidden', ()
|
||||
['Cut: No Android build', 'on a first version every cut is your decision, one letter each'],
|
||||
['Cut: No shared team calendars', 'on a first version every cut is your decision, one letter each']]);
|
||||
expect(byClass(list, 'cuts')).toEqual([]);
|
||||
expect(byClass(list, 'owner_words').map(i => [i.title, i.recommended])).toEqual([['1 of your quoted messages has no time or no line saying what this version does with it: “I want to remember what I promised people after every meeting” (missing a line (does it or choice))', 'a']]);
|
||||
expect(byClass(list, 'owner_words').map(i => [i.title, i.recommended])).toEqual([['1 of your quoted messages has no time or no line saying what this version does with it: “I want to remember what I promised people after every meeting” (missing a line (does it, choice or ruled out))', 'a']]);
|
||||
expect(list.first_version).toBe(true);
|
||||
expect(list.owner_words).toMatchObject({ status: 'ok', quotes: [{ n: 1, verified: false }] });
|
||||
});
|
||||
@@ -517,6 +517,87 @@ describe('first versions: the owner page quotes the owner and letters what it le
|
||||
expect(notes.origin!.endsWith('|finding')).toBe(true);
|
||||
});
|
||||
|
||||
describe("a ruled-out line beats a reviewer only when the owner's recorded replies hold his ruling (GST-3646)", () => {
|
||||
const RULING = 'never touch my calendar, I mean it';
|
||||
const CASE5 = CASE4 + `\n- The owner, 2026-11-12 09:00Z: "never touch my calendar" → ruled out 2026-11-12: "${RULING}"`;
|
||||
const calendar = (voice: 'native' | 'outside', tagged = true) => row('ceo', voice, { id: `${RUN}-ceo-r2-${voice}-1`, severity: 'High', title: 'Leaving the calendar out does less than the owner asked for', changes: 'scope', resolution: 'add calendar reads', ...(tagged ? { narrows_quote: 3 } : {}) } as Row);
|
||||
const run = (name: string, o: { said?: boolean; native?: FindingRow[]; outside?: FindingRow[]; cuts?: string }) => {
|
||||
const state = makeRun(name, { plan: plan(CASE5, o.cuts), round2: { native: o.native ?? [], outside: o.outside ?? [] }, round1: false, ui: false });
|
||||
if (o.said) fs.writeFileSync(path.join(state.out, 'attempts.jsonl'), JSON.stringify({ owner_reply: `c3: no. ${RULING}` }) + '\n');
|
||||
return state;
|
||||
};
|
||||
const calendarItems = (list: GateList) => list.items.filter(i => i.title.includes('calendar'));
|
||||
|
||||
test('the parser reads the ruled-out line, and only a recorded reply verifies the ruling', () => {
|
||||
expect(parseOwnerWords(CASE5).quotes[2]!.line).toEqual({ kind: 'ruled_out', date: '2026-11-12', ruling: RULING });
|
||||
expect(ownerContext(run('ruled-ctx', {}), []).ruled).toEqual(new Set());
|
||||
expect(ownerContext(run('ruled-ctx-said', { said: true })).ruled).toEqual(new Set([3]));
|
||||
expect(ownerContext(run('ruled-ctx-other', {}), ['never touch my calendar']).ruled).toEqual(new Set());
|
||||
});
|
||||
|
||||
test('a ruling dated with a time parses; a short ruling, or one that only repeats the quote, never counts as recorded', () => {
|
||||
expect(parseOwnerWords("### Owner's words\n\n- The owner, 2026-11-23 10:04Z: \"add dark mode\" → ruled out 2026-11-24 09:12Z: \"not in the first version\"").quotes[0]).toMatchObject({ text: 'add dark mode', line: { kind: 'ruled_out', date: '2026-11-24 09:12Z', ruling: 'not in the first version' } });
|
||||
const ruledWith = (ruling: string, replies: string[]) => {
|
||||
const state = makeRun(`ruled-floor-${ruling.replace(/\W+/g, '-')}`, { plan: plan(CASE4 + `\n- The owner, 2026-11-12 09:00Z: "never touch my calendar or my reminders" → ruled out 2026-11-12: "${ruling}"`), round2: { native: [], outside: [] }, round1: false, ui: false });
|
||||
return ownerContext(state, replies).ruled;
|
||||
};
|
||||
expect(ruledWith('no', ['c1: no, keep the dark mode'])).toEqual(new Set());
|
||||
expect(ruledWith('never touch my calendar', ['never touch my calendar or my reminders'])).toEqual(new Set());
|
||||
expect(ruledWith('leave my calendar alone', ['never touch my calendar or my reminders. actually leave my calendar alone'])).toEqual(new Set([3]));
|
||||
});
|
||||
|
||||
test('a recorded ruling beats a High finding: one item recommending the ruling, never a build-it choice or a proposal', () => {
|
||||
const list = buildGate(run('ruled-said', { said: true, native: [calendar('native')] }), 1);
|
||||
const items = calendarItems(list);
|
||||
expect(items.map(i => [i.item_class, i.kind, i.recommended, i.options[0]!.text, i.options[0]!.changes_plan])).toEqual([['challenge1', 'auto', 'a', 'keep your ruling', false]]);
|
||||
expect(items[0]!.why).toBe(`native says the plan does less than your words “never touch my calendar”, but you ruled it out on 2026-11-12: “${RULING}”`);
|
||||
expect(rec(list)[items[0]!.id]).toBe('a');
|
||||
});
|
||||
|
||||
test('an unrecorded ruling and the High finding are one question, side by side, recommending the ruling', () => {
|
||||
const list = buildGate(run('ruled-unsaid', { native: [calendar('native')] }), 1);
|
||||
const items = calendarItems(list);
|
||||
expect(items.map(i => [i.item_class, i.kind, i.recommended])).toEqual([['owner_choice', 'approval', 'b']]);
|
||||
const item = items[0]!;
|
||||
expect(item.why).toBe(`the plan says you ruled it out on 2026-11-12: “${RULING}”, but no recorded reply of yours says that; a reviewer (native) says the plan narrows it: Leaving the calendar out does less than the owner asked for`);
|
||||
expect(item.options.map(o => [o.text, o.changes_plan])).toEqual([['build it in this version (size not stated)', true], [`leave it out, as your ruling says: “${RULING}”`, false]]);
|
||||
expect(item.recommended_basis).toBe("your ruling as the plan quotes it; it isn't in your recorded replies, so this asks you beside the High finding");
|
||||
expect(item.origin!.split('|')[1]!.split('+')).toEqual(['quote:3', `${RUN}-ceo-r2-native-1`]);
|
||||
expect(item.origin!.endsWith('|finding')).toBe(true);
|
||||
expect(rec(list)[item.id]).toBe('b');
|
||||
const page = renderOwnerPage(fs.readFileSync(path.join(TMP, 'ruled-unsaid', 'plan-active.md'), 'utf8'), list.owner_words?.quotes).join('\n');
|
||||
expect(page).toContain(`→ you ruled it out on 2026-11-12: “${RULING}” (not found in your recorded replies: asked below)`);
|
||||
});
|
||||
|
||||
test('an unrecorded ruling with no finding and no cut still costs one question; a recorded one costs none', () => {
|
||||
expect(calendarItems(buildGate(run('ruled-quiet', {}), 1)).map(i => [i.item_class, i.recommended])).toEqual([['owner_choice', 'b']]);
|
||||
const said = buildGate(run('ruled-quiet-said', { said: true }), 1);
|
||||
expect(calendarItems(said)).toEqual([]);
|
||||
expect(renderOwnerPage(fs.readFileSync(path.join(TMP, 'ruled-quiet-said', 'plan-active.md'), 'utf8'), said.owner_words?.quotes).join('\n')).toContain(`→ you ruled it out on 2026-11-12: “${RULING}”\n`);
|
||||
});
|
||||
|
||||
test('a cut that follows a recorded ruling stays a cut recommending keep; an unrecorded one is asked beside the quote', () => {
|
||||
const cuts = '- It never touches your calendar: never touch my calendar\n- No Android build\n';
|
||||
const said = buildGate(run('ruled-cut-said', { said: true, cuts }), 1);
|
||||
expect(calendarItems(said).map(i => [i.title, i.recommended])).toEqual([['Cut: It never touches your calendar: never touch my calendar', 'a']]);
|
||||
const unsaid = buildGate(run('ruled-cut-unsaid', { cuts }), 1);
|
||||
expect(calendarItems(unsaid).map(i => [i.item_class, i.recommended])).toEqual([['owner_choice', 'b']]);
|
||||
expect(calendarItems(unsaid)[0]!.why).toContain('the plan cuts it: "It never touches your calendar: never touch my calendar"');
|
||||
});
|
||||
|
||||
test.each([['recorded', true], ['unrecorded', false]] as const)('an untagged twin of a finding on a %s ruling joins its item and never becomes a take-the-change proposal', (_, said) => {
|
||||
for (const [tagged, untagged] of [['native', 'outside'], ['outside', 'native']] as const) {
|
||||
const rows = { [tagged]: [calendar(tagged)], [untagged]: [calendar(untagged, false)] } as { native: FindingRow[]; outside: FindingRow[] };
|
||||
const list = buildGate(run(`ruled-twin-${said}-${tagged}`, { said, ...rows }), 1);
|
||||
expect(byClass(list, 'proposal'), `${tagged} tagged`).toEqual([]);
|
||||
const items = calendarItems(list);
|
||||
expect(items.length, `${tagged} tagged`).toBe(1);
|
||||
expect(items[0]!.origin!.split('|')[1]!.split('+').sort(), `${tagged} tagged`).toEqual(said ? [`${RUN}-ceo-r2-native-1`, `${RUN}-ceo-r2-outside-1`] : ['quote:3', `${RUN}-ceo-r2-native-1`, `${RUN}-ceo-r2-outside-1`]);
|
||||
expect(items[0]!.options.find(o => o.key === rec(list)[items[0]!.id])!.changes_plan, `${tagged} tagged`).toBe(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("the default reply never changes or overrides an owner line, whatever kind of finding touches it", () => {
|
||||
type Kind = { name: string; native: Row[]; outside?: Row[] };
|
||||
const finding = (voice: 'native' | 'outside', quote: number, severity: FindingRow['severity'] = 'High') =>
|
||||
@@ -526,6 +607,7 @@ describe('first versions: the owner page quotes the owner and letters what it le
|
||||
{ name: 'narrows an open choice quote (High)', native: [finding('native', 2)] },
|
||||
{ name: 'narrows an open choice quote (Medium)', native: [finding('native', 2, 'Medium')] },
|
||||
{ name: 'a paired finding: both on a does-it quote', native: [finding('native', 1)], outside: [finding('outside', 1)] },
|
||||
{ name: 'a paired finding: only the native names the does-it quote', native: [finding('native', 1)], outside: [{ ...finding('outside', 1), narrows_quote: undefined }] },
|
||||
];
|
||||
test.each(KINDS.map(k => [k.name, k] as const))('%s', (_, kind) => {
|
||||
const state = makeRun(`rec-${kind.name.replace(/\W+/g, '-')}`, { plan: plan(CASE4), round2: { native: kind.native.map(r => row('ceo', 'native', r)), outside: (kind.outside ?? []).map(r => row('ceo', 'outside', r)) }, round1: false, ui: false });
|
||||
@@ -533,7 +615,7 @@ describe('first versions: the owner page quotes the owner and letters what it le
|
||||
const chosen = rec(list);
|
||||
const quotes = parseOwnerWords(CASE4).quotes;
|
||||
for (const r of [...kind.native, ...(kind.outside ?? [])]) {
|
||||
const q = quotes.find(x => x.n === r.narrows_quote)!;
|
||||
const q = quotes.find(x => x.n === (r.narrows_quote ?? kind.native[0]!.narrows_quote))!;
|
||||
const items = list.items.filter(i => i.title.includes(r.id) || (i.item_class === 'owner_choice' && i.title.includes(q.text)));
|
||||
expect(items.length, `${r.id} reaches the gate`).toBeGreaterThan(0);
|
||||
for (const item of items) {
|
||||
|
||||
@@ -182,7 +182,7 @@ describe('redactOwnerWords', () => {
|
||||
});
|
||||
|
||||
describe('ownerWords over a run directory', () => {
|
||||
test("a leftover ruled-out line is read as part of the quote, as before lines existed, so export and validate still redact the owner's ruling", () => {
|
||||
test("a plan's ruled-out line indexes the owner's ruling as well as the quote, so export and validate both redact it", () => {
|
||||
const out = fs.mkdtempSync(path.join(os.tmpdir(), 'owner-ruling-'));
|
||||
const ruling = 'leave my calendar alone, I mean it, no exceptions';
|
||||
fs.writeFileSync(path.join(out, 'plan-source.md'), `# Plan\n\n## Implementation plan\n\n### Owner's words\n\n- The owner, 2026-11-12 09:00Z: "never touch my calendar or my reminders" → ruled out 2026-11-12: "${ruling}"\n\n## Review record\n`);
|
||||
@@ -190,7 +190,7 @@ describe('ownerWords over a run directory', () => {
|
||||
const r = redactOwnerWords(`The reviewer repeats it: "${ruling}".`, owner);
|
||||
expect(r.text).toContain(MARK);
|
||||
expect(r.text).not.toContain('no exceptions');
|
||||
expect(redactOwnerWords(`He said: "never touch my calendar or my reminders" → ruled out 2026-11-12: "${ruling}"`, owner).text).not.toContain('calendar');
|
||||
expect(redactOwnerWords('He said never touch my calendar or my reminders today.', owner).text).toContain(MARK);
|
||||
fs.rmSync(out, { recursive: true, force: true });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -403,8 +403,8 @@ describe('every attribution, line and quote shape reads as the merge base read i
|
||||
['does it after an ascii arrow', () => ' -> does it', () => ({ kind: 'does' })],
|
||||
['a choice with a size', () => ' -> choice; size: one day', () => ({ kind: 'choice', size: 'one day' })],
|
||||
['a choice left out', () => ' → choice; size: two days; leave out: needs a second permission', () => ({ kind: 'choice', size: 'two days', leave_out: 'needs a second permission' })],
|
||||
['a leftover ruled-out line', u => ` → ruled out 2026-11-20: "skrimblor dorvelin ${u}"`, () => undefined],
|
||||
['a leftover ruled-out line with nested quotes and an arrow', u => ` → ruled out 2026-11-20: "grobble "nevermore" -> ${u}"`, () => undefined],
|
||||
['a ruling', u => ` → ruled out 2026-11-20: "skrimblor dorvelin ${u}"`, u => ({ kind: 'ruled_out', date: '2026-11-20', ruling: `skrimblor dorvelin ${u}` })],
|
||||
['a ruling with nested quotes and an arrow', u => ` → ruled out 2026-11-20: "grobble "nevermore" -> ${u}"`, u => ({ kind: 'ruled_out', date: '2026-11-20', ruling: `grobble "nevermore" -> ${u}` })],
|
||||
];
|
||||
const tag = (prefix: string, i: number) => `${prefix}${String.fromCharCode(97 + Math.floor(i / 26))}${String.fromCharCode(97 + (i % 26))}vel`;
|
||||
/** Every attribution with every text, each line shape rotating through both, so every pair of shapes meets. */
|
||||
@@ -413,12 +413,12 @@ describe('every attribution, line and quote shape reads as the merge base read i
|
||||
const [lineName, line, parsed] = LINES[(a + t) % LINES.length]!;
|
||||
const words = text(tag('qx', i)), ruling = tag('rz', i);
|
||||
const bare = `- ${attr}: "${words}"`;
|
||||
return { name: `${attrName} / ${textName} / ${lineName}`, bullet: bare + line(ruling), bare, words, line: parsed(ruling), ruling: line(ruling).includes('ruled out') ? line(ruling).replace(/^ → ruled out [\d-]+: "|"$/g, '') : undefined };
|
||||
return { name: `${attrName} / ${textName} / ${lineName}`, bullet: bare + line(ruling), bare, words, line: parsed(ruling), ruling: parsed(ruling)?.kind === 'ruled_out' ? ruling : undefined };
|
||||
}));
|
||||
const section = (bullets: string[]) => ["### Owner's words", '', ...bullets, '', '## Review record', ''].join('\n');
|
||||
|
||||
test.each(ROWS.map(r => [r.name, r] as const))('%s', (_, row) => {
|
||||
const base = mergeBase((row.line ? row.bare : row.bullet).replace(/^- /, ''));
|
||||
const base = mergeBase(row.bare.replace(/^- /, ''));
|
||||
expect(base).toBeDefined();
|
||||
const w = parseOwnerWords(section([row.bullet]));
|
||||
expect(w.status, w.reason).toBe('ok');
|
||||
@@ -430,7 +430,7 @@ describe('every attribution, line and quote shape reads as the merge base read i
|
||||
expect(slack).toEqual({ status: 'ok', quotes: [{ n: 1, who: 'Garry (Slack DM -> relayed), 2026-11-23', text: 'ship the importer tonight' }] });
|
||||
const bad = parseOwnerWords(section(['- Garry (Slack DM -> relayed), 2026-11-23: "ship the importer tonight" → maybe later']));
|
||||
expect(bad.status).toBe('malformed');
|
||||
expect(bad.reason).toBe('bullet 1 has a line that is not does it or choice');
|
||||
expect(bad.reason).toBe('bullet 1 has a line that is not does it, choice or ruled out <date>: "<ruling>"');
|
||||
expect(bad.quotes.map(q => q.text)).toEqual(['ship the importer tonight']);
|
||||
});
|
||||
|
||||
|
||||
@@ -97,11 +97,11 @@ describe('the day-one table and the owner quotes it cites (pinned)', () => {
|
||||
const none = AUTOPLAN.replace(/### Owner's words[\s\S]*?### Day one/, '### Day one');
|
||||
expect(freezeActions(none)).toMatchObject({ error: { detail: expect.stringMatching(/^the plan has no ### Owner's words section/) } });
|
||||
const noLine = AUTOPLAN.replace('before work" → does it', 'before work"');
|
||||
expect(freezeActions(noLine)).toEqual({ error: { code: 'FIRST_USE_PLAN_UNREADY', detail: 'owner quote 2 needs a line (does it or choice)' } });
|
||||
expect(freezeActions(noLine)).toEqual({ error: { code: 'FIRST_USE_PLAN_UNREADY', detail: 'owner quote 2 needs a line (does it, choice or ruled out)' } });
|
||||
const noTime = AUTOPLAN.replace('- Ada Example, day 0: "remind', '- Ada Example: "remind');
|
||||
expect(freezeActions(noTime)).toEqual({ error: { code: 'FIRST_USE_PLAN_UNREADY', detail: 'owner quote 2 needs when it was said' } });
|
||||
const bad = AUTOPLAN.replace('before work" → does it', 'before work" → maybe later');
|
||||
expect(freezeActions(bad)).toMatchObject({ error: { detail: expect.stringContaining('bullet 2 has a line that is not does it or choice') } });
|
||||
expect(freezeActions(bad)).toMatchObject({ error: { detail: expect.stringContaining('bullet 2 has a line that is not does it, choice or ruled out') } });
|
||||
});
|
||||
|
||||
test('editing or inserting a quote changes the frozen hash, even when the rows stay the same', () => {
|
||||
|
||||
Reference in new issue
Block a user