A first version's public copy catches a short owner quote whose padding or quote marks are encoded (#4778)

A first version's public export now catches a short owner quote when its
padding or quote marks are encoded, such as ` `, a zero-width
space, `"` or a JSON `\"`.

Why: those spellings kept the owner's words in the public copy and
`validate --public` passed them; short quotes are now matched on the
same decoded text the long-quote scan reads.

Nothing to do: the redaction still replaces only the original characters
of the quote.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=red-team
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-24 06:02:17 +00:00
1 parent f3a89d2105
commit bb6d13ea30
6 files changed
+40 -6

No files matched your search

+19
View File
@@ -154,6 +154,25 @@ describe('redactOwnerWords', () => {
for (const kept of ['deferred: no time to spare', 'eng closed accepted-with-findings at round 1 (no time left): 0 open', '(no time; by agent:x)', 'we had no time to spare']) expect(redactOwnerWords(kept, o).text).toBe(kept);
});
test('a short plan quote in quote marks is redacted however the padding or the text is encoded, and a bare mention stays (GST-3646)', () => {
const o = ownerIndex([], { quoted: ['water alerts'] });
const cases: Array<[string, string]> = [
['He said "water alerts".', `He said "${MARK}".`],
['He said " water alerts ".', `He said " ${MARK} ".`],
['He said "&nbsp;water alerts&nbsp;".', `He said "&nbsp;${MARK}&nbsp;".`],
['He said "\u200bwater alerts\u200b".', `He said "\u200b${MARK}\u200b".`],
['He said &quot;water alerts&quot;.', `He said &quot;${MARK}&quot;.`],
['He said “water&#32;alerts”.', `He said “${MARK}”.`],
['He said “water&nbsp;alerts”.', `He said “${MARK}”.`],
['He said "water alerts".', `He said "${MARK}".`],
['{"title":"He said \\"water\\u00a0alerts\\""}', `{"title":"He said \\"${MARK}\\""}`],
['{"title":"He said \\"water alerts\\""}', `{"title":"He said \\"${MARK}\\""}`],
['Pick "panel" water alerts "toggle" here', `Pick "panel" ${MARK} "toggle" here`],
];
expect(cases.filter(([text, want]) => redactOwnerWords(text, o).text !== want).map(([text]) => text)).toEqual([]);
for (const kept of ['Turn on water alerts today.', 'He said "water alerts are noisy".']) expect(redactOwnerWords(kept, o).text).toBe(kept);
});
test('every template that renders a deferral reason has a placement (add one to DEFERRAL_RENDERINGS with any new template)', () => {
const root = path.resolve(import.meta.dir, '..');
const count = Object.fromEntries(fs.readdirSync(path.join(root, 'lib')).filter(f => f.startsWith('autoplan-') && f.endsWith('.ts'))
+4
View File
@@ -466,6 +466,8 @@ describe("short owner quotes and leave-out reasons stay out of a first-version e
['an emoji and a word', u => `🚀 ${u}`],
['CJK', u => `毎朝ベル${u}`],
['two words padded inside the quote marks', u => `skelvy ${u}`, ' '],
['two words padded with a no-break space entity', u => `drimble ${u}`, '&nbsp;'],
['two words padded with a zero-width space', u => `frawny ${u}`, '\u200b'],
];
const LINES: Array<[string, (r: string) => string, boolean]> = [
['does it', () => ' → does it', false],
@@ -524,6 +526,8 @@ describe("short owner quotes and leave-out reasons stay out of a first-version e
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 owner said "&nbsp;${ROWS[1]!.words}&nbsp;".\n`)).toBe(true);
expect(ownerWordsAt(`The owner said "\u200b${ROWS[1]!.words}\u200b".\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);