Skip to content

fix: correct if-condition assertion in task job generation test#28841

Merged
pelikhan merged 1 commit intomainfrom
copilot/fix-tests
Apr 28, 2026
Merged

fix: correct if-condition assertion in task job generation test#28841
pelikhan merged 1 commit intomainfrom
copilot/fix-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

The test TestTaskJobGenerationFix/task_job_for_if_condition was asserting the wrong format for if: conditions in compiled lock files.

What changed

  • Updated the test assertion to check for if: github.ref == 'refs/heads/main' instead of if: ${{ github.ref == 'refs/heads/main' }}

The compiler strips ${{ }} wrappers from if: fields when generating YAML — consistent with every other if: condition across all .lock.yml files in the repo. The test was written with the wrapped form, which never matches the actual output.

@pelikhan pelikhan marked this pull request as ready for review April 28, 2026 03:34
Copilot AI review requested due to automatic review settings April 28, 2026 03:34
@pelikhan pelikhan merged commit 885ab32 into main Apr 28, 2026
20 checks passed
@pelikhan pelikhan deleted the copilot/fix-tests branch April 28, 2026 03:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates an integration test to assert the correct if: condition format emitted into compiled lock files.

Changes:

  • Adjusted TestTaskJobGenerationFix/task_job_for_if_condition to expect if: github.ref == 'refs/heads/main' (without ${{ }}).
  • Clarified the test comment to document the lock file if: formatting.
Show a summary per file
File Description
pkg/workflow/task_job_generation_fix_test.go Updates the lock-file assertion for if: conditions to match the compiler’s output format.

Copilot's findings

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@github-actions github-actions Bot mentioned this pull request Apr 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 90/100

Excellent test quality

Metric Value
New/modified tests analyzed 1 (1 subtest assertion corrected)
✅ Design tests (behavioral contracts) 1 (100%)
⚠️ Implementation tests (low value) 0 (0%)
Tests with error/edge cases 1 (100%)
Duplicate test clusters 0
Test inflation detected No
🚨 Coding-guideline violations None

Test Classification Details

Test File Classification Issues Detected
TestTaskJobGenerationFix/task_job_for_if_condition pkg/workflow/task_job_generation_fix_test.go:164 ✅ Design None

What Changed

This PR corrects a single assertion in the task_job_for_if_condition subtest. The old assertion checked for "if: ${{ github.ref == 'refs/heads/main' }}" which is the raw markdown format; the corrected assertion checks for "if: github.ref == 'refs/heads/main'" which is the actual lock file format (the compiler strips the ${{ }} wrapper when emitting YAML).

This is a behavioral contract fix — the test now correctly verifies that the compiled lock file contains the if condition in the format GitHub Actions expects it. Deleting or reverting this test would allow a regression in if condition handling to go undetected.


Language Support

Tests analyzed:

  • 🐹 Go (*_test.go): 1 test function — integration (//go:build integration) ✅

Verdict

Check passed. 0% of new tests are implementation tests (threshold: 30%). The corrected assertion properly validates the observable lock file output.


📖 Understanding Test Classifications

Design Tests (High Value) verify what the system does:

  • Assert on observable outputs, return values, or state changes
  • Cover error paths and boundary conditions
  • Would catch a behavioral regression if deleted
  • Remain valid even after internal refactoring

Implementation Tests (Low Value) verify how the system does it:

  • Assert on internal function calls (mocking internals)
  • Only test the happy path with typical inputs
  • Break during legitimate refactoring even when behavior is correct
  • Give false assurance: they pass even when the system is wrong

References: §25032434900

🧪 Test quality analysis by Test Quality Sentinel · ● 591.5K ·

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: 90/100. Test quality is excellent — 0% of new tests are implementation tests (threshold: 30%). The corrected assertion properly validates the compiled lock file format for if conditions.

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.

3 participants