Skip to content

feat(pulse): make Pulse the only way to add video, delivered where it was started - #615

Closed
morepriyam wants to merge 37 commits into
mainfrom
feat/pulse-only-video
Closed

morepriyam wants to merge 37 commits into
mainfrom
feat/pulse-only-video

Conversation

@morepriyam

@morepriyam morepriyam commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

https://youtube.com/shorts/F3Mz9VNJyBE?is=6dFf6Z59bM4e1sbw

Every video in TimeHuddle now comes from the Pulse app, and a Pulse upload lands where it was started, with no client step afterwards. This follows the model Pulse and PulseVault are built on: one link, one upload, one destination. The reservation says where the video goes, and the server delivers it the moment the upload completes.

Started from When the upload lands
Huddle: Pulse in the message box (Share an update, or post a Pulse…) Posted to the team, titled with the Pulse draft's name
Clock: Clock in with Pulse, in the Pulse section above the clock Becomes the plan post, and clocks you in
Clock: Clock out with Pulse, same section Added to the session's post as the wrap-up, and clocks you out
Ticket / Redmine issue / clock session: Pulse in Links and videos Attached there
Timesheet change: Pulse beside Pending approval Added to the pending request as the walkthrough the approver sees

It also upgrades PulseVault to 0.4.2 (from npm), removes every raw video upload, and removes the profile's Feed tab, which is being redesigned from scratch.

The Pulse popup (Clock in with Pulse) Pressed Pulse but typing instead: Write it instead
The Pulse popup: QR code, where the video goes, store badges Clock page composer: Your Pulse video is on its way, with Write it instead

Stack: this is PR 1 of 2. #616 (video cards) is stacked on it.
PulseVault: @mieweb/pulsevault 0.4.2 from npm. It carries mieweb/pulsevault#74 (0.4.0 crashed Meteor at boot) and mieweb/pulsevault#77, the Pulse asset pack: the Pulse logo and the App Store / Google Play badges that every Pulse button and popup here uses.

How it works

One Pulse upload, from the button to where it lands. The server does the delivery; the page only hands out the link and asks where the video went.

sequenceDiagram
    autonumber
    actor Person
    participant WebApp as TimeHuddle web
    participant Server as Meteor backend
    participant Vault as PulseVault (mounted in Meteor)
    participant PulseApp as Pulse app (phone)

    Person->>WebApp: Press Pulse (Huddle, Clock, ticket, Redmine issue, session, timesheet)
    WebApp->>Server: pulsevault.reserve({ destination })
    Server->>Server: Check the destination, save pulse_uploads as reserved
    Server-->>WebApp: videoid + upload token (30 min)
    WebApp-->>Person: QR code on a computer, or open Pulse on a phone
    Person->>PulseApp: Record, name the draft, upload
    PulseApp->>Vault: TUS upload (poster, captions, then the video)
    Vault->>Server: Upload complete
    Server->>Server: Claim it (delivering) and recheck the destination
    alt Destination still valid
        Server->>Server: Deliver: post, plan + clock in, wrap-up + clock out, attachment, or walkthrough
        Server->>Server: pulse_uploads is done
    else No longer valid
        Server->>Server: Keep it in the uploader's library, pulse_uploads is kept (with a reason)
    end
    loop Every 3 s while waiting
        WebApp->>Server: pulsevault.status(videoid)
    end
    Server-->>WebApp: done or kept
    WebApp-->>Person: "Posted to Huddle ✓", or why it was kept
Loading

Reading guide

One commit, reviewed best by area:

  1. PulseVault 0.4.2: meteor-backend/package.json and package.json (npm, ^0.4.2), the createPulseVaultCore config in pulsevault.js, pulse-link.js, pulsevault-docs.js.
  2. Destinations (server): pulse-destinations.js (new, one table of destination kinds), then pulsevault.js (the pulse_uploads record: reserve, claim and delivery, status, the sweep).
    • clock.js / huddle.js: clock.start, clock.stop and huddle.createPost are moved verbatim into plain exported functions (clockStart, clockStop, createHuddlePost) so the upload hook can reuse them. Their only change is taking userId instead of this. git diff --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change shows it.
  3. Pulse UI: PulseButton + PulseUploadModal + PulseLogo / PulseStoreBadges (the only Pulse controls now), and where they sit (pages/Huddle.tsx, ClockPage, AttachmentsPanel, ChangeRequestWalkthrough).
  4. Raw uploads removed: AttachmentBar, useAttachmentUpload, huddle/api.ts, uploads.js, TimesheetJustificationFields, and the timesheet panels.
  5. Profile: ProfilePage (Feed tab removed); ProfileFeed deleted.

Changes

