Skip to content

feat(brainstormer): product-vision discovery + schema (#122)#127

Merged
hadamrd merged 2 commits into
trunkfrom
loop/122-feat-brainstormer-forge-product-vision-m
May 28, 2026
Merged

feat(brainstormer): product-vision discovery + schema (#122)#127
hadamrd merged 2 commits into
trunkfrom
loop/122-feat-brainstormer-forge-product-vision-m

Conversation

@hadamrd
Copy link
Copy Markdown
Owner

@hadamrd hadamrd commented May 28, 2026

Closes #122. Part of epic #121.

Summary

  • New src/forge_loop/product_vision.py with Axis, ProductVision, MissingVisionError, discover().
  • Pydantic v2 models; acceptable_work and axes are min_length=1; axes accept extra keys (forward-compat).
  • discover(repo_path) reads <repo>/.forge/product-vision.md + .forge/axes.yaml, returns a typed ProductVision, raises MissingVisionError with a specific reason + absolute path on any failure.

Acceptance criteria mapping

  • ✅ Module exposes the four public symbols.
  • Axis required fields + min-length constraint on acceptable_work.
  • ProductVision holds raw vision_markdown + non-empty axes.
  • discover() returns the object on success; missing/invalid raises.
  • ✅ Distinct reason strings: missing vision, missing axes, YAML parse failure, schema-invalid w/ field path, empty vision, empty axes list.
  • ✅ Absolute paths embedded in every error message.
  • ✅ Empty vision treated as invalid with reason vision markdown is empty.
  • __init__.py left untouched — existing pattern does not re-export public submodules wholesale.

Tests

tests/test_product_vision.py (12 tests, all passing):

  • Happy: valid_minimal, valid_full (incl. verbatim markdown round-trip).
  • Sad: missing_vision, missing_axes, empty_vision, invalid_axes_yaml, invalid_axes_schema (missing customer), empty_axes_list, acceptable_work_empty.
  • Adversarial: no .forge/ at all → MissingVisionError (no FileNotFoundError leak); symlinked .forge/ resolves; extra unknown keys on axes are ignored.

Fixtures are force-added because the repo .gitignore excludes .forge/.

hadamrd added 2 commits May 28, 2026 17:13
Introduces a typed, validated "north star" loader for the Product
Brainstormer (epic #121). Without an explicit vision + axes, the
brainstormer used to silently fabricate direction; this layer makes
that impossible.

* New ``forge_loop.product_vision`` module exposing ``Axis``,
  ``ProductVision``, ``MissingVisionError``, and ``discover()``.
* Pydantic v2 models with ``acceptable_work`` min_length=1,
  ``axes`` min_length=1, and ``extra='ignore'`` on axis entries
  for forward-compat.
* ``discover()`` reads ``<repo>/.forge/product-vision.md`` and
  ``.forge/axes.yaml``, returning a typed object or raising
  ``MissingVisionError`` with the offending absolute path and a
  specific reason for each failure mode (missing vision, missing
  axes, YAML parse failure, schema error with field path, empty
  vision, empty axes list, empty acceptable_work).
* Twelve tests covering happy paths, every documented sad path,
  the no-``.forge/``-at-all case, symlinked ``.forge/``, and
  forward-compat extra keys.
…n/ (#122)

The .forge/ pattern is gitignored at repo root; force-add the
fixture tree so CI sees the same files the local pytest run did.
@hadamrd
Copy link
Copy Markdown
Owner Author

hadamrd commented May 28, 2026

Source issue #122 was closed mid-flight (state: closed). Loop refusing auto-merge. Reopen the issue OR merge manually.

@hadamrd hadamrd deleted the loop/122-feat-brainstormer-forge-product-vision-m branch May 28, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(brainstormer): .forge/product-vision.md + axes.yaml discovery + schema

1 participant