groundswell 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/subtask-planning/prp-base-create.md +120 -0
- package/.claude/commands/subtask-planning/prp-base-execute.md +65 -0
- package/.claude/commands/task-breakdown.md +94 -0
- package/.claude/system_prompts/task-breakdown.md +1 -0
- package/CHANGELOG.md +188 -0
- package/PRD.md +543 -0
- package/README.md +99 -5
- package/examples/README.md +15 -1
- package/examples/examples/11-reparenting-workflows.ts +269 -0
- package/examples/index.ts +4 -0
- package/package-lock.json +2398 -0
- package/package.json +3 -1
- package/plan/001_d3bb02af4886/TEST_RESULTS.md +259 -0
- package/plan/001_d3bb02af4886/bug_fix_tasks.json +484 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M1T1S1/PRP.md +488 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M1T1S2/PRP.md +581 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M1T1S3/PRP.md +687 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T1S1/PRP.md +492 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T1S3/PRP.md +932 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T1S3/research/concurrent_error_testing_patterns.md +1109 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T1S3/research/vitest_concurrent_testing.md +802 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T1S3/research/workflow_engine_test_references.md +603 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T2S1/PRP.md +564 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T2S3/PRP.md +518 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T2S4/PRP.md +1252 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T3S1/PRP.md +364 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T3S1/research/CODEBASE_INVENTORY.md +114 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T3S1/research/DECORATOR_DOCUMENTATION_PATTERNS.md +205 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T3S1/research/PRD_LOCATION_ANALYSIS.md +199 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M2T3S1/research/ULTRATHINK_PRP_PLAN.md +134 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T1S1/PRP.md +495 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T1S1/research/console_error_inventory.md +435 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T1S2/PRP.md +506 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T1S3/PRP.md +612 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T2S2/PRP.md +558 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T2S2/research/external_research.md +788 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T3S2/PRP.md +460 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T3S3/PRP.md +454 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T4S1/PRP.md +520 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T4S1/RECOMMENDATION.md +417 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T4S1/research/external_workflow_engines_research.md +760 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T4S1/research/security_implications_analysis.md +245 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M3T4S2/PRP.md +792 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S1/PRP.md +535 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S1/TEST_EXECUTION_REPORT.md +190 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S2/PRP.md +654 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S2/TEST_FIX_REPORT.md +227 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S2/research/KEY_FINDINGS.md +345 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S2/research/QUICK_REFERENCE.md +193 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T1S2/research/test_maintenance_research.md +1323 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T3S1/BREAKING_CHANGES_AUDIT.md +1011 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T3S1/PRP.md +927 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T3S2/PRP.md +505 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/architecture/logger_child_signature_analysis.md +401 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S3/child_implementation_research.md +142 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S3/test_patterns_research.md +112 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S3/vitest_patterns_research.md +159 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S4/PRP.md +549 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S4/VERIFICATION_REPORT.md +368 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S4/edge_case_analysis.md +172 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M1T1S4/usage_inventory.md +175 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T1S2/PRP.md +696 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T1S4/PRP.md +860 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/PRP.md +1066 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/01-testing-aggregated-errors.md +1103 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/01_typescript_error_aggregation_patterns.md +789 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/02-error-merge-strategy-testing-guide.md +1098 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/02_aggregate_error_patterns.md +1037 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/03-promise-allsettled-testing-patterns.md +916 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/03_error_merging_strategies.md +1045 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/04_github_stackoverflow_examples.md +890 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/05_comprehensive_summary.md +822 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/INDEX.md +668 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/QUICK_REFERENCE.md +706 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/README.md +265 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S2/research/RESEARCH_REPORT.md +655 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T2S4/research/vitest_testing_patterns.md +1103 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M2T3S2/PRP.md +426 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T1S2/PRP.md +506 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T1S2/research/QUICK_REFERENCE.md +114 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T1S2/research/RESEARCH_SUMMARY.md +316 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T1S2/research/vitest_observer_error_logging_best_practices.md +754 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T1S3/PRP.md +612 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T2S1/PRP.md +719 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T2S1/README.md +215 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T2S1/analysis.md +765 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T2S3/PRP.md +718 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T3S1/DECISION.md +149 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T3S1/PRP.md +470 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T3S1/research/ULTRATHINK_PLAN.md +332 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T3S1/research/codebase_workflow_name_analysis.md +167 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T3S1/research/external_best_practices.md +265 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T3S1/research/validation_patterns.md +273 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T4S1/workflow_engine_ancestry_api_research.md +760 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M3T4S3-PRP.md +434 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M4T2S1/PRP.md +717 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M4T2S2/PRP.md +472 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M4T2S2/VALIDATION_REPORT.md +125 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/P1M4T2S2/research/ULTRATHINK_PRP_PLAN.md +301 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/error-logging-best-practices.md +1170 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/research_typescript_partial_and_overloads.md +940 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/vitest-quick-reference.md +151 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/docs/vitest-research.md +650 -0
- package/plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/prd_snapshot.md +259 -0
- package/plan/001_d3bb02af4886/bugfix/P1M1T1S1/PRP.md +457 -0
- package/plan/001_d3bb02af4886/bugfix/RESEARCH_SUMMARY.md +346 -0
- package/plan/001_d3bb02af4886/bugfix/architecture/codebase_structure.md +311 -0
- package/plan/001_d3bb02af4886/bugfix/architecture/concurrent_execution_best_practices.md +1565 -0
- package/plan/001_d3bb02af4886/bugfix/architecture/error_handling_patterns.md +288 -0
- package/plan/001_d3bb02af4886/bugfix/architecture/promise_all_analysis.md +741 -0
- package/plan/001_d3bb02af4886/docs/PRP/P1M1T1S4-functional-workflow-error-state-capture-test.md +652 -0
- package/plan/001_d3bb02af4886/docs/PRP/PRP.md +527 -0
- package/plan/001_d3bb02af4886/docs/PRP/bugfix/P1M1T2S1-PRP.md +415 -0
- package/plan/001_d3bb02af4886/docs/PRP/bugfix/P1M1T2S2-PRP.md +378 -0
- package/plan/001_d3bb02af4886/docs/PRP/bugfix/P1M1T2S4-PRP.md +713 -0
- package/plan/001_d3bb02af4886/docs/PRP/bugfix/P1M2T1S4-PRP.md +370 -0
- package/plan/001_d3bb02af4886/docs/PRP_P1M3T1S3.md +499 -0
- package/plan/001_d3bb02af4886/docs/TEST_RESULTS.md +230 -0
- package/plan/001_d3bb02af4886/docs/bugfix/ANALYSIS_PRD_VS_IMPLEMENTATION.md +1134 -0
- package/plan/001_d3bb02af4886/docs/bugfix/GAP_ANALYSIS_SUMMARY.md +179 -0
- package/plan/001_d3bb02af4886/docs/bugfix/P1M4T2S1/PRP.md +629 -0
- package/plan/001_d3bb02af4886/docs/bugfix/P1M4T2S1/validation-report.md +214 -0
- package/plan/001_d3bb02af4886/docs/bugfix/PRP_P1M4T2S3.md +629 -0
- package/plan/001_d3bb02af4886/docs/bugfix/bugfix_PRP.md +529 -0
- package/plan/001_d3bb02af4886/docs/bugfix/bugfix_QUICK_REFERENCE.md +142 -0
- package/plan/001_d3bb02af4886/docs/bugfix/bugfix_README.md +304 -0
- package/plan/001_d3bb02af4886/docs/bugfix/bugfix_TEST_RESULTS.md +558 -0
- package/plan/001_d3bb02af4886/docs/bugfix/bugfix_VALIDATION_SUMMARY.md +256 -0
- package/plan/001_d3bb02af4886/docs/bugfix/system_context.md +346 -0
- package/plan/001_d3bb02af4886/docs/bugfix-architecture/bug_analysis.md +415 -0
- package/plan/001_d3bb02af4886/docs/bugfix-architecture/implementation_patterns.md +489 -0
- package/plan/001_d3bb02af4886/docs/bugfix-architecture/system_context.md +218 -0
- package/plan/001_d3bb02af4886/docs/bugfix_INITIATION_SUMMARY.md +380 -0
- package/plan/001_d3bb02af4886/docs/research/CYCLE_DETECTION_PATTERNS.md +1923 -0
- package/plan/001_d3bb02af4886/docs/research/CYCLE_DETECTION_QUICK_REF.md +319 -0
- package/plan/001_d3bb02af4886/docs/research/P1M1T2S1/codebase-context.md +115 -0
- package/plan/001_d3bb02af4886/docs/research/P1M1T2S1/cycle-detection-algorithms.md +134 -0
- package/plan/001_d3bb02af4886/docs/research/P1M1T2S1/test-patterns.md +153 -0
- package/plan/001_d3bb02af4886/docs/research/P1M1T2S1/workflow-class.md +132 -0
- package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/DECORATOR_DOCUMENTATION_BEST_PRACTICES.md +716 -0
- package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/DECORATOR_DOCUMENTATION_QUICK_REF.md +186 -0
- package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/GROUNDSWELL_DECORATOR_EXAMPLES.md +604 -0
- package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/INDEX.md +213 -0
- package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/codebase_structure.md +30 -0
- package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/existing_test_pattern.md +56 -0
- package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/getRootObservers_implementation.md +53 -0
- package/plan/001_d3bb02af4886/docs/research/P1M2T1S4/test_conventions.md +49 -0
- package/plan/001_d3bb02af4886/docs/research/P1M3T1S4/PRP.md +958 -0
- package/plan/001_d3bb02af4886/docs/research/P1M3T1S4/QUICK_REFERENCE.md +339 -0
- package/plan/001_d3bb02af4886/docs/research/P1M3T1S4/README.md +305 -0
- package/plan/001_d3bb02af4886/docs/research/P1M3T1S4/SUMMARY.md +433 -0
- package/plan/001_d3bb02af4886/docs/research/P1M3T1S4/bidirectional-tree-consistency-testing.md +1574 -0
- package/plan/001_d3bb02af4886/docs/research/P1M3T1S4/test-pattern-examples.md +1014 -0
- package/plan/001_d3bb02af4886/docs/research/PROMISE_ALLSETTLED_QUICK_REF.md +376 -0
- package/plan/001_d3bb02af4886/docs/research/PROMISE_ALLSETTLED_RESEARCH.md +1507 -0
- package/plan/001_d3bb02af4886/docs/research/bugfix_typescript_patterns.md +949 -0
- package/plan/001_d3bb02af4886/docs/research/error-testing-research.md +619 -0
- package/plan/001_d3bb02af4886/docs/research/error_handling_patterns.md +723 -0
- package/plan/{research → 001_d3bb02af4886/docs/research/general}/introspection-security-guide.md +56 -0
- package/plan/001_d3bb02af4886/docs/research/incremental-tree-map-updates/PRP_TEMPLATE.md +460 -0
- package/plan/001_d3bb02af4886/docs/research/incremental-tree-map-updates/QUICK_REFERENCE.md +324 -0
- package/plan/001_d3bb02af4886/docs/research/incremental-tree-map-updates/README.md +175 -0
- package/plan/001_d3bb02af4886/docs/research/incremental-tree-map-updates/RESEARCH_REPORT.md +499 -0
- package/plan/001_d3bb02af4886/docs/research/incremental-tree-map-updates/SUMMARY.md +163 -0
- package/plan/bugfix/BUG_FIX_SUMMARY.md +961 -0
- package/src/__tests__/adversarial/attachChild-performance.test.ts +216 -0
- package/src/__tests__/adversarial/circular-reference.test.ts +101 -0
- package/src/__tests__/adversarial/complex-circular-reference.test.ts +139 -0
- package/src/__tests__/adversarial/concurrent-task-failures.test.ts +571 -0
- package/src/__tests__/adversarial/deep-analysis.test.ts +729 -0
- package/src/__tests__/adversarial/deep-hierarchy-stress.test.ts +213 -0
- package/src/__tests__/adversarial/e2e-prd-validation.test.ts +448 -0
- package/src/__tests__/adversarial/edge-case.test.ts +703 -0
- package/src/__tests__/adversarial/error-merge-strategy.test.ts +760 -0
- package/src/__tests__/adversarial/incremental-performance.test.ts +140 -0
- package/src/__tests__/adversarial/node-map-update-benchmarks.test.ts +457 -0
- package/src/__tests__/adversarial/observer-propagation.test.ts +487 -0
- package/src/__tests__/adversarial/parent-validation.test.ts +143 -0
- package/src/__tests__/adversarial/prd-12-2-compliance.test.ts +611 -0
- package/src/__tests__/adversarial/prd-compliance.test.ts +731 -0
- package/src/__tests__/compatibility/backward-compatibility.test.ts +1572 -0
- package/src/__tests__/helpers/index.ts +18 -0
- package/src/__tests__/helpers/tree-verification.ts +257 -0
- package/src/__tests__/integration/bidirectional-consistency.test.ts +847 -0
- package/src/__tests__/integration/observer-logging.test.ts +643 -0
- package/src/__tests__/integration/tree-mirroring.test.ts +37 -0
- package/src/__tests__/integration/workflow-reparenting.test.ts +303 -0
- package/src/__tests__/unit/context.test.ts +79 -0
- package/src/__tests__/unit/logger.test.ts +293 -0
- package/src/__tests__/unit/observable.test.ts +321 -0
- package/src/__tests__/unit/tree-debugger-incremental.test.ts +170 -0
- package/src/__tests__/unit/utils/workflow-error-utils.test.ts +209 -0
- package/src/__tests__/unit/workflow-detachChild.test.ts +100 -0
- package/src/__tests__/unit/workflow-emitEvent-childDetached.test.ts +153 -0
- package/src/__tests__/unit/workflow-isDescendantOf.test.ts +180 -0
- package/src/__tests__/unit/workflow.test.ts +277 -1
- package/src/core/agent.ts +21 -1
- package/src/core/logger.ts +27 -2
- package/src/core/workflow-context.ts +6 -4
- package/src/core/workflow.ts +252 -14
- package/src/debugger/tree-debugger.ts +52 -7
- package/src/decorators/task.ts +65 -2
- package/src/index.ts +4 -2
- package/src/types/decorators.ts +8 -1
- package/src/types/events.ts +1 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/observable.ts +32 -3
- package/src/utils/workflow-error-utils.ts +56 -0
- package/tsconfig.json +1 -1
- package/llms_full.txt +0 -5890
- package/tasks.json +0 -0
- /package/plan/{backlog.json → 001_d3bb02af4886/backlog.json} +0 -0
- /package/plan/{P1P2/PRP.md → 001_d3bb02af4886/docs/PRP/P1P2-PRP.md} +0 -0
- /package/plan/{P3P4/PRP.md → 001_d3bb02af4886/docs/PRP/P3P4-PRP.md} +0 -0
- /package/plan/{P4P5/PRP.md → 001_d3bb02af4886/docs/PRP/P4P5-PRP.md} +0 -0
- /package/plan/{architecture → 001_d3bb02af4886/docs/architecture}/external_deps.md +0 -0
- /package/plan/{architecture → 001_d3bb02af4886/docs/architecture}/system_context.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/LRU_CACHE_BEST_PRACTICES.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/LRU_CACHE_CODE_PATTERNS.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/LRU_CACHE_INTEGRATION_GUIDE.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/LRU_CACHE_RESEARCH_INDEX.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/REFLECTION_INDEX.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/REFLECTION_RESEARCH_REPORT.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/RESEARCH_SUMMARY.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/anthropic-sdk.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/async-local-storage.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/reflection-code-patterns.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/reflection-decision-matrix.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/reflection-implementation-guide.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/reflection-integration-guide.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/reflection-patterns.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/reflection-quick-reference.md +0 -0
- /package/plan/{P1P2/research → 001_d3bb02af4886/docs/research/P1P2}/zod-schema.md +0 -0
- /package/plan/{P3P4/research → 001_d3bb02af4886/docs/research/P3P4}/caching-lru.md +0 -0
- /package/plan/{P3P4/research → 001_d3bb02af4886/docs/research/P3P4}/introspection-tools.md +0 -0
- /package/plan/{P3P4/research → 001_d3bb02af4886/docs/research/P3P4}/reflection-patterns.md +0 -0
- /package/plan/{P4P5/research → 001_d3bb02af4886/docs/research/P4P5}/RESEARCH_SUMMARY.md +0 -0
- /package/plan/{research → 001_d3bb02af4886/docs/research/general}/INTROSPECTION_RESEARCH_SUMMARY.md +0 -0
- /package/plan/{research → 001_d3bb02af4886/docs/research/general}/README-INTROSPECTION.md +0 -0
- /package/plan/{research → 001_d3bb02af4886/docs/research/general}/agent-introspection-patterns.md +0 -0
- /package/plan/{research → 001_d3bb02af4886/docs/research/general}/introspection-tool-examples.md +0 -0
- /package/{PRPs/PRDs/001-hierarchical-workflow-engine.md → plan/001_d3bb02af4886/prd_snapshot.md} +0 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
# Product Requirement Prompt (PRP) - P1.M4.T3.S2
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
**Feature Goal**: Create a comprehensive backward compatibility test suite that validates all existing API usage patterns continue to work after bug fixes, and ensures breaking changes fail with clear, actionable error messages directing users to the correct migration path.
|
|
6
|
+
|
|
7
|
+
**Deliverable**: A new test file `src/__tests__/compatibility/backward-compatibility.test.ts` containing tests that verify:
|
|
8
|
+
1. All existing code patterns from documentation/examples work correctly
|
|
9
|
+
2. Old API patterns continue to function (backward compatible changes)
|
|
10
|
+
3. Breaking changes fail with descriptive error messages
|
|
11
|
+
4. Migration examples from documentation work as expected
|
|
12
|
+
|
|
13
|
+
**Success Definition**:
|
|
14
|
+
- All backward compatibility tests pass (100% success rate)
|
|
15
|
+
- Breaking change (workflow name validation) provides clear error messages
|
|
16
|
+
- Existing documentation examples run without modification
|
|
17
|
+
- Total test coverage includes backward compatibility scenarios
|
|
18
|
+
|
|
19
|
+
## User Persona
|
|
20
|
+
|
|
21
|
+
**Target User**: Library maintainers and developers who need to ensure that bug fixes don't break existing user code.
|
|
22
|
+
|
|
23
|
+
**Use Case**: After implementing bug fixes for version 0.0.3 → 0.0.4, verify that existing user code continues to work and that the one breaking change (workflow name validation) is well-documented with clear error messages.
|
|
24
|
+
|
|
25
|
+
**User Journey**:
|
|
26
|
+
1. Run the backward compatibility test suite after bug fixes
|
|
27
|
+
2. Verify all existing usage patterns still work
|
|
28
|
+
3. Confirm breaking changes have clear error messages
|
|
29
|
+
4. Use tests as documentation for migration paths
|
|
30
|
+
|
|
31
|
+
**Pain Points Addressed**:
|
|
32
|
+
- Fear of breaking existing user code with bug fixes
|
|
33
|
+
- Unclear error messages when breaking changes occur
|
|
34
|
+
- Lack of automated validation for backward compatibility
|
|
35
|
+
|
|
36
|
+
## Why
|
|
37
|
+
|
|
38
|
+
- **Business value**: Maintains user trust by ensuring updates don't silently break their code
|
|
39
|
+
- **Integration with existing features**: Validates that all 8 bug fixes preserve expected behavior
|
|
40
|
+
- **Problems this solves**: Provides automated confidence that the library's public API remains stable except for documented breaking changes
|
|
41
|
+
|
|
42
|
+
## What
|
|
43
|
+
|
|
44
|
+
Create a comprehensive backward compatibility test suite that:
|
|
45
|
+
|
|
46
|
+
1. Tests all 11 example files from `examples/examples/` directory work correctly
|
|
47
|
+
2. Validates all README documentation examples execute without error
|
|
48
|
+
3. Confirms backward compatible API changes (WorkflowLogger.child(), Promise.allSettled) maintain old behavior
|
|
49
|
+
4. Verifies the one breaking change (workflow name validation) has clear error messages
|
|
50
|
+
5. Tests decorator usage patterns from documentation
|
|
51
|
+
6. Validates parent-child workflow patterns
|
|
52
|
+
7. Tests functional workflow factory patterns
|
|
53
|
+
|
|
54
|
+
### Success Criteria
|
|
55
|
+
|
|
56
|
+
- [ ] All backward compatibility tests pass
|
|
57
|
+
- [ ] Examples from `examples/` directory run successfully
|
|
58
|
+
- [ ] README quick start examples execute without modification
|
|
59
|
+
- [ ] Old API patterns (string-based logger.child(), Promise.all behavior) work correctly
|
|
60
|
+
- [ ] Breaking change (name validation) throws descriptive errors
|
|
61
|
+
- [ ] Test file follows existing patterns from `src/__tests__/unit/`
|
|
62
|
+
|
|
63
|
+
## All Needed Context
|
|
64
|
+
|
|
65
|
+
### Context Completeness Check
|
|
66
|
+
|
|
67
|
+
**"No Prior Knowledge" test**: If someone knew nothing about this codebase, would they have everything needed to implement this successfully? ✓ YES
|
|
68
|
+
|
|
69
|
+
This PRP includes:
|
|
70
|
+
- Specific file paths and patterns to follow
|
|
71
|
+
- Complete breaking changes audit from S1
|
|
72
|
+
- Existing test patterns to emulate
|
|
73
|
+
- All documentation examples to test
|
|
74
|
+
- Exact test framework configuration
|
|
75
|
+
- Validation commands specific to this project
|
|
76
|
+
|
|
77
|
+
### Documentation & References
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
# MUST READ - Include these in your context window
|
|
81
|
+
|
|
82
|
+
# Breaking Changes Audit - Complete analysis of all 8 bug fixes
|
|
83
|
+
- file: plan/001_d3bb02af4886/bugfix/001_e8e04329daf3/P1M4T3S1/BREAKING_CHANGES_AUDIT.md
|
|
84
|
+
why: Contains complete analysis of 1 breaking change (workflow name validation) and 7 non-breaking changes
|
|
85
|
+
critical: Only LOW severity breaking change: Workflow constructor now rejects empty/whitespace/long names (>100 chars)
|
|
86
|
+
gotcha: All other changes are backward compatible via function overloads or default behavior preservation
|
|
87
|
+
|
|
88
|
+
# Existing Test Patterns - Follow these patterns
|
|
89
|
+
- file: src/__tests__/unit/workflow.test.ts
|
|
90
|
+
why: Shows Vitest testing patterns, Workflow class testing, error assertion patterns
|
|
91
|
+
pattern: describe/it structure, expect().toThrow() for error validation, async test patterns
|
|
92
|
+
|
|
93
|
+
- file: src/__tests__/unit/logger.test.ts
|
|
94
|
+
why: Shows backward compatibility testing for WorkflowLogger.child() signature change
|
|
95
|
+
pattern: Tests both old (string) and new (Partial<LogEntry>) API patterns, parameterized tests with it.each
|
|
96
|
+
|
|
97
|
+
- file: src/__tests__/adversarial/concurrent-task-failures.test.ts
|
|
98
|
+
why: Shows Promise.allSettled backward compatibility testing
|
|
99
|
+
pattern: Validates default behavior (throw first error) is preserved
|
|
100
|
+
|
|
101
|
+
# Examples to Test - All 11 example files should execute without modification
|
|
102
|
+
- file: examples/examples/01-basic-workflow.ts
|
|
103
|
+
why: Basic class-based workflow pattern - most common usage
|
|
104
|
+
|
|
105
|
+
- file: examples/examples/02-decorator-options.ts
|
|
106
|
+
why: All @Step, @Task, @ObservedState decorator options
|
|
107
|
+
|
|
108
|
+
- file: examples/examples/03-parent-child.ts
|
|
109
|
+
why: Parent-child workflow hierarchy patterns
|
|
110
|
+
|
|
111
|
+
- file: examples/examples/05-error-handling.ts
|
|
112
|
+
why: Error handling patterns with WorkflowError
|
|
113
|
+
|
|
114
|
+
- file: examples/examples/06-concurrent-tasks.ts
|
|
115
|
+
why: @Task concurrent execution patterns
|
|
116
|
+
|
|
117
|
+
# Documentation Examples
|
|
118
|
+
- file: README.md
|
|
119
|
+
why: Quick start examples are primary user onboarding patterns
|
|
120
|
+
section: Lines 17-84 contain all quick start examples
|
|
121
|
+
|
|
122
|
+
- file: docs/workflow.md
|
|
123
|
+
why: Complete API reference with usage examples
|
|
124
|
+
section: Lines 17-258 document all workflow patterns
|
|
125
|
+
|
|
126
|
+
# External Best Practices
|
|
127
|
+
- url: https://semver.org/spec/v2.0.0.html
|
|
128
|
+
why: Semantic versioning definition of breaking changes
|
|
129
|
+
critical: MAJOR = incompatible API changes, PATCH = backward-compatible bug fixes
|
|
130
|
+
|
|
131
|
+
- url: https://vitest.dev/guide/
|
|
132
|
+
why: Vitest testing framework documentation
|
|
133
|
+
critical: Project uses Vitest for all tests
|
|
134
|
+
|
|
135
|
+
- url: https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes
|
|
136
|
+
why: TypeScript-specific breaking change patterns
|
|
137
|
+
critical: Adding optional interface properties is non-breaking
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Current Codebase Structure
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
groundswell/
|
|
144
|
+
├── src/
|
|
145
|
+
│ ├── __tests__/
|
|
146
|
+
│ │ ├── unit/ # Unit tests (17 test files)
|
|
147
|
+
│ │ ├── integration/ # Integration tests (5 test files)
|
|
148
|
+
│ │ ├── adversarial/ # Adversarial/edge case tests (13 test files)
|
|
149
|
+
│ │ └── helpers/ # Test utilities (tree-verification.ts, index.ts)
|
|
150
|
+
│ ├── core/ # Core classes (Workflow, WorkflowLogger, Agent)
|
|
151
|
+
│ ├── decorators/ # @Step, @Task, @ObservedState decorators
|
|
152
|
+
│ ├── types/ # TypeScript type definitions
|
|
153
|
+
│ └── index.ts # Public API exports
|
|
154
|
+
├── examples/
|
|
155
|
+
│ └── examples/ # 11 runnable example files
|
|
156
|
+
├── dist/ # Compiled TypeScript output
|
|
157
|
+
├── vitest.config.ts # Vitest configuration
|
|
158
|
+
└── package.json # Project scripts and dependencies
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Desired Codebase Structure with Files to be Added
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
src/__tests__/
|
|
165
|
+
├── compatibility/ # NEW: Backward compatibility tests
|
|
166
|
+
│ └── backward-compatibility.test.ts # NEW: Main backward compatibility test suite
|
|
167
|
+
├── unit/ # Existing unit tests
|
|
168
|
+
├── integration/ # Existing integration tests
|
|
169
|
+
└── adversarial/ # Existing adversarial tests
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Known Gotchas & Library Quirks
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
// CRITICAL: Vitest requires specific import pattern
|
|
176
|
+
// Use: import { describe, it, expect } from 'vitest';
|
|
177
|
+
// NOT: import { test } from 'node:test';
|
|
178
|
+
|
|
179
|
+
// CRITICAL: Workflow constructor has TWO patterns
|
|
180
|
+
// Pattern 1: Class-based (extends Workflow)
|
|
181
|
+
class MyWorkflow extends Workflow {
|
|
182
|
+
constructor(name?: string) { super(name); }
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Pattern 2: Functional
|
|
186
|
+
const wf = new Workflow({ name: 'MyWorkflow' }, async (ctx) => { ... });
|
|
187
|
+
|
|
188
|
+
// GOTCHA: Workflow name validation applies to BOTH patterns
|
|
189
|
+
// Empty string, whitespace-only, and names >100 chars throw Error
|
|
190
|
+
|
|
191
|
+
// CRITICAL: WorkflowLogger.child() has TWO valid signatures
|
|
192
|
+
// Old API (backward compatible):
|
|
193
|
+
logger.child('parent-log-id')
|
|
194
|
+
|
|
195
|
+
// New API:
|
|
196
|
+
logger.child({ parentLogId: 'parent-log-id' })
|
|
197
|
+
|
|
198
|
+
// GOTCHA: @Task with concurrent: true still throws first error by default
|
|
199
|
+
// This preserves Promise.all() behavior despite using Promise.allSettled()
|
|
200
|
+
// Only when errorMergeStrategy.enabled = true does behavior change
|
|
201
|
+
|
|
202
|
+
// CRITICAL: Test files must end in .test.ts for Vitest to pick them up
|
|
203
|
+
// Place in src/__tests__/compatibility/ directory
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Implementation Blueprint
|
|
207
|
+
|
|
208
|
+
### Data Models and Structure
|
|
209
|
+
|
|
210
|
+
No new data models needed - testing existing public API patterns.
|
|
211
|
+
|
|
212
|
+
### Implementation Tasks (ordered by dependencies)
|
|
213
|
+
|
|
214
|
+
```yaml
|
|
215
|
+
Task 1: CREATE src/__tests__/compatibility/backward-compatibility.test.ts
|
|
216
|
+
- IMPLEMENT: Comprehensive backward compatibility test suite
|
|
217
|
+
- FOLLOW pattern: src/__tests__/unit/workflow.test.ts (describe/it structure, expect().toThrow())
|
|
218
|
+
- NAMING: Descriptive test names following pattern "should {expected behavior}"
|
|
219
|
+
- PLACEMENT: New compatibility/ directory under __tests__/
|
|
220
|
+
|
|
221
|
+
Task 2: ADD Tests for Breaking Change (Workflow Name Validation)
|
|
222
|
+
- IMPLEMENT: Tests that verify empty/whitespace/long names throw clear errors
|
|
223
|
+
- FOLLOW pattern: src/__tests__/unit/workflow.test.ts lines 13-85 (name validation tests)
|
|
224
|
+
- VALIDATE: Error messages are descriptive and guide users to fix
|
|
225
|
+
- COVER: Both class-based and functional constructor patterns
|
|
226
|
+
|
|
227
|
+
Task 3: ADD Tests for Backward Compatible Changes (WorkflowLogger.child())
|
|
228
|
+
- IMPLEMENT: Tests that string-based API still works
|
|
229
|
+
- FOLLOW pattern: src/__tests__/unit/logger.test.ts lines 90-140
|
|
230
|
+
- VALIDATE: Both string and Partial<LogEntry> parameters work
|
|
231
|
+
- COVER: All log levels (debug, info, warn, error)
|
|
232
|
+
|
|
233
|
+
Task 4: ADD Tests for Backward Compatible Changes (Promise.allSettled)
|
|
234
|
+
- IMPLEMENT: Tests that concurrent tasks still throw first error by default
|
|
235
|
+
- FOLLOW pattern: src/__tests__/adversarial/concurrent-task-failures.test.ts
|
|
236
|
+
- VALIDATE: Default behavior matches old Promise.all() behavior
|
|
237
|
+
- COVER: Single task failure, multiple task failure scenarios
|
|
238
|
+
|
|
239
|
+
Task 5: ADD Tests for Documentation Examples
|
|
240
|
+
- IMPLEMENT: Tests that execute README quick start examples
|
|
241
|
+
- REFERENCE: README.md lines 17-84
|
|
242
|
+
- VALIDATE: All examples run without modification
|
|
243
|
+
- COVER: Class-based, functional, decorator, and agent patterns
|
|
244
|
+
|
|
245
|
+
Task 6: ADD Tests for Example Files
|
|
246
|
+
- IMPLEMENT: Tests that import and instantiate classes from examples/
|
|
247
|
+
- REFERENCE: All 11 files in examples/examples/
|
|
248
|
+
- VALIDATE: Example workflows can be created and run
|
|
249
|
+
- COVER: Basic workflow, decorators, parent-child, error handling, concurrent tasks
|
|
250
|
+
|
|
251
|
+
Task 7: ADD Tests for Decorator Patterns
|
|
252
|
+
- IMPLEMENT: Tests for @Step, @Task, @ObservedState with various options
|
|
253
|
+
- REFERENCE: examples/examples/02-decorator-options.ts
|
|
254
|
+
- VALIDATE: All decorator option combinations work
|
|
255
|
+
- COVER: name, trackTiming, snapshotState, concurrent, errorMergeStrategy options
|
|
256
|
+
|
|
257
|
+
Task 8: ADD Tests for Parent-Child Patterns
|
|
258
|
+
- IMPLEMENT: Tests for hierarchical workflow creation
|
|
259
|
+
- REFERENCE: examples/examples/03-parent-child.ts
|
|
260
|
+
- VALIDATE: Parent-child relationships establish correctly
|
|
261
|
+
- COVER: Constructor with parent parameter, @Task decorator with parent
|
|
262
|
+
|
|
263
|
+
Task 9: UPDATE vitest.config.ts (if needed)
|
|
264
|
+
- VERIFY: Test include pattern covers new compatibility directory
|
|
265
|
+
- CURRENT: include: ['src/__tests__/**/*.test.ts']
|
|
266
|
+
- ACTION: Should already cover new files, verify no changes needed
|
|
267
|
+
|
|
268
|
+
Task 10: RUN Full Test Suite
|
|
269
|
+
- EXECUTE: npm test or vitest run
|
|
270
|
+
- VALIDATE: All 479 existing tests still pass
|
|
271
|
+
- VALIDATE: New backward compatibility tests pass
|
|
272
|
+
- RESULT: 100% test pass rate
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Implementation Patterns & Key Details
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
// CRITICAL: Test file structure for backward-compatibility.test.ts
|
|
279
|
+
|
|
280
|
+
import { describe, it, expect } from 'vitest';
|
|
281
|
+
import { Workflow, WorkflowLogger, Step, Task, ObservedState } from '../../index.js';
|
|
282
|
+
|
|
283
|
+
// Pattern 1: Test file structure - nested describe blocks
|
|
284
|
+
describe('Backward Compatibility Tests', () => {
|
|
285
|
+
describe('Breaking Changes - Workflow Name Validation', () => {
|
|
286
|
+
// Tests for the 1 breaking change
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
describe('Backward Compatible Changes - WorkflowLogger.child()', () => {
|
|
290
|
+
// Tests for old API patterns that still work
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
describe('Documentation Examples', () => {
|
|
294
|
+
// Tests from README.md and docs/
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
describe('Example Files', () => {
|
|
298
|
+
// Tests from examples/examples/
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// Pattern 2: Breaking change test with error message validation
|
|
303
|
+
it('should throw descriptive error for empty workflow name', () => {
|
|
304
|
+
expect(() => new Workflow({ name: '' }, async () => {}))
|
|
305
|
+
.toThrow('Workflow name cannot be empty or whitespace only');
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
// Pattern 3: Backward compatibility test - old API still works
|
|
309
|
+
it('should support string-based logger.child() API (backward compatible)', async () => {
|
|
310
|
+
class TestWorkflow extends Workflow {
|
|
311
|
+
async run() {
|
|
312
|
+
// Old API - should still work
|
|
313
|
+
const childLogger = this.logger.child('parent-log-id');
|
|
314
|
+
childLogger.info('Test message');
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const workflow = new TestWorkflow();
|
|
319
|
+
await workflow.run();
|
|
320
|
+
|
|
321
|
+
expect(workflow.node.logs[0].parentLogId).toBe('parent-log-id');
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
// Pattern 4: Test from documentation - execute README example
|
|
325
|
+
it('should execute README class-based workflow example', async () => {
|
|
326
|
+
// From README.md lines 50-57
|
|
327
|
+
class DataProcessingWorkflow extends Workflow {
|
|
328
|
+
private data: string[] = [];
|
|
329
|
+
|
|
330
|
+
async run(): Promise<string[]> {
|
|
331
|
+
this.setStatus('running');
|
|
332
|
+
this.data = ['item1', 'item2'];
|
|
333
|
+
this.setStatus('completed');
|
|
334
|
+
return this.data;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const workflow = new DataProcessingWorkflow('DataPipeline');
|
|
339
|
+
const result = await workflow.run();
|
|
340
|
+
|
|
341
|
+
expect(result).toEqual(['item1', 'item2']);
|
|
342
|
+
expect(workflow.status).toBe('completed');
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
// Pattern 5: Parameterized tests with it.each
|
|
346
|
+
it.each([
|
|
347
|
+
{ name: 'Basic', decorator: Step },
|
|
348
|
+
{ name: 'With timing', decorator: Step.bind(null, { trackTiming: true }) },
|
|
349
|
+
])('should support @Step decorator: $name', async ({ name, decorator }) => {
|
|
350
|
+
// Test implementation
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
// GOTCHA: Always use async/await for workflow.run()
|
|
354
|
+
// The run() method returns a Promise, must await it
|
|
355
|
+
|
|
356
|
+
// GOTCHA: Import from index.js (compiled output), not .ts files
|
|
357
|
+
// This tests the actual public API, not internal implementation
|
|
358
|
+
import { Workflow } from '../../index.js'; // CORRECT
|
|
359
|
+
import { Workflow } from '../../core/workflow'; // WRONG - tests internals
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Integration Points
|
|
363
|
+
|
|
364
|
+
```yaml
|
|
365
|
+
TEST_DIRECTORY:
|
|
366
|
+
- create: src/__tests__/compatibility/
|
|
367
|
+
- purpose: Dedicated directory for backward compatibility tests
|
|
368
|
+
- pattern: Matches existing test structure (unit/, integration/, adversarial/)
|
|
369
|
+
|
|
370
|
+
VITEST_CONFIG:
|
|
371
|
+
- file: vitest.config.ts
|
|
372
|
+
- current_pattern: include: ['src/__tests__/**/*.test.ts']
|
|
373
|
+
- change_needed: NO - existing pattern includes new compatibility directory
|
|
374
|
+
|
|
375
|
+
PACKAGE_SCRIPTS:
|
|
376
|
+
- test: "vitest run" - runs all tests including new compatibility tests
|
|
377
|
+
- test:watch: "vitest" - watch mode for development
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
## Validation Loop
|
|
381
|
+
|
|
382
|
+
### Level 1: Syntax & Style (Immediate Feedback)
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
# Run after creating backward-compatibility.test.ts
|
|
386
|
+
npx tsc --noEmit src/__tests__/compatibility/backward-compatibility.test.ts
|
|
387
|
+
|
|
388
|
+
# Type check the new file
|
|
389
|
+
npx tsc --noEmit
|
|
390
|
+
|
|
391
|
+
# Expected: Zero type errors. If errors exist, READ output and fix before proceeding.
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Level 2: Unit Tests (Component Validation)
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
# Test only the new backward compatibility file
|
|
398
|
+
npx vitest run src/__tests__/compatibility/backward-compatibility.test.ts
|
|
399
|
+
|
|
400
|
+
# Test with verbose output
|
|
401
|
+
npx vitest run src/__tests__/compatibility/backward-compatibility.test.ts --reporter=verbose
|
|
402
|
+
|
|
403
|
+
# Full test suite for affected areas
|
|
404
|
+
npx vitest run src/__tests__/compatibility/
|
|
405
|
+
|
|
406
|
+
# Expected: All new backward compatibility tests pass
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Level 3: Integration Testing (System Validation)
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
# Run full test suite - ensure no regressions
|
|
413
|
+
npm test
|
|
414
|
+
|
|
415
|
+
# Verify test count increased appropriately
|
|
416
|
+
# Current: 479 tests
|
|
417
|
+
# Expected: 479 + (number of new backward compatibility tests)
|
|
418
|
+
|
|
419
|
+
# Run specific test categories
|
|
420
|
+
npx vitest run src/__tests__/unit/
|
|
421
|
+
npx vitest run src/__tests__/integration/
|
|
422
|
+
npx vitest run src/__tests__/adversarial/
|
|
423
|
+
|
|
424
|
+
# Expected: All existing tests still pass, new tests pass
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Level 4: Documentation & Example Validation
|
|
428
|
+
|
|
429
|
+
```bash
|
|
430
|
+
# Run example files to ensure they work
|
|
431
|
+
npm run start:01-basic-workflow
|
|
432
|
+
npm run start:02-decorator-options
|
|
433
|
+
npm run start:03-parent-child
|
|
434
|
+
npm run start:05-error-handling
|
|
435
|
+
npm run start:06-concurrent-tasks
|
|
436
|
+
|
|
437
|
+
# Expected: All example files run successfully without modification
|
|
438
|
+
|
|
439
|
+
# Verify README examples can be executed
|
|
440
|
+
# (Copy code snippets from README and run in Node.js REPL)
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
## Final Validation Checklist
|
|
444
|
+
|
|
445
|
+
### Technical Validation
|
|
446
|
+
|
|
447
|
+
- [ ] All 4 validation levels completed successfully
|
|
448
|
+
- [ ] All tests pass: `npm test` shows 100% pass rate
|
|
449
|
+
- [ ] No type errors: `npx tsc --noEmit` completes cleanly
|
|
450
|
+
- [ ] Breaking change tests verify clear error messages
|
|
451
|
+
- [ ] Backward compatibility tests verify old APIs still work
|
|
452
|
+
- [ ] Documentation example tests all pass
|
|
453
|
+
|
|
454
|
+
### Feature Validation
|
|
455
|
+
|
|
456
|
+
- [ ] Workflow name validation throws descriptive errors for invalid names
|
|
457
|
+
- [ ] Old logger.child() string API still works (backward compatible)
|
|
458
|
+
- [ ] Promise.all behavior preserved (throws first error by default)
|
|
459
|
+
- [ ] All README examples execute without modification
|
|
460
|
+
- [ ] All 11 example files can be instantiated and run
|
|
461
|
+
- [ ] Decorator patterns from documentation work correctly
|
|
462
|
+
|
|
463
|
+
### Code Quality Validation
|
|
464
|
+
|
|
465
|
+
- [ ] Follows existing test patterns from src/__tests__/unit/
|
|
466
|
+
- [ ] File placement in src/__tests__/compatibility/ matches desired structure
|
|
467
|
+
- [ ] Test names follow "should {expected behavior}" convention
|
|
468
|
+
- [ ] Tests use describe/it structure from Vitest
|
|
469
|
+
- [ ] Import statements use ../../index.js (public API)
|
|
470
|
+
|
|
471
|
+
### Documentation & Deployment
|
|
472
|
+
|
|
473
|
+
- [ ] Test file is self-documenting with clear test descriptions
|
|
474
|
+
- [ ] Tests serve as executable documentation for API patterns
|
|
475
|
+
- [ ] Breaking change error messages are clear and actionable
|
|
476
|
+
- [ ] Migration path is obvious from test failures
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
## Anti-Patterns to Avoid
|
|
481
|
+
|
|
482
|
+
- ❌ Don't test internal implementation - test public API only
|
|
483
|
+
- ❌ Don't import from internal files - use `../../index.js`
|
|
484
|
+
- ❌ Don't skip testing the breaking change - it must have clear error messages
|
|
485
|
+
- ❌ Don't assume old APIs work - explicitly test them
|
|
486
|
+
- ❌ Don't test random edge cases - focus on documented usage patterns
|
|
487
|
+
- ❌ Don't modify existing tests - add new tests in compatibility directory
|
|
488
|
+
- ❌ Don't use sync execution - always await workflow.run()
|
|
489
|
+
- ❌ Don't forget to test both constructor patterns (class and functional)
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
## Success Metrics
|
|
494
|
+
|
|
495
|
+
**Confidence Score**: 9/10 for one-pass implementation success
|
|
496
|
+
|
|
497
|
+
**Validation**: The completed PRP contains:
|
|
498
|
+
- Complete breaking changes analysis from S1 audit
|
|
499
|
+
- Specific file patterns to follow
|
|
500
|
+
- All documentation examples to test
|
|
501
|
+
- Existing test patterns to emulate
|
|
502
|
+
- Exact validation commands
|
|
503
|
+
- Clear gotchas and anti-patterns
|
|
504
|
+
|
|
505
|
+
**Expected Outcome**: An AI agent unfamiliar with the codebase can implement this test suite successfully using only the PRP content and codebase access.
|