Skip to content

Add fixture-level formal compliance tests for Monte Carlo forecast engine (FC-P3/P4/P6/P8/P9/P10) - #48936

Merged
pelikhan merged 2 commits into
mainfrom
copilot/formal-spec-forecast-compliance-fixtures
Jul 29, 2026
Merged

Add fixture-level formal compliance tests for Monte Carlo forecast engine (FC-P3/P4/P6/P8/P9/P10)#48936
pelikhan merged 2 commits into
mainfrom
copilot/formal-spec-forecast-compliance-fixtures

Conversation

Copilot AI commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

The formal spec (issue #48935) identified six fixture-level predicates from the behavioral coverage map that were absent from the existing forecast_compliance_fixtures_formal_test.go test suite — which covered Monte Carlo engine internals (P1–P13) but never directly loaded and validated the four JSON fixture files themselves.

Added tests

Six new TestFormal_FC_P* tests appended to the existing file, all in package cli:

Test Spec ref Validates
TestFormal_FC_P3_ZeroETFixture T-FC-022 run_summary_zero_et.jsontotal_effective_tokens == 0
TestFormal_FC_P4_HighETFixture T-ET-006 run_summary_high_et.jsontotal_effective_tokens >= 1,000,000
TestFormal_FC_P6_FailedRunFixture T-FC-035 run_summary_failed.jsonrun.conclusion == "failure"
TestFormal_FC_P8_RunSummaryRoundTrip §8.1 RunSummary JSON marshal → unmarshal is lossless
TestFormal_FC_P9_TimestampOrdering §6.2.2 run_started_at ≤ updated_at across all four fixtures
TestFormal_FC_P10_MonteCarloInputCompleteness R-MC-020/021 Table-driven: all four fixtures have valid run_id, run.conclusion, and total_aic; skips gracefully if a fixture file is missing

Updated the package-level comment to document the new FC-P* predicate group alongside the existing TLA+/F*/Z3 families.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update formal model and test suite for compliance fixtures Add fixture-level formal compliance tests for Monte Carlo forecast engine (FC-P3/P4/P6/P8/P9/P10) Jul 29, 2026
Copilot AI requested a review from pelikhan July 29, 2026 16:14
@pelikhan
pelikhan marked this pull request as ready for review July 29, 2026 16:15
Copilot AI review requested due to automatic review settings July 29, 2026 16:15
@pelikhan
pelikhan merged commit b23b734 into main Jul 29, 2026
@pelikhan
pelikhan deleted the copilot/formal-spec-forecast-compliance-fixtures branch July 29, 2026 16:15

Copilot AI 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.

Pull request overview

Adds formal fixture-level compliance tests for Monte Carlo forecast inputs.

Changes:

  • Validates zero-, high-ET, and failed-run fixtures.
  • Adds serialization, timestamp-ordering, and input-completeness checks.
  • Documents FC-P3/P4/P6/P8/P9/P10 predicates.
Show a summary per file
File Description
pkg/cli/forecast_compliance_fixtures_formal_test.go Adds fixture compliance tests and predicate documentation.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment on lines +517 to +528
assert.Equal(t, original.CLIVersion, roundTripped.CLIVersion,
"FC-P8: CLIVersion must survive round-trip")
assert.Equal(t, original.RunID, roundTripped.RunID,
"FC-P8: RunID must survive round-trip")
assert.Equal(t, original.ProcessedAt.UTC(), roundTripped.ProcessedAt.UTC(),
"FC-P8: ProcessedAt must survive round-trip")
assert.Equal(t, original.Run.Conclusion, roundTripped.Run.Conclusion,
"FC-P8: Run.Conclusion must survive round-trip")
assert.Equal(t, original.Run.StartedAt.UTC(), roundTripped.Run.StartedAt.UTC(),
"FC-P8: Run.StartedAt must survive round-trip")
assert.Equal(t, original.Run.UpdatedAt.UTC(), roundTripped.Run.UpdatedAt.UTC(),
"FC-P8: Run.UpdatedAt must survive round-trip")
Comment on lines +551 to +554
startedStr, ok := run["run_started_at"].(string)
require.True(t, ok, "FC-P9: run.run_started_at must be a string in %s", name)
updatedStr, ok := run["updated_at"].(string)
require.True(t, ok, "FC-P9: run.updated_at must be a string in %s", name)
Comment on lines +601 to +603
runID, ok := runIDRaw.(float64)
require.True(t, ok, "FC-P10: run_id must be a number in %s", tc.name)
assert.NotEqual(t, 0.0, runID, "FC-P10: run_id must be non-zero in %s", tc.name)
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[formal-spec] forecast-compliance-fixtures/README.md — Formal model & test suite — 2026-07-29

3 participants