PulseVault 0.4.2, from npm

  • meteor-backend takes @mieweb/pulsevault@^0.4.2 from npm, and the frontend imports the logo and store badges from @mieweb/pulsevault/assets. (A vendored submodule bridged the gap until 0.4.2 shipped; it's gone, and the workflows, Dockerfile and Vite config are as on main.)
  • Config, following the package's fastify-demo:
    • uploadUnit removed (0.4 refuses to boot with it). The QR link, /pulse/open and the API docs page drop it too.
    • All four artifact kinds allowed (video, beat manifest, captions, thumbnail).
    • retention on, so abandoned uploads are removed after a day.
    • ensureWebReady makes each video web-playable before it's delivered: a faststart remux, or HEVC → H.264. It needs ffmpeg and fails open without it.
  • Links: Pulse links (capability tokens) last 30 minutes, and a reservation expires 10 minutes after its link.
  • One record per upload: each Pulse upload is one pulse_uploads document, reserved → delivering → done | kept. It replaces the separate reservation and delivery collections; live reservations are migrated at startup, Redmine ones as redmine destinations.
    • Only a reserved record expires (TTL on expiresAt, set only in that state).
    • Finishing an upload claims it (findOneAndUpdate on reserved), so it's delivered once, and a crash after the claim can't strand the video. A sweep (at startup, then every 5 minutes) keeps any claim older than 30 minutes in the uploader's library and reports kept. It doesn't deliver again: a half-done delivery may already have posted. It keeps the video before settling, so a failed library write is retried by the next sweep, and an upload only settles out of delivering, so an outcome is never overwritten.
    • Delivery runs after Pulse's final request is answered. The web-ready conversion runs only for claimed uploads, one at a time.
  • QR links are built from the Meteor backend URL, instead of the old Fastify localhost:4000 default.

Destinations (pulse-destinations.js)

  • pulsevault.reserve({ destination }) checks the destination when the upload is reserved, so a bad one fails before anyone records:

    • huddle: team membership;
    • clock-plan / clock-wrapup: the team, or your own open session;
    • ticket: exists, and you can see its team's tickets (the same check as tickets.list);
    • redmine: your Redmine key can see the issue (the same check as attachments.add);
    • clock: your session;
    • timesheet-request: your pending request.

    Each kind is one entry in a table (resolve + deliver), so the schema's list of kinds comes from it. The old target / ticketId / clockEventId arguments and pulsevault.reserveForLibrary are gone: the app only ever sent destination.

  • onUploadComplete delivers it:

    • huddle: a new post, with the draft name as its text;
    • clock-plan: a plan post, then clockStart. It only looks at its own team, like clocking in by hand: already clocked in to this team, the plan joins that shift; clocked in and back out of this team by hand since the link was made, the plan posts without clocking in again, and the popup says why. Another team's shift doesn't block it (how clocks work across teams is Make the Clock Per-Team End to End: Server, Live Updates and UI #642);
    • clock-wrapup: the video and a **Wrap-up:** … line added to the session's post, wrapUpAt set, then clockStop. If you ended that session by hand and started another in the same team, the wrap-up still lands on its post and the popup says the new shift is still running;
    • ticket / redmine / clock: an attachment;
    • timesheet-request: videoUrl set on the request while it's still pending.
  • If the clock step fails after the post is written, the video still counts as delivered, and the popup says what didn't happen ("Plan posted, but you weren't clocked in: …").

  • Huddle/Clock videos also get a media item, recording the team they were posted to. Listing someone else's library (media.listForUser) shows only what they posted to one of their teams you can access (as a member or admin, or through the org or enterprise: buildTeamAbility). Anything with no team (composer images and documents, kept videos, API-library uploads) stays private to the owner.

  • A video is never lost. Delivery rechecks the destination, the same way for every kind (team checks use Huddle's requireTeamMember, so string team ids work too). If it stopped being valid while the video was recorded (the session or ticket was deleted, the change was already reviewed, you were removed from the team), the video is kept in your media library, tagged with the destination it was recorded for, and the popup says why. Library items are one per video, so a half-finished delivery can't create a duplicate.

  • New pulsevault.status({ videoid }) returns waiting, done (with a note when a step after delivery failed), kept (with a reason) or expired, so the popup can say "Posted ✓" or explain where the video went. It's one read of the upload's record.

  • Removed existingVideoid and the per-ticket id reuse: one link is one upload.

Clock across teams: see #642. This PR doesn't change how clocking in works across teams. A one-open-shift rule was tried here (893bc34) and reverted (6f63c13): the clock is per team on the server but global in the UI, and the direction is per team end to end, written up with diagrams in #642.

Pulse only

  • Gone:
    • the composer Video button (Huddle and Clock);
    • Upload from this device in the Pulse modal;
    • profile video upload;
    • the timesheet walkthrough file picker;
    • video types on /api/media/upload;
    • tus-js-client;
    • the /api/media-thumbnail route. It and videoThumbnail.ts are archived in .attic/raw-video-uploads/ with a README.
  • Dropped or pasted video files get a message pointing to Pulse instead of uploading, in the Clock composer and Huddle's message box alike. Huddle's box also shows its other rejections (too large, too many files), which it used to drop silently.
  • authorize refuses a new upload without Pulse's Pulse-Client header (Pulse 2.1+ sends it). The capability token is still the real check, so a missing token stays 401.
  • The rule that adding past time needs a video is gone, frontend and backend. The reason is written; the walkthrough is optional and added afterwards with Pulse.
  • media.remove only takes an item out of the library. A Pulse video stays where it was posted: videos are team knowledge (Pulse Rework: Reliable Huddle Videos, One Video Card, Full-Screen Viewer, Videos Feed and Shareable Video Links #617). The old code rm'd a path that didn't exist, so it never deleted anything anyway.

UI

  • One usePulseUpload hook and PulseButton replace PulseAttachButton and PulseUploadButton. No localStorage reservations (pulseComposerUpload.ts is deleted) and no attaching.
    • The hook reserves, opens the link, and asks pulsevault.status every 3 s while the upload is waiting, with the popup open or not, since phones have none.
    • It tells its host done or kept once the person has seen the result: after the popup closes, or at once on a phone. Hosts refresh only for what they need: a walkthrough is marked added only on done.
    • Pressing Pulse again while its link is still live reopens that link instead of minting a second one.
    • The Clock page owns the hook itself, so the popup and the watch survive clocking in or out. While a Pulse plan or wrap-up is on its way, typed posting waits for it; Write it instead lets go of a link you won't record (a video that still lands is delivered and toasted).
    • A watch that has been handed off stops after about 10 minutes of failed checks (signed out, account switched) instead of polling for the tab's life.
  • One Pulse button: a Pulse chip with the Pulse logo, styled like the chips beside it (Ticket, Link). Its accessible name says what it does ("Add a video with Pulse"). The logo comes from PulseVault's asset pack.
  • One Pulse modal: the QR code, then three short lines: "Scan with your phone to record in Pulse.", where this video goes once it uploads (per destination: "It's posted to Huddle as soon as it uploads.", "It's added to this ticket…") with "Your Pulse draft's name becomes the video's title.", and "No Pulse app yet?" over the App Store and Google Play badges. Then a live status line and "Posted ✓" when the video lands. One close button (the header's ×), and no divider under the title.
  • Clock page: a Pulse section above the clock: "Record your plan" / "Record your wrap-up", with Clock in with Pulse / Clock out with Pulse as the same large pill as Clock in. It shows whether or not the team requires a plan.
  • Huddle: main's SuperChat message box. Pulse sits after its +, behind a "/", and the placeholder reads Share an update, or post a Pulse…. A Pulse video posts itself, so nothing typed goes with it, and the box doesn't take video files.
  • Tickets, Redmine issues and clock sessions: a Links and videos block with Link (a plain URL field; YouTube titles are looked up) and Pulse. Clock sessions can now take Pulse videos (a new clock destination, your own sessions only).
  • Timesheet walkthrough: ChangeRequestWalkthrough shows beside Pending approval in the personal timesheet, on pending additions, on awaiting work items, and in the admin panel's "sent for approval" notice. Next to Withdraw or a work item's menu, the two sit in a ButtonGroup.
  • Clock-page composer: Photo · Doc · Ticket · @Mention. Links go in the post text. A typed wrap-up adds its attachments to the plan post instead of replacing them, so a Pulse plan's video stays on it.

Profile: Feed tab removed

  • The profile's Feed tab is being redesigned from scratch, so it comes off the page. Profiles open on Work, and an old ?tab=feed link lands there too. ProfileFeed is deleted.
  • media.list is as on main; media.listForUser now scopes another person's view by team (above). Pulse deliveries still record media items, and media.remove still never deletes a Pulse video.
  • A video kept because it couldn't reach its destination now says "It's saved, not lost." instead of pointing at a tab that no longer exists.

Release: release-notes/1.0.6.md (main shipped 1.0.5 as the Redmine release). package.json stays 1.0.5 until the release step.

Not in this PR

  • Video cards (thumbnail + play) in Huddle and attachments: Pulse Videos Play Inline With Their Thumbnail, Wherever They Show #616. Here, a Pulse video in a post or attachment list is still a link.
  • ffmpeg in the production image. Pulse 2.1+ records (use-recorder.ts) and exports (its 1080×1920 H.264 contract) H.264 on both platforms, and real iPhone uploads arrived as H.264, so they play everywhere without it. ffmpeg is only a safety net for a rare clip where Pulse's H.264 setting doesn't apply; tracked in Pulse Rework: Reliable Huddle Videos, One Video Card, Full-Screen Viewer, Videos Feed and Shareable Video Links #617.
  • Pulse only sends a draft name when the draft has been named, so unnamed uploads post with empty text. That's a Pulse-side follow-up.
  • meteor-backend/tests/timesheet-approvals.test.ts: its fixture cites a non-UUID artifact id, which PulseVault no longer accepts, so its review-queue tests fail in a fresh environment, on main too. This PR updates the media.remove assertion; rebuilding the fixture is a separate fix.
  • VIDEOS_DIR and UPLOADS_DIR default to the server's working directory, as on main. Production should set both outside the checkout and the Meteor build directory.

Testing

Static checks: npm run typecheck, npm run lint and npm run format are clean, and the unit tests pass (193 of 193). PulseVault's own suite passed on mieweb/pulsevault#74 (172 of 172). After re-pinning to v0.4.1 (build checks and tests only, no runtime change since #74), the backend boots and the Pulse specs pass again (14 of 14).

e2e on this branch: the Pulse, composer and deep-link specs (tickets/pulsevault, huddle/pulsevault-video, huddle/composer-{actions,responsive,paste,failures}, notifications/deep-links). 45 passed and 2 were flaky; both flaky tests timed out loading the page before reaching their assertions, and passed on retry. They cover:

  • reserve → TUS upload as Pulse, for each destination:
    • huddle post;
    • plan → clocked in, then wrap-up → clocked out;
    • ticket attachment;
  • the 403 for an upload without the Pulse-Client header;
  • no device upload in the modal;
  • video files refused by the composer;
  • the media library tab.

Full e2e suite, run on #616's branch (all of this PR plus the card): 184 passed, 6 flaky, 6 skipped, 7 failed.

  • 6 of the failures need a mail server: auth/password-reset ×2 and organizations/org-invite-by-email ×4. They fail here with ECONNREFUSED :587 because no SMTP server was running.
  • The 7th was notifications/deep-links still looking for the old Feed tab. It's fixed in this PR and passes (above).
  • The 6 flaky tests each failed once on a dropped sign-in or a slow page load, then passed on retry.

After the review fixes (e7d7027):

  • typecheck, lint and format are clean, and the unit tests pass (193 of 193);
  • the Pulse specs pass, 15 of 15, including the new test for a wrap-up whose session is deleted before it lands;
  • the Huddle and timesheet specs: 60 passed, 2 skipped and 3 flaky. The 3 flaky ones are 2 dropped sign-ins, and a dialog still covering the ticket list during one test's setup; all 3 passed on retry.

After the second review round (ec2dc94):

  • typecheck, lint and format are clean, and the unit tests pass (195 of 195);
  • the Pulse specs pass, 16 of 16, plus the new link-reuse test. The new tests cover:
    • leaving the team before a wrap-up lands;
    • a session deleted before its video lands;
    • pressing Pulse twice, which makes exactly one reserve call. I checked that this test fails without the fix.

After the third review round (b38e373):

  • typecheck, lint and format are clean, and the unit tests pass (195 of 195);

  • the Pulse, composer, plan-first, deep-link and timesheet specs: 54 passed and 2 flaky. The 2 flaky ones are the plan-first settings toggle and a deep-link dashboard tap, neither of them Pulse, and both passed on retry. The new tests cover:

    • reserving with a missing or unknown destination;
    • the open popup saying "Added" and the ticket's list showing the video without a reload, and saying "kept" with the reason when the ticket was deleted first;
    • removing a video from the media library, after which its post still plays it;
    • a second Pulse plan while already clocked in, which joins the open session.
  • Copilot's review of b38e373, fixed in 3ddd57f:

    • ticket uploads use tickets.list's access rule rather than direct team membership;
    • the Link popup ignores Enter while a link is still being added.

    The ticket Pulse specs pass, 14 of 14.

  • the full e2e suite, run on Pulse Videos Play Inline With Their Thumbnail, Wherever They Show #616's branch (this PR plus the cards): 193 passed, 8 flaky, 6 skipped and 6 failed. The 6 failures need a mail server (auth/password-reset ×2, organizations/org-invite-by-email ×4), as before. The 8 flaky tests each passed on retry: slow first loads and dropped sign-ins in auth, inbox filters, plan-first, notifications and team settings, plus the new poster test, whose cleanup found the page signed out.

After testing every Pulse scenario by hand in Chrome (638736d). Each scenario pressed Pulse in the real page and then sent the poster frame and video the way Pulse does (pulse-sim.sh), against fresh local servers. Two bugs turned up and are fixed:

  • A Pulse wrap-up's popup lost its upload when it clocked you out. The wrap-up's destination was built from the open session, so clocking out (which the wrap-up does) changed it. The popup went from "Waiting" to closed without "Wrap-up posted — you're clocked out", and the page didn't refresh. The Clock page now keeps the session the wrap-up is for. A new e2e test presses the Clock page's Pulse buttons for a plan and then a wrap-up; it fails without the fix.
  • A walkthrough sent after its change was reviewed told the person nothing. The approval refreshes the requester's list and removes the pending row, and its Pulse button with it. A Pulse button that goes away while its video is on its way now keeps watching and reports the result as a toast (@mieweb/ui ToastProvider, mounted in AppLayout). The same happens if you leave the page mid-upload.

Passing by hand:

  • every destination (Huddle, plan, wrap-up, ticket, clock session, timesheet walkthrough);
  • the popup's waiting → landed → closes, and reopening a live link instead of minting a second;
  • typed posting waiting while a Pulse plan is on its way;
  • kept for a deleted ticket, a deleted session, a removed member, and a reviewed change;
  • an expired link, then a new one;
  • the phone layout (kept reason beside the button);
  • a second plan joining the open session;
  • the media library, including a kept walkthrough hidden from a teammate;
  • removing a library item leaves its post playing;
  • an HEVC upload converted to H.264 and playing in Chrome;
  • a stuck claim swept into the library on restart;
  • a reservation from before the deploy migrated and delivered.

The Pulse specs pass, 25 of 25 (24 plus one retry for a ticket list slow to load during setup).

On the deployed preview and its image (0cd2dce).

  • The PR preview (Pulse Videos Play Inline With Their Thumbnail, Wherever They Show #616's, which carries this PR): every scenario above passed in the browser or against the API, except iPhone (HEVC) playback. The preview image has no ffmpeg, so an HEVC upload stays HEVC.
  • Link expiry on the preview: an upload on a 30-minute-old link is refused (403), and status reports expired at 40 minutes.
  • The preview's own image (ghcr.io/mieweb/timehuddle:pr-616), run locally to reach its database:
    • a claim stuck for 31 minutes is kept in the library at startup with the "interrupted" reason;
    • a reservation in the old collection is migrated and still delivers after the restart;
    • with ffmpeg installed in the image (present when the process starts), HEVC is converted to H.264 and plays in Chrome. Adding ffmpeg to the runtime stage of the Dockerfile is all iPhone videos need.
  • A Pulse plan or wrap-up that posts but can't clock you in or out: triggered with a team whose _id is a string, which Pulse's checks accept but clockStart doesn't. The popup used to say "Plan posted — you're clocked in" above a note saying you weren't. Now it shows only "Plan posted, but you weren't clocked in. Clock in from the Clock page."

By hand, against a dev backend: uploads sent the way Pulse sends them gave:

  • a Huddle post titled with the draft name;
  • a plan that clocked in, then a wrap-up that clocked out, leaving one session post with the plan and wrap-up text and both videos;
  • a pending timesheet request that got its videoUrl.

The Pulse button showed beside the Huddle composer and nowhere in it (before the merge with main's SuperChat composer).

Real-device testing on the preview (Pulse 2.1 on an iPhone):

  • Desktop QR flow: the popup went from "Waiting" to "Posted to Huddle" and closed. The post had the draft name, Pulse's real poster frame, and played inline.
  • iPhone Safari: Pulse opened (after iOS's "Open in Pulse?" prompt, which iOS shows for any custom scheme; Universal Links would remove it, as a follow-up). Posts appeared without a refresh.
  • Deliveries: 3 Huddle posts, 2 sessions with a Pulse plan and Pulse wrap-up (one post per session, clocked in and out), and a ticket video were all delivered. Every file was H.264 + AAC, and every poster resolved.
  • Found and fixed (ed68fca): a Pulse plan followed by a typed wrap-up created a second post when the plan's post hadn't arrived over DDP. The typed wrap-up now uses the post the page fetches over REST.

After removing the Feed tab (67c3985):

Fourth round: UI pass, main merged, Copilot's fourth review (08dc462 … af8f6d9):

  • UI: the one Pulse button, the Clock page's Pulse section, the shorter popup with the store badges, and the Huddle message box placement, all described under UI above.
  • main merged in (bce05e4): Pulse keeps this PR's model in main's new places. In Huddle, PulseAttachButton and its staging of a video into the next message (pulseVideos, pulsePending, clearComposerPulseUpload) are replaced by the Pulse button. On ticket pages, TicketAttachmentsCard drops PulseUploadButton. Redmine issues get a redmine destination instead of main's reserve target.
  • Copilot's review, fixed in 08dc462:
    • a video that has landed can't be deleted with its link's token (409); cancelling an unfinished upload still works;
    • a second walkthrough never replaces the first; it's kept instead;
    • a wrap-up appends to the post as stored (an update pipeline), so a concurrent plan edit isn't lost;
    • data/videos/ (the default VIDEOS_DIR) is git-ignored, so a deploy's git clean -fd can't remove it;
    • a pending link whose destination changes (another ticket, past midnight) is still watched and reported;
    • the Link modal's buttons sit in a ButtonGroup.
  • PulseVault from npm (cfac2a7): 0.4.2 is released, so vendor/pulsevault and scripts/build-pulsevault.sh are removed, and every file that only existed to fetch or build them (workflows, Dockerfile, .dockerignore, .gitmodules, vite.config.ts) matches main again. Meteor boots on the npm package (protocol 2.2), and the production build bundles the badges from it.
  • Tests: typecheck, lint and format are clean, and the unit tests pass (354 of 354). The Pulse specs pass, 25 of 25, and the composer and plan-first specs pass, 12 of 12 (one plan-first test passed on retry). Clock-page specs that looked up "Clock in" now match it exactly, since "Clock in with Pulse" is on the page too.
  • By hand in Chrome: the Clock page (desktop and phone, light and dark), the Huddle message box, and the popup for Huddle and for Clock in.

Fifth round: Copilot's review of af8f6d9 (fc7f124, ff3439b):

  • meteor-backend/tests/attachments.test.ts (from main) reserved a Redmine upload with the removed target / ticketId shape; it now sends a redmine destination and checks pulse_uploads. It passes, 5 of 5, against the running backend.
  • package.json and its lockfile are 1.0.6, matching the release note.
  • Link and Pulse sit in a ButtonGroup, and the attachments list is labelled "Attachments".
  • main's Redmine issue-detail spec now uses the Pulse chip and the Link modal; 19 of 19 pass.
  • Tests on the npm package: typecheck, lint and format are clean, and the unit tests pass (354 of 354). The Pulse specs pass, 23 of 23, and the inbox, composer and ticket-detail specs pass, 24 of 24 (one ticket-detail sidebar test passed on retry).

Sixth round: Copilot's review of ff3439b (8dcdb5d):

  • a Pulse plan that lands while you're clocked in to another team posts, but doesn't open a second session; the popup says why;
  • a detached Pulse watch polls until the upload is settled or expired, not just for the link's 30 minutes;
  • the API docs say a timesheet change's video is optional, and useFileUploadLauncher.ts (only the Feed tab used it) is deleted.
  • unit tests pass (354 of 354); the Pulse specs pass, 23 of 23 (one API-contract test passed on retry, as the backend was restarting).

Seventh round and final pass: Copilot's reviews of ebde85e … 67c2f97, and a full review of both PRs (75fc870 … 5c0449f):

  • Fixed:
    • a reservation from before the deploy for a Redmine issue migrates as a redmine destination (it became a Huddle ticket);
    • a Pulse plan that lands after you clocked in and back out by hand no longer clocks you in again; a wrap-up after a newer shift has started says so;
    • Huddle's message box says why it turned a file away (a video gets the Pulse message);
    • teammates only see library videos posted to a team they share, and a kept video stays private even after a half-done delivery;
    • Write it instead, so pressing Pulse and not recording doesn't hold the plan/wrap-up composer for the link's life (40 minutes);
    • a typed wrap-up keeps the plan post's attachments;
    • the abandoned-claim sweep can't overwrite a delivery that just finished, and a failed library write is retried;
    • small ones: a handed-off watch gives up after ~10 minutes of failed checks, a Meteor.Error without a reason no longer turns a delivered video into kept, constructor as a destination kind is a bad request rather than a 500, one team-membership helper instead of two, and ButtonGroups around the walkthrough's neighbours.
  • Tests: typecheck, lint and format are clean, and the unit tests pass (357 of 357, with a new one for the composer's rejection messages). On an isolated timehuddle_test backend:
    • the Pulse, composer and timesheet specs: 38 passed, 1 flaky (the first Huddle post after setup, which then passed 27 of 27 with --repeat-each=3 and no retries);
    • the Pulse specs again after the last fixes: 23 of 23, plus the new Write it instead test (pressing Pulse, closing the popup, the post button waiting, then the button releasing it);
    • the timesheet and timers specs after the ButtonGroup change: 18 passed, 1 flaky (passed on retry).
  • Checked directly against the server:
    • legacy Redmine, ticket and library reservations migrate to the right destinations;
    • a plan landing after a hand-worked shift, a normal plan, and a link from before the change (no reservedAt) each behave as described;
    • a teammate's library listing (photo and shared-team video only), a kept video's teamId cleared, a late wrap-up's note, and a typed wrap-up appending to the plan's attachments while a normal edit still replaces them.
  • By hand in the browser: the popup without its title divider, and a video dropped into Huddle's message box showing the Pulse message.

One open shift per person (893bc34), then reverted (6f63c13): the rule moved to #642. After the revert, every reverted file matches its version before 893bc34; the unit tests pass (359 of 359), the clock, plan-gate, timers, clock-timer and media-library backend tests pass (41 of 41), and the Pulse, plan-first and timers specs pass, 29 passed and 2 flaky (passed on retry).

After Copilot's review of 893bc34 (3fb85f9): another person's library no longer exposes composer images and documents (a row without a video isn't a profile photo), and team access now goes through buildTeamAbility, so team admins and org or enterprise admins count. New backend tests (media-library.test.ts, 3 of 3): the owner sees everything, a team admin who isn't a member sees only their team's video, and someone with no team in common is refused.

After Copilot's review of 3fb85f9 (1437f27):

  • a cancel (TUS DELETE) and a completing upload can't both win: the delete marks the upload in the same write that finds it unlanded, and a claim skips a marked upload. Uploading it again clears the mark, so cancel-and-retry still delivers;
  • buildTeamAbility finds teams with a string _id, so older teams work in the media library and every other caller;
  • a reserve that returns after the destination changed (or the page went away) is dropped instead of opened.
  • Tests: new e2e for a delete marked as the last chunk lands (not delivered; delivered without the fix) and for cancel-then-upload-again (delivered), and a hook unit test for the late reserve (fails without the fix). The Pulse specs pass, 26 of 26; unit tests 360 of 360; tickets, media-library and clock backend tests 47 of 47.

Not tested:

  • Android Chrome, a timesheet walkthrough from a phone, an upload interrupted mid-way, and Firefox playback of a phone recording;
  • a Pulse plan followed by a typed wrap-up, retested after ed68fca;
  • a failed delivery other than a deleted session or ticket, or a removed member (the e2e tests cover those);
  • a Pulse video on a Redmine issue (needs a Redmine connection), and the store badges' links on a phone;
  • a video that still lands after Write it instead (it's delivered as usual, so the session can end up with the typed plan and the Pulse plan);
  • the startup migration against production data. It's logged per shift it closes, and it runs before the index, so a failure leaves the old behaviour rather than blocking startup.

… was started

Upgrade PulseVault to 0.4 (vendored as a submodule and built with
scripts/build-pulsevault.sh), and treat a Pulse upload as "one link, one
upload, one destination": every reservation says where the video goes, and
the server delivers it when the upload lands (pulse-destinations.js).

- Huddle: Pulse beside "Share an update…" posts the video to the team.
- Clock: Pulse beside the plan/wrap-up buttons makes the video the plan
  (clocks in) or the wrap-up (clocks out).
- Tickets and clock sessions: Pulse and a plain-URL Link in "Links and
  videos"; the video is attached there.
- Timesheet changes: add a Pulse walkthrough to a pending request.

Raw video uploads are gone (composer Video button, drag/paste, "Upload from
this device", profile video, the timesheet file picker, video types on
/api/media/upload, tus-js-client); PulseVault only accepts creates that carry
Pulse's Pulse-Client header. The profile's Feed becomes the Media library,
including ticket and clock-session videos for teammates on those teams.

Also: the PulseVault 0.4 config (uploadUnit removed, all artifact kinds,
retention, ensureWebReady, 30-minute links), QR links built from the Meteor
backend URL, media.remove deleting the video through PulseVault, and Vite's
dependency scan limited to index.html. Release 1.0.5.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 00:39
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

🚀 Preview Deployment Ready

Service URL
App https://mieweb-timehuddle-feat-pulse-only-video.os.mieweb.org
API (Meteor) https://mieweb-timehuddle-feat-pulse-only-video-api.os.mieweb.org

Preview auto-deletes when this PR is closed.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Destination delivery and mobile refresh paths can report success while leaving the UI stale or the video undelivered.

Review effort: Balanced
Findings: 6 Medium severity

Open (6)
What changed in this PR

Makes Pulse the sole video-ingestion path and delivers uploads directly to their reserved destination.

Changes:

  • Adds destination-aware Pulse uploads for Huddle, clocks, tickets, and timesheets.
  • Removes browser video uploads and adds a unified Pulse UI.
  • Expands profiles into media libraries and vendors PulseVault 0.4.1.
File Description
vite.config.ts Limits Vite dependency scanning.
tests/​e2e/​tickets/​pulsevault.spec.ts Updates Pulse API/UI coverage.
tests/​e2e/​tickets/​helpers.ts Adds Pulse upload helpers.
tests/​e2e/​notifications/​deep-links.spec.ts Updates Media library tab assertion.
tests/​e2e/​huddle/​pulsevault-video.spec.ts Tests destination delivery.
tests/​e2e/​huddle/​helpers.ts Updates Huddle test helpers.
tests/​e2e/​huddle/​composer-responsive.spec.ts Updates responsive Pulse assertions.
tests/​e2e/​huddle/​composer-actions.spec.ts Replaces video-upload coverage.
src/​pages/​Huddle.tsx Enables team Pulse posting.
src/​lib/​useFileUploadLauncher.ts Restricts media picker to images.
src/​lib/​timesheetApproval.ts Removes required-video policy.
src/​lib/​api.ts Adds Pulse destination/status APIs.
src/​features/​timers/​WorkPage.tsx Adds pending-request walkthroughs.
src/​features/​tickets/​TicketsPage.tsx Consolidates ticket attachment controls.
src/​features/​tickets/​TicketDetailPage.tsx Uses unified attachments panel.
src/​features/​teams/​AdminTimesheetPanel.tsx Adds admin walkthrough control.
src/​features/​pulse-upload/​PulseUploadModal.tsx Simplifies modal to QR/status.
src/​features/​pulse-upload/​PulseUploadButton.tsx Removes legacy ticket uploader.
src/​features/​pulse-upload/​pulseLinks.ts Centralizes Pulse links.
src/​features/​pulse-upload/​pulseLinks.test.ts Updates link protocol tests.
src/​features/​pulse-upload/​PulseButton.tsx Adds unified destination button.
src/​features/​profile/​ProfilePage.tsx Renames Feed to Media library.
src/​features/​profile/​ProfileFeed.tsx Lists broader media sources.
src/​features/​huddle/​useAttachmentUpload.ts Rejects raw video files.
src/​features/​huddle/​pulseComposerUpload.ts Removes client reservation persistence.
src/​features/​huddle/​PulseAttachButton.tsx Removes composer Pulse attachment flow.
src/​features/​huddle/​HuddleComposer.tsx Moves Pulse outside composer content.
src/​features/​huddle/​ComposerAttachments.tsx Removes embedded Pulse control.
src/​features/​huddle/​AttachmentBar.tsx Removes video picker.
src/​features/​huddle/​api.ts Removes TUS video uploads.
src/​features/​clock/​TimesheetRow.tsx Adds pending-action slot.
src/​features/​clock/​TimesheetJustificationFields.tsx Keeps written justification only.
src/​features/​clock/​PersonalTimesheetPanel.tsx Adds walkthrough actions.
src/​features/​clock/​LinkAttachButton.tsx Adds URL attachment modal.
src/​features/​clock/​linkAttach.ts Validates pasted links.
src/​features/​clock/​ClockPage.tsx Adds Pulse plan/wrap-up actions.
src/​features/​clock/​ChangeRequestWalkthrough.tsx Adds timesheet Pulse destination UI.
src/​features/​clock/​AttachmentsPanel.tsx Unifies link and Pulse controls.
scripts/​build-pulsevault.sh Builds vendored PulseVault.
release-notes/​1.0.5.md Documents the release.
package.json Bumps version and removes TUS.
meteor-backend/​tests/​timesheet-approvals.test.ts Tests optional walkthroughs.
meteor-backend/​server/​uploads.js Expands library and removal behavior.
meteor-backend/​server/​timesheet-change-requests.js Makes videos optional.
meteor-backend/​server/​pulsevault-docs.js Updates protocol documentation.
meteor-backend/​server/​pulse-link.js Updates forwarded link parameters.
meteor-backend/​server/​pulse-destinations.js Implements destination delivery.
meteor-backend/​server/​main.js Exposes reservation/status schemas.
meteor-backend/​server/​huddle.js Extracts reusable post creation.
meteor-backend/​server/​clock.js Extracts reusable clock operations.
meteor-backend/​package.json Uses vendored PulseVault.
Dockerfile Builds PulseVault in images.
.gitmodules Adds PulseVault submodule.
vendor/​pulsevault Pins PulseVault 0.4.1.
.github/​workflows/​pr-preview.yml Initializes PulseVault in previews.
.github/​workflows/​main.yml Builds PulseVault in CI/deploys.
.github/​workflows/​ci.yml Builds PulseVault for development deploys.
.dockerignore Excludes PulseVault build artifacts.
.attic/​raw-video-uploads/​videoThumbnail.ts Archives thumbnail extraction.
.attic/​raw-video-uploads/​README.md Documents archived upload code.
.attic/​raw-video-uploads/​media-thumbnail-route.js Archives thumbnail endpoint.
Files not reviewed (1)
  • meteor-backend/package-lock.json: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread meteor-backend/server/uploads.js Resolved
Comment thread src/features/clock/ClockPage.tsx Resolved
Comment thread src/pages/Huddle.tsx Resolved
- A Pulse video that can't reach its destination (session deleted, change
  already reviewed, uploader left the team) is kept in the uploader's media
  library with the destination it was recorded for, never thrown away, and
  pulsevault.status reports `kept` with the reason. The popup (or, on a
  phone, the line beside the button) says so instead of "Posted".
- Library items are one per video, so keeping a video after a half-finished
  delivery can't add a second.
- PulseButton keeps checking while an upload is waiting and the page is
  visible, not only while its modal is open: phones have no modal.
- The Clock page and the Huddle feed refresh when a Pulse plan, wrap-up or
  post lands, in case DDP dropped while in the Pulse app. Clock-out's
  refresh is now one shared refreshAfterClockChange.
- The media library filters a teammate's view by team before applying the
  limit, so videos on other teams can't crowd out the ones they can see.
- Timesheet walkthroughs stay between the uploader and the approver: the
  release note and code comments no longer say they're in the library.
- e2e: a wrap-up whose session is deleted before it lands is kept, and
  status says why.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 02:52

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Destination revalidation and reservation lifecycle defects can permit unauthorized writes, orphan attachments, duplicate delivery, and stale in-memory state.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
Resolved since last review (6)
Files not reviewed (1)
  • meteor-backend/package-lock.json: Generated file
Previously missed (2)

In code that hasn't changed since last review

Medium severity Expire abandoned reservations from the in-memory map

meteor-backend/​server/​pulsevault.js:674

Every reservation is added to reservationContext, but abandoned uploads are removed only from Mongo by the TTL index; the in-memory Map is deleted from only when an upload completes. Normal expired/abandoned links therefore accumulate for the lifetime of the process, and peekReservation continues returning waiting even after Mongo expires them. Add an in-memory expiry/sweeper (including rehydrated entries) tied to RESERVATION_TTL_SECONDS.

Medium severity Prevent duplicate reservations for an existing upload

src/​features/​pulse-upload/​PulseButton.tsx:114

This always creates a new reservation even when this button is already watching a waiting upload. After closing the desktop modal or returning on mobile, a second press replaces upload in state but leaves the first capability active; both can still deliver, causing duplicate posts/clock actions while onLanded observes only the second. Reopen the existing pairing link or explicitly cancel/expire it before reserving another.

- Delivery rechecks the destination: a wrap-up whose uploader left the team,
  and a ticket or session attachment whose target was deleted, are kept in
  the uploader's library (status `kept`) instead of written anyway.
- Reservations live only in Mongo, which expires them with their link; the
  in-memory copy never did, so an abandoned link stayed "waiting" for the
  life of the process. Taking a reservation is one findOneAndDelete, so two
  paths finishing the same upload can't both deliver it.
- Pressing Pulse again while its link is still live and waiting reopens that
  link instead of minting a second one that could also land.
- The kept message ends the server's reason with a period.
- Tests: a unit test for the kept message; e2e for leaving the team and a
  deleted session before the video lands, and for pressing Pulse twice.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 03:18
morepriyam added a commit that referenced this pull request Oct 1, 2026
…est playback

- linkThumbnail no longer swallows a failed related-artifact read: the
  thumbnail upload fails instead of reporting success, and the one-time
  backfill stops without recording itself done, so it runs again at the
  next start.
- It also stops using the in-memory reservation cache, which #615 removed.
- The ticket attachment test clicks the poster and checks the inline player
  loads this video's PulseVault artifact.
@morepriyam

Copy link
Copy Markdown
Collaborator Author

Replies to the two "previously missed" findings in Copilot's latest overview. They have no review thread, so I'm answering them here. Both are fixed in ec2dc94.

Expire abandoned reservations from the in-memory map: the in-memory map is gone. Reservations now live only in Mongo, whose TTL index already expires them with their link, so an abandoned link can't stay waiting. That removes code instead of adding a sweeper. Taking a reservation is now a single findOneAndDelete, so two paths finishing the same upload can't both deliver it.

Prevent duplicate reservations for an existing upload: while this button's last link is still live and waiting, pressing Pulse reopens that same link (the same QR, or the same deep link on a phone) instead of reserving another. A new link is minted only when the old one has landed or expired, or when the destination has changed. A new e2e test presses Pulse twice and expects exactly one reserve call; I checked that it fails without the fix.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Legacy team IDs, false walkthrough-success callbacks, and nonrecoverable delivery claims can cause failed or stranded uploads.

Review effort: Balanced
Findings: 2 High severity

Open (2)
Resolved since last review (2)
Files not reviewed (1)
  • meteor-backend/package-lock.json: Generated file
Previously missed (1)

In code that hasn't changed since last review

Medium severity onLanded marks undelivered walkthroughs as added

src/​features/​clock/​ChangeRequestWalkthrough.tsx:48

PulseButton invokes onLanded for both done and kept, so this can call onAdded even when the walkthrough was not attached. In AdminTimesheetPanel, that callback sets a fake videoUrl and displays “Walkthrough added” after the request was reviewed or delivery otherwise fell back to the library. Pass the outcome through (or provide a delivered-only callback) and mark/refetch the request only for done.

Comment thread meteor-backend/server/pulsevault.js Resolved
…elete a video

- One `pulse_uploads` document per video, reserved → delivering → done | kept.
  Taking an upload is a claim, not a delete, so a crash mid-delivery can't
  strand a video; a sweep keeps abandoned claims in the uploader's library
  (never re-delivered, since a half-done delivery may already have posted).
  Replaces pulsevault_reservations + pulsevault_deliveries (live reservations
  are migrated), and `status` is a single read.
- Delivery runs after the final PATCH is answered, with the web-ready
  transcode one at a time and only for claimed uploads.
- Destinations are one table of { resolve, deliver }: every kind is rechecked
  at delivery the same way, ticket uploads need team membership, team lookups
  go through Huddle's getTeam (string ids too), and the reserve schema's enum
  comes from the table. Legacy target/ticketId/clockEventId reserve inputs and
  pulsevault.reserveForLibrary are gone.
- A plan or wrap-up whose clock step fails after posting is `done` with a note,
  not `kept`; a plan recorded while already clocked in joins the open session.
  The wrap-up write moved into huddle.js as appendWrapUp.
- media.remove only takes an item out of the library: a Pulse video stays
  where it was posted. A kept walkthrough is hidden from teammates. Indexes
  for the library's attachment read and one-item-per-video.
- usePulseUpload owns a link's state and reports done or kept; the Clock page
  and the Huddle composer own theirs so the modal outlives the button, and
  typed posting waits while a Pulse plan/wrap-up is on its way. Walkthroughs
  report "added" on done only. Modal labelled by its title; status kept in a
  live region; success labels by destination kind.
- e2e: shared fixtures/pulse.ts and fixtures/db.ts; new tests for the modal's
  done and kept states, library removal, and a second plan while clocked in.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 06:25

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Legacy API compatibility, ticket authorization behavior, removal semantics, and duplicate link submission remain unresolved.

Review effort: Balanced
Findings: 1 High severity · 3 Medium severity

Open (4)
Resolved since last review (2)
Files not reviewed (1)
  • meteor-backend/package-lock.json: Generated file

Comment thread meteor-backend/server/pulsevault.js Resolved
Comment thread meteor-backend/server/uploads.js Resolved
Comment thread src/features/clock/LinkAttachButton.tsx Resolved
morepriyam added a commit that referenced this pull request Oct 1, 2026
…e a Pulse video shows

Squash of 4dd94e1, 7635d47 and 242ea5d (the card and two review rounds),
replayed onto the third #615 review.
@morepriyam

morepriyam commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator Author

Reply to the "previously missed" finding in Copilot's last overview (it has no review thread):

onLanded marks undelivered walkthroughs as added: fixed in b38e373. The Pulse button now reports the outcome (done or kept) to its host, and ChangeRequestWalkthrough calls onAdded only on done. On kept the button stays and says why, and the requester's list no longer refetches and hides that reason. The admin panel now refetches the request rather than marking it with a placeholder videoUrl. Hosts that only refresh (attachments, Clock, Huddle) still refresh on either outcome.

Correction (638736d): "the requester's list no longer refetches and hides that reason" was only half the story. Testing it by hand showed that approving the change refreshes the requester's list live, which drops the pending row, and with it the button and its popup, so a walkthrough that arrives after the review still showed nothing. Now a Pulse button that goes away while its video is on its way keeps watching, and says where the video went as a toast: "Couldn't add your video here. That change has already been reviewed. It's saved in your Media library."

…ouble link adds

- A ticket destination checks the same access as tickets.list
  (requireTeamMembership), not direct team membership, so whoever can see a
  team's tickets can add a Pulse video to one.
- LinkAttachButton ignores Enter while a link is still being added.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 07:04
morepriyam added a commit that referenced this pull request Oct 1, 2026
…e a Pulse video shows

Squash of 4dd94e1, 7635d47 and 242ea5d (the card and two review rounds),
replayed onto the third #615 review.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Completed artifacts remain deletable, while concurrent and recovery paths can lose or duplicate media.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (4)
Files not reviewed (1)
  • meteor-backend/package-lock.json: Generated file
Previously missed (3)

In code that hasn't changed since last review

Medium severity Atomically claim empty video URLs to prevent overwrite

meteor-backend/​server/​pulse-destinations.js:265

A second walkthrough can overwrite the first while the request is still pending. Multiple tabs/components can reserve for the same request before either upload lands; both deliveries match this filter, and the last write replaces videoUrl, leaving the first successful video with no library row or request reference. Make the delivery claim the empty videoUrl atomically (and reject an already-populated request during resolve) so the later upload is kept instead of lost.

Medium severity Use team-ability permissions for media visibility

meteor-backend/​server/​uploads.js:486

Media visibility only recognizes direct members/admins, while the repository’s team access model also grants organization and enterprise elevated users access (meteor-backend/server/permissions.js:95-132). An org owner who can administer and view a team gets no team ID here, so shared ticket/session videos disappear (and the separate sharedTeam gate below can reject the whole library). Resolve visibility through the same team-ability mechanism instead of raw arrays.

Medium severity Deduplicate merged media and attachment records by video ID

meteor-backend/​server/​uploads.js:554

The abandoned-claim recovery can produce two library cards for one video. If a ticket/clock attachment is inserted and the process exits before settleUpload, the sweep adds a mediaitems row for that same artifact; this merge then returns both the media row and attachment because it never deduplicates by videoid. Deduplicate the merged sources (prefer the attachment, which records the actual destination).

Comment thread meteor-backend/server/pulsevault.js Resolved
…nt after its button is gone

- The Clock page keeps the wrap-up's session after it ends, so clocking out
  (which the wrap-up itself does) no longer changes the destination under its
  watched link: the popup says "Wrap-up posted — you're clocked out" and the
  page refreshes.
- A Pulse button that goes away while its video is on its way (a timesheet
  change reviewed meanwhile drops its row, or the person leaves the page)
  keeps watching and reports the outcome as a @mieweb/ui toast. AppLayout
  mounts the ToastProvider and an AppToasts container.
- e2e: the Clock page's Pulse buttons, plan then wrap-up, each say they
  landed; fails without the fix.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 16:18

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Unresolved destination-race, deletion-race, and legacy team-ID issues can misdeliver, lose, or hide Pulse videos.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
Resolved since last review (1)
Files not reviewed (1)
  • meteor-backend/package-lock.json: Generated file
Previously missed (1)

In code that hasn't changed since last review

Medium severity Handle destination changes during reservation await

src/​features/​pulse-upload/​usePulseUpload.ts:255

A destination change during the reserve await is still lost. The destination-change effect runs while link is null, then this continuation installs and opens the old destination's link; because destinationKey already changed, the effect does not rerun, current stays null, and the eventual outcome is neither handed off nor reported. Capture the requested key and, after reserve returns, hand the reservation to a detached watcher instead of opening it when it no longer matches the current destination (and handle unmount similarly).

Comment thread meteor-backend/server/pulsevault.js Resolved
Comment thread meteor-backend/server/uploads.js Resolved
…eam ids

- Deleting an unlanded video marks it `deletingAt` in the same write that
  finds it still reserved, and claimUpload skips a marked upload, so a final
  chunk landing as the video is deleted can't also deliver it. Uploading it
  again (a new TUS create) clears the mark, so cancel-and-retry still
  delivers; a mark from a delete that failed stops counting after a minute.
- buildTeamAbility finds teams with a string `_id` too (ObjectId first, as
  nearly every team is), so the media library and every other caller work
  for older teams instead of failing on `new ObjectID`.
- A reserve that returns after the destination changed, or after the host
  went away, is dropped instead of opened: nobody has seen the link, so it
  expires unused.
- Tests: e2e for a delete marked as the last chunk lands (not delivered;
  fails without the fix) and for cancel-then-upload-again (delivered); unit
  tests for the reserve that outlives its destination (fails without the fix).
Copilot AI balanced review requested due to automatic review settings October 4, 2026 16:33
@morepriyam

Copy link
Copy Markdown
Collaborator Author

Reply to the "previously missed" finding in Copilot's review of 3fb85f9 (it has no review thread). Handle destination changes during reservation await: fixed in 1437f27. A reserve that returns after the destination changed, or after the host unmounted, is dropped instead of opened. Nobody has seen that link, so nothing can upload with it, and it expires unused; a detached watcher would only poll until it expired. A new unit test (usePulseUpload.test.ts) changes the destination while the reserve is pending, and fails without the fix.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Clock reopen races can partially mutate breaks, and startup can continue without the unique shift index.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (2)
Files not reviewed (1)
  • meteor-backend/package-lock.json: Generated file
Previously missed (1)

In code that hasn't changed since last review

Medium severity Atomically update breaks with concurrent reopen handling

meteor-backend/​server/​clock.js:259

A reopen can still fail here when a concurrent clock-in wins the unique-index race, but applyClockUpdate has already removed and reinserted the session's breaks before reaching this write. The caller receives already-clocked-in even though its requested break edits were persisted on the still-closed shift. Make the event update and break replacement atomic (or reserve the reopen before mutating breaks and roll it back on later failure).

Comment thread meteor-backend/server/clock.js Resolved
Reverts 893bc34 ("one open shift per person, enforced by the database"),
and with it 3fb85f9's switch of that code to DUPLICATE_KEY_ERROR_CODE.
How clocking in works across teams is an app-wide decision — the server,
live updates and UI disagree today — and the direction is per-team, not one
global shift. It's tracked as its own issue rather than changed here.

Back to how it was before 893bc34: no unique index or startup cleanup,
clockStart closes only a same-team open shift, clock.stop takes a teamId,
and a Pulse plan checks for another team's open shift itself before
clocking in. Every reverted file is identical to its 893bc34^ version.
Copilot AI balanced review requested due to automatic review settings October 5, 2026 14:38
@morepriyam

Copy link
Copy Markdown
Collaborator Author

The one-open-shift rule (893bc34) is reverted from this PR in 6f63c13, so the Pulse PR stays about Pulse. The clock is per team on the server but global in the UI, with live updates scoped to the selected team; the direction is per team end to end. That's written up with diagrams in #642. Copilot's "previously missed" finding on 1437f27 about reopening a shift and its breaks was about the reverted code, so it no longer applies here; #642 covers reopen handling under the per-team rule.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The one-open-shift invariant and session-specific clock-out behavior remain unenforced, leaving overlapping or incorrectly closed shifts possible.

Review effort: Balanced
Findings: 2 High severity

Open (2)
Resolved since last review (2)
Files not reviewed (1)
  • meteor-backend/package-lock.json: Generated file
Previously missed (2)

In code that hasn't changed since last review

Medium severity Refresh active approval requests when walkthroughs change

meteor-backend/​server/​pulse-destinations.js:300

This database update does not invalidate the approver's open queue or modal. TimesheetApprovalsPanel reloads when the set of notification IDs changes, but adding a walkthrough changes neither those IDs nor its copied active request; an approver who already opened the request can therefore approve it without ever seeing the newly landed video. Publish a request-change signal and reconcile the active request when its data changes.

Medium severity Prevent stale add requests from closing reopened dialogs

src/​features/​clock/​LinkAttachButton.tsx:78

The dialog can be dismissed while handleAdd is awaiting title lookup or persistence. If it is reopened before that request completes, the first request's eventual close() closes the new dialog and clears its newly entered URL. Ignore dismissals while adding (or use an operation token so an older completion cannot mutate a reopened dialog).

Comment thread meteor-backend/server/clock.js Resolved
…in by hand

Pulse had its own cross-team rule: a plan refused to clock you in while
another team's shift was open, which clock.start doesn't do. How clocks work
across teams is #642, so Pulse no longer decides it.

- A plan only looks at its own team: it joins that team's open shift, or
  clocks in through clockStart; another team's shift no longer blocks it.
- "Clocked in and back out by hand since pressing Pulse" counts only shifts
  in the plan's team.
- The late wrap-up note only mentions a newer shift in the wrap-up's team.
Copilot AI balanced review requested due to automatic review settings October 5, 2026 15:03

Copilot AI 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.

Copilot review overview

🔵 Needs a closer look

The broad cross-layer upload, persistence, authorization, and recovery changes warrant final human validation.

Review effort: Balanced
Findings: None

Resolved since last review (2)
Files not reviewed (1)
  • meteor-backend/package-lock.json: Generated file

@morepriyam

Copy link
Copy Markdown
Collaborator Author

This PR is being landed in stages on top of 0.5.0 (#644), each shaped like pulsevault's examples/meteor-demo. Stage 1 is #654: the destination on the token and the DESTINATIONS table, for the three kinds main already has. The Pulse button, the Huddle/Clock/timesheet destinations and the raw-upload removal follow as one small PR each, and #616 is rebuilt on top. This PR stays open as the reference for the design decisions until the stack has landed.

@morepriyam

Copy link
Copy Markdown
Collaborator Author

Closing as reference only. Main is on @mieweb/pulsevault 0.5.0 (#644), which replaced this PR's pulse_uploads ledger, status method and poster linking with the package's own token context, status route, poster route and replay. The pieces that still apply are landing one small PR at a time on top of 0.5.0: #654 (destinations on the token) and #658 (one Pulse button and modal, attachments panel) so far. The Huddle flow changes direction: a Pulse video attaches to the composer so the person can type and send it, rather than posting itself. #616 stays open as the reference for the video cards.

@morepriyam morepriyam closed this Oct 7, 2026
morepriyam added a commit that referenced this pull request Oct 7, 2026
As #615 placed it: Ticket and its chips, the composer's own +, then "/ Pulse" — another way
to post, not another attachment. ChatComposer renders its leading slot before the +, so the
CSS module lets the slot's children join the row (display: contents) and orders the Pulse
group after the + (order: 1). Visual order only: in the DOM, and so for the keyboard, Pulse
still comes before the +.
morepriyam added a commit that referenced this pull request Oct 7, 2026
…he wrap-up, and the server clocks you in or out

The Clock page opens with a Pulse section (#615's): Record your plan with a 'Clock in with
Pulse' pill while clocked out, Record your wrap-up with 'Clock out with Pulse' while clocked
in, whether or not the team requires a plan. Two destinations carry it: clock-plan posts the
video to Huddle as the plan (draft name as text) and clocks in to that team; clock-wrapup adds
the video and a '**Wrap-up:** <name>' line to the session's post, stamps wrapUpAt and clocks
out. Both are idempotent on the video (a replay finds the post), and both follow the hand
flows: a shift opened by hand meanwhile takes the plan; a shift already ended isn't
restarted; a session ended by hand still gets its wrap-up; a step after the post that fails
(the clock-in itself) comes back in the outcome note, and the chip and modal show that note
only then. clockStart/clockStop are the clock.start/clock.stop methods as plain functions,
appendWrapUp joins createHuddlePost in huddle.js, the reserve schema takes postDate and
clockEventId, and the Pulse colour token backs the section. The page owns the two hooks so the
modal outlives the pill swap, and clears the composer when a video lands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants