You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
One Pulse Button, Which Hands Out a Link and Says Where the Video Went - #658
Stage 2 of landing #615 in pieces, stacked on #654 (stage 1). One Pulse button, on tickets, Redmine issues and clock sessions, built on the destination the link now carries — and the attachments panel from #615 around it.
usePulseUpload(destination) reserves a link, shows the QR code on a computer or opens the Pulse app on a phone, and asks PulseVault's status route (with the upload's own token) where the video stands until it has landed or the link has expired. It keeps nothing across a reload and nothing outlives the component: the server delivers the video wherever the link said, whether or not anyone is watching. That is the whole difference from #615's hook — no detached watcher, no hand-off, no toasts — and from main's button — no localStorage videoid cache, no polling of the attachments list.
Screenshots
Taken on this branch against a local backend (ticket #cf057, a real upload over tus to the link the button reserved, as the Pulse app sends it).
The panel: Links and videos with Link and Pulse, list labelled Attachments
Press Pulse on a computer: QR, where the video goes, store badges, live status line
The video lands: the chip says Added to this ticket, the modal has closed itself, the video is in the list
Link: a pasted URL in a small modal; the YouTube title is looked up
A Pulse video and a link, side by side
The whole ticket page after the video landed
Not pictured: the same panel on a clock session (same component, kind="clock", on the Dashboard timesheet while clocked in), a Redmine issue (no Redmine here), and a phone, where the button opens the Pulse app instead of the modal and the chip shows the outcome beside itself.
Changes
src/features/pulse-upload/: usePulseUpload.ts (the hook), PulseButton.tsx (PulseChip + PulseButton), PulseUploadModal.tsx rewritten as a presentational modal (QR, store badges, live status line, optional "Upload from this device"), PulseLogo.tsx and PulseStoreBadges.tsx from @mieweb/pulsevault/assets, pulseLinks.ts (the deep-link and scan-link builders, moved out of the button) and pulseStatus.ts (labels per destination kind, the kept message). PulseUploadButton.tsx is deleted.
No "Upload from this device": on a phone the link opens the Pulse app (or its store listing), on a computer the modal shows the QR code. A video comes from Pulse. Gone from the modal and from the Huddle attach button's tus path.
AttachmentsPanel (tickets, Redmine issues, clock sessions) is feat(pulse): make Pulse the only way to add video, delivered where it was started #615's: a "Links and videos" header with a ButtonGroup of Link (LinkAttachButton, a pasted URL in a small modal, with linkAttach.ts) and Pulse. The list is labelled "Attachments". TicketAttachmentsCard just renders the panel. clock is a destination kind of its own on the backend: an attachment on the uploader's own session.
Huddle PulseAttachButton keeps its behaviour minus the device upload: it imports the link builders from pulseLinks.ts and passes the modal its new props. It is replaced in stage 3.
videoApi.status reads the status route once; waitUntilFiled (still used by the profile feed) loops over it.
Backend: existingVideoid is removed from pulsevault.reserve and its schema with its only caller. A link is one upload, and PulseVault's reclaim resumes it on a re-scan.
Version 1.0.6 and release-notes/1.0.6.md: the panel and the button change, the modal says when the video has landed, and device upload is gone from tickets.
Testing
Local, backend on :3101 against a scratch MongoDB replica set with VIDEOS_DIR set, frontend :3002 from the Playwright config:
tests/e2e/tickets/pulsevault.spec.ts + huddle/pulsevault-video.spec.ts + huddle/composer-actions.spec.ts + redmine/issue-detail.spec.ts: all passed (final run of the ticket and Huddle video specs: 16/16; the Redmine spec 21/21 and composer actions 9/9 earlier in the same pass). The ticket video now reaches its attachments the way the Pulse app sends it — a link reserved for the ticket over REST and a tus upload through it (uploadVideoToTicket) — plus the chip opening the QR modal, the Link modal on a Redmine issue, and the kept case from A Pulse Link Carries Its Destination, and One Table Delivers It #654.
vitest run src/features/pulse-upload: 9/9 — the links, the kept message, and the hook (opens the link for the pressed destination; drops a link that comes back after the destination changed; reopens the live link instead of minting a second).
tsc --noEmit, ESLint on every changed file, Prettier, vite build (the badge assets are bundled, the 1.0.6 note is in the chunk): clean. npm run lint on the whole tree reports errors only from a stale agent worktree under .claude/, not from the repo.
Not run: an upload from the Pulse app on a phone; the Huddle composer's Pulse button in a browser (its change is two imports and the modal's props, checked by tsc and the composer e2e specs above).
Later in the same PR (after a browser demo): the modal shows the destination's own label instead of the backend's note (which carried a raw ticket id) and closes on any delivery; then the device-upload fallback, the #615 attachments panel with Link + Pulse, and the clock destination.
After Copilot's reviews (10a0b2f, 16c5d6b): the chip says every outcome beside itself when there is no modal (phones), sharing the modal's copy; one status check in flight with a 10 s deadline, aborted on cleanup; the browser-phone launch's cleanup is kept and cancelled on a new launch, a destination change or unmount; a stale reservation's error stays off the next destination; Link waits at most 3 s for a YouTube title and the chip is busy while an add saves; the Clock composer's attach button shows an expired link; ticket and clock ids are checked as 24 hex characters before new ObjectId; e2e cases for the clock destination (own session attached, another's refused, deleted session kept). Unit tests 12/12; ticket spec 17/17, Redmine issue spec 18/18.
After the Docker build failed and Copilot's review of 5f55c25 (27412f2, 2d396e5): the root package.json now declares @mieweb/pulsevault (exactly 0.5.0, like the backend), which PulseLogo.tsx and PulseStoreBadges.tsx import the logo and store badges from; local builds had only worked from leftover node_modules, so build-and-push had nothing to resolve. And an organization's owners can reach a clock session's attachments like its team admins (isTeamAdminOrOrgOwner, the rule the team methods and TeamContext use). Run: tsc --noEmit, vitest run src/features/pulse-upload (12/12), Prettier, vite build (both badge assets in the bundle). The org-owner path is checked by reading; the attachments integration test needs the :3101 backend and was not re-run.
#654 merged, so this PR now targets main (f1a267e merges it in). Two conflicts: release-notes/1.0.6.md, where main had started the 1.0.6 note with the confetti and App Store changes (1.0.6 is not tagged, so the two are now one note with both, per the release-notes README), and the Playwright import line in tests/e2e/tickets/helpers.ts. After a fresh npm install for the merged manifest: tsc --noEmit clean, vitest run src/features/release-notes src/features/pulse-upload 23/23, Prettier and ESLint clean on the two files.
Next
Stage 3: the huddle destination and the Pulse chip in the SuperChat composer, replacing PulseAttachButton.
…the video went
`usePulseUpload(destination)` reserves a link, shows the QR code on a
computer or opens the Pulse app on a phone, and asks PulseVault's status
route where the video stands until it has landed or the link has expired.
No videoid cache, no attachment polling, nothing that outlives the button:
the server delivers the video wherever the link said, whether or not
anyone is watching.
`PulseButton` is the chip (Pulse logo, "Pulse") with the modal, used on
tickets and Redmine issues in place of `PulseUploadButton`. The modal is
presentational — QR, store badges, a live status line — so the Huddle
composer's attach button shares it until its own stage. "Upload from this
device" stays, sent through the same link, in `DeviceVideoUpload`.
`existingVideoid` goes with its only caller: a link is one upload, and a
re-scan resumes it. Version 1.0.6 and its release note.
… closes on any done
The backend's outcome note is written for the status route ("Attached to
ticket <id>"); showing it put a raw id in front of people, and treating
it as a reason to stay open kept the modal from closing. The modal shows
the destination's label and closes a moment after any delivery.
openPulseAppOrStore returns a cleanup function that cancels its iOS App Store fallback and removes its listeners (src/lib/device.ts:199–209), but this call discards it. If the user changes tickets or leaves the component before the fallback settles, it can still redirect the new screen to the store. Retain the cleanup and call it on destination changes, unmount, and before another launch.
…d no device upload
The attachments panel of a ticket, a Redmine issue or a clock session is
"Links and videos" with a ButtonGroup of two chips: Link, a pasted URL in
a small modal, and Pulse. The clock session is a destination of its own
(an attachment on the uploader's own session). The ticket card no longer
places the button itself.
"Upload from this device" is gone from the Pulse modal and the Huddle
attach button: on a phone the link opens the Pulse app, on a computer the
modal shows the QR code, and a video comes from Pulse. The e2e helper
sends a ticket's video the way the app does, through its link.
Show expired status after the Huddle scan times out
src/features/huddle/PulseAttachButton.tsx:258
After the Huddle watcher's 30-minute timeout, it clears pending but leaves modalOpen and scanLink unchanged. This passes null, which the new modal renders as “Waiting for your upload…”, leaving an expired QR code looking usable indefinitely. Pass an expired status when the outstanding scan link times out, while preserving the successful state for completed uploads.
Keep the cleanup returned by openPulseAppOrStore. In iOS browsers it owns a store-redirect timer and global listeners (src/lib/device.ts:183–258). Discarding it lets a pending launch redirect to the App Store after this hook unmounts or changes destination. Cancel the previous launch when reopening the link, changing destinations, or unmounting.
…and a phone launch is cancelled
Beside the chip, where there is no modal, the same words as in the modal:
where the video landed, that it was kept, or that the link has expired.
The hook asks about the upload once at a time with a ten-second deadline,
aborts the question when the link is let go of, and keeps the cleanup a
browser-phone launch returns so a pending store fallback can't redirect
a later screen.
Link: saving waits at most three seconds for YouTube's title, and the
chip is busy while an add saves. The Huddle/Clock attach button shows an
expired link as such. Destinations check a ticket or session id as 24
hex characters, which is what ObjectId takes; isValidId also accepts
legacy Meteor ids, which turned a bad link into a server error.
If a reservation for destination A rejects after this hook switches to destination B, this catch displays A's error beside B's Pulse button. The success path already ignores stale results. Apply the same mounted/current-destination check before setting the error.
Add integration coverage for clock reservation and delivery ownership
meteor-backend/server/pulse-destinations.js:128
The new clock destination has no automated reserve/delivery coverage, unlike ticket delivery in tests/e2e/tickets/pulsevault.spec.ts and Redmine reservation authorization in meteor-backend/tests/attachments.test.ts. Add integration cases that attach to an owned session, reject another user's session at reservation, and report kept without attaching when the session is deleted before upload completion. These exercise the new ownership check and its delivery-time recheck, which the ticket-only hook tests do not cover.
Replies to the two "previously missed" findings in Copilot's last overview (no review threads). Both are fixed in 10a0b2f. Preserve and cancel openPulseAppOrStore cleanup: the hook keeps the function the browser-phone launch returns in a ref and calls it before another launch, when the destination changes, and on unmount, so a pending App Store fallback can't redirect a later screen. Show expired status after the Huddle scan times out:PulseAttachButton (still used by the Clock page's composer) records that its link ran out and passes { state: 'expired' } to the modal, which shows the shared expiry message instead of "Waiting for your upload…"; a new reservation clears it.
…n; the clock destination gets e2e coverage
A reservation that fails after the host moved on to another destination
no longer puts its error beside that destination's chip (unit test).
Two e2e cases for clock sessions: a video for the uploader's own session
is attached and another person's session is refused at reservation; a
session deleted while the video uploads is recorded kept, with nothing
attached.
Replies to the two "previously missed" findings in Copilot's review of 10a0b2f (no review threads). Both are addressed in 16c5d6b. Ignore stale reservation errors from previous destinations: the reserve's catch now makes the same mounted-and-same-destination check as the success path before setting the error; a unit test changes the destination while the reserve is pending, then fails it, and expects no error. Add integration coverage for clock reservation and delivery ownership: two e2e cases in tests/e2e/tickets/pulsevault.spec.ts — a video reserved for the uploader's own session lands in that session's attachments while another person's reservation for the same session is refused (forbidden); and a session deleted (directly in Mongo) between the link and the last byte ends kept with "Clock session not found", with nothing attached. Run at 16c5d6b: ticket spec 17/17 and the Redmine issue spec 18/18 (one flaky retry in an unrelated timer test), unit tests 12/12.
Canonicalize uppercase session IDs before delivery
meteor-backend/server/pulse-destinations.js:136
Uppercase hexadecimal IDs pass isObjectIdHex and find the session, but returning the original string makes delivery persist an uppercase attachedTo.id. Attachment listing matches that string exactly, while session IDs and deletion cleanup use lowercase toHexString() values (clock.js:178–187). Delivery therefore reports success for an attachment the normal session view cannot find or clean up. Return the canonical ID before signing the destination.
Show expired-link messaging outside the modal
src/features/huddle/PulseAttachButton.tsx:262
The new expiry state is only rendered inside the modal. Phone launches never open that modal, and expiry clears pending, which also removes the waiting row. Users therefore get no visible or announced explanation when their link stops working. Render the shared EXPIRED_MESSAGE beside the composer chip when expired && !modalOpen, in a live region; this also covers desktop users who closed the modal.
If a reservation fails before the destination changes, error remains populated and link is null. This effect then returns without clearing the error, so the next ticket displays the previous ticket's failure. The catch guard and existing test only cover failures arriving after the switch. Clear the error whenever destinationKey changes, independently of whether a link exists.
Cancel native launches when the destination changes
Native launches have no cancellation: launch.current stays a no-op, while openNativePulseOrStore awaits both its import and canOpenUrl before navigating (src/lib/device.ts:135–151). If the destination changes or the component unmounts during those awaits, it still opens the old destination's Pulse link or the store from the next screen. Pass a cancellation signal or launch-generation guard into the native helper and check it before openUrl.
…m admins', and a launch is cancellable
Reading, adding to or listing a clock session's attachments now needs to
be the session's owner or an admin of its team; until now any signed-in
person could list them by id. The e2e clock case checks an unrelated user
is refused.
Ticket and session ids are stored lowercase, as `toHexString` writes
them, so an uppercase id in a link can't deliver an attachment the
session's own view never finds. The Clock composer's attach button says
beside the chip when its link ran out. The hook clears an earlier
destination's error when the destination changes, and a native launch
takes an abort signal checked after its two awaits, so a change of
screen meanwhile opens nothing.
Replies to the four "previously missed" findings in Copilot's review of 16c5d6b (no review threads). All four are addressed in 5f55c25. Canonicalize uppercase session IDs: the ticket and clock checks lowercase the id before looking it up and sign the lowercase id into the token, matching toHexString. Expired-link messaging outside the modal:PulseAttachButton renders the shared EXPIRED_MESSAGE beside its chip, in a live region, whenever the link ran out and the modal isn't open. Clear stale errors when the destination changes: the hook clears error on every destination change, independently of whether a link exists. Cancel native launches when the destination changes:openNativePulseOrStore takes an AbortSignal, checked after its import and canOpenUrl awaits; the hook aborts it before another launch, on a destination change and on unmount (device.test.ts covers the aborted launch opening nothing). Run at 5f55c25: ticket spec 17/17 including the new refusals, unit tests 38/38 across the Pulse and device suites.
…s the Pulse logo and store badges from
PulseLogo.tsx and PulseStoreBadges.tsx import from @mieweb/pulsevault/assets, but only
meteor-backend/package.json declared the package. Local builds worked from leftover
node_modules; the Docker build (build-and-push) had nothing to resolve and failed. Pinned
exactly, like the backend.
…chments, like its team admins
assertCanReachSession compared against team.admins alone, so an org owner absent from that
list could neither list nor add attachments on a member's session. Uses isTeamAdminOrOrgOwner,
the same rule as the team methods and the frontend's TeamContext.
Two conflicts: release-notes/1.0.6.md, where main had started the 1.0.6 note with the
confetti and App Store changes and this branch had started it with Pulse (1.0.6 is not
tagged, so the two become one note with both), and the Playwright import line in
tests/e2e/tickets/helpers.ts, which now takes APIRequestContext, Page and Route.
The reason will be displayed to describe this comment to others. Learn more.
Checked against the preview deployment: both hosts up, ticket and clock-session videos delivered end to end through a reserved link, clock attachment permissions (owner, team admin, org owner allowed; others refused), status route, QR scan link, and older clients still sending existingVideoid. Meteor backend lint and typecheck are clean on the PR head. Not covered: the browser UI, the phone path into the Pulse app, and Redmine issues (no Redmine on the preview).
The red deploy-preview check is a Launchpad wait timeout; the container came up.
release-notes/1.0.6.md takes main's note as is: this branch's Huddle section described the
video posting itself, which is not the behaviour this PR will ship.
…writing
The Huddle message box and the Clock page's plan and wrap-up composer use the one Pulse
button from #658, reserving a library video. When PulseVault reports it landed, it joins the
composer as an attachment chip and the person types and sends the post; nothing posts
itself. The hook hands its host the settled link so the composer knows which video it was.
Gone: PulseAttachButton and pulseComposerUpload.ts (a localStorage reservation per
composer, restored on remount, polling media.list every 4 s), the Clock page's pending-
reservation gate, and this branch's earlier huddle destination with its server-side post
and the huddle.js extraction, which are back to main.
The modal and chip take the composer's own words (attached to your post), and the Huddle
button remounts after a post or a removed video so its landed line clears.
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
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.
Summary
Stage 2 of landing #615 in pieces, stacked on #654 (stage 1). One Pulse button, on tickets, Redmine issues and clock sessions, built on the destination the link now carries — and the attachments panel from #615 around it.
usePulseUpload(destination)reserves a link, shows the QR code on a computer or opens the Pulse app on a phone, and asks PulseVault's status route (with the upload's own token) where the video stands until it has landed or the link has expired. It keeps nothing across a reload and nothing outlives the component: the server delivers the video wherever the link said, whether or not anyone is watching. That is the whole difference from #615's hook — no detached watcher, no hand-off, no toasts — and frommain's button — no localStorage videoid cache, no polling of the attachments list.Screenshots
Taken on this branch against a local backend (ticket
#cf057, a real upload over tus to the link the button reserved, as the Pulse app sends it).Not pictured: the same panel on a clock session (same component,
kind="clock", on the Dashboard timesheet while clocked in), a Redmine issue (no Redmine here), and a phone, where the button opens the Pulse app instead of the modal and the chip shows the outcome beside itself.Changes
src/features/pulse-upload/:usePulseUpload.ts(the hook),PulseButton.tsx(PulseChip+PulseButton),PulseUploadModal.tsxrewritten as a presentational modal (QR, store badges, live status line, optional "Upload from this device"),PulseLogo.tsxandPulseStoreBadges.tsxfrom@mieweb/pulsevault/assets,pulseLinks.ts(the deep-link and scan-link builders, moved out of the button) andpulseStatus.ts(labels per destination kind, the kept message).PulseUploadButton.tsxis deleted.AttachmentsPanel(tickets, Redmine issues, clock sessions) is feat(pulse): make Pulse the only way to add video, delivered where it was started #615's: a "Links and videos" header with aButtonGroupof Link (LinkAttachButton, a pasted URL in a small modal, withlinkAttach.ts) and Pulse. The list is labelled "Attachments".TicketAttachmentsCardjust renders the panel.clockis a destination kind of its own on the backend: an attachment on the uploader's own session.PulseAttachButtonkeeps its behaviour minus the device upload: it imports the link builders frompulseLinks.tsand passes the modal its new props. It is replaced in stage 3.videoApi.statusreads the status route once;waitUntilFiled(still used by the profile feed) loops over it.existingVideoidis removed frompulsevault.reserveand its schema with its only caller. A link is one upload, and PulseVault'sreclaimresumes it on a re-scan.release-notes/1.0.6.md: the panel and the button change, the modal says when the video has landed, and device upload is gone from tickets.Testing
Local, backend on :3101 against a scratch MongoDB replica set with
VIDEOS_DIRset, frontend :3002 from the Playwright config:tests/e2e/tickets/pulsevault.spec.ts+huddle/pulsevault-video.spec.ts+huddle/composer-actions.spec.ts+redmine/issue-detail.spec.ts: all passed (final run of the ticket and Huddle video specs: 16/16; the Redmine spec 21/21 and composer actions 9/9 earlier in the same pass). The ticket video now reaches its attachments the way the Pulse app sends it — a link reserved for the ticket over REST and a tus upload through it (uploadVideoToTicket) — plus the chip opening the QR modal, the Link modal on a Redmine issue, and the kept case from A Pulse Link Carries Its Destination, and One Table Delivers It #654.vitest run src/features/pulse-upload: 9/9 — the links, the kept message, and the hook (opens the link for the pressed destination; drops a link that comes back after the destination changed; reopens the live link instead of minting a second).tsc --noEmit, ESLint on every changed file, Prettier,vite build(the badge assets are bundled, the 1.0.6 note is in the chunk): clean.npm run linton the whole tree reports errors only from a stale agent worktree under.claude/, not from the repo.Not run: an upload from the Pulse app on a phone; the Huddle composer's Pulse button in a browser (its change is two imports and the modal's props, checked by
tscand the composer e2e specs above).Later in the same PR (after a browser demo): the modal shows the destination's own label instead of the backend's note (which carried a raw ticket id) and closes on any delivery; then the device-upload fallback, the #615 attachments panel with Link + Pulse, and the
clockdestination.After Copilot's reviews (10a0b2f, 16c5d6b): the chip says every outcome beside itself when there is no modal (phones), sharing the modal's copy; one status check in flight with a 10 s deadline, aborted on cleanup; the browser-phone launch's cleanup is kept and cancelled on a new launch, a destination change or unmount; a stale reservation's error stays off the next destination; Link waits at most 3 s for a YouTube title and the chip is busy while an add saves; the Clock composer's attach button shows an expired link; ticket and clock ids are checked as 24 hex characters before
new ObjectId; e2e cases for the clock destination (own session attached, another's refused, deleted session kept). Unit tests 12/12; ticket spec 17/17, Redmine issue spec 18/18.After the Docker build failed and Copilot's review of 5f55c25 (27412f2, 2d396e5): the root
package.jsonnow declares@mieweb/pulsevault(exactly 0.5.0, like the backend), whichPulseLogo.tsxandPulseStoreBadges.tsximport the logo and store badges from; local builds had only worked from leftovernode_modules, sobuild-and-pushhad nothing to resolve. And an organization's owners can reach a clock session's attachments like its team admins (isTeamAdminOrOrgOwner, the rule the team methods andTeamContextuse). Run:tsc --noEmit,vitest run src/features/pulse-upload(12/12), Prettier,vite build(both badge assets in the bundle). The org-owner path is checked by reading; the attachments integration test needs the :3101 backend and was not re-run.#654 merged, so this PR now targets
main(f1a267e merges it in). Two conflicts:release-notes/1.0.6.md, where main had started the 1.0.6 note with the confetti and App Store changes (1.0.6 is not tagged, so the two are now one note with both, per the release-notes README), and the Playwright import line intests/e2e/tickets/helpers.ts. After a freshnpm installfor the merged manifest:tsc --noEmitclean,vitest run src/features/release-notes src/features/pulse-upload23/23, Prettier and ESLint clean on the two files.Next
Stage 3: the
huddledestination and the Pulse chip in the SuperChat composer, replacingPulseAttachButton.