Skip to content

feat: add bundle-mapper module (bundle-mapper-01, #121)#274

Merged
djm81 merged 3 commits intodevfrom
feature/add-bundle-mapping-strategy
Feb 18, 2026
Merged

feat: add bundle-mapper module (bundle-mapper-01, #121)#274
djm81 merged 3 commits intodevfrom
feature/add-bundle-mapping-strategy

Conversation

@djm81
Copy link
Copy Markdown
Collaborator

@djm81 djm81 commented Feb 18, 2026

Description

Adds the bundle-mapper module (OpenSpec change bundle-mapper-01-mapping-strategy): confidence-based spec-to-bundle assignment with three signals (explicit labels, historical patterns, content similarity), mapping history persistence, and interactive UI. Implemented in worktree only; no core specfact-cli changes.

Fixes #121

New Features #121

Contract References: BundleMapping (Pydantic + beartype), BundleMapper.compute_mapping (@require/@Ensure), MappingRule.matches (beartype), save_user_confirmed_mapping (@require/@Ensure), ask_bundle_mapping (@require/@Ensure).

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🔒 Contract enforcement (adding/updating @icontract decorators)
  • 🧪 Test enhancement (scenario tests, property-based tests)

Contract-First Testing Evidence

Contract Validation

  • Runtime contracts added/updated (@icontract decorators on public APIs)
  • Type checking enforced (@beartype decorators applied)
  • CrossHair exploration completed: hatch run contract-test-exploration
  • Contract violations reviewed and addressed

Test Execution

  • Contract validation: hatch run contract-test-contracts
  • Contract exploration: hatch run contract-test-exploration (not run for module-only)
  • Scenario tests: hatch run contract-test-scenarios
  • Full test suite: hatch run pytest modules/bundle-mapper/tests/ ✅ (11 passed)

Test Quality

  • CLI commands tested (no new CLI in this PR; module provides hooks for future --auto-bundle)
  • Edge cases covered (explicit label valid/invalid, no signals, confidence bounds, history save)
  • Error handling tested (invalid bundle ignored, Pydantic validation)
  • Rich console output verified (interactive UI present; manual check for full flow)

How Has This Been Tested?

Contract-First Approach: New public APIs use @icontract and @beartype. Unit tests cover BundleMapping, BundleMapper (explicit/historical/content signals), and mapping history (item_key, save/load). TDD_EVIDENCE.md in openspec/changes/bundle-mapper-01-mapping-strategy/.

Manual Testing

  • Tested CLI commands manually (N/A – module only)
  • Verified rich console output (ask_bundle_mapping)
  • Tested with different input scenarios (unit tests)
  • Checked error messages for clarity

Automated Testing

  • Contract validation passes
  • Unit tests cover mapping and history
  • All 11 bundle-mapper tests pass
  • Format, type-check, contract-test pass in worktree

Test Environment

  • Python version: 3.12
  • OS: Linux

Checklist

  • My code follows the style guidelines (PEP 8, ruff format, isort)
  • I have performed a self-review of my code
  • I have added/updated contracts (@icontract, @beartype)
  • I have added/updated docstrings (Google style)
  • I have made corresponding changes to documentation (docs update can follow in separate PR)
  • My changes generate no new warnings (basedpyright 0 errors for new code)
  • All tests pass locally
  • I have added tests that prove my fix/feature works
  • Any dependent changes have been merged (none; Wave 1 cross-cutting)

Quality Gates Status

  • Type checking ✅ (hatch run type-check)
  • Linting ✅ (hatch run format)
  • Contract validation ✅ (hatch run contract-test)
  • Contract exploration ✅ (optional for module)
  • Scenario tests ✅ (unit tests for bundle-mapper)

Screenshots/Recordings (if applicable)

N/A – module library; CLI integration (--auto-bundle) to follow when core backlog commands are extended.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

architecture Architecture and design changes change-proposal Proposal for a new change openspec

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Bundle/Spec Mapping Strategy

1 participant