Skip to content

test: guard package install lock wait status - #620

Merged
zackees merged 1 commit into
mainfrom
test/package-install-lock-wait-status
Jun 16, 2026
Merged

zackees merged 1 commit into
mainfrom
test/package-install-lock-wait-status

Conversation

@zackees

@zackees zackees commented Jun 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • advances meta: broker-safe global artifact repository feature burndown #603 blocked-client status coverage for package/toolchain/framework install gates
  • verifies a waiter behind the process-shared install lock publishes structured wait status
  • asserts package name, version, waiting_for_lock phase, waiter role, lock path, and human wait message

Tests

  • soldr cargo test --locked -p fbuild-packages install_lock::tests
  • soldr cargo fmt --all --check
  • git diff --check

Reference #603

Summary by CodeRabbit

  • Tests
    • Added test coverage for install lock synchronization and status event handling to ensure proper waiter behavior and locking mechanisms.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@zackees, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 36 minutes. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6c3e6902-5c75-4f7c-b45f-863d341ae128

📥 Commits

Reviewing files that changed from the base of the PR and between 7947849 and ff46db8.

📒 Files selected for processing (1)
  • crates/fbuild-packages/src/install_lock.rs
📝 Walkthrough

Walkthrough

A new import (Arc, Mutex) and a Tokio async test are added to install_lock.rs. The test acquires the install lock in one task, spawns a second task that blocks waiting for the same lock, subscribes to structured install-status events, and asserts the emitted WaitingForLock status contains the expected role, lock directory path, and message. The subscriber is cleared before the first lock guard is dropped and the waiter task is awaited.

Changes

WaitingForLock Status Subscriber Test

Layer / File(s) Summary
WaitingForLock async test and imports
crates/fbuild-packages/src/install_lock.rs
Adds Arc/Mutex imports for event capture and a full async test that holds a lock, spawns a blocking waiter, subscribes to status events, asserts WaitingForLock phase/role/path/message fields, clears the subscriber, releases the lock, and joins the waiter.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A bunny hops in, grabs the lock with glee,
A second one waits — what status shall it be?
WaitingForLock rings out, role and path in tow,
The subscriber confirms what all watchers should know.
First guard drops away, the waiter hops free! 🐇✨

🚥 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 'test: guard package install lock wait status' directly and specifically describes the main change: adding a test for the install lock wait status behavior.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/package-install-lock-wait-status

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.

Actionable comments posted: 2

🤖 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 `@crates/fbuild-packages/src/install_lock.rs`:
- Around line 239-245: The test uses a fixed 50ms sleep followed by a single
check for the expected status, which is unreliable under CI load and can fail
before the waiter publishes the status. Replace the fixed sleep and single
assertion with a bounded polling loop that repeatedly checks the shared seen
events until either the expected status (with name "framework", version "3.0",
and phase WaitingForLock) is found or a reasonable timeout is exceeded. This
makes the test deterministic by waiting as long as needed (within bounds) rather
than relying on precise timing.
- Around line 225-255: The test sets up a global install-status subscriber with
set_install_status_subscriber but the corresponding
clear_install_status_subscriber call at the end is not guaranteed to run if an
assertion panics earlier, leaving the subscriber registered for subsequent
tests. Make the subscriber cleanup panic-safe by wrapping it in a guard or scope
mechanism that implements Drop behavior to ensure
clear_install_status_subscriber is always called regardless of panics,
preventing global state leakage between tests.
🪄 Autofix (Beta)

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

Run ID: 8f712e9f-0e1d-4d81-9f0e-e66617c35e76

📥 Commits

Reviewing files that changed from the base of the PR and between 2974e5c and 7947849.

📒 Files selected for processing (1)
  • crates/fbuild-packages/src/install_lock.rs

@zackees
zackees force-pushed the test/package-install-lock-wait-status branch from 7947849 to 131efb6 Compare June 16, 2026 10:37
@zackees
zackees force-pushed the test/package-install-lock-wait-status branch from 131efb6 to ff46db8 Compare June 16, 2026 10:45
@zackees
zackees merged commit bc76c03 into main Jun 16, 2026
89 checks passed
@zackees
zackees deleted the test/package-install-lock-wait-status branch June 16, 2026 10:58
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jun 17, 2026
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.

1 participant