Skip to content

test(gamma): use embedded offline fixtures for gamma tests - #231

Merged
Sergey Galkin (sgalkin) merged 6 commits into
mainfrom
gamma-offline-fixtures
Oct 8, 2026
Merged

Sergey Galkin (sgalkin) merged 6 commits into
mainfrom
gamma-offline-fixtures

Conversation

@sgalkin

@sgalkin Sergey Galkin (sgalkin) commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Generate small gamma test projects from immutable embedded assets in owned temporary directories instead of using the repository as the project under test. Preserve explicit manifests, source bytes, specialized local graphs, and intentionally malformed inputs.
  • Compile public function- and module-scoped #[gamma::resource] attributes in the complete scheduling campaign using a copied real proc-macro artifact and --extern, without a Cargo dependency in the sample.
  • Exercise actual public macro diagnostics using the authoritative Cargo-artifact helper, dependency-free consumers, and fresh Cargo homes and targets.
  • Keep offline configuration after updates, respect .cargo/config precedence, reject Windows path escapes, and preserve Cargo's effective inherited compiler-flag source.
  • Keep private test helpers under tests/support, without introducing nightly coverage attributes or default production helper APIs.

System-test boundary

Real compiler/offline acceptance is preserved, not replaced by scripted compiler success. The three new build cases now live in offline_builds, which requires the non-default system-tests feature; ordinary project checks observe materialization and pure scripted flag/configuration/path invariants without subprocesses. Native all-feature Anvil checks retain the real-build target.

The system-test specification records purpose, provisioning, immutable inputs and owned outputs, isolation, runtime budgets, interpreter boundaries, and explicit failure semantics. The generator's blanket Miri exclusion is removed: pure checks run with isolation enabled, while only unsupported filesystem-output or compiler cases carry individual explanatory ignores. The missing-file regression now requires its requested-path diagnostic prefix.

Scope

This is test infrastructure, not a production gamma algorithm/API change. Committed-source/documentation invariant checks remain read-only repository checks. Real proc-macro bootstrap is offline and locked but still requires the product's normal available build dependencies; the empty-registry-cache guarantee applies to generated consumers, not rebuilding the whole repository from an empty cache. Checked-in sample input bytes are not mutated.

Validation

  • Original broad conversion: 3,542 gamma tests passed offline, with four pre-existing skips; this full run predates the review corrections.
  • Current boundary correction: 40 selected native tests passed, covering real offline/public-macro/resource acceptance, materializer invariants, and source read/error behavior.
  • Actual Careful: all 9 offline_builds and 16 project cases passed.
  • Isolated Windows Miri: 9 pure project cases and 6 pure offline_builds cases passed; filesystem-output and compiler-process exclusions are individual and reasoned. Isolation was not disabled.
  • Scoped Clippy with warnings denied, generated formatting, README generation, spelling, package inclusion, and whitespace gates passed.
  • Bounded self-review found no additional findings.

Local follow-up validation was on Windows x86_64 MSVC. The new revision awaits its cross-platform CI/review round.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 13:33

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.

Copilot review overview

🟡 Changes recommended

Windows-prefixed paths can escape fixture roots, and two survey fixtures overwrite the enforced offline configuration.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Refactors gamma tests to use isolated embedded fixtures, offline Cargo configuration, and real proc-macro artifacts.

Changes:

  • Adds shared fixture materialization with offline Cargo settings.
  • Migrates gamma tests away from repository-backed projects.
  • Adds offline fixture and proc-macro diagnostic coverage.
File Description
Cargo.lock Records new test dependencies.
crates/​cargo-gamma-attrs/​Cargo.toml Adds diagnostic-test dependencies.
crates/​cargo-gamma-attrs/​tests/​diagnostics.rs Tests real copied proc-macro artifacts.
crates/​cargo-gamma-engine/​Cargo.toml Adds tempfile for tests.
crates/​cargo-gamma-engine/​src/​parse/​source_file.rs Uses temporary source fixtures.
crates/​cargo-gamma-lib/​Cargo.toml Registers the fixture test target.
crates/​cargo-gamma-lib/​src/​cfg/​build.rs Uses shared fixture writing.
crates/​cargo-gamma-lib/​src/​cfg/​features.rs Generates isolated metadata projects.
crates/​cargo-gamma-lib/​src/​commands/​clean.rs Uses an isolated workspace.
crates/​cargo-gamma-lib/​src/​commands/​run.rs Migrates run fixtures.
crates/​cargo-gamma-lib/​src/​discover/​hints.rs Uses embedded source fixtures.
crates/​cargo-gamma-lib/​src/​discover/​record.rs Consolidates fixture construction.
crates/​cargo-gamma-lib/​src/​discover/​survey.rs Adds embedded dependency graphs.
crates/​cargo-gamma-lib/​src/​exec/​build/​tests.rs Migrates build fixtures.
crates/​cargo-gamma-lib/​src/​exec/​test_binary.rs Migrates test-target fixtures.
crates/​cargo-gamma-lib/​src/​exec/​workspace.rs Migrates workspace fixtures.
crates/​cargo-gamma-lib/​src/​fixtures.rs Adopts shared project generation.
crates/​cargo-gamma-lib/​src/​testing.rs Exposes fixture helpers to tests.
crates/​cargo-gamma-lib/​tests/​cli.rs Uses isolated CLI projects.
crates/​cargo-gamma-lib/​tests/​project.rs Tests fixture guarantees.
crates/​cargo-gamma-lib/​tests/​regressions.rs Migrates regression fixtures.
crates/​cargo-gamma-lib/​tests/​session.rs Migrates end-to-end fixtures.
crates/​cargo-gamma-lib/​tests/​support/​project.rs Implements shared fixture generation.
crates/​cargo-gamma/​tests/​binary.rs Runs binaries from temporary projects.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/cargo-gamma-lib/src/discover/survey.rs Outdated
Comment thread crates/cargo-gamma-lib/tests/support/project.rs Outdated
@martintmk martintmk added the human-review-required Requires human review before approval or merge. label Oct 6, 2026
@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.9%. Comparing base (3cd0306) to head (39aaae8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #231   +/-   ##
=====================================
  Coverage   98.9%   98.9%           
=====================================
  Files        304     304           
  Lines      44436   44436           
=====================================
  Hits       43975   43975           
  Misses       461     461           
Flag Coverage Δ
linux 98.9% <ø> (ø)
linux-arm 98.9% <ø> (ø)
scheduled ?
windows 98.8% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@martintmk

Copy link
Copy Markdown
Member

Posted by an AI agent

Fast-path approval stopped at 62586e2: the resource E2E fixture pre-expands cargo_gamma_attrs_impl::resource instead of compiling public #[gamma::resource], dropping existing proc-macro integration coverage. Two survey fixtures also overwrite .cargo/config.toml after the helper sets net.offline, breaking the forced-offline fixture guarantee. Please restore both guarantees and have a human review the migration.

@martintmk

martintmk commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Posted by an AI agent

Review preparation has started for #231 at pinned head 1f469b8b7c0e94d0a0f08c302ca5a77bd63a7f7e, targeting microsoft/ox-tools:main.

The submitted review will contain the result.

@martintmk martintmk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Posted by an AI agent

Warning: Incomplete review

I reviewed the public contract, behavior, tests, performance, naming, and consistency between code and documentation. Telemetry and recovery checks were not applicable to these changes. I could not check:

  • Public API surface: paired cargo public-api captures were unavailable, and local Rust API generation was not permitted.

No overall verdict is given. The existing concerns about resource-macro end-to-end coverage, forced-offline configuration, and Windows fixture paths are already raised in the discussion; I have not duplicated them here. No tests or benchmarks were run locally. CI test/coverage, MSRV, mutation, and CodeQL passed; fast PR-title and runtime careful checks failed. These statuses do not establish full verification.

@sgalkin Sergey Galkin (sgalkin) changed the title Use embedded offline fixtures for gamma tests test(gamma): use embedded offline fixtures for gamma tests Oct 7, 2026
Copilot AI balanced review requested due to automatic review settings October 7, 2026 10:44
@sgalkin

Copy link
Copy Markdown
Contributor Author

The resource E2E fixture pre-expands the implementation instead of compiling public #[gamma::resource].

Restored the public macro-to-compiled-marker-to-scheduler path in e88652b. The fixture now compiles literal public attributes in separate function/module test binaries using the real proc-macro artifact copied into the owned project, with no Cargo dependencies in the generated consumer. The artifact helper is shared with diagnostics, and the original capacity-one/overlap assertions remain. Both the empty-Cargo-home build and scheduling campaign pass under Careful; the survey offline-configuration and Windows path findings are also corrected.

🤖 Authored by Copilot.

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.

Copilot review overview

🟡 Changes recommended

Target-specific Cargo rustflags are dropped by two new helpers, making analysis-runner behavior unreliable.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
Resolved since last review (2)

Comment thread crates/cargo-gamma-lib/tests/project.rs Outdated
Comment thread crates/cargo-gamma-lib/tests/session.rs Outdated

@martintmk martintmk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Posted by an AI agent

Warning: Incomplete review

I reviewed the public contract, behavior, tests, performance, naming, and documentation, including a static check of the previously reported resource-macro E2E, offline-configuration, and Windows fixture-path fixes. I could not review:

  • Public API surface: matching base/head cargo-public-api output is unavailable, and generating it is not permitted.

No overall verdict is given. There are no new inline comments; the target-specific compiler-flag concern is already in the discussion and is not repeated. Telemetry and recovery do not apply because neither changed. I ran no local tests or benchmarks.

Copilot AI balanced review requested due to automatic review settings October 7, 2026 12:55

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.

Copilot review overview

🟢 Approval recommended

The test-only refactor is internally consistent and includes focused regression coverage for its key isolation guarantees.

Review effort: Balanced
Findings: None

Resolved since last review (2)

@martintmk martintmk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Posted by an AI agent

Warning: Incomplete review

I reviewed public contracts, behavior, tests, performance, naming, and documentation consistency; I found no new actionable issues in these areas. The change did not introduce emitted telemetry or recovery behavior, so those topics did not apply.

I could not check:

  • Public API surface: matching cargo-public-api captures for the base and head were unavailable, and generating them was outside this review's scope.

No overall verdict is given. No local tests or benchmarks were run.

Sergey Galkin and others added 3 commits October 7, 2026 15:34
Generate isolated sample projects from embedded assets, preserve specialized assertions, and exercise the real public macros without consumer Cargo dependencies.

Respect Cargo configuration precedence and keep the shared fixture helper stable-compatible under tests/support.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep survey configuration writes offline and reject Windows-prefixed fixture assets. Restore public resource macro compilation using the shared real-artifact helper while retaining dependency-free consumers and scheduler assertions.

Preserve inherited analysis flags in fixture builds and add targeted regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Share Cargo environment flag selection between offline project and public-resource fixtures. Retain the applicable target flags before adding fixture arguments, honor global precedence, exclude unrelated targets, and keep argument boundaries intact.

Add target/build/global precedence regressions and validate actual compiler environments and Careful.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

Copilot review overview

🟡 Changes recommended

The new test infrastructure has unresolved test-policy violations and one error-path test does not verify its stated contract.

Review effort: Balanced
Findings: 3 Medium severity · 1 Low severity

Open (4)

Comment thread crates/cargo-gamma-lib/tests/project.rs Outdated
Comment thread crates/cargo-gamma-lib/tests/project.rs Outdated
Comment thread crates/cargo-gamma-lib/tests/support/project.rs
Comment thread crates/cargo-gamma-engine/src/parse/source_file.rs Outdated
Keep real Cargo/compiler acceptance in an opt-in system target with documented provisioning, isolation and runtime budgets. Separate pure configuration/path/flag invariants from host operations so they execute under isolated Miri, with individual reasons for unsupported output and process cases.

Preserve embedded input bytes and native acceptance assertions, and pin missing-file diagnostics to the requested path.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 06:59

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.

🔵 Needs a closer look

The new engine filesystem tests lack the documented Miri exclusions, and proc-macro bootstrap failures hide JSON compiler diagnostics.

0 open findings

4 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Add Miri ignores for host TempDir read tests

crates/​cargo-gamma-engine/​src/​parse/​source_file.rs:340

Both changed read tests now create a host TempDir, but docs/design/system-tests.md:103-108 records that this setup is unsupported under isolated Windows Miri and requires individual explanatory ignores; the equivalent filesystem-output tests use that guard at tests/project.rs:16-20. Add reasoned Miri ignores to both read tests so the all-feature interpreter run does not select unsupported host filesystem setup.

Medium severity Include compiler diagnostics from stdout in failure output

crates/​cargo-gamma-lib/​tests/​support/​macros.rs:40

Because this command requests --message-format=json, actionable compiler diagnostics are emitted in built.stdout (which is parsed below), while this failure reports only stderr. A proc-macro compilation error can therefore leave only Cargo's summary in the panic. Include stdout so the failure identifies the actual compiler error.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

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.

🟢 Approval recommended

The fixture isolation, flag precedence, platform path handling, system-test gating, and documentation are consistent and adequately covered.

0 open findings

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread crates/cargo-gamma-lib/tests/session.rs
Require the selected child test to execute and pass at both resource and compiler-flag re-exec sites, not merely exit successfully. Share the small libtest result guard and pin zero, failed, ignored, multiple, and misleading-summary rejection in pure regressions.

Preserve all real offline/public-macro/resource assertions and captured failure output.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 09:35

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.

🔵 Needs a closer look

Broad cross-platform fixture, environment, and real-toolchain orchestration warrants final CI-backed human review.

0 open findings

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@sgalkin
Sergey Galkin (sgalkin) enabled auto-merge (squash) October 8, 2026 10:11
@sgalkin
Sergey Galkin (sgalkin) merged commit a4997ea into main Oct 8, 2026
29 checks passed
@sgalkin
Sergey Galkin (sgalkin) deleted the gamma-offline-fixtures branch October 8, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

human-review-required Requires human review before approval or merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants