Skip to content

feat: migrate meteor settings file to new places - #1781

Merged
Julusian merged 6 commits into
Sofie-Automation:mainfrom
SuperFlyTV:feat/migrate-meteor-settings-file
Jul 29, 2026
Merged

feat: migrate meteor settings file to new places#1781
Julusian merged 6 commits into
Sofie-Automation:mainfrom
SuperFlyTV:feat/migrate-meteor-settings-file

Conversation

@Julusian

Copy link
Copy Markdown
Member

About the Contributor

This pull request is posted on behalf of Superfly

Type of Contribution

This is a: Code improvement / Documentation improvement

Current Behavior

There are some sofie settings defined in a meteor-settings.json config file. This is documented but is not very friendly to those configuring sofie, as it requires to be done at deployment separate from the rest of the settings.

New Behavior

These settings have all been migrated to new homes:

  • Most are in the studio settings, and can be configured both in the ui and from blueprints
  • Some are in the 'core system' settings and can be configured in the ui
  • One has moved to be an environment variable, as it is security related and requires other deployment changes to be useful.
  • A couple have been removed as they do not appear useful

The customizationClassName setting has been removed, as I am not sure if it has value. I expect that anyone wanting to use this already needs to embed custom css into sofie, in which case they can easily do this in another way. Please say if you disagree and use this.
The enableNTPTimeChecker setting has been removed as it appears it was broken and has been for I suspect multiple years.

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 SuperFly.tv Contributions sponsored by SuperFly.tv label Jun 23, 2026
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Removes the legacy Meteor settings object and moves configuration to environment variables, CoreSystem settings, Studio settings, and shared defaults. Updates server cleanup, REST contracts, WebUI timing, scrolling, keyboard behavior, permissions, and management interfaces accordingly.

Changes

Settings migration

