fix: preserve source task sections and explicit empty notes
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a07ff8-19d0-7820-b4d0-1353833cb7fc
This commit is contained in:
parent
ccb285fc40
commit
f767a1a245
4 changed files with 231 additions and 17 deletions
|
|
@ -17,6 +17,81 @@ from api.services import forge_credential as fc
|
|||
from api.services import forge_projection as fp
|
||||
|
||||
|
||||
def test_task_description_retains_nested_sections_and_matches_consistency(monkeypatch):
|
||||
monkeypatch.syspath_prepend(str(Path(__file__).parents[1] / "scripts"))
|
||||
from scripts.consistency_check import parse_task_blocks
|
||||
|
||||
body = '''## Factory admission
|
||||
|
||||
```task
|
||||
id: HFACT-WP-0001-T01
|
||||
status: progress
|
||||
description: Earlier inline summary.
|
||||
intervention_note: ""
|
||||
blocking_reason: ""
|
||||
```
|
||||
|
||||
---
|
||||
Current native admission requirements.
|
||||
|
||||
### Local proof
|
||||
|
||||
Retain the source evidence and limitations.
|
||||
|
||||
#### Remaining return
|
||||
|
||||
Exact operator binding remains open.
|
||||
---
|
||||
|
||||
## Next task
|
||||
|
||||
```task
|
||||
id: HFACT-WP-0001-T02
|
||||
status: wait
|
||||
```
|
||||
|
||||
Separate next-task description.
|
||||
'''
|
||||
derived = fp._parse_tasks(body, "HFACT-WP-0001")
|
||||
authoritative = parse_task_blocks(body)
|
||||
assert derived[0].description == authoritative[0]["description"]
|
||||
assert "### Local proof" in derived[0].description
|
||||
assert "#### Remaining return" in derived[0].description
|
||||
assert "Next task" not in derived[0].description
|
||||
assert not derived[0].description.startswith("---")
|
||||
assert derived[0].intervention_note == ""
|
||||
assert derived[0].blocking_reason == ""
|
||||
assert derived[1].description == authoritative[1]["description"]
|
||||
assert derived[1].intervention_note is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize("heading", ["", "# Workplan\n", "## Task\n", "### Task\n"])
|
||||
def test_task_description_stops_before_next_task_block(heading, monkeypatch):
|
||||
monkeypatch.syspath_prepend(str(Path(__file__).parents[1] / "scripts"))
|
||||
from scripts.consistency_check import parse_task_blocks
|
||||
|
||||
body = heading + '''```task
|
||||
id: DEMO-WP-0001-T01
|
||||
status: todo
|
||||
```
|
||||
|
||||
First description.
|
||||
|
||||
```task
|
||||
id: DEMO-WP-0001-T02
|
||||
status: wait
|
||||
description: Inline fallback.
|
||||
intervention_note: null
|
||||
blocking_reason: null
|
||||
```
|
||||
'''
|
||||
derived = fp._parse_tasks(body, "DEMO-WP-0001")
|
||||
authoritative = parse_task_blocks(body)
|
||||
assert derived[0].description == authoritative[0]["description"] == "First description."
|
||||
assert derived[1].description == authoritative[1]["description"] == "Inline fallback."
|
||||
assert derived[1].intervention_note is derived[1].blocking_reason is None
|
||||
|
||||
|
||||
def test_identity_matches_the_fleet_derivation():
|
||||
"""Same namespace as ADR-007, so overlay and forge agree on identity."""
|
||||
assert fp.derived_record_uuid("CUST-WP-0067") == "16249302-2767-55df-aec0-d92c2751c225"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue