Skip to content

fix(scripts): migrate_vbrief produces PROJECT-DEFINITION without required 'overview' narrative key #417

@MScottAdams

Description

@MScottAdams

Problem

task migrate:vbrief on a canonical v0.19 consumer project (SPECIFICATION.md + PROJECT.md + ROADMAP.md, no pre-existing vbrief/specification.vbrief.json) produces a vbrief/PROJECT-DEFINITION.vbrief.json that is missing the overview narrative key, causing task vbrief:validate to fail with:

FAIL: vbrief/PROJECT-DEFINITION.vbrief.json: narratives missing expected key 'overview' (D3)
FAIL: 1 error(s) found

vbrief_validate.py::PROJECT_DEF_EXPECTED_NARRATIVES requires both "overview" and "tech stack" (after .lower()) to be present on PROJECT-DEFINITION.vbrief.json per D3. The migration already derives tech stack from **Tech Stack**: ... in PROJECT.md (via _extract_tech_stack), but has no corresponding derivation for Overview.

Result: brownfield users who run task migrate:vbrief get a validator-failing PROJECT-DEFINITION out of the box. task check fails on their first post-migration commit until they hand-write an Overview narrative.

Discovered during

Swarm-402 Phase 5 consumer upgrade simulation. Simulation transcript:

Step 3 -- migrate_vbrief.py exit=0
...
Step 5 -- vbrief:validate on consumer exit=1
  FAIL: vbrief/PROJECT-DEFINITION.vbrief.json: narratives missing expected key 'overview' (D3)

13 of 14 simulation checks passed; this one FAIL blocks the "consumer runs task check after migration" guarantee.

Root cause

scripts/migrate_vbrief.py::_build_project_definition only populates narratives from (a) a pre-existing specification.vbrief.json plan.narratives and (b) PROJECT.md content (as ProjectConfig + extracted tech stack). Neither path produces an Overview key. Canonical v0.19 consumer projects start with no specification.vbrief.json, so (a) yields nothing; (b) yields ProjectConfig and tech stack but never Overview.

Fix proposal

Add Overview derivation to _build_project_definition:

  1. Prefer spec_vbrief.plan.narratives['Overview'] if present.
  2. Else, derive from the first non-empty paragraph of SPECIFICATION.md (before the <!-- deft:deprecated-redirect --> sentinel is written) or the top-level # <title> heading.
  3. Else, fall back to "TODO: describe this project." so the key is at least present and task vbrief:validate passes; flag it in the migration report so the user knows to fill it in.

Add migration tests covering: spec-present path; SPECIFICATION.md-derived path; fallback path.

Workaround for consumers on current builds

Edit vbrief/PROJECT-DEFINITION.vbrief.json after migration and add an Overview key to plan.narratives.

Impact

Medium. Blocks clean task check post-migration but is trivially patchable by hand. The rest of the migration (lifecycle folders, scope vBRIEFs in pending/, deprecation sentinels, tech stack derivation) works as designed.

Part of #402 validation

Discovered during the Phase 5 consumer upgrade simulation. Not fixed in any of the swarm-402 PRs (#413/#414/#415/#416) because the scope fence forbids expanding PR scope beyond the explicit must-fix list. Filed here so it can be picked up post-v0.20.0 release.

Labels: bug, discovered-during-402

Metadata

Metadata

Assignees

No one assigned

    Labels

    discovered-during-402Bugs discovered during swarm-402 validation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions