markitect-main/markitect
tegwick 7b4bd461c9 feat(prompts): implement Phase 8 - Observability & Traceability (FR-11)
Complete implementation of Phase 8, the final phase of prompt dependency
resolution infrastructure, adding full observability and traceability.

## Features (FR-11)

### FR-11.1: Complete Artifact Provenance Tracing
- TraceabilityService: composition layer for full artifact lineage
- Trace any artifact to producing PromptTemplate, input artifacts,
  generator runs, and quality validation results
- ProvenanceTrace model with complete dependency chain reconstruction
- RunSummary and ArtifactLineage models for structured trace output

### FR-11.2: Recomputation Query Infrastructure
- PromptQueryService: cross-service complex queries
- Run history queries with template and status filters
- Stale artifact detection via impact debt analysis
- Dependency graph statistics (nodes, edges, cycles, roots, leaves)
- Content-based artifact lookups by digest

### Visualization Support
- GraphExporter: DOT (Graphviz) and Mermaid format export
- Supports all edge types (requires, generates, includes)
- Handles isolated nodes, linear chains, diamonds, and complex graphs

### CLI Commands (prompt group)
- `prompt trace <artifact_id>` - Full provenance trace as JSON
- `prompt graph <artifact_id>` - Dependency graph (DOT/Mermaid)
- `prompt runs` - List execution runs with filters
- `prompt debt` - Show impact debt and stale artifacts
- `prompt stats` - Dependency graph statistics

## Implementation

Source files (8):
- markitect/prompts/traceability/models.py - Trace data models
- markitect/prompts/traceability/service.py - TraceabilityService
- markitect/prompts/visualization/graph.py - Graph export
- markitect/prompts/queries/operations.py - PromptQueryService
- markitect/prompts/cli.py - Click CLI commands
- Package __init__.py files (3)

Tests (64 total, all passing):
- tests/unit/prompts/test_traceability_service.py (21 tests)
- tests/unit/prompts/test_visualization.py (14 tests)
- tests/unit/prompts/test_query_operations.py (12 tests)
- tests/integration/prompts/test_traceability_workflow.py (7 tests)
- tests/integration/prompts/test_prompt_cli.py (10 tests)

## Architecture

TraceabilityService is a composition layer that delegates to:
- DependencyQueryService (transitive dependency lookups)
- QualityValidator (validation history)
- IncrementalExecutionEngine (impact debt queries)
- Direct repository access (artifacts, edges)

No duplicate data storage - all data comes from existing Phase 1-7
infrastructure (artifact repo, dependency repo, validation DB, debt DB).

## Verification

