Skip to content

fix: activeRundown handling#310

Open
Julusian wants to merge 1 commit into
Sofie-Automation:mainfrom
bbc:fix/activeRundown-handling
Open

fix: activeRundown handling#310
Julusian wants to merge 1 commit into
Sofie-Automation:mainfrom
bbc:fix/activeRundown-handling

Conversation

@Julusian
Copy link
Copy Markdown
Member

About Me

This pull request is posted on behalf of the BBC

Type of Contribution

This is a: Bug fix

New Behavior

Fixes the activeRundown handling, which was discovered to be broken by #285

This has to rely on some hope of types aligning, as it appears that the types between sofie-core and package-manager are not shared in a way that makes it simple to share this property definition

Testing Instructions

Other Information

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

@Julusian Julusian added the Contribution from BBC Contributions sponsored by BBC (bbc.co.uk) label May 13, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Review Change Stack

Warning

Rate limit exceeded

@Julusian has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 25 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fe2127c3-7908-45ea-bb83-954c5eaef333

📥 Commits

Reviewing files that changed from the base of the PR and between 2040cc7 and b2a664d.

📒 Files selected for processing (3)
  • apps/package-manager/packages/generic/src/fakeCore.ts
  • apps/package-manager/packages/generic/src/generateExpectations/nrk/expectations.ts
  • apps/package-manager/packages/generic/src/packageManager.ts

Walkthrough

This PR adds rundown-aware priority calculation to the package manager. The ConvertExpectedPackage type now carries an optional rundownId, enabling the priority computation to check whether a package targets an active rundown and assign higher priority accordingly. An unrelated import path is also simplified.

Changes

Rundown-based expectation prioritization

Layer / File(s) Summary
ConvertExpectedPackage type extension
apps/package-manager/packages/generic/src/packageManager.ts
RundownId imported from core model IDs; ConvertExpectedPackage extended with optional rundownId?: RundownId field to carry rundown context through converted expected packages.
Priority calculation with active rundown lookup
apps/package-manager/packages/generic/src/generateExpectations/nrk/expectations.ts
getPriority function rewritten to look up packageWrap.expectedPackage.rundownId in activeRundownMap; returns higher priority (PLAY_NOW + rundown's _rank) for active rundown matches, otherwise falls back to OTHER priority.
Import path simplification
apps/package-manager/packages/generic/src/fakeCore.ts
ExternalPeripheralDeviceAPI import source updated from @sofie-automation/server-core-integration/dist/lib/methods to @sofie-automation/server-core-integration package root.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% 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
Title check ✅ Passed The title 'fix: activeRundown handling' directly matches the pull request's primary objective to fix broken activeRundown handling as discovered in PR #285.
Description check ✅ Passed The description clearly explains the bug fix purpose and references the related PR #285, relating directly to the changeset's goal of fixing activeRundown handling.
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

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 `@apps/package-manager/packages/generic/src/packageManager.ts`:
- Around line 1207-1209: Add a short comment above the optional property
declaration rundownId in packageManager.ts explaining its contract with Core:
state that this field is expected to be populated by sofie-core’s expected
package data and that package-manager treats it as optional (handled in
expectations.ts for priority calculation) so missing values are allowed;
reference the expectations.ts logic in the comment to guide maintainers to where
the runtime behavior is enforced.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e3f930b8-3199-4c85-9339-c3a491068e76

📥 Commits

Reviewing files that changed from the base of the PR and between 54e04f1 and 2040cc7.

📒 Files selected for processing (3)
  • apps/package-manager/packages/generic/src/fakeCore.ts
  • apps/package-manager/packages/generic/src/generateExpectations/nrk/expectations.ts
  • apps/package-manager/packages/generic/src/packageManager.ts

Comment thread apps/package-manager/packages/generic/src/packageManager.ts
@Julusian Julusian force-pushed the fix/activeRundown-handling branch from 2040cc7 to b2a664d Compare May 13, 2026 12:12
@sonarqubecloud
Copy link
Copy Markdown

@Saftret Saftret requested a review from nytamin May 19, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contribution from BBC Contributions sponsored by BBC (bbc.co.uk)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant