5 Commits

Author SHA1 Message Date
HAL9000 8ed8c25652 fix(plan-lifecycle): record full context snapshots in Strategize phase
The Strategize phase was recording decisions with minimal context
snapshots (only a hash of question+chosen_option), violating the
v3.2.0 acceptance criterion that decisions must include full context
snapshots sufficient to replay the decision.

Changes:
- Add _build_strategize_context_snapshot() helper that builds a full
  ContextSnapshot from plan metadata (description, action_name,
  strategy_actor, project_links)
- Update _try_record_decision() to accept an optional context_snapshot
  parameter and forward it to DecisionService
- Update start_strategize() to build and pass a full context snapshot
- Add 3 BDD scenarios in decision_recording.feature verifying that
  hot_context_hash, hot_context_ref, actor_state_ref, and
  relevant_resources are all populated for Strategize-phase decisions

ISSUES CLOSED: #9056
2026-05-08 05:11:47 +00:00
khyari hamza 0e36755db9 fix(service): address review findings for decision service
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / build (pull_request) Successful in 14s
CI / quality (pull_request) Successful in 16s
CI / security (pull_request) Successful in 31s
CI / typecheck (pull_request) Successful in 43s
CI / unit_tests (pull_request) Successful in 2m18s
CI / integration_tests (pull_request) Successful in 2m53s
CI / docker (pull_request) Successful in 39s
CI / coverage (pull_request) Successful in 3m58s
CI / benchmark-regression (pull_request) Successful in 24m44s
- Rehydrate sequence counter from DB on restart (BUG-1)
- Add uniqueness guard raising SequenceConflictError (BUG-2)
- Fix delete_decision consistency between persisted/in-memory (BUG-3)
- Validate new_decision_id exists in mark_superseded (BUG-4)
- Include orphaned subtrees in get_tree output (BUG-5)
- Remove dead _decision_seq/_next_seq from plan_lifecycle (BUG-7)
- Export SequenceConflictError from services __init__ (SPEC-2)
- Replace list[Any] with list[ArtifactRef] typing (SPEC-4)
- Add actor_reasoning max_length validation (SEC-1)
- Use SELECT COUNT(*) in count_decisions (PERF-1)
- Replace MagicMock with create_autospec(Settings) (TEST-3)
- Eliminate UnitOfWork.__new__() anti-pattern (TEST-4)
- Use exact assertion counts in DI tests (TEST-5)
- Add restart rehydration, BFS order, invalid type, and
  confidence boundary test scenarios (TEST-1/2/6/7)
- Fix decision_service_coverage.feature to match actual API

ISSUES CLOSED: #172
2026-03-03 12:53:28 +00:00
khyari hamza e179f34266 test(service): add persisted-mode integration scenarios for coverage
Add 9 Behave scenarios exercising all database-backed code paths in
DecisionService: record, get, list, list_by_type, get_path_to_root,
get_superseded, mark_superseded, delete, and duplicate detection.
File-level coverage rises from 81% to 96%.

ISSUES CLOSED: #172
2026-03-03 12:18:27 +00:00
khyari hamza db81c4cfd6 test(service): add edge-case scenarios for coverage
Add 11 new Behave scenarios covering SnapshotStore hash-less storage,
hash-index cleanup on remove, multi-entry removal, list_for_plan with
missing snapshots, whitespace-only validation, no-root tree traversal,
and list-by-type string coercion. Brings scenario count from 37 to 48.

ISSUES CLOSED: #172
2026-03-03 12:18:27 +00:00
khyari hamza 878bad4848 feat(service): add decision recording and snapshot store 2026-03-03 12:18:27 +00:00