Skip to content

Pulse in Huddle and on the Clock Page: the Video Posts Itself, and Clocks You In or Out - #659

Merged
morepriyam merged 17 commits into
mainfrom
feat/pulse-huddle
Oct 8, 2026
Merged

morepriyam merged 17 commits into
mainfrom
feat/pulse-huddle

Conversation

@morepriyam

@morepriyam morepriyam commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Status: ready to merge

All Copilot review threads are addressed (fixed or answered in-thread); the last fixes are in 798ea69. Tested by hand against a local backend (Huddle Pulse post with the draft name; Clock in with Pulse, then Clock out with Pulse, both landing on one post), plus typecheck, lint, format and unit tests. Destination-level backend tests for the clock kinds are a follow-up PR.

Summary

Stage 3 of landing #615 in pieces, on top of #654 and #658: Pulse where an update is posted. In Huddle, the one Pulse button from #658 sits beside the message box, after the composer's +, behind a "/": press it, record on your phone, and the video is posted to the team the moment it uploads, as its own post with the Pulse draft's name as its text. On the Clock page, a Pulse section opens the page: Clock in with Pulse posts the video as your plan and clocks you in; Clock out with Pulse adds it to your session's post as the wrap-up and clocks you out. Nothing typed goes with a Pulse video, and nothing is staged, held or kept on the page.

This is direct delivery, the same model as tickets, Redmine issues and clock sessions in #658 and PulseVault's examples/meteor-demo: the link carries the destination, the server delivers from onUploadComplete and replays if it must, the page only watches. The composers attach no Pulse video, on Huddle or on the Clock page, so there is no wait, no Cancel and nothing to lose on a reload. (An attach-to-composer version of this PR was built and reviewed first; it is in the history and was dropped for this.)

Screenshots

Taken on this branch against a local backend: real uploads over tus to the links the buttons reserved, with the draft name in Upload-Metadata, as the Pulse app sends it.

Huddle

Ticket, the composer's +, then / Pulse, and the placeholder saying so Press Pulse on a computer: the hint says the video will post itself
1-huddle-composer-pulse-chip 2-huddle-pulse-modal

The video lands: its own post, titled with the draft name, nothing typed went with it, and nothing beside the chip.

3-huddle-post-from-pulse

Clock page

The Pulse section opens the page: Record your plan, Clock in with Pulse Press it: the hint says you'll be clocked in when it uploads
4-clock-pulse-section 5-clock-pulse-modal
The plan video landed: clocked in, the section now offers Clock out with Pulse, and the wrap-up composer is seeded with the plan After the wrap-up video: one Huddle post with the plan, a Wrap-up: line and both videos
6-clock-clocked-in-by-pulse 7-huddle-plan-and-wrapup-post

Changes

  • huddle destination (pulse-destinations.js): check is team membership (requireTeamMember); deliver adds the video to the uploader's media library once (addToLibrary, shared with the library kind) and creates the post with createHuddlePost; delivered finds this uploader's post in this team by the video's URL, so a replay never posts twice. describeVideo carries the Pulse draft's name for the post text; the attachment title is unchanged. destination.teamId is in the Wormhole schema.
  • huddle.js: createHuddlePost(userId, …) and requireTeamMember are the huddle.createPost method's checks as plain functions, so the server-side caller makes the same ones. The method calls them after its identity and draft checks; its behaviour is unchanged.
  • Huddle page: PulseButton with { kind: 'huddle', teamId } after the composer's own +, behind a "/" — another way to post, not another attachment — keyed by team; onSettled refetches the feed in case the live subscription missed the post while the app was in the Pulse app. Placeholder: "Share an update, or post a Pulse…". ChatComposer renders its leading slot before the +, so Huddle.module.css lets the slot's children join the row (display: contents) and orders the Pulse group after the + (order: 1); that is visual order only, the keyboard still reaches Pulse before the +, as in feat(pulse): make Pulse the only way to add video, delivered where it was started #615. The composer's own Pulse attachment (PulseAttachButton, the staged videos, the pending flag and the per-team localStorage scope) is gone.
  • clock-plan and clock-wrapup destinations (pulse-destinations.js, from feat(pulse): make Pulse the only way to add video, delivered where it was started #615, on the check / delivered / deliver table): clock-plan checks team membership and the poster's calendar date, signs reservedAt into the token, and on delivery posts the video as the plan (postVideo) then clocks in (clockInWithPlan): a shift opened by hand meanwhile takes the plan instead of a second session; a shift opened and ended by hand since the link was made is not restarted. clock-wrapup checks the session is the uploader's own and, at reserve only, still open (check now takes a phase); on delivery it adds the video and a **Wrap-up:** <draft name> line to the session's post (appendWrapUp, which stamps wrapUpAt), then clocks out; a session ended by hand meanwhile still gets its wrap-up, and the note says so. Both are replay-safe across their two steps: delivered means the plan post linked to a session, or the wrap-up on a session that has ended, and deliver reuses a post it finds rather than writing a second, so a replay after a crash between the post and the clock change does only the missing step. A step after the post that fails (the clock-in itself) comes back in the outcome note — "Plan posted, but you weren't clocked in: …" — and the chip and modal show a done-note only when it differs from the plain landed label (followUpNote; the backend's notes and pulseStatus.ts's labels are the same strings on purpose).
  • clock.js: clockStart(userId, …) and clockStop(userId, …) are the clock.start / clock.stop methods as plain functions; the methods call them. huddle.js exports appendWrapUp and POST_DATE_RE. The reserve schema takes postDate and clockEventId. pulse-destinations.js loads clock.js lazily (clock → timesheet-change-requests → pulsevault would close a cycle).
  • Clock page (ClockPage.tsx, feat(pulse): make Pulse the only way to add video, delivered where it was started #615's UI): a Pulse section above the status card — the Pulse logo, "Record your plan" / "Record your wrap-up", and a Clock in with Pulse / Clock out with Pulse pill in the page's main-action style (PulseChip's new main variant, PulseLogo inverse on it, the --color-pulse token for the section's tint) — shown whether or not the team requires a plan. The page owns the two usePulseUpload hooks, so the modal outlives the pill swap when the clock changes, and a landed video clears the composer the way a hand-written post does. The post date and the wrap-up's session id are held still while a link is waiting (the hooks compare destinations by value), so midnight passing or a shift opened by hand can't drop the watch. No Pulse in the composer's Photo / Video / Doc / Ticket / @Mention row, and no Pulse gate on submit.
  • The chip says nothing beside itself when a video has landed, here and on the attachments panel: the post or attachment is the news and the modal already said it, so the row keeps its shape. Screen readers are still told. Kept, expired and error notes stay.
  • API: PulseDestination gains { kind: 'huddle'; teamId }, { kind: 'clock-plan'; teamId; postDate } and { kind: 'clock-wrapup'; clockEventId; postDate }; pulseStatus.ts gains their labels and hints.
  • Gone: PulseAttachButton.tsx and pulseComposerUpload.ts (a localStorage reservation per composer, restored on remount, polling media.list every 4 s).
  • Release note (1.0.6): "Pulse in Huddle" and "Clock in and out with Pulse" sections.
  • e2e: huddle/pulsevault-video.spec.ts gets the case from the first version of this PR: a link reserved for { kind: 'huddle', teamId } over REST, a tus upload with a draft name, the post found through huddle_getPosts with that text and then in the inbox; tickets/helpers.ts takes the union type.

Not in this PR: the composer's Video button and dropped or pasted video files (the raw-upload removal PR, where their e2e specs are rewritten); the timesheet walkthrough (timesheet-request, next PR); video cards (#616 rebuilt, later); e2e cases for the three new destinations (the huddle one is in pulsevault-video.spec.ts; the clock ones follow the same check → deliver path and were driven by hand, below).

Testing

Local, Vite on :3000 and Meteor on :3100 (dev database), at 3ee7944:

  • tsc --noEmit, ESLint and Prettier on every changed file, node --check on the four backend files: clean. vitest run src/features/pulse-upload src/features/huddle src/features/clock: 103/103.
  • Browser (Playwright): in the Huddle inbox the chip reads "Post a video with Pulse" and the placeholder "Share an update, or post a Pulse…"; pressed Pulse, the modal showed the QR with "It's posted to Huddle as soon as it uploads, with your draft's name as its text."; uploaded the e2e fixture over tus to the link the button reserved, with name in Upload-Metadata (create 201, PATCH 204; the token's context was { kind: 'huddle', teamId }); within seconds the post appeared in the thread as "Walkthrough of the new clock page" with the video attached (a[href="/pulsevault/artifacts/cbb6b25c-…"]), the modal had closed itself, and nothing was shown beside the chip (the landed line is sr-only).
  • Clock page (c71f1ea), browser + tus: the section read "Record your plan" with Clock in with Pulse; pressed it, the modal said "It's posted as your plan, and you're clocked in, as soon as it uploads."; the token's context was { kind: 'clock-plan', teamId, postDate, reservedAt }; uploaded the fixture with a draft name; within seconds the page was clocked in (timer running, "since 5:14 PM"), the section read "Record your wrap-up" with Clock out with Pulse, the wrap-up composer was seeded with the plan text, and the status route recorded { state: "done", note: "Plan posted — you're clocked in" }. Pressed Clock out with Pulse, uploaded again with a draft name: the page clocked out, Recent sessions showed the 1-minute session, the status route recorded "Wrap-up posted — you're clocked out", and in Huddle the session's one post read the plan text, "Wrap-up: ", with both videos attached. tsc, ESLint, Prettier, node --check on the backend files, vitest 103/103.
  • After Copilot's review of c71f1ea (afb199a): replay-safe two-step deliveries, the frozen date and session while a link waits, the e2e helper type. tsc, ESLint, Prettier, node --check, vitest (clock + pulse-upload 26/26) clean; the Clock page still renders its Pulse section after the hook change (browser).
  • After Copilot's review of afb199a (ef06fad): clockStop stops only the reserved session; clockStart decides reuse-or-create next to its insert; appendWrapUp matches both team-id forms; each hook on the Clock page freezes its own destination through its result modal. tsc, ESLint, Prettier, node --check, vitest 26/26 clean. A second full plan → wrap-up cycle in the browser against this head is below.
  • Checked by reading and tsc only: the replay branches themselves (a process killed between the post and the clock change), the composer clearing after a landed video (added after the run above), the follow-up note path (a clock-in that fails after the post), the "shift opened/ended by hand meanwhile" branches.
  • Not run: the Playwright suite (huddle/pulsevault-video.spec.ts needs the :3101 test backend; its huddle case passed in this PR's first version at c081c2b), a Redmine-target upload, an upload from the Pulse app on a phone.

Next

The timesheet walkthrough (timesheet-request destination, Pulse beside Pending approval), then the raw-upload removal, then video cards.

A `huddle` destination: the link carries the team, and when the video
lands the server adds it to the uploader's library and creates the post,
with the Pulse draft's name as its text. `createHuddlePost` and
`requireTeamMember` are the method's checks as plain functions, so the
server-side caller makes the same ones.

In the Huddle inbox the Pulse chip sits after the composer's own +,
behind a "/": nothing typed in the box goes with it, and nothing is
staged, cached or polled on the page. The composer no longer carries a
Pulse attachment of its own; the Clock page's composer keeps its attach
button until its own stage.
Copilot AI balanced review requested due to automatic review settings October 6, 2026 19:49
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

🗑️ Preview Environment Cleaned Up

The preview container for this PR has been deleted.

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 global delivery lookup can incorrectly mark a video as posted to its reserved team, and the new test has typing and coverage gaps.

Review effort: Balanced
Findings: 2 High severity · 1 Low severity

Open (3)
What changed in this PR

Adds server-delivered Pulse videos to Huddle and replaces staged composer videos with a destination-aware Pulse button.

Changes:

  • Adds the Huddle Pulse destination and shared post-creation logic.
  • Updates the Huddle composer, status messaging, release notes, and API types.
  • Adds an end-to-end delivery test.
File Description
tests/​e2e/​huddle/​pulsevault-video.spec.ts Tests Huddle Pulse delivery.
src/​pages/​Huddle.tsx Integrates the Pulse composer button.
src/​pages/​Huddle.module.css Positions Pulse after the attachment button.
src/​lib/​api.ts Adds the Huddle destination type.
src/​features/​pulse-upload/​pulseStatus.ts Adds Huddle status messaging.
release-notes/​1.0.6.md Documents Huddle Pulse posting.
meteor-backend/​server/​pulsevault.js Carries the Pulse draft name into delivery.
meteor-backend/​server/​pulse-destinations.js Implements Huddle delivery.
meteor-backend/​server/​main.js Extends the reservation schema.
meteor-backend/​server/​huddle.js Extracts reusable post creation and membership checks.

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

…w fixes

The Huddle delivery's "already delivered" lookup is scoped to the reserved
team and the uploader, as the ticket and session lookups are to their
place, so a post elsewhere carrying the same video isn't this delivery.
Every kind's `delivered` takes the uploader, one signature.

The e2e helper's destination is the real union, and the Huddle case sends
a draft name through the upload and expects it as the post's text.
Copilot AI balanced review requested due to automatic review settings October 6, 2026 20:31

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

CSS reordering creates an accessibility focus-order mismatch, and the release note overstates the retained upload behavior.

Review effort: Balanced
Findings: 1 Medium severity · 2 Low severity

Open (3)
Resolved since last review (3)

Comment thread src/pages/Huddle.module.css Resolved
Comment thread release-notes/1.0.6.md Resolved
Comment thread src/pages/Huddle.tsx Resolved
…w fixes

Pulse sits after Ticket in the composer's leading slot in document order,
so it reads and tabs where it shows; the CSS that moved it past the + is
gone. The "/" uses the muted foreground token. The release note calls a
Pulse post a new way to put a video in Huddle, since the message box's +
still takes a video file in this stage.
Copilot AI balanced review requested due to automatic review settings October 6, 2026 20:50

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 composer does not render Pulse after the built-in plus as described, and the membership boundary lacks negative coverage.

Review effort: Balanced
Findings: 2 Medium severity · 1 Low severity

Open (3)
Resolved since last review (2)

Comment thread src/pages/Huddle.tsx Resolved
@morepriyam

Copy link
Copy Markdown
Collaborator Author

Closing. This PR made the Huddle video post itself from the server with the draft name as its text. The intended behaviour is the other way round: the Pulse video attaches to the composer as a staged attachment, and the person types and sends the update. That needs no huddle destination kind and no server-side post, just #654's library destination and #658's hook settling into the composer. A new PR on top of #658 will do that for both the Huddle and Clock composers and remove the localStorage staging in PulseAttachButton.

@morepriyam morepriyam closed this Oct 7, 2026
@github-project-automation github-project-automation Bot moved this from Ready to Done in Scrum Team Jerry Oct 7, 2026
@morepriyam

Copy link
Copy Markdown
Collaborator Author

Reopened: direct delivery stays for some surfaces, with composer attach for others.

@morepriyam morepriyam reopened this Oct 7, 2026
@morepriyam
morepriyam changed the base branch from feat/pulse-button to main October 7, 2026 19:20
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.
Copilot AI balanced review requested due to automatic review settings October 7, 2026 19:31
…ttaches to the post

The half of the rework the previous commit was meant to carry: both composers render
PulseButton with the library destination, the hook hands its host the settled link, the
modal and chip take the composer's own words, the Huddle button remounts after a post or a
removed video, the Clock page loses its pending-reservation gate, and the 1.0.6 note gets its
composer section.
…live with the other status copy

COMPOSER_COPY and the PulseCopy type, which the previous commit's button and modal import.

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.

🟡 Changes recommended

The branch has unresolved compile errors and implements a staged library attachment flow instead of the described automatic Huddle delivery.

6 open findings
1 resolved since last review

🧠 Review effort: Balanced

Comment thread src/pages/Huddle.tsx Resolved
Comment thread src/pages/Huddle.tsx Resolved
Comment thread release-notes/1.0.6.md Resolved
Copilot AI balanced review requested due to automatic review settings October 7, 2026 19:34

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.

🔵 Needs a closer look

The implementation stages library uploads instead of server-posting to Huddle and introduces a Clock submission race.

6 open findings
Previously missed (2)

In code that hasn't changed since last review

Medium severity Removing pending guard can orphan Pulse videos

src/​features/​clock/​ClockPage.tsx:124

Removing the Pulse-pending guard lets a plan or wrap-up submit while the replacement PulseButton is still waiting. Submission changes composerMode, unmounting the keyed button before its onSettled callback can add the video, so the UI promise that it will attach to this post is false and the video remains only in the library. This also contradicts the PR's statement that Clock keeps the existing attach flow until stage 4; retain that flow or preserve the pending guard until server-side Clock destinations land.

Low severity Huddle prompt still uses the old placeholder

src/​pages/​Huddle.tsx:993

The PR explicitly changes the Huddle prompt to “Share an update, or post a Pulse…”, but this still renders the old placeholder, so the advertised entry point is not visible in the composer.

🧠 Review effort: Balanced

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.

🔵 Needs a closer look

The CSS creates conflicting visual and keyboard focus order for composer controls.

0 open findings

3 resolved since last review

🧠 Review effort: Balanced

…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.
Copilot AI balanced review requested due to automatic review settings October 7, 2026 21:20
@morepriyam morepriyam changed the title Pulse Beside the Huddle Composer, and the Video Posts Itself Pulse in Huddle and on the Clock Page: the Video Posts Itself, and Clocks You In or Out Oct 7, 2026

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.

🟡 Changes recommended

Clock delivery replay can skip required state transitions, and pending uploads can lose their watcher when session or date state changes.

4 open findings

🧠 Review effort: Balanced

Comment thread src/features/clock/ClockPage.tsx Resolved
Comment thread src/features/clock/ClockPage.tsx Resolved
Comment thread tests/e2e/tickets/helpers.ts Resolved
… and a live link keeps its date and session

clock-plan and clock-wrapup are two steps, the post and the clock change, and 'delivered'
treated the post alone as the whole delivery: a process that died between the two would
have left the person unclocked (or still clocked in) with the replay saying done. Now
delivered means both — the plan post linked to a session, the wrap-up on a session that
ended — and deliver reuses the post it finds instead of writing a second, so a replay only
does the step that is missing.

On the page, the hooks compare destinations by value and drop a link whose destination
changed, so the post date and the wrap-up's session now hold still while a link is waiting:
midnight passing, or a newer shift opened by hand, no longer stops the watch on a video that
will still land where it said. The e2e helper's destination type takes the two new kinds.
Copilot AI balanced review requested due to automatic review settings October 7, 2026 21:32

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.

🟡 Changes recommended

Destination-state bugs, raw-ID status text, concurrency races, and accessibility ordering remain unresolved.

5 open findings
4 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Suppress backend notes except for new clock destinations

src/​features/​pulse-upload/​pulseStatus.ts:42

This treats every backend note as user-facing follow-up text. Existing ticket/Redmine/clock deliveries return notes such as Attached to ticket <id>, which intentionally differ from the friendly landed labels, so this re-exposes raw IDs in the modal and beside the chip on phones. Only the two new clock action destinations use notes to report a failed follow-up; suppress notes for the other kinds.

🧠 Review effort: Balanced

Comment thread meteor-backend/server/huddle.js Resolved
Comment thread src/features/clock/ClockPage.tsx Resolved
clockStop takes the session to stop and stops it only while it is still open, so a wrap-up
that lands after the person ended that session by hand and started another doesn't end the
new one; the wrap-up delivery reads the session again after its write and branches on what
it finds. clockStart takes reuseOpen: a plan that lands while this team's shift is already
open joins that shift, decided next to the insert rather than in the destination (#642's
unique open-shift index closes the remaining window). appendWrapUp finds the session's post
by either form of the team id, as the feed does. On the page each link freezes its own
destination, through its result modal: a plan still uploading no longer keeps the wrap-up
from adopting a shift clocked in by hand, and a newer shift no longer clears a wrap-up's
result from under the person.
Copilot AI balanced review requested due to automatic review settings October 7, 2026 21:43

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.

🟡 Changes recommended

Delivery notes expose raw destination IDs, and late Pulse completion can erase text from a newer Clock composer.

1 open finding
5 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Limit follow-up note handling to multi-step clock destinations

src/​features/​pulse-upload/​pulseStatus.ts:42

followUpNote now treats every backend note that differs from the UI label as a follow-up failure. Existing destinations intentionally return different notes—for example, ticket/Redmine/clock return Attached to ${kind} ${id}—so their modal and phone chip will regress to exposing raw IDs instead of the friendly “Added to this …” copy. Restrict follow-up notes to the two multi-step clock destinations.

🧠 Review effort: Balanced

Comment thread src/features/clock/ClockPage.tsx Resolved
…, and the modal shows only clock follow-up notes
Copilot AI balanced review requested due to automatic review settings October 7, 2026 22:01
@morepriyam

Copy link
Copy Markdown
Collaborator Author

Also fixed in 721d84e (from the last review's previously missed): followUpNote shows backend notes only for clock-plan / clock-wrapup, so ticket/Redmine/clock/library deliveries no longer surface raw notes like Attached to ticket <id>. Covered in pulseStatus.test.ts. Typecheck, lint, format and the pulse-upload/clock unit tests pass.

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.

🟡 Changes recommended

Clock destination state can be lost or cleared incorrectly, and clock-in reuse remains subject to a session race.

1 open finding
1 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Prevent stale uploads from clearing newer composer generations

src/​features/​clock/​ClockPage.tsx:318

The text-only guard still clears a newer composer generation when its text happens to match the old snapshot. A common case is starting Pulse with plan text X, posting that plan by hand, and leaving the newly seeded wrap-up as X; when the older Pulse upload settles, this equality succeeds and erases the wrap-up composer. Track the draft/composer generation owned by each link (and advance it on manual submission) in addition to comparing text, so an older link cannot clear a later plan or wrap-up.

Medium severity Freeze plan team ID while upload result is pending

src/​features/​clock/​ClockPage.tsx:330

The plan destination still follows gateTeamId live. If a user starts a plan upload for team A, closes the modal, and switches the selected team (or clocks into team B) before it lands, this value changes; usePulseUpload then discards team A's link/status and stops showing its result even though the server will still post and clock into A. Freeze the plan team ID for the lifetime of its waiting link/result modal, just as the date and wrap-up session are frozen.

🧠 Review effort: Balanced

Comment thread meteor-backend/server/clock.js Resolved
…link keeps its team and owns only its own draft
Copilot AI balanced review requested due to automatic review settings October 7, 2026 22:14
@morepriyam

Copy link
Copy Markdown
Collaborator Author

Previously missed items from the 721d84e review, fixed in 798ea69:

  • Stale uploads clearing newer drafts (ClockPage.tsx:318): each link snapshots the draft text and a draft generation that advances on every hand-posted plan or wrap-up. A landed video clears the composer only if both still match, so a wrap-up seeded with the same text as an earlier plan is left alone.
  • Freeze plan team ID (ClockPage.tsx:330): the plan link's team is state now. It follows the gate team only while that link isn't waiting or showing its result, the same way the date and wrap-up session already do.

Checked: typecheck, lint, format and the pulse-upload/clock unit tests (28) pass.

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.

🔵 Needs a closer look

Operational retry handling, independent date freezing, and logical keyboard order need correction.

0 open findings

1 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Operational delivery failures are incorrectly marked successful

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

Transient clock failures are converted into a successful delivery here. If MongoDB, the dynamic import, or another non-Meteor.Error operation fails after the post is written, deliverPulseVideo returns done and recordOutcome prevents PulseVault from replaying the missing clock-in/out step. Rethrow operational errors and only turn expected business-state errors into the user-facing follow-up note.

Medium severity Shared post date can assign uploads to the wrong calendar day

src/​features/​clock/​ClockPage.tsx:369

The date is shared across both independent links, so one pending upload can give a newly reserved upload the wrong calendar date. For example, a plan link started before midnight keeps planBusy true; after manually clocking in after midnight, a new wrap-up link still uses yesterday's postDate, which can place a recovery post in the wrong daily feed/gate. Freeze and refresh a separate post date for each Pulse hook, just as the team/session destinations are tracked independently.

🧠 Review effort: Balanced

@SarkarShubhdeep

Copy link
Copy Markdown
Collaborator

✅ Was able to clock in with Pulse
✅ And clock out with Pulse

@SarkarShubhdeep SarkarShubhdeep left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Manually tested on preview container, everything works as it supposed to be.
Approving.

@morepriyam
morepriyam merged commit 04dd409 into main Oct 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants