Skip to content

Replace native-suite-count file with dynamic test discovery - #11413

Merged
jp-bennett merged 4 commits into
developfrom
claude/native-suite-count-7ueuma
Aug 11, 2026
Merged

Replace native-suite-count file with dynamic test discovery#11413
jp-bennett merged 4 commits into
developfrom
claude/native-suite-count-7ueuma

Conversation

@jp-bennett

@jp-bennett jp-bennett commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Removes the manual test/native-suite-count file and replaces it with dynamic detection of test suites. The canonical suite count is now derived on-the-fly from test_* directories under test/, eliminating the need to manually update a static file when adding or removing test suites.

Changes

CI/CD (test_native.yml)

  • Renamed suite-count-check job to suite-shrinkage-check with new logic:
    • Only runs on pull requests (skipped for other events)
    • Fetches full history to compute merge base
    • Compares test_* directories between merge base and PR head
    • Fails if a suite vanished without being acknowledged in PR title, body, or commit messages
    • Allows deliberate removals by requiring the suite name to appear in PR metadata
  • Removed needs: suite-count-check dependency from test jobs (no job depends on this check)

Test Runner (bin/run-tests.sh)

  • Removed all references to test/native-suite-count file
  • Suite count is now detected on-the-fly: EXPECTED_COUNT=${#ALL_SUITES[@]}
  • Removed the AMBER verdict for count mismatches (no longer possible)
  • Simplified verdict suffix from canonical_rating() to verdict_suffix() (only includes shuffle seed if applicable)
  • Updated comments to reflect dynamic detection

Documentation

  • Updated .github/copilot-instructions.md to explain the new scheme
  • Updated test/README.md to clarify that suite count is derived from test_* directories
  • Updated AGENTS.md to reference dynamic detection
  • Updated comments in bin/test-state-check.sh and bin/test-lint-unity-exit.sh to clarify they are not counted in the suite total

Removed

  • test/native-suite-count file (no longer needed)

Rationale

The previous approach required manually maintaining a count file that could drift from reality. This created two failure modes:

  1. Silent loss: A suite directory deleted without updating the count file would go unnoticed in CI
  2. Manual burden: Every suite addition/removal required remembering to update the file

The new approach:

  • Automatic detection: Suite count is always accurate (derived from actual directories)
  • Accidental loss prevention: PR checks fail if a suite vanishes without acknowledgment
  • Deliberate removal support: Removing a suite is allowed if you name it in the PR
  • Simpler maintenance: No file to keep in sync

Testing

  • Existing test suite runs unchanged (exit codes and verdicts remain the same)
  • CI now prevents accidental suite loss via the suite-shrinkage-check job
  • All verdict lines continue to emit machine-readable output for automation

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions.

https://claude.ai/code/session_01APCEfNjd1X7ErDHEzT6Dqd

Summary by CodeRabbit

  • Improvements

    • Test suite counts are now detected automatically from available suites, eliminating manual count maintenance.
    • Test results provide clearer verdict information, including shuffle seeds when applicable.
    • Pull requests now receive checks when test suites are removed without acknowledgment.
    • Test reporting continues to distinguish successful, filtered, and attention-needed outcomes.
  • Documentation

    • Updated testing guidance to explain automatic suite discovery, excluded process checks, and suite-change validation.

claude added 2 commits August 11, 2026 18:07
… a file

test/native-suite-count was a manually-maintained register of the test_*
directory count, reconciled against the actual directories by
bin/run-tests.sh (as an AMBER verdict) and by a dedicated suite-count-check
CI job. The reconciliation only ever guarded the file itself: the check
that matters - suites that actually ran vs. the test_* directories on
disk - already derives its expected count from a directory walk, so the
file added a bookkeeping step to every suite addition/removal without
adding signal.

Remove the file and everything that existed to keep it honest:

- bin/run-tests.sh: drop the canonical-count file read, the count-mismatch
  AMBER verdict, and the [canonical: x/y] suffix; the verdict lines already
  carry ran/expected from the directory walk. The shuffle seed suffix stays.
- test_native.yml: delete the suite-count-check job and its needs: edges.
- Docs (copilot-instructions.md, AGENTS.md, test/README.md) and the
  test-script comments now describe the count as derived from test/test_*
  at run time.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APCEfNjd1X7ErDHEzT6Dqd
With test/native-suite-count gone, nothing in CI noticed the suite set
shrinking: platformio test discovers and runs whatever test_* directories
exist, and bin/run-tests.sh derives its expected count from the same walk,
so a suite directory lost in a bad rebase or an overzealous cleanup just
means fewer suites run - every remaining check stays green.

Restore that tripwire git-aware instead of file-based: on pull_request
runs, compare the test_* directory list at the PR's merge base against the
PR result. A vanished suite fails the job unless its name appears in the
PR title, PR body, or a commit message in the PR's range - a deliberate
removal satisfies that by stating what it removes; an accidental loss
cannot. Other events skip: they have no natural base, and PRs are where
accidents arrive. No job depends on this one (a skipped job would skip
its dependents).

Incidentally: test/ currently holds 47 test_* directories while the
deleted count file said 46 - the manual register had already drifted,
which is exactly the bookkeeping failure mode this replaces.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APCEfNjd1X7ErDHEzT6Dqd
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a98ed7ed-4ee1-4efc-8dcf-db1b4324d9cb

📥 Commits

Reviewing files that changed from the base of the PR and between 8bfff01 and e254d0b.

📒 Files selected for processing (1)
  • .github/copilot-instructions.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/copilot-instructions.md

📝 Walkthrough

Walkthrough

Native test suite counts now derive from test_* directories. The test runner no longer validates a static count file. Pull-request CI checks for unacknowledged suite removal. Documentation and verdict output describe the new behavior.

Changes

Native suite discovery and enforcement

Layer / File(s) Summary
Dynamic discovery and verdict output
bin/run-tests.sh, bin/test-lint-unity-exit.sh, bin/test-state-check.sh, test/README.md
The test runner discovers suites from test_* directories and removes static count validation. Verdicts include shuffle seeds only for shuffled runs. Script classifications and test documentation reflect the dynamic count.
Suite shrinkage CI check
.github/workflows/test_native.yml
A pull-request job compares suite directories with the merge base and requires removed suites to be acknowledged in PR metadata or commit messages.
Repository guidance updates
.github/copilot-instructions.md, AGENTS.md
Project guidance now documents dynamic suite discovery, CI enforcement, and updated verdict examples.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: tech debt, cleanup

Suggested reviewers: thebentern

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: replacing the manually maintained suite-count file with dynamic test discovery.
Description check ✅ Passed The description covers the change, rationale, implementation details, testing, and attestations required by the repository template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/native-suite-count-7ueuma

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.

@github-actions

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Note

Building this pull request… the flash button, badges and supported-board
list will appear here automatically once CI finishes.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In @.github/copilot-instructions.md:
- Line 735: Replace the literal suite counts in the documented RESULT examples
on lines 735 and 738 with the symbolic N/M placeholder used on line 726, while
preserving the existing result wording and statuses.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6f8215b1-58d9-43f3-b6d5-aeaae9649ba2

📥 Commits

Reviewing files that changed from the base of the PR and between 97f8361 and 8bfff01.

📒 Files selected for processing (8)
  • .github/copilot-instructions.md
  • .github/workflows/test_native.yml
  • AGENTS.md
  • bin/run-tests.sh
  • bin/test-lint-unity-exit.sh
  • bin/test-state-check.sh
  • test/README.md
  • test/native-suite-count
💤 Files with no reviewable changes (1)
  • test/native-suite-count

# AMBER: native-suite-count disagrees with test/ directory count (too high)
RESULT: AMBER test/ has 24 suite directories but native-suite-count says 99 - update test/native-suite-count after removing suites
# AMBER: a suite silently went missing on a full run
RESULT: AMBER 23/24 suites ran (missing: test_radio) - all that ran passed

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove literal suite counts from the examples.

Line 735 contains 23/24, and Line 738 contains 1/24. Replace both values with symbolic placeholders such as N/M, as already used in Line 726.

As per coding guidelines, never state the number of test suites as a literal; discover it from the current test/test_* directories.

Suggested documentation fix
-RESULT: AMBER 23/24 suites ran (missing: test_radio) - all that ran passed
+RESULT: AMBER N/M suites ran (missing: test_radio) - all that ran passed
-RESULT: FILTERED 1/24 suites ran (not run: test_admin_radio test_atak …) - filtered: test_serial
+RESULT: FILTERED N/M suites ran (not run: test_admin_radio test_atak …) - filtered: test_serial

Also applies to: 738-738

🤖 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 @.github/copilot-instructions.md at line 735, Replace the literal suite
counts in the documented RESULT examples on lines 735 and 738 with the symbolic
N/M placeholder used on line 726, while preserving the existing result wording
and statuses.

Source: Coding guidelines

@thebentern thebentern added the bugfix Pull request that fixes bugs label Aug 11, 2026
claude added 2 commits August 11, 2026 19:29
Shrinking the AMBER cell left the table's column padding inconsistent,
which trunk (prettier + markdownlint MD060) rejects.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APCEfNjd1X7ErDHEzT6Dqd
develop bumped the count file to 47 (the drift this branch's first commit
noted); this branch removes the file entirely in favor of deriving the
count from the test_* directories, so the deletion wins.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APCEfNjd1X7ErDHEzT6Dqd
@jp-bennett
jp-bennett merged commit af56a11 into develop Aug 11, 2026
53 checks passed
@jp-bennett
jp-bennett deleted the claude/native-suite-count-7ueuma branch August 11, 2026 21:17
jp-bennett pushed a commit that referenced this pull request Aug 11, 2026
Resolves test/native-suite-count modify/delete: develop replaced the
count file with dynamic test discovery (#11413), so the deletion wins
and our 46->47 bump is obsolete.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBiZc9sfPrH1MZ2L3Fxgt1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants