fix(expand,setup): append behavioral findings to sections 02-behavioral-profile.md actually has (#520)

Both commands told the model to add to "Strongest Behavioral Traits" and
"How I Work Best" / "How [Candidate] Works Best" while also saying "match
existing structure", but the shipped file's headings are "Strongest
Behaviors" and "How You Work Best", so an inferred trait either opened a
duplicate near-identical section or was dropped.

The companion to #519, which fixed the same drift in /reset's skeleton.
Both bullets now name the shipped headings, and a derived test in each
command's suite reads the quoted section names and requires each to be a
## heading of the shipped file; both fail on master.
This commit is contained in:
Ayobami Adegoke authored and GitHub committed 2026-10-08 21:18:08 +02:00
1 parent 895c02191d
commit 760bbc34cf
5 files changed
+65 -2

No files matched your search

+22
View File
@@ -1,10 +1,12 @@
"""Tests for the /expand command specification."""
import re
import unittest
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parent.parent
EXPAND_COMMAND_FILE = REPO_ROOT / ".claude" / "commands" / "expand.md"
BEHAVIORAL_PROFILE = REPO_ROOT / ".claude" / "skills" / "job-application-assistant" / "02-behavioral-profile.md"
class ExpandCommandTests(unittest.TestCase):
@@ -39,6 +41,26 @@ class ExpandCommandTests(unittest.TestCase):
self.assertIn("Portfolio & projects grounded in code", text)
self.assertNotIn("documents/projects/", text)
def test_behavioral_additions_name_sections_the_shipped_file_has(self):
# Step 5 told the model to append to "Strongest Behavioral Traits" or
# "How I Work Best" and to "match existing structure" - but the shipped
# 02-behavioral-profile.md has neither heading (it has "Strongest
# Behaviors" and "How You Work Best"), so the addition either landed
# in a duplicate near-identical section or was dropped. Derived from
# the shipped file so a renamed heading fails here until /expand follows.
text = EXPAND_COMMAND_FILE.read_text(encoding="utf-8")
start = text.index("### Additions to `02-behavioral-profile.md`")
section = text[start: text.index("---", start)]
quoted = re.findall(r'"([^"]+)"', section)
self.assertTrue(quoted, "the 02-behavioral-profile step must name its target sections")
headings = {
line[3:].strip() for line in BEHAVIORAL_PROFILE.read_text(encoding="utf-8").splitlines()
if line.startswith("## ")
}
for name in quoted:
with self.subTest(section=name):
self.assertIn(name, headings, f"02-behavioral-profile.md has no '## {name}' heading")
def test_expand_enforces_additive_and_confirmation_principles(self):
text = EXPAND_COMMAND_FILE.read_text(encoding="utf-8")
self.assertIn("Additive only", text)
+30
View File
@@ -10,6 +10,7 @@ on the drafter noticing. A real user (#420) ran `/setup` and then hand-edited bo
files to close the gap.
"""
import os
import re
import unittest
from pathlib import Path
@@ -90,6 +91,35 @@ class TemplatesStillCarryThePlaceholders(unittest.TestCase):
self.assertIn("\\signature{[YOUR_NAME]}", text)
class SetupPathAWritesIntoSectionsTheShippedFilesHave(unittest.TestCase):
"""Step A7 named 02-behavioral-profile.md sections that do not exist.
"Strongest Behavioral Traits" and "How [Candidate] Works Best" are not
headings in the shipped file ("Strongest Behaviors", "How You Work Best"
are), so the "add only to these sections" rule pointed at nothing. The
section names are read from the bullet and checked against the file's
`##` headings, with the placeholder-free spelling required: a reader
cannot match "[Candidate]" against a heading.
"""
def test_behavioral_profile_bullet_names_real_headings(self):
text = COMMAND.read_text(encoding="utf-8")
bullet = next(
line for line in text.splitlines()
if line.startswith("- **`02-behavioral-profile.md`:**")
)
quoted = re.findall(r'"([^"]+)"', bullet)
self.assertTrue(quoted, "the 02-behavioral-profile bullet must name its target sections")
headings = {
line[3:].strip()
for line in (SKILL_DIR / "02-behavioral-profile.md").read_text(encoding="utf-8").splitlines()
if line.startswith("## ")
}
for name in quoted:
with self.subTest(section=name):
self.assertIn(name, headings, f"02-behavioral-profile.md has no '## {name}' heading")
class SetupPathAProjectsIngestion(unittest.TestCase):
"""Guards for /setup Path A document ingestion of documents/projects/."""