Skip to content

fix(config): split board tests under LOC gate (#519 follow-up) - #567

Merged
zackees merged 1 commit into
mainfrom
fix/loc-gate-split-board-tests
Jun 13, 2026
Merged

zackees merged 1 commit into
mainfrom
fix/loc-gate-split-board-tests

Conversation

@zackees

@zackees zackees commented Jun 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #566
Refs #519

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Strengthened test coverage for board configuration override and fallback behavior
    • Reorganized project-local board resolution tests to improve test structure and clarity

…ts to dedicated module

The #519 deploy-fallback PR pushed board/tests.rs to 1025 lines, tripping
the 1000-LOC gate on main. Relocate the two project-local resolution tests
to tests_project_local.rs (their natural home), bringing tests.rs to 976.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 13, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR resolves a LOC gate violation by relocating two project-local board resolution tests from tests.rs to tests_project_local.rs, reducing tests.rs from 1025 to 976 lines. While moving tests, tests.rs gains expanded test coverage for from_board_id_with_override_fallback behavior.

Changes

Board configuration test reorganization

Layer / File(s) Summary
Update override-fallback test coverage in tests.rs
crates/fbuild-config/src/board/tests.rs
Removes prior project-local resolution tests for from_board_id_or_default and from_board_id_with_override_fallback and replaces them with new unit tests validating from_board_id_with_override_fallback for known boards, unknown boards (returning None), and f_cpu override application.
Add project-local board resolution tests in tests_project_local.rs
crates/fbuild-config/src/board/tests_project_local.rs
Introduces two new unit tests: from_board_id_or_default_resolves_project_local_board (verifying project-local widget123.json is resolved instead of built-in default uno), and from_board_id_with_override_fallback_resolves_project_local_board (verifying project-local widget456.json resolution with board-field matching).

Possibly related PRs

  • FastLED/fbuild#564: Updates BoardConfig tests to validate project-local board resolution and override-fallback behavior introduced by the same from_board_id_or_default/from_board_id_with_override_fallback APIs that this PR's new tests exercise.
  • FastLED/fbuild#544: Introduces/refactors the from_board_id_with_override_fallback API and its call-site behavior, which this PR's expanded test coverage directly validates.
  • FastLED/fbuild#545: Uses BoardConfig override and fallback behavior through ResolutionContext::resolve_board, which this PR's unit tests provide direct coverage for.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Poem

🐰 Tests relocated with care so fine,
From overcrowded shelf to their home divine,
A gate appeased by lines refined—
Project-local paths, at last aligned! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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: relocating board tests under LOC gate to fix a file size issue.
Linked Issues check ✅ Passed The PR successfully addresses issue #566 by moving two project-local tests from tests.rs to tests_project_local.rs, reducing tests.rs from 1025 to 976 LOC and restoring compliance with the 1000-line limit.
Out of Scope Changes check ✅ Passed All changes are directly related to relocating project-local tests; no unrelated modifications are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/loc-gate-split-board-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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
crates/fbuild-config/src/board/tests_project_local.rs (1)

148-152: Flat JSON is supported for project-local board resolution; only core/variant require build.*

flatten_board_entry reads mcu (top-level mcu) and f_cpu (top-level fcpu) directly, and falls back to the PlatformIO nested build shape when those top-level fields are missing—so the flat JSON in these tests can resolve the board. However, core and variant are only extracted from build.core / build.variant, so the flat JSON’s core/variant fields won’t affect resolution; update the test assertions or move core/variant under "build" if you intend to validate them.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/fbuild-config/src/board/tests_project_local.rs` around lines 148 -
152, Test uses flat JSON with top-level "core" and "variant" but
flatten_board_entry only reads core/variant from build.core/build.variant; to
fix, update the write_project_board call in this test so the board JSON nests
core and variant under "build" (e.g.
"build":{"core":"arduino","variant":"standard"}) or alternatively change the
test assertions to not expect core/variant to be resolved from top-level fields;
locate the call to write_project_board and adjust the input JSON accordingly
and/or update assertions that reference flatten_board_entry’s resolved
core/variant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/fbuild-config/src/board/tests_project_local.rs`:
- Around line 148-152: Test uses flat JSON with top-level "core" and "variant"
but flatten_board_entry only reads core/variant from build.core/build.variant;
to fix, update the write_project_board call in this test so the board JSON nests
core and variant under "build" (e.g.
"build":{"core":"arduino","variant":"standard"}) or alternatively change the
test assertions to not expect core/variant to be resolved from top-level fields;
locate the call to write_project_board and adjust the input JSON accordingly
and/or update assertions that reference flatten_board_entry’s resolved
core/variant.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b252b8bf-2611-4933-9973-702c588ef435

📥 Commits

Reviewing files that changed from the base of the PR and between 2488d60 and 9336847.

📒 Files selected for processing (2)
  • crates/fbuild-config/src/board/tests.rs
  • crates/fbuild-config/src/board/tests_project_local.rs
💤 Files with no reviewable changes (1)
  • crates/fbuild-config/src/board/tests.rs

@zackees
zackees merged commit 8d3e34a into main Jun 13, 2026
91 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 14, 2026
@zackees
zackees deleted the fix/loc-gate-split-board-tests branch October 16, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

main red: LOC Gate failing — board/tests.rs exceeded 1000 LOC after #564

1 participant