Skip to content

feat: add createdByAdLib to ActivePlaylistTopic parts#1756

Open
ianshade wants to merge 2 commits into
Sofie-Automation:mainfrom
tv2norge-collab:contribute/EAV-880
Open

feat: add createdByAdLib to ActivePlaylistTopic parts#1756
ianshade wants to merge 2 commits into
Sofie-Automation:mainfrom
tv2norge-collab:contribute/EAV-880

Conversation

@ianshade
Copy link
Copy Markdown
Contributor

About the Contributor

This pull request is posted on behalf of TV 2 Norge.

Type of Contribution

This is a:

Feature

Current Behavior

New Behavior

Following the convention from other LSG topic(s), createdByAdLib is added to parts that appear in the activePlaylist topic

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

LSG - activePlaylist topic, and the API definitions in general

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.

@ianshade ianshade added the Contribution from TV 2 Norge Contributions sponsored by TV 2 Norge (tv2.no) label May 22, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 257ce052-84a5-47a7-9d72-1a223b92a53e

📥 Commits

Reviewing files that changed from the base of the PR and between 63f4ff9 and 86afa83.

⛔ Files ignored due to path filters (2)
  • packages/live-status-gateway-api/src/generated/asyncapi.yaml is excluded by !**/generated/**
  • packages/live-status-gateway-api/src/generated/schema.ts is excluded by !**/generated/**
📒 Files selected for processing (7)
  • packages/live-status-gateway-api/api/components/part/partBase/partBase-example.yaml
  • packages/live-status-gateway-api/api/components/part/partBase/partBase.yaml
  • packages/live-status-gateway-api/api/components/part/resolvedPart/resolvedPart.yaml
  • packages/live-status-gateway/src/topics/__tests__/activePlaylist.spec.ts
  • packages/live-status-gateway/src/topics/activePlaylistTopic.ts
  • packages/live-status-gateway/src/topics/helpers/__tests__/segmentParts.test.ts
  • packages/live-status-gateway/src/topics/helpers/segmentParts.ts

Walkthrough

This PR introduces a createdByAdLib boolean field throughout the ad-lib part tracking system. The field is added to the PartBase API schema as a required field defaulting to false, computed at runtime from the orphaned: 'adlib-part' flag on part instances. The helper function getCurrentSegmentParts now carries this status through to emitted segment part objects, and ActivePlaylistTopic includes the field in both currentPart and nextPart payloads sent to clients.

Changes

Ad-lib Part Tracking Implementation

Layer / File(s) Summary
API schema contracts for createdByAdLib
packages/live-status-gateway-api/api/components/part/partBase/partBase.yaml, packages/live-status-gateway-api/api/components/part/partBase/partBase-example.yaml, packages/live-status-gateway-api/api/components/part/resolvedPart/resolvedPart.yaml
PartBase schema adds a required boolean field createdByAdLib with default false; example YAML is updated to show the new field. ResolvedPart schema removes createdByAdLib since resolved schemas do not carry runtime instance flags.
Segment parts helper: mapping orphaned status to createdByAdLib
packages/live-status-gateway/src/topics/helpers/segmentParts.ts, packages/live-status-gateway/src/topics/helpers/__tests__/segmentParts.test.ts
getCurrentSegmentParts preserves the orphaned status from part instances in an internal index and maps it to createdByAdLib on each returned segment part (true when orphaned === 'adlib-part', false otherwise). Test suite validates both matching and non-matching orphaned instances.
Active playlist topic status serialization
packages/live-status-gateway/src/topics/activePlaylistTopic.ts, packages/live-status-gateway/src/topics/__tests__/activePlaylist.spec.ts
ActivePlaylistTopic.sendStatus includes createdByAdLib in both currentPart and nextPart payloads, derived from the part instance's orphaned status. Existing tests are extended with createdByAdLib: false assertions; a new test verifies the field is true when part instances are marked as ad-lib-created.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 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 accurately summarizes the main change: adding a createdByAdLib field to parts in the ActivePlaylistTopic.
Description check ✅ Passed The description is related to the changeset, explaining the new behavior and affected areas in the LSG activePlaylist topic and API definitions.
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.

@ianshade ianshade changed the title feat(EAV-880): add createdByAdLib to ActivePlaylistTopic parts feat: add createdByAdLib to ActivePlaylistTopic parts May 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...e-status-gateway/src/topics/activePlaylistTopic.ts 83.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contribution from TV 2 Norge Contributions sponsored by TV 2 Norge (tv2.no)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant