Skip to content

[Bug] Enrichment parser not merging stories into existing features #59

@djm81

Description

@djm81

Bug Description

When using specfact import from-code --enrichment, stories from LLM enrichment reports are not being correctly merged into existing features. The enrichment parser only adds stories when creating new features, but fails to merge stories when updating existing features that were already present in the plan bundle.

Steps to Reproduce

  1. Run specfact import from-code to create an initial plan bundle with features
  2. Generate an LLM enrichment report that includes stories for existing features
  3. Run specfact import from-code --enrichment <enrichment-report.md>
  4. Observe that stories from the enrichment report are not added to existing features

Expected Behavior

Stories from enrichment reports should be merged into existing features:

  • New stories (by key) should be added to existing features
  • Existing stories should be preserved
  • Feature titles should be updated if they were empty

Actual Behavior

  • Stories are only added when creating new features
  • Existing features do not receive stories from enrichment reports
  • This breaks the dual-stack enrichment workflow (CLI grounding → LLM enrichment → CLI artifact creation)

Impact

  • User Impact: High - Breaks core enrichment workflow
  • Severity: Critical - Prevents proper feature enrichment
  • Workflow: Blocks dual-stack enrichment pattern for brownfield analysis

Example

With DjangoGoat validation:

  • Initial CLI import: 1 feature, 2 stories
  • LLM enrichment report: 8 features with 24 stories total
  • After applying enrichment: Stories not merged into existing features
  • Expected: 8 features with 24 stories correctly populated

Related

This affects the dual-stack enrichment workflow documented in docs/guides/dual-stack-enrichment.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions