Skip to content

fix(test): align mock latest result schema - #290

Merged
zeshi-du merged 1 commit into
TestSprite:mainfrom
zengxm1979:codex/fix-latest-result-mock-schema-287
Aug 13, 2026
Merged

fix(test): align mock latest result schema#290
zeshi-du merged 1 commit into
TestSprite:mainfrom
zengxm1979:codex/fix-latest-result-mock-schema-287

Conversation

@zengxm1979

@zengxm1979 zengxm1979 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Align the mock-backend LatestResult fixtures and P4 contract validator with the current public CliLatestResult shape.

Root cause

The dry-run producer and public type already use the current semantic schema:

  • verdict
  • executionStatus
  • string summary

The mock backend fixtures and P4 validator still taught the old shape where summary was a { passed, failed, skipped } object and verdict / executionStatus were absent. That lets stale mock responses pass contract tests while rendering malformed text such as summary: [object Object].

Change

  • Update running, passed, failed, and no-analysis mock result fixtures to include verdict and executionStatus.
  • Replace count-object summaries with human-readable string summaries.
  • Update the P4 LatestResult validator to require the current fields and validate summary as a string.

Validation

  • npm test -- test/contract/p4-schema.test.ts test/mock-backend/handlers.smoke.test.ts
  • npm run typecheck
  • npm run lint
  • npm run format:check

All checks passed locally on Node v24.15.0 / npm 11.12.1.

Closes #287

Summary by CodeRabbit

  • Tests

    • Updated latest-result contract validation to require verdict and execution status fields.
    • Added validation for supported verdict and execution status values.
    • Updated summary validation to use human-readable text.
  • Test Fixtures

    • Refreshed sample results to include verdict, execution status, and descriptive summaries across running, passed, failed, and no-analysis scenarios.

Closes #255 (same defect, filed earlier — see review comment).

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The LatestResult contract validator now requires verdict and executionStatus, validates their allowed values, and expects a string summary. Mock fixtures are updated from count objects to the corresponding semantic result fields.

Changes

LatestResult schema migration

Layer / File(s) Summary
LatestResult contract validation
test/contract/p4-schema.test.ts
The validator requires and checks verdict and executionStatus, while validating summary as a string instead of a numeric count object.
Mock LatestResult fixtures
test/mock-backend/fixtures.ts
Running, passed, failed, and no-analysis fixtures now provide semantic verdicts, execution statuses, and descriptive summaries.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • #255 — Updates the obsolete LatestResult schema in the same fixtures and contract validator.

Suggested reviewers: ruili-testsprite, zeshi-du

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The fixtures and contract validator now use verdict, executionStatus, and string summaries, matching the linked migration goal.
Out of Scope Changes check ✅ Passed The changes stay focused on the LatestResult schema migration in tests and fixtures, with no unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: updating test mocks to match the latest result schema.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zeshi-du zeshi-du left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving and merging.

One amendment I've made to the description: added Closes #255 alongside Closes #287. Those two issues are the same defect — the mock backend and the contract fixtures both model LatestResult as {passed, failed, skipped} while the real CliLatestResult carries verdict / executionStatus / a string summary, so the "strict" contract test was green against a shape the renderer no longer supports. #255 was filed first (by me, on 07-16) and #287 is the independent rediscovery; without the extra keyword #255 would have silently survived this merge.

Also worth saying: your other PR, #289, is closed as superseded — the test diff exit-contract bug it fixed had already been fixed internally 8 days before the issue that prompted it was filed. That's a publishing gap on our side and nothing you could have seen from the public repo. Thanks for both.

@zeshi-du
zeshi-du merged commit 97bcd7a into TestSprite:main Aug 13, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants