diff --git a/changelog.d/public-copy-redacts-padded-short-quotes.md b/changelog.d/public-copy-redacts-padded-short-quotes.md new file mode 100644 index 000000000..ee4229931 --- /dev/null +++ b/changelog.d/public-copy-redacts-padded-short-quotes.md @@ -0,0 +1 @@ +**A first version's public export now also keeps out a short owner quote written with spaces just inside its quote marks.** `gstack-autoplan export --public` matched a short plan quote only when its words touched the quote marks, so a bullet like `" water alerts "` kept those words in the public copy, and `validate --public` passed it. Now spaces inside the marks are allowed in the match. diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 187905584..fee8a5dbe 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -6029,8 +6029,8 @@ are one, compared across punctuation, line breaks, JSON escapes, entities, HTML Markdown markup, invisible format characters, contractions and case; replies of 1 or 2 words are not scanned for, and words the owner echoed from earlier text he didn't write are not his (the words a reply adds to an echo still are). -A plan quote of any length is also one wherever it appears directly inside quote -marks, and so is its `leave out:` reason after `leave out:`, `leave it out for +A plan quote of any length is also one wherever it appears inside quote +marks, spaces just inside them included, and so is its `leave out:` reason after `leave out:`, `leave it out for now:` or `reason to leave it out:`, in any case. See [the public copy](unattended.md#the-public-copy). `gstack-artifact validate --public --private /run.json` reports each quote with file:line, and `gstack-autoplan export diff --git a/docs/unattended.md b/docs/unattended.md index 583e09a9f..ed0aa5639 100644 --- a/docs/unattended.md +++ b/docs/unattended.md @@ -387,7 +387,7 @@ owner's own words: nothing a person wrote leaves without their click (GST-1243). quote too. Replies of 1 or 2 words ("yes", "do it") are not scanned for: they are codes or grammar, and the field itself is already dropped. A quote under the plan's `### Owner's words` heading is redacted at any length - wherever it appears directly inside quote marks, and the reason on its + wherever it appears inside quote marks (spaces just inside them included), and the reason on its `leave out:` line wherever it follows `leave out:`, `leave it out for now:` or `reason to leave it out:`, in any case; a bare mention of a short quote's words outside quote marks stays. A quote diff --git a/lib/autoplan-owner-words.ts b/lib/autoplan-owner-words.ts index c1b23b03c..551741ec5 100644 --- a/lib/autoplan-owner-words.ts +++ b/lib/autoplan-owner-words.ts @@ -190,7 +190,7 @@ export function ownerIndex(replies: OwnerSource[], o: { deferred?: OwnerSource[] const placements = [ ...(o.deferred ?? []).flatMap(d => DEFERRAL_RENDERINGS(escape(d.text))), ...(o.carried ?? []).map(w => `words=(${escape(JSON.stringify(w))})(?= by=|$)`), - ...(o.quoted ?? []).map(q => `["“](${escape(q)})["”]`), + ...(o.quoted ?? []).map(q => `["“]\\s*(${escape(q)})\\s*["”]`), ].map(p => new RegExp(p, 'gd')).concat((o.reasons ?? []).map(r => new RegExp(`(?:leave out|leave it out for now|reason to leave it out)\\s*:\\s*(${escape(r)})`, 'gdi'))); return { replies: indexed, placements }; } diff --git a/test/autoplan-public-owner-words.test.ts b/test/autoplan-public-owner-words.test.ts index 4e138c435..d9a73f470 100644 --- a/test/autoplan-public-owner-words.test.ts +++ b/test/autoplan-public-owner-words.test.ts @@ -460,11 +460,12 @@ describe('every attribution, line and quote shape reads as the merge base read i describe("short owner quotes and leave-out reasons stay out of a first-version export (GST-3646)", () => { const tag = (prefix: string, i: number) => `${prefix}${String.fromCharCode(97 + Math.floor(i / 26))}${String.fromCharCode(97 + (i % 26))}vel`; - const QUOTES: Array<[string, (u: string) => string]> = [ + const QUOTES: Array<[string, (u: string) => string, string?]> = [ ['one word', u => u], ['two words', u => `quimbly ${u}`], ['an emoji and a word', u => `🚀 ${u}`], ['CJK', u => `毎朝ベル${u}`], + ['two words padded inside the quote marks', u => `skelvy ${u}`, ' '], ]; const LINES: Array<[string, (r: string) => string, boolean]> = [ ['does it', () => ' → does it', false], @@ -478,10 +479,10 @@ describe("short owner quotes and leave-out reasons stay out of a first-version e ['a choice and size in mixed case', () => ' → Choice; Size: one day', false], ['a recommended reason in mixed case', r => ` → CHOICE; size: two days; Recommend Leave Out: ${r}`, true], ]; - const ROWS = QUOTES.flatMap(([qName, quote], a) => LINES.map(([lName, line, hasReason], b) => { + const ROWS = QUOTES.flatMap(([qName, quote, pad = ''], a) => LINES.map(([lName, line, hasReason], b) => { const i = a * LINES.length + b, reason = tag('rz', i); const words = quote(tag('qx', i)); - return { name: `${qName} / ${lName}`, bullet: `- The owner, 2026-11-20 08:${String(i).padStart(2, '0')}Z: "${words}"${line(reason)}`, words, reason: hasReason ? line(reason).replace(/^.*leave out\s*:\s*/i, '') : undefined }; + return { name: `${qName} / ${lName}`, bullet: `- The owner, 2026-11-20 08:${String(i).padStart(2, '0')}Z: "${pad}${words}${pad}"${line(reason)}`, words, reason: hasReason ? line(reason).replace(/^.*leave out\s*:\s*/i, '') : undefined }; })); const plan = [ '# Morning helper (synthetic first version)', '', '## Implementation plan', '', @@ -522,6 +523,7 @@ describe("short owner quotes and leave-out reasons stay out of a first-version e expect(validate().status).toBe(0); const ownerWordsAt = (added: string) => { fs.writeFileSync(record, before + added); return validate().stderr.includes('ARTIFACT_OWNER_WORDS'); }; expect(ownerWordsAt(`The owner said “${ROWS[0]!.words}”.\n`)).toBe(true); + expect(ownerWordsAt(`The owner said " ${ROWS[1]!.words} ".\n`)).toBe(true); expect(ownerWordsAt(`The plan's reason: leave out: ${ROWS[2]!.reason}\n`)).toBe(true); expect(ownerWordsAt(`A plain mention of ${ROWS[0]!.words} and ${ROWS[2]!.reason}.\n`)).toBe(false); fs.writeFileSync(record, before);