diff --git a/bin/gstack-design-doc-find b/bin/gstack-design-doc-find index 485b59725..c31661ee4 100755 --- a/bin/gstack-design-doc-find +++ b/bin/gstack-design-doc-find @@ -9,6 +9,9 @@ # Precedence: # 1. newest $GSTACK_STATE_ROOT/projects//*--design-*.md # 2. else newest $GSTACK_STATE_ROOT/projects//*-design-*.md +# Neither step returns an office-hours decision memo (*-memo-*) or a +# /design-review audit summary (*-design-audit-*), unless "design-" follows +# that word because the branch name holds it (#4615). # 3. the newest repo doc under $TOP/docs/designs/ wins when no state-root doc # exists or it is newer than the state-root doc. A root DESIGN.md is the # design system /design-consultation writes, never a design doc (#2839). @@ -39,7 +42,8 @@ newest() { newest_design() { ls -t "$@" 2>/dev/null | while IFS= read -r f; do b=${f##*/} - case "${b##*-memo-}" in "$b"|*design-*) printf '%s\n' "$f"; break ;; esac + case "${b##*-memo-}" in "$b"|*design-*) ;; *) continue ;; esac + case "${b##*-design-audit-}" in "$b"|*design-*) printf '%s\n' "$f"; break ;; esac done } diff --git a/changelog.d/fix-design-doc-find-skips-audit-summaries.md b/changelog.d/fix-design-doc-find-skips-audit-summaries.md new file mode 100644 index 000000000..722b7f8a7 --- /dev/null +++ b/changelog.d/fix-design-doc-find-skips-audit-summaries.md @@ -0,0 +1 @@ +**Plan reviews no longer read a /design-review audit summary as the branch's design doc.** After a design review, `/autoplan`, `/plan-ceo-review` and `/plan-eng-review` could pick up the one-line `…-design-audit-…md` pointer, because `gstack-design-doc-find` matched it as a design doc. The finder now skips audit summaries the way it already skips decision memos, and still finds the real design doc, including on a branch whose name contains "design-audit". Reported by @robbiesierra in #4615. diff --git a/test/gstack-design-doc-find.test.ts b/test/gstack-design-doc-find.test.ts index cd0e9b3ce..9d31a176d 100644 --- a/test/gstack-design-doc-find.test.ts +++ b/test/gstack-design-doc-find.test.ts @@ -136,4 +136,21 @@ describe('rendered Design Doc Check block', () => { const repo = f.write(path.join(f.repo, 'docs/designs/add-memo-export.md'), 5); expect(f.find({}, ['proj', 'feat-memo'])).toBe(repo); }); + test('a /design-review audit summary is never returned as the design doc (#4615)', () => { + const f = fixture(); + f.write(path.join(f.home, '.gstack/projects/proj/user-feat-x-design-audit-20261121-100000.md'), 10); + expect(f.find()).toBe(''); + expect(f.find({}, ['proj', 'other'])).toBe(''); + const doc = f.write(path.join(f.home, '.gstack/projects/proj/user-feat-x-design-20261101-100000.md'), 1000); + expect(f.find()).toBe(doc); + expect(f.find({}, ['proj', 'other'])).toBe(doc); + }); + test('a branch named after a design audit still finds its design doc, not its audit summary (#4615)', () => { + const f = fixture(); + const args = ['proj', 'fix-design-audit']; + f.write(path.join(f.home, '.gstack/projects/proj/user-fix-design-audit-design-audit-20261121-100000.md'), 10); + expect(f.find({}, args)).toBe(''); + const doc = f.write(path.join(f.home, '.gstack/projects/proj/user-fix-design-audit-design-20261101-100000.md'), 1000); + expect(f.find({}, args)).toBe(doc); + }); });