-
Notifications
You must be signed in to change notification settings - Fork 54
feat: cue from anywhere #1573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
justandras
wants to merge
24
commits into
Sofie-Automation:main
Choose a base branch
from
bbc:upstream/set-next-from-here
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: cue from anywhere #1573
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
395a90c
feat: Set here as next
olzzon c741c3e
chore: add missing type
3363e86
feat: calculate lookahead offsets when setting a take point in the mi…
justandras bd80b43
chore: improve type safety for lookaheadOffset calculations, ignore o…
justandras 4045189
fix: ignore pieces that are replaced before the in-point by another p…
justandras ac7c2e9
chore: fix linting issues
justandras 4fd80ad
fix: sorting of timelineObjects
justandras 9f474a3
chore: refactor and update findForLayer tests
justandras 5424645
chore: add tests for lookaheadOffset
justandras a761dc2
chore: remove console logs
justandras 52515ba
chore: add test case for single layer parts with while timings
justandras 151b4be
chore: move constants into separate file
justandras e43669c
chore: update tests to conform to already existing tests
justandras 74eb8e4
fix: correctly update the timeline offset
justandras 0f0f430
fix: Allow upcoming part instances to be nexted to override nextTimeO…
justandras 43ce2eb
fix: display correct timestamps
justandras 985474f
feat: reset and create new pieceInstance if an already played instanc…
justandras 0306d1b
fix: block reuse of partInstances from the UI
justandras 4742ace
fix: do not reset past instances, rather fully reuse them where possible
justandras ef25d2c
fix: block play/set from here for current part if playhead is past th…
justandras d396840
fix: block current part from being nexted when orphaned
justandras 9de4efe
chore: update TSR dependencies
justandras a859b22
chore: update tests due to changes from time of day pieces
justandras 498e489
chore: fix package.json
justandras File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -254,7 +254,8 @@ export interface ActivateRundownPlaylistProps extends RundownPlayoutPropsBase { | |
| } | ||
| export type DeactivateRundownPlaylistProps = RundownPlayoutPropsBase | ||
| export interface SetNextPartProps extends RundownPlayoutPropsBase { | ||
| nextPartId: PartId | ||
| nextPartId?: PartId | ||
| nextPartInstanceId?: PartInstanceId | ||
|
Comment on lines
+257
to
+258
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enforce exactly one next identifier in Both fields being optional lets callers omit both or set both, which can silently produce invalid jobs. Suggest a union that requires exactly one. ✅ Proposed type guard-export interface SetNextPartProps extends RundownPlayoutPropsBase {
- nextPartId?: PartId
- nextPartInstanceId?: PartInstanceId
- setManually?: boolean
- nextTimeOffset?: number
-}
+export type SetNextPartProps = RundownPlayoutPropsBase &
+ (
+ | { nextPartId: PartId; nextPartInstanceId?: never }
+ | { nextPartInstanceId: PartInstanceId; nextPartId?: never }
+ ) & {
+ setManually?: boolean
+ nextTimeOffset?: number
+ }🤖 Prompt for AI Agents |
||
| setManually?: boolean | ||
| nextTimeOffset?: number | ||
| } | ||
|
|
||
207 changes: 0 additions & 207 deletions
207
packages/job-worker/src/playout/lookahead/__tests__/findForLayer.test.ts
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
packages/job-worker/src/playout/lookahead/__tests__/findForLayer/basicBehavior.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| jest.mock('../../findObjects') | ||
| import { context, TfindLookaheadObjectsForPart } from './helpers/mockSetup.js' | ||
| import { findLookaheadForLayer } from '../../findForLayer.js' | ||
| import { expectInstancesToMatch } from '../utils.js' | ||
| import { findForLayerTestConstants } from './constants.js' | ||
| import { findLookaheadObjectsForPart } from '../../findObjects.js' | ||
|
|
||
| const findLookaheadObjectsForPartMockBase = findLookaheadObjectsForPart as TfindLookaheadObjectsForPart | ||
| const findLookaheadObjectsForPartMock = findLookaheadObjectsForPartMockBase.mockImplementation(() => []) // Default mock | ||
|
|
||
| beforeEach(() => { | ||
| findLookaheadObjectsForPartMock.mockReset() | ||
| }) | ||
|
|
||
| const current = findForLayerTestConstants.current | ||
| const nextFuture = findForLayerTestConstants.nextFuture | ||
| const layer = findForLayerTestConstants.layer | ||
|
|
||
| describe('findLookaheadForLayer – basic behavior', () => { | ||
| test('no parts', () => { | ||
| const res = findLookaheadForLayer(context, {}, [], 'abc', 1, 1) | ||
|
|
||
| expect(res.timed).toHaveLength(0) | ||
| expect(res.future).toHaveLength(0) | ||
| }) | ||
| test('if the previous part is unset', () => { | ||
| findLookaheadObjectsForPartMock.mockReturnValue([]) | ||
|
|
||
| findLookaheadForLayer(context, { previous: undefined, current, next: nextFuture }, [], layer, 1, 1) | ||
|
|
||
| expect(findLookaheadObjectsForPartMock).toHaveBeenCalledTimes(2) | ||
| expectInstancesToMatch(findLookaheadObjectsForPartMock, 1, layer, current, undefined) | ||
| }) | ||
| }) |
40 changes: 40 additions & 0 deletions
40
packages/job-worker/src/playout/lookahead/__tests__/findForLayer/constants.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { getRandomString } from '@sofie-automation/corelib/dist/lib' | ||
| import { PartInstanceAndPieceInstances, PartAndPieces } from '../../util.js' | ||
| import { createFakePiece } from '../utils.js' | ||
|
|
||
| const layer: string = getRandomString() | ||
|
|
||
| export const findForLayerTestConstants = { | ||
| previous: { | ||
| part: { _id: 'pPrev', part: 'prev' }, | ||
| allPieces: [createFakePiece('1'), createFakePiece('2'), createFakePiece('3')], | ||
| onTimeline: true, | ||
| nowInPart: 2000, | ||
| } as any as PartInstanceAndPieceInstances, | ||
| current: { | ||
| part: { _id: 'pCur', part: 'cur' }, | ||
| allPieces: [createFakePiece('4'), createFakePiece('5'), createFakePiece('6')], | ||
| onTimeline: true, | ||
| nowInPart: 1000, | ||
| } as any as PartInstanceAndPieceInstances, | ||
| nextTimed: { | ||
| part: { _id: 'pNextTimed', part: 'nextT' }, | ||
| allPieces: [createFakePiece('7'), createFakePiece('8'), createFakePiece('9')], | ||
| onTimeline: true, | ||
| } as any as PartInstanceAndPieceInstances, | ||
| nextFuture: { | ||
| part: { _id: 'pNextFuture', part: 'nextF' }, | ||
| allPieces: [createFakePiece('10'), createFakePiece('11'), createFakePiece('12')], | ||
| onTimeline: false, | ||
| } as any as PartInstanceAndPieceInstances, | ||
|
|
||
| orderedParts: [{ _id: 'p1' }, { _id: 'p2', invalid: true }, { _id: 'p3' }, { _id: 'p4' }, { _id: 'p5' }].map( | ||
| (p) => ({ | ||
| part: p as any, | ||
| usesInTransition: true, | ||
| pieces: [{ _id: p._id + '_p1' } as any], | ||
| }) | ||
| ) as PartAndPieces[], | ||
|
|
||
| layer, | ||
| } |
6 changes: 6 additions & 0 deletions
6
packages/job-worker/src/playout/lookahead/__tests__/findForLayer/helpers/mockSetup.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { setupDefaultJobEnvironment } from '../../../../../__mocks__/context.js' | ||
| import { findLookaheadObjectsForPart } from '../../../../../playout/lookahead/findObjects.js' | ||
|
|
||
| export type TfindLookaheadObjectsForPart = jest.MockedFunction<typeof findLookaheadObjectsForPart> | ||
|
|
||
| export const context = setupDefaultJobEnvironment() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing validation for
timeOffsetandisInstanceparameters.The validation callback only checks
rundownPlaylistIdandnextPartOrInstanceId, but omitstimeOffsetandisInstance. Every other method in this class validates all incoming parameters (e.g.,takevalidatesfromPartInstanceIdwithMatch.OneOf). Without these checks, malformed inputs bypass Meteor's type enforcement.Proposed fix
() => { check(rundownPlaylistId, String) check(nextPartOrInstanceId, String) + check(timeOffset, Match.OneOf(Number, null)) + check(isInstance, Match.OneOf(Boolean, null)) },📝 Committable suggestion
🤖 Prompt for AI Agents