Skip to content

Commit 072ab33

Browse files
authored
fix(tasks): require field constraints from data-model.md in generated tasks (#4430)
* fix(tasks): require field constraints from data-model.md in generated tasks /speckit.tasks mapped data-model.md entities to user stories but never told the agent to carry field-level constraints (max length, nullable, enum values, validation rules) into the task text. Left to discretion, the implementing agent can silently invent its own value instead of the one recorded in data-model.md. Fixes #4383 * test(tasks): tighten constraint regression assertion to match verbatim wording Addresses Copilot review feedback that the prior assertion only checked for the word 'constraint', so it would still pass if the rule's meaning were reversed (e.g. constraints permitted to be omitted).
1 parent d00176e commit 072ab33

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

templates/commands/tasks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ Every task MUST strictly follow this format:
197197
- Map each entity to the user story(ies) that need it
198198
- If entity serves multiple stories: Put in earliest story or Setup phase
199199
- Relationships → service layer tasks in appropriate story phase
200+
- For each field with constraints in data-model.md (max length, nullable/required, enum values, validation rules), quote the constraint verbatim in the task description so it is not left to implementation-time discretion
200201

201202
4. **From Setup/Infrastructure**:
202203
- Shared infrastructure → Setup phase (Phase 1)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""Regression test for #4383: tasks.md loses data-model field constraints.
2+
3+
The /speckit.tasks command template maps data-model.md entities to task
4+
descriptions but did not require that field-level constraints (max length,
5+
nullable/required, enum values, validation rules) be carried into the
6+
generated task text verbatim. Without an explicit instruction, the
7+
implementing agent falls back to its own defaults instead of the value
8+
recorded in data-model.md.
9+
"""
10+
11+
from pathlib import Path
12+
13+
REPO_ROOT = Path(__file__).parent.parent
14+
TASKS_TEMPLATE = REPO_ROOT / "templates" / "commands" / "tasks.md"
15+
16+
17+
def test_data_model_section_requires_verbatim_field_constraints():
18+
content = TASKS_TEMPLATE.read_text(encoding="utf-8")
19+
20+
from_data_model_start = content.index("**From Data Model**")
21+
next_section_start = content.index("**From Setup/Infrastructure**")
22+
section = content[from_data_model_start:next_section_start]
23+
24+
assert "quote the constraint verbatim in the task description" in section.lower(), (
25+
"The 'From Data Model' task-organization rules must instruct the "
26+
"agent to quote field constraints (max length, nullable, enum, "
27+
"validation rules) from data-model.md verbatim in task descriptions, "
28+
"not merely mention that constraints exist."
29+
)

0 commit comments

Comments
 (0)