All 2250 tests pass with 0 regressions.
Phase 8 completes the full 8-phase implementation roadmap.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-09 20:32:18 +01:00
..
assets refactor: failed attempt at edit mode recovery and robustness implementation 2025-11-12 00:19:03 +01:00
core feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00
explode_variants feat: complete Issue #150 - Advanced Packaging Features (.mdz, .mdt) 2025-10-13 23:09:18 +02:00
finance feat: reorganize tests by capability with separate test targets 2025-10-25 02:37:45 +02:00
graphql feat(spaces): implement Phase 6 API Layer 2026-02-08 12:29:11 +01:00
legacy feat: Complete Issue #39 - Database CLI Reorganization with Comprehensive Legacy Compatibility System 2025-09-30 17:28:39 +02:00
matter_contentmatter feat: Complete Issue #38 - Full MarkdownMatters CLI implementation with TDD8 methodology 2025-10-02 09:14:24 +02:00
matter_frontmatter feat: implement comprehensive front matter preservation and unicode handling 2025-10-13 20:26:08 +02:00
matter_tailmatter feat: Complete Issue #38 - Full MarkdownMatters CLI implementation with TDD8 methodology 2025-10-02 09:14:24 +02:00
packaging feat: complete Issue #150 - Advanced Packaging Features (.mdz, .mdt) 2025-10-13 23:09:18 +02:00
plugins feat: consolidate testdrive-jsui to capabilities and implement plugin self-declaration 2025-12-15 23:42:54 +01:00
production feat: complete Issue #145 - Phase 4: Production Readiness and Release 2025-10-14 18:15:26 +02:00
profile feat: implement comprehensive User Profile Management System (issue #107) 2025-10-04 01:53:31 +02:00
prompts feat(prompts): implement Phase 8 - Observability & Traceability (FR-11) 2026-02-09 20:32:18 +01:00
query_paradigms feat: reorganize tests by capability with separate test targets 2025-10-25 02:37:45 +02:00
schema feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00
schemas feat: add changelog schema for Keep a Changelog validation 2026-01-06 13:31:02 +01:00
spaces feat(spaces): implement Phase 8 Git History Tracking 2026-02-08 18:03:35 +01:00
static/css feat: Complete Phase 4 - Remove legacy JavaScript files 2025-12-16 10:27:05 +01:00
storage feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00
template feat: Complete Issue #65 Template Engine Foundation + Fix CLI Regression 2025-10-02 15:33:32 +02:00
templates fix: CSS injection and theme application bugs 2025-12-17 12:02:42 +01:00
themes feat: implement modular theme system with file-based theme organization 2025-11-10 11:43:25 +01:00
validators feat: add LinkValidator for semantic link validation (Phase 3) 2026-01-06 03:41:03 +01:00
__init__.py chore: gitignore and repo cleanup 2025-09-16 03:04:18 +02:00
__version__.py refactor: delegate version management to release-management capability 2025-11-09 10:41:28 +01:00
asset_commands.py feat: implement Issue #143 - CLI integration and user experience for asset management 2025-10-14 13:46:34 +02:00
associated_files.py feat: Complete Issue #40 - Associated Files Management with Interactive vs Automation Mode System 2025-09-30 13:09:37 +02:00
ast_cache.py feat: Strategic pivot to CLI implementation with comprehensive foundation 2025-09-24 01:14:27 +02:00
ast_service.py fix: Improve AST display content visibility for Issue #15 2025-09-27 09:31:47 +02:00
batch_processor.py feat: implement batch processing and recursive operations (issue #17) 2025-10-03 10:45:43 +02:00
cache_service.py feat: Complete logging standardization with context-aware system 2025-09-27 08:28:10 +02:00
clean_document_manager.py fix: CSS injection and theme application bugs 2025-12-17 12:02:42 +01:00
cli.py feat(prompts): implement Phase 8 - Observability & Traceability (FR-11) 2026-02-09 20:32:18 +01:00
cli_utils.py feat: implement Issue #143 - CLI integration and user experience for asset management 2025-10-14 13:46:34 +02:00
config_manager.py feat: optimize code quality with pylint analysis and critical fixes - Issue #130 2025-10-06 03:03:38 +02:00
database.py feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00
document_manager.py feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00
draft_generator.py refactor: enhance draft generator documentation and code quality 2025-10-03 10:35:16 +02:00
exceptions.py feat: optimize code quality with pylint analysis and critical fixes - Issue #130 2025-10-06 03:03:38 +02:00
frontmatter.py feat: optimize code quality with pylint analysis and critical fixes - Issue #130 2025-10-06 03:03:38 +02:00
legacy_compat.py feat: optimize code quality with pylint analysis and critical fixes - Issue #130 2025-10-06 03:03:38 +02:00
legacy_integration_example.py feat: Complete Issue #39 - Database CLI Reorganization with Comprehensive Legacy Compatibility System 2025-09-30 17:28:39 +02:00
metaschema.py feat: implement Phase 1 - Enhanced Schema Format with Classifications 2026-01-04 21:02:51 +01:00
parser.py feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00
performance_tracker.py feat: optimize code quality with pylint analysis and critical fixes - Issue #130 2025-10-06 03:03:38 +02:00
schema_analyzer.py feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00
schema_generator.py feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00
schema_loader.py feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00
schema_naming.py feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00
schema_refiner.py feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00
schema_validator.py feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00
semantic_validator.py feat: complete schema-evolution topic with ADR schema and markdown support 2026-01-06 12:32:38 +01:00
serializer.py feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00
stub_generator.py feat: optimize code quality with pylint analysis and critical fixes - Issue #130 2025-10-06 03:03:38 +02:00
validation_error.py feat: Complete Issue #8 - Detailed Validation Error Reporting and CLI Enhancements 2025-09-29 21:21:21 +02:00
workspace.py feat(spaces): implement Phase 0-1 of Information Space Service 2026-02-08 02:02:46 +01:00