@jamesaphoenix/tx-core 0.8.0 → 0.9.0
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/dist/db.d.ts +6 -6
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +29 -2
- package/dist/db.js.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/cycle-scan-service-impl.d.ts +28 -0
- package/dist/internal/cycle-scan-service-impl.d.ts.map +1 -0
- package/dist/internal/cycle-scan-service-impl.js +877 -0
- package/dist/internal/cycle-scan-service-impl.js.map +1 -0
- package/dist/internal/doc-service-impl.d.ts +42 -0
- package/dist/internal/doc-service-impl.d.ts.map +1 -0
- package/dist/internal/doc-service-impl.js +812 -0
- package/dist/internal/doc-service-impl.js.map +1 -0
- package/dist/internal/embedding-service-impl.d.ts +202 -0
- package/dist/internal/embedding-service-impl.d.ts.map +1 -0
- package/dist/internal/embedding-service-impl.js +466 -0
- package/dist/internal/embedding-service-impl.js.map +1 -0
- package/dist/internal/memory-service-impl.d.ts +49 -0
- package/dist/internal/memory-service-impl.d.ts.map +1 -0
- package/dist/internal/memory-service-impl.js +1061 -0
- package/dist/internal/memory-service-impl.js.map +1 -0
- package/dist/internal/spec-trace-service-impl.d.ts +50 -0
- package/dist/internal/spec-trace-service-impl.d.ts.map +1 -0
- package/dist/internal/spec-trace-service-impl.js +707 -0
- package/dist/internal/spec-trace-service-impl.js.map +1 -0
- package/dist/internal/sync/service-impl.d.ts +41 -0
- package/dist/internal/sync/service-impl.d.ts.map +1 -0
- package/dist/{services/sync-service.js → internal/sync/service-impl.js} +954 -499
- package/dist/internal/sync/service-impl.js.map +1 -0
- package/dist/layer.d.ts +8 -5
- package/dist/layer.d.ts.map +1 -1
- package/dist/layer.js +22 -10
- package/dist/layer.js.map +1 -1
- package/dist/mappers/anchor.d.ts.map +1 -1
- package/dist/mappers/anchor.js +5 -4
- package/dist/mappers/anchor.js.map +1 -1
- package/dist/mappers/attempt.d.ts.map +1 -1
- package/dist/mappers/attempt.js +2 -1
- package/dist/mappers/attempt.js.map +1 -1
- package/dist/mappers/candidate.d.ts.map +1 -1
- package/dist/mappers/candidate.js +2 -1
- package/dist/mappers/candidate.js.map +1 -1
- package/dist/mappers/claim.d.ts.map +1 -1
- package/dist/mappers/claim.js +2 -1
- package/dist/mappers/claim.js.map +1 -1
- package/dist/mappers/doc.d.ts.map +1 -1
- package/dist/mappers/doc.js +9 -8
- package/dist/mappers/doc.js.map +1 -1
- package/dist/mappers/edge.d.ts.map +1 -1
- package/dist/mappers/edge.js +4 -3
- package/dist/mappers/edge.js.map +1 -1
- package/dist/mappers/file-learning.d.ts.map +1 -1
- package/dist/mappers/file-learning.js +2 -1
- package/dist/mappers/file-learning.js.map +1 -1
- package/dist/mappers/index.d.ts +1 -0
- package/dist/mappers/index.d.ts.map +1 -1
- package/dist/mappers/index.js +2 -0
- package/dist/mappers/index.js.map +1 -1
- package/dist/mappers/learning.d.ts.map +1 -1
- package/dist/mappers/learning.js +4 -3
- package/dist/mappers/learning.js.map +1 -1
- package/dist/mappers/memory.d.ts.map +1 -1
- package/dist/mappers/memory.js +7 -6
- package/dist/mappers/memory.js.map +1 -1
- package/dist/mappers/orchestrator-state.d.ts.map +1 -1
- package/dist/mappers/orchestrator-state.js +2 -1
- package/dist/mappers/orchestrator-state.js.map +1 -1
- package/dist/mappers/pin.d.ts.map +1 -1
- package/dist/mappers/pin.js +2 -1
- package/dist/mappers/pin.js.map +1 -1
- package/dist/mappers/run.d.ts.map +1 -1
- package/dist/mappers/run.js +4 -3
- package/dist/mappers/run.js.map +1 -1
- package/dist/mappers/spec-trace.d.ts +11 -0
- package/dist/mappers/spec-trace.d.ts.map +1 -0
- package/dist/mappers/spec-trace.js +59 -0
- package/dist/mappers/spec-trace.js.map +1 -0
- package/dist/mappers/task.d.ts.map +1 -1
- package/dist/mappers/task.js +4 -4
- package/dist/mappers/task.js.map +1 -1
- package/dist/mappers/worker.d.ts.map +1 -1
- package/dist/mappers/worker.js +2 -1
- package/dist/mappers/worker.js.map +1 -1
- package/dist/migrations-embedded.d.ts.map +1 -1
- package/dist/migrations-embedded.js +15 -0
- package/dist/migrations-embedded.js.map +1 -1
- package/dist/repo/anchor-repo.d.ts +2 -2
- package/dist/repo/anchor-repo.d.ts.map +1 -1
- package/dist/repo/anchor-repo.js +18 -17
- package/dist/repo/anchor-repo.js.map +1 -1
- package/dist/repo/attempt-repo.d.ts.map +1 -1
- package/dist/repo/attempt-repo.js +11 -10
- package/dist/repo/attempt-repo.js.map +1 -1
- package/dist/repo/candidate-repo.d.ts.map +1 -1
- package/dist/repo/candidate-repo.js +8 -7
- package/dist/repo/candidate-repo.js.map +1 -1
- package/dist/repo/claim-repo.d.ts +4 -4
- package/dist/repo/claim-repo.d.ts.map +1 -1
- package/dist/repo/claim-repo.js +14 -13
- package/dist/repo/claim-repo.js.map +1 -1
- package/dist/repo/compaction-repo.d.ts +4 -4
- package/dist/repo/compaction-repo.d.ts.map +1 -1
- package/dist/repo/compaction-repo.js +7 -6
- package/dist/repo/compaction-repo.js.map +1 -1
- package/dist/repo/deduplication-repo.d.ts.map +1 -1
- package/dist/repo/deduplication-repo.js +80 -57
- package/dist/repo/deduplication-repo.js.map +1 -1
- package/dist/repo/dep-repo.d.ts.map +1 -1
- package/dist/repo/dep-repo.js +90 -88
- package/dist/repo/dep-repo.js.map +1 -1
- package/dist/repo/doc-repo.d.ts +2 -63
- package/dist/repo/doc-repo.d.ts.map +1 -1
- package/dist/repo/doc-repo.js +6 -4
- package/dist/repo/doc-repo.js.map +1 -1
- package/dist/repo/doc-repo.types.d.ts +64 -0
- package/dist/repo/doc-repo.types.d.ts.map +1 -0
- package/dist/repo/doc-repo.types.js +2 -0
- package/dist/repo/doc-repo.types.js.map +1 -0
- package/dist/repo/edge-repo.d.ts.map +1 -1
- package/dist/repo/edge-repo.js +91 -81
- package/dist/repo/edge-repo.js.map +1 -1
- package/dist/repo/file-learning-repo.d.ts.map +1 -1
- package/dist/repo/file-learning-repo.js +7 -6
- package/dist/repo/file-learning-repo.js.map +1 -1
- package/dist/repo/guard-repo.d.ts +4 -4
- package/dist/repo/guard-repo.d.ts.map +1 -1
- package/dist/repo/guard-repo.js +8 -7
- package/dist/repo/guard-repo.js.map +1 -1
- package/dist/repo/index.d.ts +1 -0
- package/dist/repo/index.d.ts.map +1 -1
- package/dist/repo/index.js +1 -0
- package/dist/repo/index.js.map +1 -1
- package/dist/repo/label-repo.d.ts +4 -4
- package/dist/repo/label-repo.d.ts.map +1 -1
- package/dist/repo/label-repo.js +9 -8
- package/dist/repo/label-repo.js.map +1 -1
- package/dist/repo/learning-repo.d.ts +2 -2
- package/dist/repo/learning-repo.d.ts.map +1 -1
- package/dist/repo/learning-repo.js +37 -31
- package/dist/repo/learning-repo.js.map +1 -1
- package/dist/repo/memory-repo/document.d.ts +4 -0
- package/dist/repo/memory-repo/document.d.ts.map +1 -0
- package/dist/repo/memory-repo/document.js +205 -0
- package/dist/repo/memory-repo/document.js.map +1 -0
- package/dist/repo/memory-repo/link.d.ts +4 -0
- package/dist/repo/memory-repo/link.d.ts.map +1 -0
- package/dist/repo/memory-repo/link.js +124 -0
- package/dist/repo/memory-repo/link.js.map +1 -0
- package/dist/repo/memory-repo/property.d.ts +4 -0
- package/dist/repo/memory-repo/property.d.ts.map +1 -0
- package/dist/repo/memory-repo/property.js +56 -0
- package/dist/repo/memory-repo/property.js.map +1 -0
- package/dist/repo/memory-repo/shared.d.ts +28 -0
- package/dist/repo/memory-repo/shared.d.ts.map +1 -0
- package/dist/repo/memory-repo/shared.js +63 -0
- package/dist/repo/memory-repo/shared.js.map +1 -0
- package/dist/repo/memory-repo/source.d.ts +4 -0
- package/dist/repo/memory-repo/source.d.ts.map +1 -0
- package/dist/repo/memory-repo/source.js +58 -0
- package/dist/repo/memory-repo/source.js.map +1 -0
- package/dist/repo/memory-repo.d.ts +14 -10
- package/dist/repo/memory-repo.d.ts.map +1 -1
- package/dist/repo/memory-repo.js +8 -527
- package/dist/repo/memory-repo.js.map +1 -1
- package/dist/repo/message-repo.d.ts.map +1 -1
- package/dist/repo/message-repo.js +9 -8
- package/dist/repo/message-repo.js.map +1 -1
- package/dist/repo/orchestrator-state-repo.d.ts.map +1 -1
- package/dist/repo/orchestrator-state-repo.js +2 -1
- package/dist/repo/orchestrator-state-repo.js.map +1 -1
- package/dist/repo/pin-repo.d.ts.map +1 -1
- package/dist/repo/pin-repo.js +5 -4
- package/dist/repo/pin-repo.js.map +1 -1
- package/dist/repo/run-repo.d.ts.map +1 -1
- package/dist/repo/run-repo.js +11 -10
- package/dist/repo/run-repo.js.map +1 -1
- package/dist/repo/spec-trace-repo.d.ts +9 -0
- package/dist/repo/spec-trace-repo.d.ts.map +1 -0
- package/dist/repo/spec-trace-repo.filter.d.ts +3 -0
- package/dist/repo/spec-trace-repo.filter.d.ts.map +1 -0
- package/dist/repo/spec-trace-repo.filter.js +13 -0
- package/dist/repo/spec-trace-repo.filter.js.map +1 -0
- package/dist/repo/spec-trace-repo.js +323 -0
- package/dist/repo/spec-trace-repo.js.map +1 -0
- package/dist/repo/spec-trace-repo.types.d.ts +60 -0
- package/dist/repo/spec-trace-repo.types.d.ts.map +1 -0
- package/dist/repo/spec-trace-repo.types.js +2 -0
- package/dist/repo/spec-trace-repo.types.js.map +1 -0
- package/dist/repo/task-repo/factory.d.ts +4 -0
- package/dist/repo/task-repo/factory.d.ts.map +1 -0
- package/dist/repo/task-repo/factory.js +7 -0
- package/dist/repo/task-repo/factory.js.map +1 -0
- package/dist/repo/task-repo/read.d.ts +6 -0
- package/dist/repo/task-repo/read.d.ts.map +1 -0
- package/dist/repo/task-repo/read.js +332 -0
- package/dist/repo/task-repo/read.js.map +1 -0
- package/dist/repo/task-repo/shared.d.ts +10 -0
- package/dist/repo/task-repo/shared.d.ts.map +1 -0
- package/dist/repo/task-repo/shared.js +29 -0
- package/dist/repo/task-repo/shared.js.map +1 -0
- package/dist/repo/task-repo/write.d.ts +6 -0
- package/dist/repo/task-repo/write.d.ts.map +1 -0
- package/dist/repo/task-repo/write.js +182 -0
- package/dist/repo/task-repo/write.js.map +1 -0
- package/dist/repo/task-repo.d.ts +5 -4
- package/dist/repo/task-repo.d.ts.map +1 -1
- package/dist/repo/task-repo.js +2 -520
- package/dist/repo/task-repo.js.map +1 -1
- package/dist/repo/tracked-project-repo.d.ts.map +1 -1
- package/dist/repo/tracked-project-repo.js +6 -5
- package/dist/repo/tracked-project-repo.js.map +1 -1
- package/dist/repo/worker-repo.d.ts.map +1 -1
- package/dist/repo/worker-repo.js +60 -47
- package/dist/repo/worker-repo.js.map +1 -1
- package/dist/schemas/index.d.ts +4 -2
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +2 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/sync-events.d.ts +25 -0
- package/dist/schemas/sync-events.d.ts.map +1 -0
- package/dist/schemas/sync-events.js +23 -0
- package/dist/schemas/sync-events.js.map +1 -0
- package/dist/schemas/sync.d.ts +20 -10
- package/dist/schemas/sync.d.ts.map +1 -1
- package/dist/schemas/sync.js +10 -4
- package/dist/schemas/sync.js.map +1 -1
- package/dist/services/agent-service.d.ts +4 -4
- package/dist/services/agent-service.d.ts.map +1 -1
- package/dist/services/agent-service.js.map +1 -1
- package/dist/services/anchor/anchor-service-core-ops.d.ts +125 -0
- package/dist/services/anchor/anchor-service-core-ops.d.ts.map +1 -0
- package/dist/services/anchor/anchor-service-core-ops.js +41 -0
- package/dist/services/anchor/anchor-service-core-ops.js.map +1 -0
- package/dist/services/anchor/anchor-service-deps.d.ts +10 -0
- package/dist/services/anchor/anchor-service-deps.d.ts.map +1 -0
- package/dist/services/anchor/anchor-service-deps.js +2 -0
- package/dist/services/anchor/anchor-service-deps.js.map +1 -0
- package/dist/services/anchor/anchor-service-ops.d.ts +296 -0
- package/dist/services/anchor/anchor-service-ops.d.ts.map +1 -0
- package/dist/services/anchor/anchor-service-ops.js +9 -0
- package/dist/services/anchor/anchor-service-ops.js.map +1 -0
- package/dist/services/anchor/anchor-service-state-ops.d.ts +116 -0
- package/dist/services/anchor/anchor-service-state-ops.d.ts.map +1 -0
- package/dist/services/anchor/anchor-service-state-ops.js +150 -0
- package/dist/services/anchor/anchor-service-state-ops.js.map +1 -0
- package/dist/services/anchor/anchor-service-validation.d.ts +7 -0
- package/dist/services/anchor/anchor-service-validation.d.ts.map +1 -0
- package/dist/services/anchor/anchor-service-validation.js +114 -0
- package/dist/services/anchor/anchor-service-validation.js.map +1 -0
- package/dist/services/anchor/anchor-service-verification-ops.d.ts +71 -0
- package/dist/services/anchor/anchor-service-verification-ops.d.ts.map +1 -0
- package/dist/services/anchor/anchor-service-verification-ops.js +169 -0
- package/dist/services/anchor/anchor-service-verification-ops.js.map +1 -0
- package/dist/services/anchor/anchor-verification-batch.d.ts +12 -0
- package/dist/services/anchor/anchor-verification-batch.d.ts.map +1 -0
- package/dist/services/anchor/anchor-verification-batch.js +109 -0
- package/dist/services/anchor/anchor-verification-batch.js.map +1 -0
- package/dist/services/anchor/anchor-verification-single.d.ts +7 -0
- package/dist/services/anchor/anchor-verification-single.d.ts.map +1 -0
- package/dist/services/anchor/anchor-verification-single.js +407 -0
- package/dist/services/anchor/anchor-verification-single.js.map +1 -0
- package/dist/services/anchor/anchor-verification-utils.d.ts +19 -0
- package/dist/services/anchor/anchor-verification-utils.d.ts.map +1 -0
- package/dist/services/anchor/anchor-verification-utils.js +107 -0
- package/dist/services/anchor/anchor-verification-utils.js.map +1 -0
- package/dist/services/anchor-service.d.ts +12 -90
- package/dist/services/anchor-service.d.ts.map +1 -1
- package/dist/services/anchor-service.js +5 -530
- package/dist/services/anchor-service.js.map +1 -1
- package/dist/services/anchor-verification.d.ts +9 -60
- package/dist/services/anchor-verification.d.ts.map +1 -1
- package/dist/services/anchor-verification.js +5 -796
- package/dist/services/anchor-verification.js.map +1 -1
- package/dist/services/ast-grep-service/patterns.d.ts +90 -0
- package/dist/services/ast-grep-service/patterns.d.ts.map +1 -0
- package/dist/services/ast-grep-service/patterns.js +261 -0
- package/dist/services/ast-grep-service/patterns.js.map +1 -0
- package/dist/services/ast-grep-service.d.ts +2 -13
- package/dist/services/ast-grep-service.d.ts.map +1 -1
- package/dist/services/ast-grep-service.js +3 -261
- package/dist/services/ast-grep-service.js.map +1 -1
- package/dist/services/auto-sync-service.d.ts +3 -3
- package/dist/services/auto-sync-service.d.ts.map +1 -1
- package/dist/services/auto-sync-service.js +12 -13
- package/dist/services/auto-sync-service.js.map +1 -1
- package/dist/services/compaction-service.d.ts +6 -6
- package/dist/services/compaction-service.d.ts.map +1 -1
- package/dist/services/compaction-service.js +11 -7
- package/dist/services/compaction-service.js.map +1 -1
- package/dist/services/cycle-scan-service.d.ts +1 -27
- package/dist/services/cycle-scan-service.d.ts.map +1 -1
- package/dist/services/cycle-scan-service.js +1 -876
- package/dist/services/cycle-scan-service.js.map +1 -1
- package/dist/services/daemon-service/process.d.ts +93 -0
- package/dist/services/daemon-service/process.d.ts.map +1 -0
- package/dist/services/daemon-service/process.js +325 -0
- package/dist/services/daemon-service/process.js.map +1 -0
- package/dist/services/daemon-service/templates.d.ts +88 -0
- package/dist/services/daemon-service/templates.d.ts.map +1 -0
- package/dist/services/daemon-service/templates.js +119 -0
- package/dist/services/daemon-service/templates.js.map +1 -0
- package/dist/services/daemon-service.d.ts +8 -160
- package/dist/services/daemon-service.d.ts.map +1 -1
- package/dist/services/daemon-service.js +4 -440
- package/dist/services/daemon-service.js.map +1 -1
- package/dist/services/doc-service.d.ts +1 -41
- package/dist/services/doc-service.d.ts.map +1 -1
- package/dist/services/doc-service.js +1 -780
- package/dist/services/doc-service.js.map +1 -1
- package/dist/services/edge-service.d.ts +6 -6
- package/dist/services/edge-service.d.ts.map +1 -1
- package/dist/services/edge-service.js.map +1 -1
- package/dist/services/embedding-service.d.ts +1 -201
- package/dist/services/embedding-service.d.ts.map +1 -1
- package/dist/services/embedding-service.js +1 -465
- package/dist/services/embedding-service.js.map +1 -1
- package/dist/services/feedback-tracker.d.ts +2 -2
- package/dist/services/feedback-tracker.d.ts.map +1 -1
- package/dist/services/feedback-tracker.js.map +1 -1
- package/dist/services/file-watcher-service/shared.d.ts +76 -0
- package/dist/services/file-watcher-service/shared.d.ts.map +1 -0
- package/dist/services/file-watcher-service/shared.js +43 -0
- package/dist/services/file-watcher-service/shared.js.map +1 -0
- package/dist/services/file-watcher-service.d.ts +2 -42
- package/dist/services/file-watcher-service.d.ts.map +1 -1
- package/dist/services/file-watcher-service.js +1 -46
- package/dist/services/file-watcher-service.js.map +1 -1
- package/dist/services/graph-expansion/from-files.d.ts +14 -0
- package/dist/services/graph-expansion/from-files.d.ts.map +1 -0
- package/dist/services/graph-expansion/from-files.js +187 -0
- package/dist/services/graph-expansion/from-files.js.map +1 -0
- package/dist/services/graph-expansion/live.d.ts +11 -0
- package/dist/services/graph-expansion/live.d.ts.map +1 -0
- package/dist/services/graph-expansion/live.js +263 -0
- package/dist/services/graph-expansion/live.js.map +1 -0
- package/dist/services/graph-expansion.d.ts +17 -20
- package/dist/services/graph-expansion.d.ts.map +1 -1
- package/dist/services/graph-expansion.js +2 -439
- package/dist/services/graph-expansion.js.map +1 -1
- package/dist/services/guard-service.d.ts +2 -2
- package/dist/services/guard-service.d.ts.map +1 -1
- package/dist/services/guard-service.js.map +1 -1
- package/dist/services/index.d.ts +3 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +3 -1
- package/dist/services/index.js.map +1 -1
- package/dist/services/learning-service.d.ts +4 -4
- package/dist/services/learning-service.d.ts.map +1 -1
- package/dist/services/learning-service.js.map +1 -1
- package/dist/services/llm-service.d.ts +4 -4
- package/dist/services/llm-service.d.ts.map +1 -1
- package/dist/services/llm-service.js.map +1 -1
- package/dist/services/memory-retriever-service.d.ts.map +1 -1
- package/dist/services/memory-retriever-service.js.map +1 -1
- package/dist/services/memory-service.d.ts +1 -48
- package/dist/services/memory-service.d.ts.map +1 -1
- package/dist/services/memory-service.js +1 -1060
- package/dist/services/memory-service.js.map +1 -1
- package/dist/services/migration-service.d.ts +6 -6
- package/dist/services/migration-service.d.ts.map +1 -1
- package/dist/services/migration-service.js +6 -2
- package/dist/services/migration-service.js.map +1 -1
- package/dist/services/orchestrator-service.d.ts +2 -2
- package/dist/services/orchestrator-service.d.ts.map +1 -1
- package/dist/services/orchestrator-service.js.map +1 -1
- package/dist/services/pin-service.d.ts.map +1 -1
- package/dist/services/pin-service.js +21 -28
- package/dist/services/pin-service.js.map +1 -1
- package/dist/services/promotion-service.d.ts +4 -4
- package/dist/services/promotion-service.d.ts.map +1 -1
- package/dist/services/promotion-service.js.map +1 -1
- package/dist/services/query-expansion-service.d.ts +2 -2
- package/dist/services/query-expansion-service.d.ts.map +1 -1
- package/dist/services/query-expansion-service.js.map +1 -1
- package/dist/services/reflect-service.d.ts +6 -6
- package/dist/services/reflect-service.d.ts.map +1 -1
- package/dist/services/reflect-service.js.map +1 -1
- package/dist/services/reranker-service.d.ts +2 -2
- package/dist/services/reranker-service.d.ts.map +1 -1
- package/dist/services/reranker-service.js.map +1 -1
- package/dist/services/retriever-scoring.d.ts +52 -0
- package/dist/services/retriever-scoring.d.ts.map +1 -0
- package/dist/services/retriever-scoring.js +146 -0
- package/dist/services/retriever-scoring.js.map +1 -0
- package/dist/services/retriever-service.d.ts.map +1 -1
- package/dist/services/retriever-service.js +1 -191
- package/dist/services/retriever-service.js.map +1 -1
- package/dist/services/run-heartbeat-service.d.ts +10 -10
- package/dist/services/run-heartbeat-service.d.ts.map +1 -1
- package/dist/services/run-heartbeat-service.js.map +1 -1
- package/dist/services/score-service.d.ts +2 -2
- package/dist/services/score-service.d.ts.map +1 -1
- package/dist/services/score-service.js.map +1 -1
- package/dist/services/spec-trace-service.d.ts +2 -0
- package/dist/services/spec-trace-service.d.ts.map +1 -0
- package/dist/services/spec-trace-service.js +2 -0
- package/dist/services/spec-trace-service.js.map +1 -0
- package/dist/services/stream-service.d.ts +31 -0
- package/dist/services/stream-service.d.ts.map +1 -0
- package/dist/services/stream-service.js +162 -0
- package/dist/services/stream-service.js.map +1 -0
- package/dist/services/swarm-verification/shared.d.ts +71 -0
- package/dist/services/swarm-verification/shared.d.ts.map +1 -0
- package/dist/services/swarm-verification/shared.js +108 -0
- package/dist/services/swarm-verification/shared.js.map +1 -0
- package/dist/services/swarm-verification.d.ts +4 -68
- package/dist/services/swarm-verification.d.ts.map +1 -1
- package/dist/services/swarm-verification.js +2 -122
- package/dist/services/swarm-verification.js.map +1 -1
- package/dist/services/sync/converters.d.ts +63 -0
- package/dist/services/sync/converters.d.ts.map +1 -0
- package/dist/services/sync/converters.js +253 -0
- package/dist/services/sync/converters.js.map +1 -0
- package/dist/services/sync/entity-export.d.ts +22 -0
- package/dist/services/sync/entity-export.d.ts.map +1 -0
- package/dist/services/sync/entity-export.js +15 -0
- package/dist/services/sync/entity-export.js.map +1 -0
- package/dist/services/sync/entity-import.d.ts +22 -0
- package/dist/services/sync/entity-import.d.ts.map +1 -0
- package/dist/services/sync/entity-import.js +15 -0
- package/dist/services/sync/entity-import.js.map +1 -0
- package/dist/services/sync/file-utils.d.ts +23 -0
- package/dist/services/sync/file-utils.d.ts.map +1 -0
- package/dist/services/sync/file-utils.js +97 -0
- package/dist/services/sync/file-utils.js.map +1 -0
- package/dist/services/sync/index.d.ts +3 -0
- package/dist/services/sync/index.d.ts.map +1 -0
- package/dist/services/sync/index.js +2 -0
- package/dist/services/sync/index.js.map +1 -0
- package/dist/services/sync/service.d.ts +2 -0
- package/dist/services/sync/service.d.ts.map +1 -0
- package/dist/services/sync/service.js +2 -0
- package/dist/services/sync/service.js.map +1 -0
- package/dist/services/sync/sync-helpers.d.ts +54 -0
- package/dist/services/sync/sync-helpers.d.ts.map +1 -0
- package/dist/services/sync/sync-helpers.js +245 -0
- package/dist/services/sync/sync-helpers.js.map +1 -0
- package/dist/services/sync/types.d.ts +104 -0
- package/dist/services/sync/types.d.ts.map +1 -0
- package/dist/services/sync/types.js +5 -0
- package/dist/services/sync/types.js.map +1 -0
- package/dist/services/task-service/internals.d.ts +36 -0
- package/dist/services/task-service/internals.d.ts.map +1 -0
- package/dist/services/task-service/internals.js +270 -0
- package/dist/services/task-service/internals.js.map +1 -0
- package/dist/services/task-service.d.ts +2 -1
- package/dist/services/task-service.d.ts.map +1 -1
- package/dist/services/task-service.js +28 -236
- package/dist/services/task-service.js.map +1 -1
- package/dist/services/tracing-service.d.ts +2 -2
- package/dist/services/tracing-service.d.ts.map +1 -1
- package/dist/services/tracing-service.js.map +1 -1
- package/dist/services/transcript-adapter.d.ts +6 -6
- package/dist/services/transcript-adapter.d.ts.map +1 -1
- package/dist/services/transcript-adapter.js +3 -8
- package/dist/services/transcript-adapter.js.map +1 -1
- package/dist/services/validation-service.d.ts +8 -8
- package/dist/services/validation-service.d.ts.map +1 -1
- package/dist/services/validation-service.js.map +1 -1
- package/dist/services/verify-service.d.ts +2 -2
- package/dist/services/verify-service.d.ts.map +1 -1
- package/dist/services/verify-service.js.map +1 -1
- package/dist/services/worker-process/runtime.d.ts +51 -0
- package/dist/services/worker-process/runtime.d.ts.map +1 -0
- package/dist/services/worker-process/runtime.js +150 -0
- package/dist/services/worker-process/runtime.js.map +1 -0
- package/dist/services/worker-process.d.ts +3 -18
- package/dist/services/worker-process.d.ts.map +1 -1
- package/dist/services/worker-process.js +3 -173
- package/dist/services/worker-process.js.map +1 -1
- package/dist/services/worker-service.d.ts +6 -6
- package/dist/services/worker-service.d.ts.map +1 -1
- package/dist/services/worker-service.js.map +1 -1
- package/dist/utils/db-result.d.ts +14 -0
- package/dist/utils/db-result.d.ts.map +1 -0
- package/dist/utils/db-result.js +37 -0
- package/dist/utils/db-result.js.map +1 -0
- package/dist/utils/doc-renderer.d.ts +10 -10
- package/dist/utils/doc-renderer.d.ts.map +1 -1
- package/dist/utils/doc-renderer.js.map +1 -1
- package/dist/utils/ears-validator.d.ts +2 -2
- package/dist/utils/ears-validator.d.ts.map +1 -1
- package/dist/utils/ears-validator.js.map +1 -1
- package/dist/utils/file-path.d.ts +27 -0
- package/dist/utils/file-path.d.ts.map +1 -0
- package/dist/utils/file-path.js +77 -0
- package/dist/utils/file-path.js.map +1 -0
- package/dist/utils/glob.d.ts +2 -11
- package/dist/utils/glob.d.ts.map +1 -1
- package/dist/utils/glob.js +22 -13
- package/dist/utils/glob.js.map +1 -1
- package/dist/utils/spec-discovery.d.ts +34 -0
- package/dist/utils/spec-discovery.d.ts.map +1 -0
- package/dist/utils/spec-discovery.js +344 -0
- package/dist/utils/spec-discovery.js.map +1 -0
- package/dist/utils/toml-config.d.ts +7 -2
- package/dist/utils/toml-config.d.ts.map +1 -1
- package/dist/utils/toml-config.js +106 -2
- package/dist/utils/toml-config.js.map +1 -1
- package/dist/utils/ulid.d.ts +8 -0
- package/dist/utils/ulid.d.ts.map +1 -0
- package/dist/utils/ulid.js +30 -0
- package/dist/utils/ulid.js.map +1 -0
- package/dist/worker/hooks.d.ts +10 -10
- package/dist/worker/hooks.d.ts.map +1 -1
- package/dist/worker/run-worker.d.ts.map +1 -1
- package/dist/worker/run-worker.js.map +1 -1
- package/migrations/033_sync_events.sql +33 -0
- package/migrations/034_spec_test_traceability.sql +51 -0
- package/migrations/035_anchor_schema_repair.sql +82 -0
- package/package.json +3 -2
- package/dist/services/sync-service.d.ts +0 -247
- package/dist/services/sync-service.d.ts.map +0 -1
- package/dist/services/sync-service.js.map +0 -1
|
@@ -0,0 +1,707 @@
|
|
|
1
|
+
import { Context, Effect, Layer } from "effect";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { XMLParser, XMLValidator } from "fast-xml-parser";
|
|
4
|
+
import { SpecTraceRepository } from "../repo/spec-trace-repo.js";
|
|
5
|
+
import { DocService } from "../services/doc-service.js";
|
|
6
|
+
import { ValidationError } from "../errors.js";
|
|
7
|
+
import { defaultSpecTestPatterns, discoverSpecTests } from "../utils/spec-discovery.js";
|
|
8
|
+
import { readTxConfig } from "../utils/toml-config.js";
|
|
9
|
+
import { toNormalizedRelativePath } from "../utils/file-path.js";
|
|
10
|
+
const MAX_RUN_DETAILS_LENGTH = 20_000;
|
|
11
|
+
export const SPEC_BATCH_MAX_BYTES = 5 * 1024 * 1024;
|
|
12
|
+
export const SPEC_BATCH_MAX_RECORDS = 50_000;
|
|
13
|
+
const normalizeDetails = (value) => {
|
|
14
|
+
if (typeof value !== "string")
|
|
15
|
+
return null;
|
|
16
|
+
if (value.length <= MAX_RUN_DETAILS_LENGTH)
|
|
17
|
+
return value;
|
|
18
|
+
return value.slice(0, MAX_RUN_DETAILS_LENGTH);
|
|
19
|
+
};
|
|
20
|
+
const extractTestNameFromCanonicalId = (testId) => {
|
|
21
|
+
const splitAt = testId.lastIndexOf("::");
|
|
22
|
+
if (splitAt < 0)
|
|
23
|
+
return null;
|
|
24
|
+
const name = testId.slice(splitAt + 2).trim();
|
|
25
|
+
return name.length > 0 ? name : null;
|
|
26
|
+
};
|
|
27
|
+
const toCanonicalTestId = (testFile, testName) => {
|
|
28
|
+
const name = testName && testName.trim().length > 0 ? testName.trim() : "manual";
|
|
29
|
+
return `${testFile}::${name}`;
|
|
30
|
+
};
|
|
31
|
+
const resolveSignoffScope = (filter) => {
|
|
32
|
+
const doc = filter?.doc?.trim();
|
|
33
|
+
const subsystem = filter?.subsystem?.trim();
|
|
34
|
+
if (doc && subsystem)
|
|
35
|
+
return null;
|
|
36
|
+
if (doc)
|
|
37
|
+
return { scopeType: "doc", scopeValue: doc };
|
|
38
|
+
if (subsystem)
|
|
39
|
+
return { scopeType: "subsystem", scopeValue: subsystem };
|
|
40
|
+
return { scopeType: "global", scopeValue: null };
|
|
41
|
+
};
|
|
42
|
+
const classifyInvariants = (params) => {
|
|
43
|
+
const { invariants, testsByInvariant, latestRunBySpecTestId } = params;
|
|
44
|
+
let covered = 0;
|
|
45
|
+
let uncovered = 0;
|
|
46
|
+
let passing = 0;
|
|
47
|
+
let failing = 0;
|
|
48
|
+
let untested = 0;
|
|
49
|
+
for (const invariant of invariants) {
|
|
50
|
+
const tests = testsByInvariant.get(invariant.id) ?? [];
|
|
51
|
+
if (tests.length === 0) {
|
|
52
|
+
uncovered += 1;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
covered += 1;
|
|
56
|
+
const hasFailure = tests.some((test) => {
|
|
57
|
+
const latest = latestRunBySpecTestId.get(test.id);
|
|
58
|
+
return latest ? !latest.passed : false;
|
|
59
|
+
});
|
|
60
|
+
if (hasFailure) {
|
|
61
|
+
failing += 1;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const allPassed = tests.every((test) => {
|
|
65
|
+
const latest = latestRunBySpecTestId.get(test.id);
|
|
66
|
+
return latest ? latest.passed : false;
|
|
67
|
+
});
|
|
68
|
+
if (allPassed) {
|
|
69
|
+
passing += 1;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
untested += 1;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const total = invariants.length;
|
|
76
|
+
const fciRaw = total === 0 ? 0 : (passing / total) * 100;
|
|
77
|
+
return {
|
|
78
|
+
total,
|
|
79
|
+
covered,
|
|
80
|
+
uncovered,
|
|
81
|
+
passing,
|
|
82
|
+
failing,
|
|
83
|
+
untested,
|
|
84
|
+
fciRaw,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export class SpecTraceService extends Context.Tag("SpecTraceService")() {
|
|
88
|
+
}
|
|
89
|
+
export const SpecTraceServiceLive = Layer.effect(SpecTraceService, Effect.gen(function* () {
|
|
90
|
+
const repo = yield* SpecTraceRepository;
|
|
91
|
+
const docService = yield* DocService;
|
|
92
|
+
const resolveLinksForTestId = (testId) => Effect.gen(function* () {
|
|
93
|
+
const direct = yield* repo.findSpecTestsByTestId(testId);
|
|
94
|
+
if (direct.length > 0)
|
|
95
|
+
return direct;
|
|
96
|
+
const testName = extractTestNameFromCanonicalId(testId);
|
|
97
|
+
if (!testName)
|
|
98
|
+
return [];
|
|
99
|
+
const byName = yield* repo.findSpecTestsByTestName(testName);
|
|
100
|
+
// Only accept fallback when unambiguous.
|
|
101
|
+
return byName.length === 1 ? byName : [];
|
|
102
|
+
});
|
|
103
|
+
const computeFci = (filter) => Effect.gen(function* () {
|
|
104
|
+
const invariants = yield* repo.listActiveInvariants(filter);
|
|
105
|
+
const tests = yield* repo.findSpecTestsByInvariantIds(invariants.map((i) => i.id));
|
|
106
|
+
const testsByInvariant = new Map();
|
|
107
|
+
for (const test of tests) {
|
|
108
|
+
const current = testsByInvariant.get(test.invariantId) ?? [];
|
|
109
|
+
current.push(test);
|
|
110
|
+
testsByInvariant.set(test.invariantId, current);
|
|
111
|
+
}
|
|
112
|
+
const latestRuns = yield* repo.findLatestRunsBySpecTestIds(tests.map((t) => t.id));
|
|
113
|
+
const rollup = classifyInvariants({
|
|
114
|
+
invariants,
|
|
115
|
+
testsByInvariant,
|
|
116
|
+
latestRunBySpecTestId: latestRuns,
|
|
117
|
+
});
|
|
118
|
+
const fci = Number(rollup.fciRaw.toFixed(2));
|
|
119
|
+
let phase = fci < 100 ? "BUILD" : "HARDEN";
|
|
120
|
+
if (fci === 100) {
|
|
121
|
+
const signoffScope = resolveSignoffScope(filter);
|
|
122
|
+
if (signoffScope) {
|
|
123
|
+
const signoff = yield* repo.findSignoff(signoffScope.scopeType, signoffScope.scopeValue);
|
|
124
|
+
if (signoff) {
|
|
125
|
+
phase = "COMPLETE";
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
total: rollup.total,
|
|
131
|
+
covered: rollup.covered,
|
|
132
|
+
uncovered: rollup.uncovered,
|
|
133
|
+
passing: rollup.passing,
|
|
134
|
+
failing: rollup.failing,
|
|
135
|
+
untested: rollup.untested,
|
|
136
|
+
fci,
|
|
137
|
+
phase,
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
return {
|
|
141
|
+
discover: (options) => Effect.gen(function* () {
|
|
142
|
+
const rootDir = resolve(options?.rootDir ?? process.cwd());
|
|
143
|
+
const config = readTxConfig(rootDir);
|
|
144
|
+
const patterns = options?.patterns ?? config.spec.testPatterns ?? defaultSpecTestPatterns();
|
|
145
|
+
if (patterns.length === 0) {
|
|
146
|
+
return yield* Effect.fail(new ValidationError({
|
|
147
|
+
reason: "No spec test patterns configured. Set [spec].test_patterns in .tx/config.toml",
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
yield* docService.syncInvariants(options?.doc).pipe(Effect.catchTag("DocNotFoundError", (error) => Effect.fail(new ValidationError({
|
|
151
|
+
reason: `Document '${error.name}' not found while syncing invariants`,
|
|
152
|
+
}))));
|
|
153
|
+
const discovered = yield* Effect.tryPromise({
|
|
154
|
+
try: () => discoverSpecTests(rootDir, patterns),
|
|
155
|
+
catch: (cause) => new ValidationError({ reason: `Discovery failed: ${String(cause)}` }),
|
|
156
|
+
});
|
|
157
|
+
const activeInvariants = yield* repo.listActiveInvariants(options?.doc ? { doc: options.doc } : undefined);
|
|
158
|
+
const activeInvariantIds = activeInvariants.map((i) => i.id);
|
|
159
|
+
const activeSet = new Set(activeInvariantIds);
|
|
160
|
+
const validRows = discovered.discovered.filter((row) => activeSet.has(row.invariantId));
|
|
161
|
+
const persisted = yield* repo.syncDiscoveredSpecTests({
|
|
162
|
+
rows: validRows,
|
|
163
|
+
invariantIds: activeInvariantIds,
|
|
164
|
+
});
|
|
165
|
+
let tagLinks = 0;
|
|
166
|
+
let commentLinks = 0;
|
|
167
|
+
let manifestLinks = 0;
|
|
168
|
+
for (const row of validRows) {
|
|
169
|
+
if (row.discovery === "tag")
|
|
170
|
+
tagLinks += 1;
|
|
171
|
+
if (row.discovery === "comment")
|
|
172
|
+
commentLinks += 1;
|
|
173
|
+
if (row.discovery === "manifest")
|
|
174
|
+
manifestLinks += 1;
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
scannedFiles: discovered.scannedFiles,
|
|
178
|
+
discoveredLinks: validRows.length,
|
|
179
|
+
upserted: persisted.upserted,
|
|
180
|
+
tagLinks,
|
|
181
|
+
commentLinks,
|
|
182
|
+
manifestLinks,
|
|
183
|
+
};
|
|
184
|
+
}),
|
|
185
|
+
link: (invariantId, testFile, testName, framework) => Effect.gen(function* () {
|
|
186
|
+
const rootDir = resolve(process.cwd());
|
|
187
|
+
const normalizedFile = toNormalizedRelativePath(rootDir, testFile);
|
|
188
|
+
const normalizedName = testName && testName.trim().length > 0 ? testName.trim() : null;
|
|
189
|
+
const testId = toCanonicalTestId(normalizedFile, normalizedName);
|
|
190
|
+
return yield* repo.upsertSpecTest({
|
|
191
|
+
invariantId,
|
|
192
|
+
testId,
|
|
193
|
+
testFile: normalizedFile,
|
|
194
|
+
testName: normalizedName,
|
|
195
|
+
framework: framework ?? null,
|
|
196
|
+
discovery: "manual",
|
|
197
|
+
});
|
|
198
|
+
}),
|
|
199
|
+
unlink: (invariantId, testId) => repo.deleteSpecTest(invariantId, testId),
|
|
200
|
+
testsForInvariant: (invariantId) => repo.findSpecTestsByInvariant(invariantId),
|
|
201
|
+
invariantsForTest: (testId) => Effect.gen(function* () {
|
|
202
|
+
const rows = yield* repo.findSpecTestsByTestId(testId);
|
|
203
|
+
return rows.map((row) => row.invariantId);
|
|
204
|
+
}),
|
|
205
|
+
uncoveredInvariants: (filter) => repo.listUncoveredInvariants(filter),
|
|
206
|
+
recordRun: (testId, passed, options) => Effect.gen(function* () {
|
|
207
|
+
const links = yield* resolveLinksForTestId(testId);
|
|
208
|
+
if (links.length === 0) {
|
|
209
|
+
return yield* Effect.fail(new ValidationError({
|
|
210
|
+
reason: `No spec test mapping found for testId '${testId}'`,
|
|
211
|
+
}));
|
|
212
|
+
}
|
|
213
|
+
const inserted = yield* repo.insertRunsBatch(links.map((link) => ({
|
|
214
|
+
specTestId: link.id,
|
|
215
|
+
passed,
|
|
216
|
+
durationMs: options?.durationMs,
|
|
217
|
+
details: normalizeDetails(options?.details),
|
|
218
|
+
runAt: options?.runAt,
|
|
219
|
+
})));
|
|
220
|
+
return {
|
|
221
|
+
received: 1,
|
|
222
|
+
recorded: inserted.length,
|
|
223
|
+
unmatched: [],
|
|
224
|
+
};
|
|
225
|
+
}),
|
|
226
|
+
recordBatchRun: (results, options) => Effect.gen(function* () {
|
|
227
|
+
if (results.length === 0) {
|
|
228
|
+
return {
|
|
229
|
+
received: 0,
|
|
230
|
+
recorded: 0,
|
|
231
|
+
unmatched: [],
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
const uniqueTestIds = [...new Set(results.map((row) => row.testId))];
|
|
235
|
+
const byTestId = yield* repo.findSpecTestsByTestIds(uniqueTestIds);
|
|
236
|
+
const byNameCache = new Map();
|
|
237
|
+
const unmatched = new Set();
|
|
238
|
+
const inserts = [];
|
|
239
|
+
for (const row of results) {
|
|
240
|
+
let links = byTestId.get(row.testId) ?? [];
|
|
241
|
+
if (links.length === 0) {
|
|
242
|
+
const testName = extractTestNameFromCanonicalId(row.testId);
|
|
243
|
+
if (testName) {
|
|
244
|
+
let cached = byNameCache.get(testName);
|
|
245
|
+
if (!cached) {
|
|
246
|
+
cached = yield* repo.findSpecTestsByTestName(testName);
|
|
247
|
+
byNameCache.set(testName, cached);
|
|
248
|
+
}
|
|
249
|
+
if (cached.length === 1) {
|
|
250
|
+
links = cached;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (links.length === 0) {
|
|
255
|
+
unmatched.add(row.testId);
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
for (const link of links) {
|
|
259
|
+
inserts.push({
|
|
260
|
+
specTestId: link.id,
|
|
261
|
+
passed: row.passed,
|
|
262
|
+
durationMs: row.durationMs ?? null,
|
|
263
|
+
details: normalizeDetails(row.details ?? null),
|
|
264
|
+
runAt: options?.runAt,
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
const inserted = yield* repo.insertRunsBatch(inserts);
|
|
269
|
+
return {
|
|
270
|
+
received: results.length,
|
|
271
|
+
recorded: inserted.length,
|
|
272
|
+
unmatched: [...unmatched],
|
|
273
|
+
};
|
|
274
|
+
}),
|
|
275
|
+
fci: (filter) => computeFci(filter),
|
|
276
|
+
matrix: (filter) => Effect.gen(function* () {
|
|
277
|
+
const invariants = yield* repo.listActiveInvariants(filter);
|
|
278
|
+
const tests = yield* repo.findSpecTestsByInvariantIds(invariants.map((i) => i.id));
|
|
279
|
+
const latestRuns = yield* repo.findLatestRunsBySpecTestIds(tests.map((t) => t.id));
|
|
280
|
+
const testsByInvariant = new Map();
|
|
281
|
+
for (const test of tests) {
|
|
282
|
+
const latest = latestRuns.get(test.id);
|
|
283
|
+
const row = {
|
|
284
|
+
specTestId: test.id,
|
|
285
|
+
testId: test.testId,
|
|
286
|
+
testFile: test.testFile,
|
|
287
|
+
testName: test.testName,
|
|
288
|
+
framework: test.framework,
|
|
289
|
+
discovery: test.discovery,
|
|
290
|
+
latestRun: {
|
|
291
|
+
passed: latest ? latest.passed : null,
|
|
292
|
+
runAt: latest ? latest.runAt : null,
|
|
293
|
+
},
|
|
294
|
+
};
|
|
295
|
+
const current = testsByInvariant.get(test.invariantId) ?? [];
|
|
296
|
+
current.push(row);
|
|
297
|
+
testsByInvariant.set(test.invariantId, current);
|
|
298
|
+
}
|
|
299
|
+
const out = invariants.map((invariant) => ({
|
|
300
|
+
invariantId: invariant.id,
|
|
301
|
+
rule: invariant.rule,
|
|
302
|
+
subsystem: invariant.subsystem,
|
|
303
|
+
tests: (testsByInvariant.get(invariant.id) ?? []).sort((a, b) => a.testId.localeCompare(b.testId)),
|
|
304
|
+
}));
|
|
305
|
+
return out;
|
|
306
|
+
}),
|
|
307
|
+
complete: (filter, signedOffBy, notes) => Effect.gen(function* () {
|
|
308
|
+
const normalizedBy = signedOffBy.trim();
|
|
309
|
+
if (normalizedBy.length === 0) {
|
|
310
|
+
return yield* Effect.fail(new ValidationError({ reason: "signedOffBy is required" }));
|
|
311
|
+
}
|
|
312
|
+
const scope = resolveSignoffScope(filter);
|
|
313
|
+
if (!scope) {
|
|
314
|
+
return yield* Effect.fail(new ValidationError({
|
|
315
|
+
reason: "Sign-off scope must be global, --doc, or --subsystem (not both)",
|
|
316
|
+
}));
|
|
317
|
+
}
|
|
318
|
+
const result = yield* computeFci(filter);
|
|
319
|
+
if (result.phase !== "HARDEN") {
|
|
320
|
+
return yield* Effect.fail(new ValidationError({
|
|
321
|
+
reason: `Cannot complete scope while phase is ${result.phase} (must be HARDEN with FCI 100)`,
|
|
322
|
+
}));
|
|
323
|
+
}
|
|
324
|
+
return yield* repo.upsertSignoff(scope.scopeType, scope.scopeValue, normalizedBy, notes ?? null);
|
|
325
|
+
}),
|
|
326
|
+
status: (filter) => Effect.gen(function* () {
|
|
327
|
+
const fci = yield* computeFci(filter);
|
|
328
|
+
return {
|
|
329
|
+
phase: fci.phase,
|
|
330
|
+
fci: fci.fci,
|
|
331
|
+
gaps: fci.uncovered,
|
|
332
|
+
total: fci.total,
|
|
333
|
+
};
|
|
334
|
+
}),
|
|
335
|
+
};
|
|
336
|
+
}));
|
|
337
|
+
const parseGenericBatch = (value) => {
|
|
338
|
+
if (!Array.isArray(value)) {
|
|
339
|
+
throw new ValidationError({ reason: "Generic batch input must be an array" });
|
|
340
|
+
}
|
|
341
|
+
const out = [];
|
|
342
|
+
for (const item of value) {
|
|
343
|
+
if (typeof item !== "object" || item === null)
|
|
344
|
+
continue;
|
|
345
|
+
const row = item;
|
|
346
|
+
if (typeof row.testId !== "string" || row.testId.trim().length === 0)
|
|
347
|
+
continue;
|
|
348
|
+
if (typeof row.passed !== "boolean")
|
|
349
|
+
continue;
|
|
350
|
+
const durationMs = typeof row.durationMs === "number" && Number.isFinite(row.durationMs)
|
|
351
|
+
? Math.max(0, Math.trunc(row.durationMs))
|
|
352
|
+
: undefined;
|
|
353
|
+
const details = typeof row.details === "string" ? row.details : undefined;
|
|
354
|
+
out.push({
|
|
355
|
+
testId: row.testId,
|
|
356
|
+
passed: row.passed,
|
|
357
|
+
durationMs,
|
|
358
|
+
details,
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
return out;
|
|
362
|
+
};
|
|
363
|
+
const parseVitestBatch = (value) => {
|
|
364
|
+
const out = [];
|
|
365
|
+
if (typeof value !== "object" || value === null) {
|
|
366
|
+
return out;
|
|
367
|
+
}
|
|
368
|
+
const obj = value;
|
|
369
|
+
if (Array.isArray(obj.testResults)) {
|
|
370
|
+
for (const fileEntry of obj.testResults) {
|
|
371
|
+
if (typeof fileEntry !== "object" || fileEntry === null)
|
|
372
|
+
continue;
|
|
373
|
+
const fileObj = fileEntry;
|
|
374
|
+
const fileName = typeof fileObj.name === "string" ? fileObj.name.replace(/\\/g, "/") : "vitest";
|
|
375
|
+
if (!Array.isArray(fileObj.assertionResults))
|
|
376
|
+
continue;
|
|
377
|
+
for (const assertion of fileObj.assertionResults) {
|
|
378
|
+
if (typeof assertion !== "object" || assertion === null)
|
|
379
|
+
continue;
|
|
380
|
+
const a = assertion;
|
|
381
|
+
const testName = typeof a.fullName === "string" && a.fullName.length > 0
|
|
382
|
+
? a.fullName
|
|
383
|
+
: typeof a.title === "string"
|
|
384
|
+
? a.title
|
|
385
|
+
: "vitest";
|
|
386
|
+
const status = typeof a.status === "string" ? a.status : "failed";
|
|
387
|
+
if (status !== "passed" && status !== "pass" && status !== "failed" && status !== "fail") {
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
const details = Array.isArray(a.failureMessages)
|
|
391
|
+
? a.failureMessages.filter((x) => typeof x === "string").join("\n")
|
|
392
|
+
: undefined;
|
|
393
|
+
out.push({
|
|
394
|
+
testId: `${fileName}::${testName}`,
|
|
395
|
+
passed: status === "passed" || status === "pass",
|
|
396
|
+
durationMs: typeof a.duration === "number" ? Math.max(0, Math.trunc(a.duration)) : undefined,
|
|
397
|
+
details,
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (Array.isArray(obj.files)) {
|
|
403
|
+
const collectTasks = (prefixFile, tasks) => {
|
|
404
|
+
if (!Array.isArray(tasks))
|
|
405
|
+
return;
|
|
406
|
+
for (const task of tasks) {
|
|
407
|
+
if (typeof task !== "object" || task === null)
|
|
408
|
+
continue;
|
|
409
|
+
const t = task;
|
|
410
|
+
const result = typeof t.result === "object" && t.result !== null
|
|
411
|
+
? t.result
|
|
412
|
+
: null;
|
|
413
|
+
if (typeof t.name === "string" && result && typeof result.state === "string") {
|
|
414
|
+
if (result.state !== "pass" && result.state !== "fail") {
|
|
415
|
+
collectTasks(prefixFile, t.tasks);
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
const errors = Array.isArray(result.errors)
|
|
419
|
+
? result.errors.map((e) => String(e)).join("\n")
|
|
420
|
+
: undefined;
|
|
421
|
+
out.push({
|
|
422
|
+
testId: `${prefixFile}::${t.name}`,
|
|
423
|
+
passed: result.state === "pass",
|
|
424
|
+
durationMs: typeof result.duration === "number" ? Math.max(0, Math.trunc(result.duration)) : undefined,
|
|
425
|
+
details: errors,
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
collectTasks(prefixFile, t.tasks);
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
for (const fileEntry of obj.files) {
|
|
432
|
+
if (typeof fileEntry !== "object" || fileEntry === null)
|
|
433
|
+
continue;
|
|
434
|
+
const fileObj = fileEntry;
|
|
435
|
+
const fileName = typeof fileObj.filepath === "string"
|
|
436
|
+
? fileObj.filepath.replace(/\\/g, "/")
|
|
437
|
+
: typeof fileObj.name === "string"
|
|
438
|
+
? fileObj.name.replace(/\\/g, "/")
|
|
439
|
+
: "vitest";
|
|
440
|
+
collectTasks(fileName, fileObj.tasks);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return out;
|
|
444
|
+
};
|
|
445
|
+
const parsePytestBatch = (value) => {
|
|
446
|
+
const out = [];
|
|
447
|
+
if (typeof value !== "object" || value === null)
|
|
448
|
+
return out;
|
|
449
|
+
const obj = value;
|
|
450
|
+
if (!Array.isArray(obj.tests))
|
|
451
|
+
return out;
|
|
452
|
+
for (const entry of obj.tests) {
|
|
453
|
+
if (typeof entry !== "object" || entry === null)
|
|
454
|
+
continue;
|
|
455
|
+
const test = entry;
|
|
456
|
+
if (typeof test.nodeid !== "string" || test.nodeid.length === 0)
|
|
457
|
+
continue;
|
|
458
|
+
const outcome = typeof test.outcome === "string" ? test.outcome : "failed";
|
|
459
|
+
if (outcome !== "passed" && outcome !== "failed" && outcome !== "error") {
|
|
460
|
+
continue;
|
|
461
|
+
}
|
|
462
|
+
const call = (typeof test.call === "object" && test.call !== null)
|
|
463
|
+
? test.call
|
|
464
|
+
: null;
|
|
465
|
+
out.push({
|
|
466
|
+
testId: test.nodeid,
|
|
467
|
+
passed: outcome === "passed",
|
|
468
|
+
durationMs: call && typeof call.duration === "number"
|
|
469
|
+
? Math.max(0, Math.trunc(call.duration * 1000))
|
|
470
|
+
: undefined,
|
|
471
|
+
details: typeof test.longrepr === "string" ? test.longrepr : undefined,
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
return out;
|
|
475
|
+
};
|
|
476
|
+
const getXmlNodeText = (node) => {
|
|
477
|
+
if (typeof node === "string") {
|
|
478
|
+
const text = node.trim();
|
|
479
|
+
return text.length > 0 ? text : undefined;
|
|
480
|
+
}
|
|
481
|
+
if (typeof node !== "object" || node === null)
|
|
482
|
+
return undefined;
|
|
483
|
+
const obj = node;
|
|
484
|
+
const parts = [];
|
|
485
|
+
if (typeof obj["@_message"] === "string" && obj["@_message"].trim().length > 0) {
|
|
486
|
+
parts.push(obj["@_message"].trim());
|
|
487
|
+
}
|
|
488
|
+
if (typeof obj["#text"] === "string" && obj["#text"].trim().length > 0) {
|
|
489
|
+
parts.push(obj["#text"].trim());
|
|
490
|
+
}
|
|
491
|
+
if (typeof obj["__cdata"] === "string" && obj["__cdata"].trim().length > 0) {
|
|
492
|
+
parts.push(obj["__cdata"].trim());
|
|
493
|
+
}
|
|
494
|
+
return parts.length > 0 ? parts.join("\n") : undefined;
|
|
495
|
+
};
|
|
496
|
+
const getXmlNodeTexts = (node) => {
|
|
497
|
+
if (Array.isArray(node)) {
|
|
498
|
+
return node.flatMap((entry) => getXmlNodeTexts(entry));
|
|
499
|
+
}
|
|
500
|
+
const text = getXmlNodeText(node);
|
|
501
|
+
return text ? [text] : [];
|
|
502
|
+
};
|
|
503
|
+
const normalizeJunitFilePath = (value) => value
|
|
504
|
+
.trim()
|
|
505
|
+
.replace(/\\/g, "/")
|
|
506
|
+
.replace(/\/+/g, "/")
|
|
507
|
+
.replace(/^\.\//, "");
|
|
508
|
+
const parseJunitDurationMs = (value) => {
|
|
509
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
510
|
+
return Math.max(0, Math.trunc(value * 1000));
|
|
511
|
+
}
|
|
512
|
+
if (typeof value !== "string")
|
|
513
|
+
return undefined;
|
|
514
|
+
const trimmed = value.trim();
|
|
515
|
+
if (trimmed.length === 0)
|
|
516
|
+
return undefined;
|
|
517
|
+
const normalized = trimmed.includes(",") && !trimmed.includes(".")
|
|
518
|
+
? trimmed.replace(",", ".")
|
|
519
|
+
: trimmed;
|
|
520
|
+
const seconds = Number.parseFloat(normalized);
|
|
521
|
+
if (!Number.isFinite(seconds))
|
|
522
|
+
return undefined;
|
|
523
|
+
return Math.max(0, Math.trunc(seconds * 1000));
|
|
524
|
+
};
|
|
525
|
+
const isSkippedJunitCase = (testcase) => {
|
|
526
|
+
if (testcase.skipped !== undefined)
|
|
527
|
+
return true;
|
|
528
|
+
const status = typeof testcase["@_status"] === "string"
|
|
529
|
+
? testcase["@_status"].trim().toLowerCase()
|
|
530
|
+
: null;
|
|
531
|
+
if (status === "skip" || status === "skipped")
|
|
532
|
+
return true;
|
|
533
|
+
const result = typeof testcase["@_result"] === "string"
|
|
534
|
+
? testcase["@_result"].trim().toLowerCase()
|
|
535
|
+
: null;
|
|
536
|
+
return result === "skip" || result === "skipped";
|
|
537
|
+
};
|
|
538
|
+
const collectJunitSuites = (node, out) => {
|
|
539
|
+
if (Array.isArray(node)) {
|
|
540
|
+
for (const entry of node) {
|
|
541
|
+
collectJunitSuites(entry, out);
|
|
542
|
+
}
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
if (typeof node !== "object" || node === null)
|
|
546
|
+
return;
|
|
547
|
+
const suite = node;
|
|
548
|
+
out.push(suite);
|
|
549
|
+
if (suite.testsuite !== undefined) {
|
|
550
|
+
collectJunitSuites(suite.testsuite, out);
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
const parseJunitBatch = (rawXml) => {
|
|
554
|
+
const validation = XMLValidator.validate(rawXml);
|
|
555
|
+
if (validation !== true) {
|
|
556
|
+
const reason = typeof validation.err?.msg === "string"
|
|
557
|
+
? validation.err.msg
|
|
558
|
+
: "Malformed XML payload";
|
|
559
|
+
throw new ValidationError({ reason: `Invalid JUnit XML input: ${reason}` });
|
|
560
|
+
}
|
|
561
|
+
let parsed;
|
|
562
|
+
try {
|
|
563
|
+
const parser = new XMLParser({
|
|
564
|
+
ignoreAttributes: false,
|
|
565
|
+
attributeNamePrefix: "@_",
|
|
566
|
+
isArray: (name) => name === "testsuite" || name === "testcase",
|
|
567
|
+
});
|
|
568
|
+
parsed = parser.parse(rawXml);
|
|
569
|
+
}
|
|
570
|
+
catch (error) {
|
|
571
|
+
throw new ValidationError({ reason: `Invalid JUnit XML input: ${String(error)}` });
|
|
572
|
+
}
|
|
573
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
574
|
+
throw new ValidationError({ reason: "Invalid JUnit XML input: expected XML object root" });
|
|
575
|
+
}
|
|
576
|
+
const root = parsed;
|
|
577
|
+
const suites = [];
|
|
578
|
+
const testsuitesRoot = root.testsuites;
|
|
579
|
+
if (typeof testsuitesRoot === "object" && testsuitesRoot !== null) {
|
|
580
|
+
const testsuitesNode = testsuitesRoot.testsuite;
|
|
581
|
+
if (testsuitesNode !== undefined) {
|
|
582
|
+
collectJunitSuites(testsuitesNode, suites);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
if (root.testsuite !== undefined) {
|
|
586
|
+
collectJunitSuites(root.testsuite, suites);
|
|
587
|
+
}
|
|
588
|
+
const out = [];
|
|
589
|
+
for (const suite of suites) {
|
|
590
|
+
const suiteFile = typeof suite["@_file"] === "string" && suite["@_file"].trim().length > 0
|
|
591
|
+
? normalizeJunitFilePath(suite["@_file"])
|
|
592
|
+
: null;
|
|
593
|
+
const testcases = Array.isArray(suite.testcase)
|
|
594
|
+
? suite.testcase
|
|
595
|
+
: suite.testcase !== undefined && suite.testcase !== null
|
|
596
|
+
? [suite.testcase]
|
|
597
|
+
: [];
|
|
598
|
+
for (const testcaseNode of testcases) {
|
|
599
|
+
if (typeof testcaseNode !== "object" || testcaseNode === null)
|
|
600
|
+
continue;
|
|
601
|
+
const testcase = testcaseNode;
|
|
602
|
+
const testName = typeof testcase["@_name"] === "string"
|
|
603
|
+
? testcase["@_name"].trim()
|
|
604
|
+
: "";
|
|
605
|
+
if (testName.length === 0)
|
|
606
|
+
continue;
|
|
607
|
+
if (isSkippedJunitCase(testcase))
|
|
608
|
+
continue;
|
|
609
|
+
const className = typeof testcase["@_classname"] === "string" && testcase["@_classname"].trim().length > 0
|
|
610
|
+
? testcase["@_classname"].trim()
|
|
611
|
+
: null;
|
|
612
|
+
const testcaseFile = typeof testcase["@_file"] === "string" && testcase["@_file"].trim().length > 0
|
|
613
|
+
? normalizeJunitFilePath(testcase["@_file"])
|
|
614
|
+
: null;
|
|
615
|
+
const rawTestFile = testcaseFile ?? suiteFile ?? className ?? "junit";
|
|
616
|
+
const testFile = rawTestFile.includes("/")
|
|
617
|
+
? normalizeJunitFilePath(rawTestFile)
|
|
618
|
+
: rawTestFile;
|
|
619
|
+
const failed = testcase.failure !== undefined || testcase.error !== undefined;
|
|
620
|
+
const durationMs = parseJunitDurationMs(testcase["@_time"]);
|
|
621
|
+
let details;
|
|
622
|
+
if (failed) {
|
|
623
|
+
const detailsChunks = [
|
|
624
|
+
...getXmlNodeTexts(testcase.failure),
|
|
625
|
+
...getXmlNodeTexts(testcase.error),
|
|
626
|
+
];
|
|
627
|
+
details = detailsChunks.length > 0 ? detailsChunks.join("\n\n") : undefined;
|
|
628
|
+
}
|
|
629
|
+
out.push({
|
|
630
|
+
testId: `${testFile}::${testName}`,
|
|
631
|
+
passed: !failed,
|
|
632
|
+
durationMs,
|
|
633
|
+
details,
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return out;
|
|
638
|
+
};
|
|
639
|
+
const parseGoBatch = (rawText) => {
|
|
640
|
+
const outputs = new Map();
|
|
641
|
+
const final = new Map();
|
|
642
|
+
for (const line of rawText.split(/\r?\n/)) {
|
|
643
|
+
const trimmed = line.trim();
|
|
644
|
+
if (trimmed.length === 0)
|
|
645
|
+
continue;
|
|
646
|
+
let parsed;
|
|
647
|
+
try {
|
|
648
|
+
parsed = JSON.parse(trimmed);
|
|
649
|
+
}
|
|
650
|
+
catch {
|
|
651
|
+
continue;
|
|
652
|
+
}
|
|
653
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
654
|
+
continue;
|
|
655
|
+
const row = parsed;
|
|
656
|
+
if (typeof row.Test !== "string" || row.Test.length === 0)
|
|
657
|
+
continue;
|
|
658
|
+
const pkg = typeof row.Package === "string" && row.Package.length > 0
|
|
659
|
+
? row.Package
|
|
660
|
+
: "go";
|
|
661
|
+
const testId = `${pkg}::${row.Test}`;
|
|
662
|
+
if (row.Action === "output" && typeof row.Output === "string") {
|
|
663
|
+
const current = outputs.get(testId) ?? [];
|
|
664
|
+
current.push(row.Output.trimEnd());
|
|
665
|
+
outputs.set(testId, current);
|
|
666
|
+
continue;
|
|
667
|
+
}
|
|
668
|
+
if (row.Action === "pass" || row.Action === "fail") {
|
|
669
|
+
final.set(testId, {
|
|
670
|
+
testId,
|
|
671
|
+
passed: row.Action === "pass",
|
|
672
|
+
durationMs: typeof row.Elapsed === "number"
|
|
673
|
+
? Math.max(0, Math.trunc(row.Elapsed * 1000))
|
|
674
|
+
: undefined,
|
|
675
|
+
details: row.Action === "fail"
|
|
676
|
+
? (outputs.get(testId)?.filter((s) => s.length > 0).join("\n") || undefined)
|
|
677
|
+
: undefined,
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return [...final.values()];
|
|
682
|
+
};
|
|
683
|
+
/** Parse framework-native batch payloads into generic run records. */
|
|
684
|
+
export const parseBatchRunInput = (raw, source) => {
|
|
685
|
+
if (Buffer.byteLength(raw, "utf8") > SPEC_BATCH_MAX_BYTES) {
|
|
686
|
+
throw new ValidationError({ reason: `Raw batch payload exceeds ${SPEC_BATCH_MAX_BYTES} bytes` });
|
|
687
|
+
}
|
|
688
|
+
if (source === "go")
|
|
689
|
+
return parseGoBatch(raw);
|
|
690
|
+
if (source === "junit")
|
|
691
|
+
return parseJunitBatch(raw);
|
|
692
|
+
let parsed;
|
|
693
|
+
try {
|
|
694
|
+
parsed = JSON.parse(raw);
|
|
695
|
+
}
|
|
696
|
+
catch (error) {
|
|
697
|
+
throw new ValidationError({ reason: `Invalid JSON input: ${String(error)}` });
|
|
698
|
+
}
|
|
699
|
+
if (source === "generic")
|
|
700
|
+
return parseGenericBatch(parsed);
|
|
701
|
+
if (source === "vitest")
|
|
702
|
+
return parseVitestBatch(parsed);
|
|
703
|
+
if (source === "pytest")
|
|
704
|
+
return parsePytestBatch(parsed);
|
|
705
|
+
return [];
|
|
706
|
+
};
|
|
707
|
+
//# sourceMappingURL=spec-trace-service-impl.js.map
|