Skip to content

Commit a068d37

Browse files
nhortonclaude
andcommitted
fix: format inline-content review tasks as "inline content" (not "0 files")
Follow-up to the issue #350 string-output review fix. The formatter's _task_name() used len(files_to_review) to describe task scope, which fell through to the multi-file branch for inline-content tasks and produced "review of 0 files" — cosmetic wart visible in the parallel-task listing. Also adds a bespoke test_job (.deepwork/jobs/test_job/) that exercises the full quality gate end-to-end with four outputs covering every review-level combination: file_path + output-ref review, string + output-ref review (NEW), string + arg-level review (NEW, inherited), and string + no review (control). Used as a manual smoke test when verifying the fix. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d335629 commit a068d37

4 files changed

Lines changed: 97 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Test Job Report
2+
3+
This is a short markdown report produced by the test_job workflow to exercise
4+
the file_path review path of the DeepWork quality-gate review system.

.deepwork/jobs/test_job/job.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: test_job
2+
summary: "Exercise the DeepWork quality-gate review system with string and file_path outputs to verify string-output reviews run"
3+
4+
step_arguments:
5+
- name: report_file
6+
description: "A short markdown report file produced by the step — exercises the file_path review path."
7+
type: file_path
8+
9+
- name: summary_text
10+
description: "A 1-2 sentence narrative summary of the step's work — exercises a string output review defined at the step output-ref level."
11+
type: string
12+
13+
- name: metrics_text
14+
description: "A concise metrics blurb containing at least one numeric value — exercises a string output review defined at the step_argument level (inherited by any step that outputs it)."
15+
type: string
16+
review:
17+
strategy: individual
18+
instructions: |
19+
Verify the value is a concise metrics summary of 1-3 sentences that contains at
20+
least one numeric value. Flag it if the value is empty, a placeholder, or does
21+
not mention any numbers.
22+
23+
- name: notes_text
24+
description: "A freeform notes string with no review attached — control case that should produce no review task."
25+
type: string
26+
27+
workflows:
28+
test_review_system:
29+
summary: "Produce four outputs of mixed types and review levels to verify the quality gate reviews them correctly."
30+
common_job_info_provided_to_all_steps_at_runtime: |
31+
This bespoke test job verifies that the DeepWork quality-gate review system
32+
executes reviews on string outputs as well as file_path outputs. Four outputs are
33+
produced in a single step, each hitting a distinct review code path. The control
34+
case (notes_text) must NOT produce a review task.
35+
steps:
36+
- name: produce_outputs
37+
instructions: |
38+
# Produce test outputs for the quality gate
39+
40+
Create each of the four outputs below, then call `finished_step` with all four
41+
values. Keep the content short.
42+
43+
1. **report_file**: write a small markdown file at
44+
`.deepwork/jobs/test_job/fixtures/report.md` (create the parent directory
45+
first if needed). Two or three lines — a heading plus a sentence is fine.
46+
47+
2. **summary_text**: a 1-2 sentence narrative summary describing the work
48+
performed in this step.
49+
50+
3. **metrics_text**: a 1-3 sentence metrics blurb that includes at least one
51+
number (e.g., "Produced 4 outputs, 3 reviewed, in under 1 second.").
52+
53+
4. **notes_text**: any freeform string — this one has no review attached.
54+
55+
Expected quality-gate result: three review tasks (one per output that has a
56+
review configured). `notes_text` should not produce a review task.
57+
outputs:
58+
report_file:
59+
review:
60+
strategy: individual
61+
instructions: |
62+
Verify the file is a valid markdown document with a recognisable heading
63+
or non-empty first line. Flag it if the file is empty or contains no
64+
markdown structure.
65+
summary_text:
66+
review:
67+
strategy: individual
68+
instructions: |
69+
Verify the value is a non-empty narrative summary of 1-2 sentences
70+
written in plain English that describes some concrete outcome of the
71+
step. Flag it if the value is empty, a placeholder, or does not describe
72+
anything.
73+
metrics_text: {}
74+
notes_text: {}

src/deepwork/review/formatter.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,18 @@ def _task_name(task: ReviewTask) -> str:
137137
rule comes from a subdirectory .deepreview file. This disambiguates
138138
same-named rules from different directories (REVIEW-REQ-004.10).
139139
140+
For inline-content tasks (type: string step outputs per JOBS-REQ-004.8)
141+
the scope reads ``inline content`` instead of a file count.
142+
140143
Args:
141144
task: The ReviewTask to name.
142145
143146
Returns:
144147
Task name string.
145148
"""
146149
prefix = _scope_prefix(task)
150+
if not task.files_to_review and task.inline_content is not None:
151+
return f"{prefix}{task.rule_name} review of inline content"
147152
if len(task.files_to_review) == 1:
148153
return f"{prefix}{task.rule_name} review of {task.files_to_review[0]}"
149154
return f"{prefix}{task.rule_name} review of {len(task.files_to_review)} files"

tests/unit/review/test_formatter.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ def test_grouped_task_name_includes_file_count(self, tmp_path: Path) -> None:
5656
result = format_for_claude([(task, file_path)], tmp_path)
5757
assert 'name: "py_review review of 3 files"' in result
5858

59+
def test_inline_content_task_name_says_inline_content(self, tmp_path: Path) -> None:
60+
"""Inline-content tasks render as "review of inline content", not "0 files"."""
61+
task = ReviewTask(
62+
rule_name="string_rule",
63+
files_to_review=[],
64+
instructions="Review the value.",
65+
agent_name=None,
66+
inline_content="the value",
67+
)
68+
file_path = tmp_path / "instructions.md"
69+
result = format_for_claude([(task, file_path)], tmp_path)
70+
assert 'name: "string_rule review of inline content"' in result
71+
assert "0 files" not in result
72+
5973
# THIS TEST VALIDATES A HARD REQUIREMENT (REVIEW-REQ-006.3.3b).
6074
# YOU MUST NOT MODIFY THIS TEST UNLESS THE REQUIREMENT CHANGES
6175
def test_default_subagent_type_when_no_agent(self, tmp_path: Path) -> None:

0 commit comments

Comments
 (0)