Repository navigation
fix(recording): Rap yaml loader followups 40 - #26078
antobinary merged 3 commits into
Conversation
BigBlueButton.load_yaml passes fallback: through to Psych, but Psych only applies it when the stream has no document at all. An override file under /etc/bigbluebutton/recording/ that was trimmed down to a bare "---" or an explicit "null" is a document whose value is nil, so read_props and every format script still raised "no implicit conversion of nil into Hash" from the merge that follows -- the same crash the fallback was added to avoid for empty and comment-only files. Return the fallback for a nil document as well. A document that parses to false is still a value and is kept, and a required config without a fallback still yields nil, so a broken install keeps failing loudly. Seen on Ubuntu 24.04 with Psych 5.0.1. Noted as a non-blocking item in the review of bigbluebutton#25820 and carried over unchanged by the 4.0 port in bigbluebutton#25952.
… script presentation/scripts/caption/presentation parses captions.json with JSON.parse and copies tracks with FileUtils.cp, but requires neither library. It only loads boot.rb, which stops at yaml and date, so the first JSON.parse raises NameError: uninitialized constant JSON. FileUtils happens to be loaded by bundler/setup today, which the script should not rely on. Noted as a non-blocking item in the review of bigbluebutton#25820; the 4.0 port in bigbluebutton#25952 carried the gap over unchanged.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
Walkthrough
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
| # silently yielding empty settings. | ||
| def self.load_yaml(path, fallback: nil) | ||
| YAML.safe_load_file(path, permitted_classes: YAML_PERMITTED_CLASSES, aliases: true, fallback: fallback) | ||
| loaded = YAML.safe_load_file(path, permitted_classes: YAML_PERMITTED_CLASSES, aliases: true, fallback: fallback) |
There was a problem hiding this comment.
Possible code simplification: the nil? check already covers the empty-file case, so fallback: fallback can be dropped from the Psych call.
|
@coderabbitai review |
|
Since ef86493 load_yaml returns the fallback itself whenever the loaded document is nil, and Psych yields nil for a stream with no document just as it does for a null-only one. Passing fallback: through to safe_load_file only duplicated that branch for the empty-file case. Keep the single nil check; behaviour is unchanged on Psych 3.3 and 5.0. Suggested in the review of bigbluebutton#26078.
✅ Automated tests have passed! |
What does this PR do?
Two small follow-ups to #25952, the 4.0 port of #25820 (recording script cleanup with the shared
BigBlueButton.load_yamlloader). Both were noted as non-blocking in the #25820 review and were carried over unchanged by the port.load_yamltreats a null-only document as absent. The loader passesfallback:through to Psych, but Psych applies it only when the stream has no document at all. An override file under/etc/bigbluebutton/recording/trimmed down to a bare---,nullor~is a document whose value isnil, soread_propsand every format script still failed withTypeError: no implicit conversion of nil into Hashfrom the merge that follows. The loader now returns the fallback for anildocument as well. An explicitfalsedocument is still kept, and a required config without a fallback still yieldsnil, so a broken install keeps failing loudly.test_config_yaml.rbgains a test for the null-document cases and extends the "required config is not masked" test with---.presentation/scripts/caption/presentationrequiresjsonandfileutils. The script callsJSON.parseandFileUtils.cpbut only loadsboot.rb, which stops atyamlanddate, so the firstJSON.parseraisedNameError: uninitialized constant JSON.FileUtilshappened to be loaded bybundler/setup, which the script should not rely on.No behaviour change for valid config files.
Closes Issue(s)
Follow-up to #25952 / #25820. No issue filed.
Motivation
Carry the two review notes from #25820 that the 4.0 port did not address, and re-confirm the merged port on the current
v4.0.x-develophead.Testing
Ubuntu 24.04 container (
imdt/bigbluebutton:4.0.x-develop), Ruby 3.2.3, Psych 5.0.1,v4.0.x-developat 35cad46.Unit tests (
record-and-playback/core,rake test):v4.0.x-develop35cad46The one failure is
test_enforce_cut_lengths_short_cut_start, which also fails onv4.0.x-developand was already recorded as pre-existing in #25952.Override file probe (
BigBlueButton.read_propswith/etc/bigbluebutton/recording/recording.ymlset to each content):v4.0.x-develop# comment only---TypeErrornullTypeError~TypeErrorplayback_host: override.exampleCaption integration script (
caption/presentation --record-id <id>against a published recording with a captions index):v4.0.x-develop35cad46NameError: uninitialized constant JSONat the firstJSON.parsecaptions.jsongains theen_USentryRe-test of the merged port on the current head. One recording with microphone, webcam, non-ASCII user names and chat, a published poll, BlockNote shared notes, a screenshare, slide changes,
meetingKeepEvents=trueand an analytics callback URL. It was processed in all five formats (presentation, video, screenshare, podcast, notes) once on the pre-merge tree (f8d9ebb, parent of the #25952 merge) and once on the current head, then the published trees were compared.resque:failedpublished/presentation/(see below)The three differing files are
metadata.xml(onlyprocessing_timeand the resultingsize), andpanzooms.xml/cursor.xml, which on the head gain one event each at the screenshare start and stop timestamps. Those two come from #25991 (panzoom and screenshare boundaries), which landed after the port:1ec02fc94bmarks the panzoom as changed on screenshare start and stop. They are not from the YAML loader. Every other text output is byte-identical and no log contains a Psych, TypeError or NameError line.The keep-events worker and
post_events_analytics_callback.rb(both touched by the port) ran on the head tree:events/events.xmlanddata.jsonwere written and the callback POST arrived with the Authorization header and the non-ASCII meeting name and metadata intact.Note for anyone reproducing on Ubuntu 24.04: the presentation publish fails on both trees with
nil can't be coerced into Floatunless the ImageMagick policy allows theXCcoder. That is issue #25926 and is unrelated to this change; the A/B above was run withrights="read | write"on the{XC}module line.