Layer / File(s) Summary
Shared contracts and defaults
packages/shared-lib/src/core/*, packages/meteor-lib/src/Settings.ts
Adds CoreSystem and Studio settings fields, runtime configuration types, and shared default constants.
Authentication and settings sources
meteor/server/security/auth.ts, meteor/server/api/rest/koa.ts, packages/webui/src/client/lib/Settings.ts, packages/webui/src/client/collections/index.ts, packages/webui/src/client/ui/UserPermissions.tsx
Moves header-auth configuration to SOFIE_ENABLE_HEADER_AUTH, injects it into runtime config, and removes the mutable client Settings object.
CoreSystem configuration
meteor/server/coreSystem/*, meteor/server/api/cleanup.ts, meteor/server/migration/*, packages/webui/src/client/ui/Settings/SystemManagement.tsx
Seeds and resolves CoreSystem settings, applies configurable cleanup retention, and adds management controls for retention and keyboard settings.
Studio configuration APIs
meteor/server/api/studio/api.ts, meteor/server/api/rest/v1/typeConversion.ts, meteor/server/lib/rest/v1/studios.ts, packages/openapi/api/definitions/studios.yaml, packages/webui/src/client/ui/Settings/Studio/Generic.tsx
Adds Studio settings defaults, API mappings, OpenAPI fields, and override controls.
Timing and scrolling
packages/webui/src/client/lib/rundown*.ts, packages/webui/src/client/lib/viewPort.ts, packages/webui/src/client/ui/RundownView/*, packages/webui/src/client/ui/SegmentTimeline/*
Replaces boolean duration and history arguments with numeric Studio-configured values and propagates them through timing and viewport operations.
Keyboard and display consumers
packages/webui/src/client/lib/ModalDialog.tsx, packages/webui/src/client/lib/ui/containers/modals/Modal.tsx, packages/webui/src/client/lib/triggers/*, packages/webui/src/client/ui/Shelf/Shelf.tsx, packages/webui/src/client/ui/ClockView/*, packages/webui/src/client/ui/Prompter/*
Reads CoreSystem keyboard settings and Studio display settings with shared fallbacks.
Documentation and migration validation
packages/documentation/docs/user-guide/*, meteor/server/__tests__/cronjobs.test.ts
Documents environment-based header authentication and updates cleanup fixtures to use shared defaults.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

Suggested reviewers: jesperstarkar, jstarpl, nytamin

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 19.44% 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: migrating Meteor settings to new locations.
Description check ✅ Passed The description matches the changeset, covering the settings migration, removals, and documentation updates.
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.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 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 `@meteor/server/api/cleanup.ts`:
- Around line 86-89: The maximumDataAge variable extracted from systemSettings
on line 88 is not validated before being used in cleanup threshold calculations.
Add validation logic to ensure maximumDataAge is a positive finite number before
it is applied to any retention or cleanup math. If the value is invalid (less
than or equal to zero, NaN, or Infinity), either clamp it to a safe minimum
value or fallback to the DEFAULT_MAXIMUM_DATA_AGE constant to prevent unsafe
aggressive purging of recent data across collections.

In `@packages/documentation/docs/user-guide/configuration/sofie-core-settings.md`:
- Line 7: In the opening sentence of the sofie-core-settings.md file, replace
the contraction "it's" with the possessive form "its" in the phrase "configured
at its most basic level". The sentence should read "_Sofie Core_ is
configured at its most basic level using environment variables." where "its"
indicates possession rather than "it is".

In `@packages/shared-lib/src/core/model/StudioSettings.ts`:
- Around line 131-133: The new field `defaultShelfDisplayOptions` added to
`IStudioSettings` in StudioSettings.ts needs to be mapped in the REST conversion
layer to prevent it from being silently dropped in API responses. Add the
mapping for `defaultShelfDisplayOptions` in both the `APIStudioSettingsFrom`
function (which converts to API format) and the `APIStudioSettingsTo` function
(which converts from API format) in the type conversion module to ensure proper
round-trip serialization and deserialization of this setting.

In `@packages/webui/src/client/lib/viewPort.ts`:
- Around line 225-227: The variable followOnAirSegmentsHistory is being used
directly as a loop counter without normalization, but since it can contain
fractional values (like 1.5), this causes the loop to iterate an incorrect
number of times. Before assigning followOnAirSegmentsHistory to the loop counter
variable i, normalize it to a non-negative integer by using Math.floor to remove
any fractional part and ensure it doesn't go below zero.

In `@packages/webui/src/client/ui/SegmentTimeline/TimelineGrid.tsx`:
- Line 46: The new prop defaultDisplayDuration added at line 46 is not being
monitored for changes in the component's update guards. Update the
shouldComponentUpdate method to include defaultDisplayDuration in its prop
comparison logic, and ensure that componentDidUpdate also invalidates the
relevant cache (total duration cache) when defaultDisplayDuration changes. This
will prevent the grid from using stale duration values when this prop is
updated.

In `@packages/webui/src/client/ui/Settings/Studio/Generic.tsx`:
- Around line 511-526: The defaultTimeScale property uses IntInputControl which
truncates decimal values via parseInt, but the property is modeled as a number
that should support decimal precision. Replace IntInputControl with a
FloatInputControl or equivalent numeric control that properly handles and
preserves decimal values when updating the defaultTimeScale key through the
handleUpdate callback.

In `@packages/webui/src/client/ui/Shelf/Shelf.tsx`:
- Around line 600-604: The displayOptions variable assignment in the Shelf
component does not guard against params['display'] being a string array (which
occurs when URL has repeated display parameters). The .split() method will fail
at runtime if params['display'] is an array. Add a type check to handle both
cases: if params['display'] is already an array, use it directly; if it's a
string, call .split(',') on it. Ensure the result is always an array of strings
before assigning to displayOptions, falling back to
studioSettings?.defaultShelfDisplayOptions or DEFAULT_SHELF_DISPLAY_OPTIONS as
needed.
🪄 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: d32d0b38-9289-4099-9125-982e6ec713f1

📥 Commits

Reviewing files that changed from the base of the PR and between b2a2225 and 58f9f74.

⛔ Files ignored due to path filters (1)
  • packages/openapi/src/generated/openapi.yaml is excluded by !**/generated/**
📒 Files selected for processing (47)
  • meteor/server/Settings.ts
  • meteor/server/__tests__/cronjobs.test.ts
  • meteor/server/api/cleanup.ts
  • meteor/server/api/rest/koa.ts
  • meteor/server/api/rest/v1/typeConversion.ts
  • meteor/server/api/studio/api.ts
  • meteor/server/api/systemTime/ntpTimeChecker.ts
  • meteor/server/coreSystem/index.ts
  • meteor/server/lib/rest/v1/studios.ts
  • meteor/server/migration/1_40_0.ts
  • meteor/server/migration/upgrades/system.ts
  • meteor/server/security/auth.ts
  • packages/documentation/docs/user-guide/configuration/sofie-core-settings.md
  • packages/documentation/docs/user-guide/features/access-levels.md
  • packages/meteor-lib/src/Settings.ts
  • packages/openapi/api/definitions/studios.yaml
  • packages/shared-lib/src/core/constants.ts
  • packages/shared-lib/src/core/model/CoreSystemSettings.ts
  • packages/shared-lib/src/core/model/StudioSettings.ts
  • packages/webui/src/client/collections/index.ts
  • packages/webui/src/client/lib/ModalDialog.tsx
  • packages/webui/src/client/lib/Settings.ts
  • packages/webui/src/client/lib/rundown.ts
  • packages/webui/src/client/lib/rundownTiming.ts
  • packages/webui/src/client/lib/triggers/TriggersHandler.tsx
  • packages/webui/src/client/lib/ui/containers/modals/Modal.tsx
  • packages/webui/src/client/lib/viewPort.ts
  • packages/webui/src/client/ui/App.tsx
  • packages/webui/src/client/ui/ClockView/ClockView.tsx
  • packages/webui/src/client/ui/Prompter/PrompterView.tsx
  • packages/webui/src/client/ui/RundownView.tsx
  • packages/webui/src/client/ui/RundownView/MediaStatusPopUp/MediaStatusPopUpItem.tsx
  • packages/webui/src/client/ui/RundownView/MediaStatusPopUp/index.tsx
  • packages/webui/src/client/ui/RundownView/RundownDetachedShelf.tsx
  • packages/webui/src/client/ui/RundownView/RundownHeader/useRundownPlaylistOperations.tsx
  • packages/webui/src/client/ui/RundownView/RundownTiming/RundownTimingProvider.tsx
  • packages/webui/src/client/ui/RundownView/RundownViewContextProviders.tsx
  • packages/webui/src/client/ui/SegmentStoryboard/SegmentStoryboard.tsx
  • packages/webui/src/client/ui/SegmentTimeline/Constants.tsx
  • packages/webui/src/client/ui/SegmentTimeline/Renderers/VTSourceRenderer.tsx
  • packages/webui/src/client/ui/SegmentTimeline/SegmentTimeline.tsx
  • packages/webui/src/client/ui/SegmentTimeline/SegmentTimelineContainer.tsx
  • packages/webui/src/client/ui/SegmentTimeline/TimelineGrid.tsx
  • packages/webui/src/client/ui/Settings/Studio/Generic.tsx
  • packages/webui/src/client/ui/Settings/SystemManagement.tsx
  • packages/webui/src/client/ui/Shelf/Shelf.tsx
  • packages/webui/src/client/ui/UserPermissions.tsx
💤 Files with no reviewable changes (3)
  • meteor/server/Settings.ts
  • meteor/server/api/systemTime/ntpTimeChecker.ts
  • packages/webui/src/client/ui/App.tsx

Comment thread meteor/server/api/cleanup.ts
Comment thread packages/documentation/docs/user-guide/configuration/sofie-core-settings.md Outdated
Comment thread packages/shared-lib/src/core/model/StudioSettings.ts
Comment thread packages/webui/src/client/lib/viewPort.ts Outdated
Comment thread packages/webui/src/client/ui/SegmentTimeline/TimelineGrid.tsx
Comment thread packages/webui/src/client/ui/Settings/Studio/Generic.tsx Outdated
Comment thread packages/webui/src/client/ui/Shelf/Shelf.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/webui/src/client/lib/rundownTiming.ts (1)

748-754: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add coverage for forward timing without expectedEnd.

getPlaylistTimingDiff() falls back to startedPlayback ?? Math.max(expectedStart, currentTime) + expectedDuration ?? totalPlaylistDuration, so add a forward-timed playlist case where expectedEnd is unset and there is no later-rundown anchor available.

🤖 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 `@packages/webui/src/client/lib/rundownTiming.ts` around lines 748 - 754, Add a
test case covering getPlaylistTimingDiff() for a forward-timed playlist with
expectedEnd unset and no later-rundown anchor, asserting it uses the
startedPlayback or expectedStart/currentTime fallback plus expectedDuration or
totalPlaylistDuration.
🤖 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.

Outside diff comments:
In `@packages/webui/src/client/lib/rundownTiming.ts`:
- Around line 748-754: Add a test case covering getPlaylistTimingDiff() for a
forward-timed playlist with expectedEnd unset and no later-rundown anchor,
asserting it uses the startedPlayback or expectedStart/currentTime fallback plus
expectedDuration or totalPlaylistDuration.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a5236b14-25a5-458f-9dbe-66b5409811b6

📥 Commits

Reviewing files that changed from the base of the PR and between 7baa175 and 1015d25.

⛔ Files ignored due to path filters (1)
  • packages/openapi/src/generated/openapi.yaml is excluded by !**/generated/**
📒 Files selected for processing (6)
  • meteor/server/api/rest/v1/typeConversion.ts
  • packages/webui/src/client/lib/rundownTiming.ts
  • packages/webui/src/client/ui/RundownView.tsx
  • packages/webui/src/client/ui/RundownView/RundownTiming/RundownTimingProvider.tsx
  • packages/webui/src/client/ui/SegmentStoryboard/SegmentStoryboard.tsx
  • packages/webui/src/client/ui/SegmentTimeline/SegmentTimeline.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/webui/src/client/ui/RundownView/RundownTiming/RundownTimingProvider.tsx
  • meteor/server/api/rest/v1/typeConversion.ts
  • packages/webui/src/client/ui/SegmentStoryboard/SegmentStoryboard.tsx
  • packages/webui/src/client/ui/RundownView.tsx
  • packages/webui/src/client/ui/SegmentTimeline/SegmentTimeline.tsx

@Julusian
Julusian merged commit 3638678 into Sofie-Automation:main Jul 29, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contribution from SuperFly.tv Contributions sponsored by SuperFly.tv Goodbye Meteor!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant