Skip to content

fix(output): add missing surface field to test Finding constructors#59

Merged
boorad merged 1 commit into
mainfrom
fix/finding-surface-field-merge-skew
May 5, 2026
Merged

fix(output): add missing surface field to test Finding constructors#59
boorad merged 1 commit into
mainfrom
fix/finding-surface-field-merge-skew

Conversation

@boorad
Copy link
Copy Markdown
Contributor

@boorad boorad commented May 5, 2026

Summary

Note that cargo build (lib target) still succeeds — the field is only required when the test target is built, which is why the failure shows up under cargo clippy --all-targets / cargo test but not a plain build.

Followup (separate)

The repo ruleset on main has no required_status_checks rule, so neither "CI must pass" nor "Require branches to be up to date before merging" is enforced today. That's why this slipped through. Will address in a separate change.

Test plan

  • cargo fmt
  • cargo clippy --all-targets -- -D warnings clean
  • cargo test passes

Summary by CodeRabbit

  • Tests
    • Updated test fixtures to support surface identification in output validation. No changes to user-facing functionality.

#54 and #55 were merged ~30s apart on main. #55 added a new `surface`
field to `Finding` (with `#[serde(default)]` on the field but no default
on the struct itself), and #54 was merged without rebasing onto post-#55
main. The new field is required at construction time, so the test
helpers in `src/output/json.rs` and `src/output/text.rs` introduced by
#54 no longer compile against the post-#55 struct shape.

Both PRs passed CI on their own branches because each was tested against
the main they branched from — neither saw the other's changes. No
textual conflict, but a semantic one: `cargo build` still succeeds (lib
target only references the field via serde), but `cargo clippy
--all-targets` and `cargo test` fail with E0063 on the lib-test target.

Fix is mechanical: add `surface: Surface::Backend` to the two test
helpers, matching the convention already used elsewhere in the
codebase (src/scanner/matcher.rs, src/rego/grouping.rs, etc).

Followup: the repo ruleset on `main` doesn't include a
`required_status_checks` rule, so neither "CI must pass" nor "branches
must be up to date before merging" is currently enforced — that's why
this slipped through. Tracked separately.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ab2eff58-eb35-431f-9dad-6b1959c3ad24

📥 Commits

Reviewing files that changed from the base of the PR and between f4ee1a2 and ef0f1db.

📒 Files selected for processing (2)
  • src/output/json.rs
  • src/output/text.rs

📝 Walkthrough

Walkthrough

The PR updates test fixtures in JSON and text output modules to construct Finding instances with a surface field set to Surface::Backend. Both modules import the Surface type and update their test helpers accordingly. No functional logic in output rendering is modified.

Changes

Test Fixture Updates for Surface Field

Layer / File(s) Summary
Type Imports
src/output/json.rs, src/output/text.rs
Test modules import Surface from crate::types to support constructing surface-tagged Finding instances in test fixtures.
Test Fixtures
src/output/json.rs, src/output/text.rs
Finding constructors in test helpers now set surface: Surface::Backend to match the updated Finding data shape.

Estimated Code Review Effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly Related PRs

  • EnforceAuth/zift#55: Implements the Surface type and surface-tagged text output logic that these test updates are preparing for.

Poem

🐰 A surface field hops into the tests,
Backend-tagged findings dressed in their best,
Fixtures now gleam, complete and sound,
Unified surfaces, all around! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding the missing surface field to test Finding constructors in output test files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

Copy link
Copy Markdown

@amazon-q-developer amazon-q-developer Bot left a comment

Choose a reason for hiding this comment

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

The fix correctly resolves the compilation error by adding the missing surface field to both test helpers. The choice of Surface::Backend as the default value is appropriate and matches the pattern used elsewhere in the codebase. The changes are minimal and targeted, addressing the semantic merge conflict without introducing any defects.

The PR is ready to merge.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@boorad boorad self-assigned this May 5, 2026
@boorad boorad merged commit a083289 into main May 5, 2026
3 checks passed
@boorad boorad deleted the fix/finding-surface-field-merge-skew branch May 5, 2026 12:11
This was referenced May 5, 2026
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.

1 participant