Repository navigation
feat(lectures,music): store the data JSON-LD needs for VideoObject and MusicRecording - #1244
sydevs-bot wants to merge 20 commits into
Conversation
Google requires `uploadDate` on a VideoObject, and nothing here held it: `metadata.lastSyncedAt` is when SahajCloud read the lecture and `createdAt` is when the row was made. The Nirmala Vidya response could not be checked for a date of its own — the routine has no NIRMALA_VIDYA_API_KEY — so this is the ticket's editor-entered fallback, optional, so a lecture with no known date still saves and publishes no upload date. A clip reads its parent's date through `fullLecture`, as it reads the parent's `metadata`. Refs #1236 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXrgywSTQ8UnLgCCRh
`LecturePlayerData` is the one shape both feeds answer, so the date joins it beside `duration`, from the same source `metadata` comes from — the parent's for a clip. The OpenAPI schema and the three places that pin the key set move with it. Refs #1236 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXrgywSTQ8UnLgCCRh
A MusicRecording's `byArtist` publishes this URL, and the website drops anything its own `isSafeHttpUrl` gate refuses — so a malformed value travelled all the way there to be discarded silently. `urlField` is the repo's existing answer, as Lectures uses it; the column is unchanged text, so no migration. Refs #1236 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXrgywSTQ8UnLgCCRh
`extractAudioDuration` leaves the document unchanged when the audio states no length, and `duration` is read-only — so the gap showed as a blank field that said nothing, and the website read it as a zero. A warning banner above the field is the signal, drawn by the existing InfoBanner through `admin.custom`, so no component is added. The fixture already carries a song with such audio. Refs #1236 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXrgywSTQ8UnLgCCRh
A `select` narrows the returned type, so one read cannot assert both. The clip's own column is null, and the parent's date is where the website reads it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXrgywSTQ8UnLgCCRh
`extractAudioDuration` returned the document untouched when the audio stated no length, so a song that once carried 42 seconds kept reporting it after a length-less file replaced the old one — the stored number described a file that was gone. Both failure branches now clear the column, and the silent branch warns like its neighbour. Found while adding the editor warning, which read the column rather than the upload and so stayed hidden in exactly this case. Meditations mounts the same hook and gains the fix. Refs #1236 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXrgywSTQ8UnLgCCRh
`metadata` already declares `access.update: ({ doc }) => doc?.type === 'full'`
so an API write cannot diverge a clip from its parent. The date is inherited the
same way, so the invariant was stated only in `admin.condition` — enforced in
the admin panel and nowhere else. One layer now holds it for both fields.
Refs #1236
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXrgywSTQ8UnLgCCRh
Cut four comments and one description that restated the code or config beside them, drop `icon: 'warning'` (InfoBanner derives it from `type`), take the album URL case down to the repo's one-case wiring proof, and share a `clipOf` fixture between the two clip blocks. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXrgywSTQ8UnLgCCRh
Every other lecture fact comes from the Nirmala Vidya API, so a reader would expect the sync to fill this one too. It never does. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXrgywSTQ8UnLgCCRh
Three review findings. `pickerAppearance: 'dayOnly'` defaults to `MMM dd`, so the year a talk was given — the whole point of the field — was invisible in the picker; `scheduleFields` sets `displayFormat` for the same reason. The access comment said "reject" where field access strips. And clearing a duration empties a meditation's node weights, which `cacheMeditationNodeWeights` is mounted after the extraction precisely to do, so the case is now pinned rather than found. The Songs review link is dropped: `admin.hidden` unregisters the collection's routes, so a song is reachable only through the Albums join drawer. Refs #1236 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXrgywSTQ8UnLgCCRh
|
🚅 Deployed to the SahajCloud-pr-1244 environment in sahajcloud
1 service not affected by this PR
|
sydevs-bot
left a comment
There was a problem hiding this comment.
2 questions for the reviewer, one per thread.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Holistic. The diff is the size of its ticket and no larger: one nullable column, one field-factory swap, one ui notice, one hook fix. It adds no module, no helper and no dependency, and date copies metadata's own access.update and condition instead of inventing a gate. The ticket's optional (c) is correctly left out. The duration clear is joined, not smuggled — the banner reads the stored column, so a kept stale value would make the banner lie.
Two things to know before the threads. The body's claim that WeMeditateWeb "reads the date the same way" is false: its LECTURE_SELECT omits date, so the consumer reads none until it adds a line. And the hook fix lands on meditations, which this PR leaves with the new exposure and no notice.
Findings
consider—src/collections/Lectures/Lectures.ts:130: adayOnlyvalue can store the previous UTC day for an editor east of UTC, on a column published asuploadDate.
Second opinions
Lectures.ts:121— A, the built option, on corrected grounds. Resolved.Songs.ts:105— B, against the built option. Left open.
What was checked. Ticket #1236 against the diff, its acceptance criteria included. Read whole: the three collections, audio/duration.ts, lectureShape.ts, urlField.ts, InfoBanner.tsx. new-pieces.mjs answered NONE, so no streamliner ran. I walked the ladder over the four nested pieces and the zero new dependencies — each has a named platform or repo answer. The grown-file pass found nothing custom where the platform now answers. Consumer side followed into WeMeditateWeb server/sahajcloud-client.ts. LECTURE_FEED_SELECT holds fullLecture: true wholesale, so a clip's parent carries date and the feed is right. All five preview links ON_HOST, each id checked against src/fixture/ on the branch.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
A review finding read the field as storing local midnight, which would put an editor east of UTC on the previous UTC day — a wrong `uploadDate` on a public page. `@payloadcms/ui`'s DatePicker pins a day-only pick to noon UTC instead (`setHours(12 - tzOffset, 0)`), so the day picked is the value's UTC date part from every zone, +14:00 and +05:45 included. Nothing to fix, and nothing in our own source says so, so the next reader re-derives it from a dependency — or reaches for `timezone: true` and a second column. Upstream calls dropping that pin a 4.0 breaking change, which is the one thing that would move the stored hour, so the comment names it. Refs #1236 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVtESRnwUtnX1Vv4Zx
|
One critic finding, rebutted on a fact. The base is merged in, and nothing else is built. The A meditation's missing-duration notice — open, waiting on you. The critic picks B against the built A. That is your call, so nothing is built for it.
Body corrected where the critic proved it wrong: 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
Merged The merge re-armed #566, which the diff does not show. Nothing else overlapped: Lean gate green — 295 files, 3934 tests. Integration: 122 passed across 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
src/migrations/index.ts was the only conflict: both sides appended migrations, so every entry stays, in timestamp order. main's 20261125_152923_atlas_drop_compact_tab and 20261125_191844_merge_snapshot_heal sit before this branch's 20261125_191905_merge_snapshot_heal. That ordering re-armed #566. This branch's heal carries the later timestamp, and its snapshot still holds both compact columns, so the newest snapshot on disk described a schema main had already dropped them from and the next migrate:create re-emitted the two DROP COLUMN statements 20261125_152923_atlas_drop_compact_tab already ships. 20261125_194946_merge_snapshot_heal carries the merged-tree snapshot with empty DDL; a probe run afterwards wrote no files. src/payload-types.ts merged clean and is correct on both sides: Lecture.date is present and no compact key remains. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYhrByrtm5q9vVrckx
|
Merged The ordering re-armed #566. This branch's
Lean gate green (lint, format, both typechecks, 3935 unit tests), plus 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
src/migrations/index.ts was the only conflict: both sides appended migrations, so every entry stays, in timestamp order. main's 20261125_213000_atlas_common_copied and 20261125_230000_atlas_drop_captcha_blocked sit after this branch's two 20261125_19* heals. That ordering re-armed #566 in the other direction. Both of main's new snapshots predate 20261120_235118_lecture_date, so the newest snapshot on disk described a schema without "lectures"."date" and the next migrate:create re-emitted the same ADD COLUMN — confirmed by running it. 20261126_035802_merge_snapshot_heal carries the merged-tree snapshot with empty DDL; a probe run afterwards wrote no files. Nothing else overlapped. src/payload-types.ts and the admin importMap merged clean and hold both sides: Lecture.date is present, as are main's impersonation components. main's InfoBanner change is an opt-in `inline` prop, which the branch's durationNotice does not pass. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWhejbJxXgyFysqZqf
|
Merged That ordering re-armed #566. Both of main's new snapshots — Nothing else overlapped. Lean gate green: lint, format, both typechecks, unit lane — 295 files, 3943 tests. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
The session for resolve-conflicts did not finish after 3 attempts. I have stopped retrying. A mention ( 🤖 sydevs dispatcher |
Summary
VideoObjectcan publishuploadDate.artistUrlis refused unless it is an http(s) URL, and a song or meditation with no readable duration says so to its editor.Change outline
The main change is a new collection field and the one feed shape that carries it.
Contract — the lecture's date
Contract — what the feeds answer
LecturePlayerData src/lib/lectures/lectureShape.ts id, title + date: string | null # metadataSource's, so a clip reports its parent's hlsUrl, thumbnailUrl, subtitles startTime, stopTime, duration, fullLectureId, userChoicesGET /api/lectures/for-audienceandGET /api/meditations/:id/related-lecturesboth serve it.LECTURE_FEED_SELECTgainsdate, and the hand-authored OpenAPI schema with it.Contract — the music fields
Behaviour — the shared duration extraction
extractAudioDuration({ maxMinutes }) src/lib/audio/duration.ts the save carries no file → leave the document alone parse the buffer - threw → warn, leave the stored duration in place - no length stated → leave the stored duration in place, silently + threw → warn, clear the duration + no length stated → warn, clear the duration over the cap → throw otherwise → store the whole seconds Meditations mounts this before cacheMeditationNodeWeights, so a length-less replacement now empties subtleSystemNodeWeights rather than weighting frames against the replaced file's lengthPreview
An introduction to meditation (1979-03-18); Date shows 18 Mar 1979, read-onlysubtleSystemNodeWeightsit explainsartistUrl, and it holds "Fixture Damaged Interlude (no duration)"; open that song from the Songs table for the same warningartistUrlat all, which stays allowedsongsisadmin.hidden, which unregisters its routes, so a song has no page of its own — it opens in the album's drawer.Contract impact
src/payload-types.tsgainedLecture.date, and it is acontractSyncsource forWeMeditateWeb (
server/payload-types.ts) and SahajAtlasWeb(
src/types/payload/payload-types.ts). Both re-sync in a bot PR after this merges. FillinguploadDateinlectureSeois sydevs/WeMeditateWeb#273's follow-up, not this PR's.Migration
src/migrations/20261120_235118_lecture_date.tslectures. No data transformed, none lost. The only schema delta between the two drizzle snapshots ispublic.lectures/columns/date.downdrops the column.Test results
Lectures/hooks/matchessecurityReview.triggerPattern, so the branch-level sweep ranEach new assertion was watched failing against the defect first. From the earlier rounds: the three
shapeLecturedate cases with the shaper line removed, theartistUrlcase with the field back totype: 'text', and both duration cases with the clear removed (expected 42 to be null). From thisround: the three create-path date cases with
data.datedropped from the hook (expected null to be '1979-03-18T12:00:00.000Z'), the sync case withdatedropped from its update, the calendar-invalidcase with the round trip removed (
expected '1990-02-31T12:00:00.000Z' to be null), the year-boundcase with
19|20loosened to\d{4}(expected '1842-07-01T12:00:00.000Z' to be null), and themeditation wiring case with the mount reverted (
expected [] to have a length of 1).Manual verification
Mar 18, 1979and takes no input. Payload'sdayOnlydefault isMMM dd, which hides the year a talk was given.Notes for reviewer
/hlsprobe the ticket puts first still cannot run — a routine has noNIRMALA_VIDYA_API_KEY— but it no longer has to: NV publishes its OpenAPI document unauthenticated athttps://mapi.nirmalavidya.org/api/v2/openapi.json, which declares every key of the route'sVimeoVideoHlsResponse. Its two dates arecreated_timeandmodified_time, both Vimeo's own — video393387855was uploaded 2020-02-24 under the title(1990-03-16)(Vimeo oEmbed, unkeyed), so those are 30 years off the talk and disqualify the Vimeo upload date the ticket asked us to check. NV does hold the day, one route away:/hlsforwardsevent_id, andGET /api/v2/events/{event_id}answersdate.date, "Date and time when the event takes place", with its own verification status. That route declaresOAuth2PasswordBearerwhere/hlstakesX-API-KEY, and answersNot authenticatedunkeyed, so it needs an NV account credential nobody has provisioned. Whether to pursue it is an open thread.nameand stores it asmetadata.title, and that is observable without the key: across all 77 full lectures on production, 76 spell the date (68 as(1990-03-16), 8 as a1989-08-01prefix). So the column is derived rather than typed, which is what the reviewer asked for.1980-0421 What Is The Second Birth London NITL HD. A parse that guessed where the missing hyphen goes would invent a date on a public page, so it refuses. The fix belongs in the NV title, and the next monthly sync picks it up — which is the point of sourcing the column there rather than having an editor patch it here.metadata.title, never the editor'stitle. The two differ on 31 of those 77, because an editor retitles freely; only the NV-owned copy is refreshed by the sync.buildLectureMetadatais untouched: the date is a column besidemetadata, not a key inside it, so it stays selectable and sortable, andlectureDateFromTitleis called by both writers that build metadata.GET /api/lectures?select[date]answers null on a clip, by design: a clip stores no date, as it stores nometadata, and WeMeditateWeb self-populatesfullLecturewithLECTURE_SELECTto read the parent's playback data. That select omitsdate, so the consumer reads none until onedate: trueline is added there, which covers a clip and a full lecture at once. The question thread settled on this shape.Albums.artistshould stop being localized is the other product decision it raises, and is left alone.creategate a previous round dismissed is now in. That dismissal rested on having to key the gate ondata.type, which rides on adefaultValue. A derived column needs no such key:create: () => falserefuses every caller, and the hook writes the value afterwards, because field access runs in thebeforeValidatetraversal and a collectionbeforeChangehook runs after it.fieldErrorMessageintotests/utils/touches 8 pre-existing copies outside this diff; the albums case uses the repo's own one-case wiring shape instead. ThedayOnlytimezone shift rests on a premise Payload disproves:DatePickerpins a day-only pick to noon UTC, so the day picked is the stored value's UTC date part in every editor timezone. The field carries that constraint as a comment, andlectureDateFromTitlewrites the same hour so a derived value and a legacy typed one agree.Detail
Why a plain column rather than a virtual field. Payload 3 supports
virtual: 'fullLecture.date',which would let a clip answer directly at depth 0. It was rejected: the consumer already populates
fullLecture, nothing sorts or filters on the date, and it would add a second name for one value.The reviewer resolved that thread on the built option.
Why a regex over the title rather than a new response field.
/hlscarries no date of thetalk — only Vimeo's
created_timeandmodified_time— so no key on the route we already callcan be preferred to the title. The event route that does carry one needs a second credential, and
its
event_idis present only "if a unique matching event exists", so its coverage againstproduction's 77 cannot be measured from here either. The title arrives through the fetch we already
make, so it needs no new credential and no change to the response schema. If the event date is
taken up later, it replaces this function's caller rather than the column.
Why the duration clear came in with this ticket. The editor warning reads the stored column, so
a song whose replacement audio stated no length kept its old number and the warning never appeared —
the banner would have been correct about a value that was wrong. Fixing the hook makes the condition
describe the upload rather than the symptom.
cacheMeditationNodeWeightsis mounted after theextraction precisely so the weights describe the duration being stored, so emptying them is that
invariant holding, not a new behaviour; it is now pinned by a case.
Review passes.
/simplify(four lenses: reuse, simplification, efficiency, altitude) and/code-review high; this repo has nopr-review-toolkit./security-reviewran this round, overthe whole branch diff, and reported no findings.
comment-lint.mjsreported no banned commentadded.
Closes #1236
🤖 Written by the sydevs autonomous loop — see what this is
🤖 Generated with Claude Code
https://claude.ai/code/session_01Mg9rjXrgywSTQ8UnLgCCRh