feat(testing): add structured comparison output for test-dsl#1566
Open
AdityaShome wants to merge 17 commits intomofa-org:mainfrom
Open
feat(testing): add structured comparison output for test-dsl#1566AdityaShome wants to merge 17 commits intomofa-org:mainfrom
AdityaShome wants to merge 17 commits intomofa-org:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR is rebased on #1558, #1556, #1555 and #1447, adds machine‑readable comparison output and a CI gate flag for DSL baseline diffs.
mofa test-dslcan now emit a JSON comparison artifact via--comparison-out, enabling CI and tooling to consume the baseline diff in a stable, structured form.Context
Baseline comparison already exists and can report match/mismatch in CLI output, but there was no structured output for CI gates or downstream tooling.
What Changed
This PR closes that gap by:
AgentRunArtifactComparison(serializable comparison output type)--comparison-out <file>tomofa test-dsl--fail-on-diffto return a non-zero exit on baseline mismatches--comparison-outis providedFiles Changed
Core Files
tests/src/artifact.rsAgentRunArtifactComparison.tests/src/lib.rscrates/mofa-cli/src/cli.rs--comparison-outflag totest-dsl.crates/mofa-cli/src/commands/test_dsl.rsAgentRunArtifactComparisonusing existing diff output.--comparison-out.--comparison-outis used without--baseline-in.--fail-on-diffis set and the baseline mismatches.crates/mofa-cli/src/main.rscomparison_outthrough CLI dispatch.CLI Usage
Example Comparison Output
{ "case_name": "simple_agent_run", "matches": false, "differences": [ { "field": "output_text", "expected": "forced mismatch", "actual": "hello from DSL" } ], "baseline_execution_id": "019d4e06-f888-7a43-9ef3-edc0603b5dcd", "candidate_execution_id": "019d4e0b-806c-7393-b3f6-53f0b5a9efc9" }Execution Flow
flowchart TD A[TOML DSL file] --> B[mofa test-dsl] B --> C[Parse TestCaseDsl] C --> D[Execute case] D --> E[Build AgentRunArtifact] E --> F[Write artifact<br/>--artifact-out] E --> G[Write baseline<br/>--baseline-out] E --> H[Load baseline<br/>--baseline-in] H --> I[Compare artifacts] I --> J[Write comparison JSON<br/>--comparison-out] E --> K[Build report] K --> L[Write report<br/>--report-out] I --> M{--fail-on-diff?} M -->|matches| N[Exit 0] M -->|mismatch| O[Exit 1]Tests
cargo test -p mofa-cli test_dslNotes
This is the CI oriented, machine readable layer on top of the existing baseline diff model. It does not change diff semantics, only the output shape and CLI wiring.