Skip to content

fix: expose RundownId of expectedPackage in publication to package-manager#1745

Open
Julusian wants to merge 3 commits into
Sofie-Automation:mainfrom
bbc:fix/package-manager-active-rundown
Open

fix: expose RundownId of expectedPackage in publication to package-manager#1745
Julusian wants to merge 3 commits into
Sofie-Automation:mainfrom
bbc:fix/package-manager-active-rundown

Conversation

@Julusian
Copy link
Copy Markdown
Member

About the Contributor

This pull request is posted on behalf of the BBC

Type of Contribution

This is a: Bug fix

Current Behavior

During #1595, the rundownId property needed by package-manager to do rundown based prioritisation of packages was broken due to removing a property that appeared unused.

New Behavior

This restores the property

Testing

  • I have added one or more unit tests for this PR
  • I have updated the relevant unit tests
  • No unit test changes are needed for this PR

Affected areas

Time Frame

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

Walkthrough

The PR extends the expected packages publication system to include and propagate a rundownId field. The shared type contract adds the field, the cache invalidation setup tracks it, and the generation logic populates it for device mappings.

Changes

Expected Packages rundownId Addition

Layer / File(s) Summary
Shared publication type contract
packages/shared-lib/src/package-manager/publications.ts
PackageManagerExpectedPackageBase type is extended with an optional rundownId: RundownId | undefined field to represent the rundown association for each expected package.
Cache type and reactive field specifier
meteor/server/publications/packageManager/expectedPackages/contentCache.ts
ExpectedPackageDBCompact type is extended to include rundownId, and the Mongo field specifier is updated to track rundownId changes for reactive cache invalidation.
Generation implementation
meteor/server/publications/packageManager/expectedPackages/generate.ts
generateExpectedPackageForDevice now populates the rundownId field in generated expected package objects from the source data.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Sofie-Automation/sofie-core#1595: Both PRs update the ExpectedPackages data/document shape to include and propagate rundownId (main PR: publication/cache types and generation add rundownId; retrieved PR: ExpectedPackages generation/management restructures docs around rundownId), so the main PR is directly related to the retrieved changes.

Suggested reviewers

  • nytamin
  • rjmunro
🚥 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
Title check ✅ Passed The title clearly and specifically describes the main change: exposing RundownId of expectedPackage in a publication for package-manager use.
Description check ✅ Passed The description is directly related to the changeset, explaining the bug fix context, current behavior, new behavior, and the restoration of the rundownId property.
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.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ns/packageManager/expectedPackages/contentCache.ts 0.00% 2 Missing ⚠️
...ations/packageManager/expectedPackages/generate.ts 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

🧹 Nitpick comments (1)
meteor/server/publications/packageManager/expectedPackages/generate.ts (1)

130-130: ⚡ Quick win

Add regression coverage for rundownId propagation.

Please add/extend a publication generation test that asserts expectedPackage.rundownId is forwarded into expectedPackage output (including the undefined/nullish case), since this path has regressed before.

🤖 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 `@meteor/server/publications/packageManager/expectedPackages/generate.ts` at
line 130, Add a regression test that covers propagation of
expectedPackage.rundownId through the publication generator: extend or create a
unit/test in the publication generation tests that calls the same generator used
in generate.ts (the function that builds expectedPackage outputs) and assert
that the resulting expectedPackage object contains rundownId when
input.expectedPackage.rundownId is set, and that the field is absent/undefined
for nullish inputs; specifically target the code path that maps
expectedPackage.rundownId -> expectedPackage in the generator to ensure both
non-null and undefined/null cases are exercised.
🤖 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 `@meteor/server/publications/packageManager/expectedPackages/generate.ts`:
- Line 130: Add a regression test that covers propagation of
expectedPackage.rundownId through the publication generator: extend or create a
unit/test in the publication generation tests that calls the same generator used
in generate.ts (the function that builds expectedPackage outputs) and assert
that the resulting expectedPackage object contains rundownId when
input.expectedPackage.rundownId is set, and that the field is absent/undefined
for nullish inputs; specifically target the code path that maps
expectedPackage.rundownId -> expectedPackage in the generator to ensure both
non-null and undefined/null cases are exercised.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 144ab2a3-b176-49c3-a39b-9f11598441df

📥 Commits

Reviewing files that changed from the base of the PR and between e967cb7 and 07c6753.

📒 Files selected for processing (4)
  • .husky/pre-commit
  • meteor/server/publications/packageManager/expectedPackages/contentCache.ts
  • meteor/server/publications/packageManager/expectedPackages/generate.ts
  • packages/shared-lib/src/package-manager/publications.ts

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.

2 participants