You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upgrades @mieweb/pulsevault from ^0.1.2 to exactly 0.5.0 (protocol 2.3). There's no change to how Pulse is used in the app: reserving, the Pulse button and attaching work as on main. What changes is how much of it this repo has to do itself.
This PR was first written against 0.4.2, and most of what its reviews found — two security holes among them — was in code TimeHuddle had to write around PulseVault. Those findings became mieweb/pulsevault#80, and 0.5.0 (mieweb/pulsevault#81) moves that work into the package. This PR now deletes it here. #615 stays open as the reference for the destination flows that build on this.
Changes
Gone from pulsevault.js (each replaced by a PulseVault 0.5.0 feature):
Was
Now
pulsevault_reservations collection + in-memory map, rehydrated at startup
The reservation ({ userId, target, ticketId }) is signed into the capability token as its context; PulseVault stores it with the upload and hands it to onUploadComplete
Stale-upload pre-handler (the source of the first review's security hole) and its req.on('error') guard
PulseVault's reclaim: a re-scan of the same link takes over an upload the app abandoned once it has been idle 5 minutes, only with the same token's kind and relatedTo; the core guards aborted streams itself
assertPulseShape
pulseShape (default on): a video only under the token's own id, a thumbnail/manifest/captions only under its own id relatedTo the video — refused at create with 403
storage.resolve content-type wrapper
PulseVault serves .mov/.m4v/.pulse with their own types
In-process web-ready queue, and the "publish before the conversion finishes" caveat
webReady: { completeAfter: true }: the video is made web-playable in the background and onUploadComplete runs only once that's done
Restart-recovery path for a ready-but-unattached video
PulseVault replays an unacknowledged completion (5 s after boot, then every 5 minutes); the attach is idempotent on the video id
SSE /pulsevault/events/:id route (unused by the web app)
GET /pulsevault/artifacts/:id/status from the package, documented on /pulsevault/docs
Kept: the Wormhole mount and its request logging, the Swagger page (now also documenting the status and poster routes and the delete lock), the pulsevault.reserve / reserveForLibrary / getVideo / listVideos methods with the same signatures, artifactBelongsTo (now reading the upload's context through core.getPulse instead of a reservation), and the .mov/.m4v video extensions for the browser's device-upload fallback.
Also: a video that landed can no longer be deleted with its pairing token (lockWhenReady); /pulse/open verifies the link's token as a status read of the video rather than a create (a create now checks the shape of a pulse, which needs an upload's kind).
onUploadComplete settles an upload as kept ("Ticket … was deleted while the video was uploading") when the reserved ticket is gone at delivery, instead of attaching the video to a ticket that no longer exists. Any other failure is still thrown, so PulseVault replays it. A replay records the same outcome note as the first delivery.
artifactBelongsTo accepts only a video: getPulse describes whatever artifact the id names, and a pulse's thumbnail or captions carry the uploader's context too, so a thumbnail's id passed as timesheet evidence.
pulsevault.reserve reuses existingVideoid only when it is a UUID (getStatus answers unknown for anything else instead of throwing, so "foo" was being reused) and only a video's.
Frontend: with webReady.completeAfter the video is filed only after the conversion, seconds after the last byte. The ticket's "Upload from this device" refreshed its attachments once on tus success and missed the new one (the e2e case failed 3/3 before this), and the profile feed polled for the media item for only 4 s. Both now wait for GET /pulsevault/artifacts/:id/status (with the upload's own token) to report acknowledged (videoApi.waitUntilFiled).
Swagger: the create's 403 (shape) and 409, and the TUS DELETE's 403 under lockWhenReady. The e2e artifact test now expects the lock (DELETE with the pairing token → 403, video still served).
Testing
Everything below was run locally on this branch at e716f30 (backend code as committed; frontend as committed).
Static:prettier --check on pulsevault.js, pulsevault-docs.js, pulse-link.js, the spec and the three frontend files: clean. eslint on the spec and frontend files: clean. tsc --noEmit (root): exit 0. vitest run src/features/pulse-upload: 4/4.
Backend boot:npm ci (resolves @mieweb/pulsevault 0.5.0 from the registry), npm start on :3100 with a scratch VIDEOS_DIR; /pulsevault/capabilities reports protocolRevision: "2.3".
Pulse-shaped uploads by script (token minted the way reserve mints it, issuer = ROOT_URL), one library and one ticket upload (real ticket in the dev DB), 16/16 checks each:
captions, beat manifest and thumbnail relatedTo the video: 201/204 each; a thumbnail under the video's id: 403; a video under another id: 403;
status unknown before the video, then processing → ready, acknowledged: true, no context on the route; outcome { state: "done", note: "Added to the media library" } / "Attached to ticket <id>";
served bytes were faststart-remuxed (moov moved from byte 41932 to 36);
poster 200 image/jpeg; DELETE with the pairing token 403; re-create of the finished id 409; /pulse/open 200 with the real token, 403 with a tampered one;
Mongo after the runs: exactly 1 media item for the library video and exactly 1 attachment for the ticket video.
Replay (idempotence): set acknowledged: false (and removed outcome) on both sidecars, restarted the backend: the boot pass replayed both (ctx.replay), each recorded done again, and Mongo still held 1 media item and 1 attachment. Once more for the ticket video without a restart: the periodic pass replayed it, still 1 attachment, same note as the first delivery.
Failure paths: a token for a well-formed but nonexistent ticket → outcome kept with the reason, no attachment. A token whose ticket id is malformed (the attach throws) → status ready, acknowledged: false, no outcome, logged as "will be tried again".
reserve over REST (two local users): existingVideoid"foo" → fresh id; unknown UUID → reused; finished video → fresh; uploading video by the same user → reused; by another user → fresh; uploading thumbnail's id → fresh. A ticket reserve's token carries { userId, target: "ticket", ticketId }; a missing ticket → not-found.
artifactBelongsTo (evaluated in the running server via meteor shell): owner's ticket video → true; another user → false; that video's thumbnail id → false; malformed id → false.
Playwright e2e against a :3101 backend on a scratch MongoDB replica set (timehuddle_test) with VIDEOS_DIR set, frontend :3002 started by the config:
tickets/pulsevault.spec.ts: 14/14 passed, no retries — including both shape cases (403), the abandoned thumbnail re-sent after aging 10 min (201/204), and the other person's token (409, owner's HEAD still 200). Before the frontend fix, 13 passed and the device-upload case failed on all 3 attempts (the attachment was created; the list was refreshed before it existed).
After Copilot's review of e716f30 (eb8d937):prettier, eslint and tsc --noEmit clean on the five changed files. Backend booted again on :3100: the scripted library upload passes 16/16 as before; a video reserved for a ticket that was soft-deleted (status: 'deleted', inserted directly in Mongo) ends ready, acknowledged, outcome { state: "kept", reason: "Ticket … was deleted while the video was uploading" }, with 0 attachments for that ticket. The frontend's handling of kept / forbidden / timeout is checked by tsc and reading only.
After Copilot's review of eb8d937 (3e65de6):prettier, eslint and tsc --noEmit clean on the four changed files; node --check on the backend file. The Redmine revalidation at delivery is checked by reading only (no Redmine instance); the QR modal's wait and the feed's message are checked by tsc and reading.
After Copilot's review of 3e65de6 (5ff316f):prettier, eslint, tsc --noEmit and node --check clean. The team-membership check on reserve and the modal's outcome branches are checked by reading and tsc; not driven.
Final run at b9243cb (the merge candidate), same scratch setup (backend :3101 on a scratch MongoDB replica set, VIDEOS_DIR set, frontend :3002 from the config, listener PIDs fresh, capabilities 2.3):
tests/e2e/tickets/pulsevault.spec.ts: 14 passed, 0 failed, 0 skipped, no retries (32 s) — including the device-upload case, both pulse-shape cases (403), the abandoned thumbnail re-sent, and the other person's token (409).
prettier --check on all seven changed files, eslint on the spec and the three frontend files, tsc --noEmit, vitest run src/features/pulse-upload (4/4): all clean.
Not run: the rest of the e2e suite; a Redmine-target upload (no Redmine instance here; its path is unchanged from main and was checked by reading only); an upload from the Pulse app on a phone; HEVC transcode timing (only a faststart remux was exercised); the profile feed's upload path in a browser (the change is the same wait as the ticket button, checked by tsc and reading).
Upgrade note (inferred, not tested): an upload whose token was minted before this deploy has no context, so if it finishes afterwards it is settled kept (not attached); the pulsevault_reservations collection is no longer read and its TTL index expires its rows within a day.
- @mieweb/pulsevault ^0.1.2 -> ^0.4.2 (protocol 2.2). 0.4 refuses to boot
with `uploadUnit`, so it's gone from the core config, the deep link,
/pulse/open's allowed params and the API docs.
- All four kinds are accepted: Pulse sends a thumbnail, beat manifest and
captions with each video, related to it.
- `retention` removes uploads abandoned for a day (and the related files of
a video that never finished).
- Finished videos are made web-playable after Pulse gets its response
(ensureWebReady: faststart remux, or H.264 for HEVC; fail-open without
ffmpeg), one at a time.
- The stale-upload cleanup stays: a TUS DELETE now removes the artifact,
but an app killed mid-upload sends none, and its re-upload would still
409 until retention.
- Test assertions that expected uploadUnit now expect it absent.
The path that finalizes an upload whose onUploadComplete never ran (a
restart in between) attached the video without converting it. Both paths
now start the same background conversion (startWebReady).
…ried
The stale-upload check verified the token with only the artifactId. A
thumbnail, manifest or captions file carries its video's token, so the check
failed for it and an abandoned one answered every retry with 409 until
retention. It now passes `kind` and `relatedTo`, as the core does.
Runtime image lacks ffmpeg, disabling video remuxing and transcoding
meteor-backend/server/pulsevault.js:379
The web-ready path will always fail open in the deployed container because the runtime image installs MongoDB utilities but not ffmpeg/ffprobe (Dockerfile:69-84). PulseVault 0.4.2 returns skipped when either binary is unavailable, so production and PR-preview uploads will never be remuxed or transcoded. Add ffmpeg to the runtime image so this feature is actually enabled.
Add coverage for multi-artifact upload contract and authorization
meteor-backend/server/pulsevault.js:312
The new multi-artifact contract is not exercised by the automated suite: the updated e2e test only checks that uploadUnit disappeared, and all upload requests still use a video without kind or relatedTo. Add a contract test that uploads project, captions, and thumbnail artifacts with a parent-scoped token and verifies the advertised kinds/extensions; otherwise the configuration or related-artifact authorization can regress while all current tests pass.
OpenAPI schema omits protocolRevision and viewLinks
meteor-backend/server/pulsevault-docs.js:79
PulseVault 0.4.2's capabilities response also includes the required protocolRevision field and the viewLinks boolean, but this updated OpenAPI schema omits both. As a result, the standalone Swagger page no longer describes the actual protocol 2.2 response; add both properties while updating the removed uploadUnit field.
Refactor upload token verification to use stored metadata.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
Two issues in meteor-backend/server/pulsevault.js, checked against the published 0.4.2 package source:
1. Stale-upload cleanup lets any signed-in user delete another user's paused upload (L556)
The cleanup now passes the request's upload-metadata relatedTo into the token check. The package accepts a token that matches either the artifact id orrelatedTo, so any valid token now passes for any artifact id.
Abuse: reserve a library slot to get a token for your own id, then send an upload-create naming a victim's artifact id with relatedTo set to your own id. Artifact ids aren't secret: they're in the QR code and deep link.
Result: if the victim's upload has been idle for 5 minutes or more, the cleanup deletes it and the attacker's file is created under the victim's id.
This defeats the protection the comment above that line describes.
2. Thumbnails and other side files get attached to the ticket as the video (L356)
The upload-complete hook now fires for the newly accepted thumbnail, beat-manifest and captions files. It checks the kind only before starting the web-playback fix. It still consumes the reservation and creates a video attachment or media item for whatever file finished.
Example: a thumbnail uploaded under a reserved video id is attached to the ticket labelled as an mp4 (it's a JPEG). The real video upload to that id then fails with a 409.
Fix: only consume the reservation and attach when the kind is video.
Provision ffmpeg and ffprobe in runtime environments
meteor-backend/server/pulsevault.js:379
ensureWebReady needs ffmpeg and ffprobe for every remux/transcode, but the repository-managed runtime images do not install either binary (Dockerfile:71-84; meteor-backend/Dockerfile.dev:13-16). Videos that actually need conversion therefore always take the fail-open skipped path in those environments, so the new faststart/HEVC behavior is not enabled there. Provision ffmpeg in the runtime images (and explicitly on the SSH-deployed hosts) or make the dependency part of deployment validation.
Add protocolRevision and viewLinks to capabilities schema
meteor-backend/server/pulsevault-docs.js:78
PulseVault 0.4.2 always returns protocolRevision and viewLinks in /capabilities, but this hand-written schema omits both while claiming to describe the protocol response. Add them so generated Swagger clients and readers see the actual protocol 2.2 payload.
Assert all artifact extensions in configuration test
tests/e2e/tickets/pulsevault.spec.ts:102
The upgraded configuration's main new contract is that all four artifact kinds and their extensions are accepted, but this test now checks only that uploadUnit disappeared. A regression that drops .pulse, captions, or thumbnails would still pass. Assert the exact allowedExtensions object here (and ideally exercise one relatedTo create) so the application-specific 0.4 configuration is covered.
Now that thumbnails, manifests and captions are accepted, onUploadComplete
consumed the reservation and attached whatever file finished, so a thumbnail
sent under a reserved video id became the ticket's "video" (a JPEG labelled
mp4) and used up the reservation. Only kind "video" does that now, in
onUploadComplete and in the path that finalizes an upload a restart
interrupted (which checks the stored kind).
Stale cleanup: fixed in 65be1d2. The token is now checked against the upload's stored kind and relatedTo, not the request's metadata, and there's nothing to clean without a stored upload. Checked by hand: a second user's token with relatedTo set to their own id gets 409, and the other user's idle upload is still there. Your own abandoned thumbnail can still be retried.
Side files attached as the video: fixed in 1437ab1. Only kind: video consumes the reservation and gets attached, in onUploadComplete and in the restart-recovery path (which checks the stored kind). A thumbnail sent under a reserved video id now creates nothing and the reservation stays for the video; without the fix it became a media item and used up the reservation.
asserting every extension in the e2e: leaving the test as is. This PR keeps test edits to what the upgrade needs; the four kinds were checked by hand (each created and finished).
- A thumbnail, beat manifest and captions sent with the reserved video's
token are accepted, none is added as the video, and the video is added
exactly once.
- A file sent under the video's own id isn't added as the video, and the
reservation is still there for it.
- An abandoned thumbnail upload can be sent again, and another person's
token, claiming relatedTo their own video, can't clear someone's abandoned
upload. These two age the upload on the backend's disk, so they need its
VIDEOS_DIR and skip without it.
Each fails against the code it guards (no video-only guard; the request's
relatedTo trusted; relatedTo left out of the check).
…es is gone
The reservation collection and in-memory map, the stale-upload pre-handler
and its request error guard, assertPulseShape, the storage.resolve
content-type wrapper, the web-ready queue, the restart-recovery path and
the SSE /events route are removed. In their place:
- pulsevault.reserve signs { userId, target, ticketId } into the capability
token as its context; PulseVault stores it with the upload and hands it to
onUploadComplete, which attaches the video (idempotent on the video id —
PulseVault fires the completion again if it threw or the server restarted)
and records the outcome.
- pulseShape (default) refuses a video under another id or a related file
under the video's; reclaim lets a re-scan of the same link take over an
upload the app abandoned; lockWhenReady keeps a landed video; webReady
{ completeAfter: true } makes the video web-playable before it is attached.
- existingVideoid reuse and artifactBelongsTo read the upload's own context
through core.getStatus / core.getPulse instead of a reservation record.
- /pulse/open verifies the link's token as a status read of the video.
- The Swagger page documents the status and poster routes and the delete
lock; the dependency is pinned to exactly 0.5.0.
… evidence
- onUploadComplete records { state: 'kept' } when the reserved ticket was
deleted while the video uploaded, instead of attaching it to a ticket that
no longer exists; any other failure still throws, so PulseVault replays it.
- A replayed completion records the same outcome note as the first one.
- artifactBelongsTo accepts only a video: getPulse describes whatever the id
names, and a pulse's thumbnail or captions carry the uploader's context too.
- reserve reuses existingVideoid only when it is a UUID (getStatus reports
anything else as unknown rather than throwing) and only a video's.
- The Swagger page lists the create's 403 (shape) and 409, and the TUS
DELETE's 403 under lockWhenReady.
- The e2e artifact test expects the lock: DELETE with the pairing token is
403 and the video is still served.
With webReady.completeAfter the backend attaches a video only after making
it web-playable, which can come seconds after the last byte. The ticket's
"Upload from this device" refreshed its attachments once on tus success and
missed the new one; the profile feed polled for the media item for 4 s.
Both now wait for PulseVault's status route to report the upload
acknowledged, read with the upload's own token, before refreshing.
Make Authorization header optional for query-token status requests
meteor-backend/server/pulsevault-docs.js:252
The status route accepts the pairing token either in this header or in the token query parameter, but reusing AUTH_HEADER_PARAM marks the header as required. Swagger-generated clients therefore require an Authorization header even for the documented query-token form. Mark this header optional for this either/or endpoint.
… the upload wait reports its outcome
- artifactBelongsTo requires a video with bytes received (ready, processing,
or bytesReceived > 0): a reservation that was never used, or a related
file's id, is not timesheet evidence.
- Both ticket lookups exclude status 'deleted', which is how tickets.delete
deletes; a video for a soft-deleted ticket is settled as kept.
- waitUntilFiled returns done / kept / forbidden / timeout from the status
route's outcome instead of treating acknowledged as success; the ticket
button and the profile feed show the difference and keep the stored
videoid when the filing didn't happen.
- The poster route is documented as image/jpeg or image/png.
completeAfter only delays the server completion hook; the final TUS PATCH still succeeds before conversion and filing finish. Several existing direct-upload callers still publish immediately on onSuccess (src/features/huddle/PulseAttachButton.tsx:231-235, src/features/huddle/api.ts:186-205, and src/features/clock/TimesheetJustificationFields.tsx:39-44), so Huddle posts/timesheet evidence can expose the video while it is still being rewritten and before its library record exists. These paths need to wait for the new status outcome as well before marking the upload attachable.
…atus wait, surface filing outcomes in the feed and the QR modal
- A Redmine destination is resolved again when the video lands: gone for
good settles as kept; unreachable, rate-limited or a rejected key is
thrown so PulseVault retries the delivery.
- waitUntilFiled aborts each status request at the remaining deadline (at
most 10 s), so timeoutMs is enforced.
- The profile feed shows the filing message (kept / expired / still
processing) instead of the generic upload failure once the bytes landed.
- The QR modal's Done waits for the backend to file the phone's upload
before closing and refreshing, so the ticket isn't refreshed too early.
The status route returns 401 when the credential is missing, but the new OpenAPI operation documents only 403. Add the 401 response so generated clients and the Swagger page describe the actual authentication contract.
… modal acts on the filing outcome
- pulsevault.reserve checks requireTeamMembership on the ticket's team, the
same check as reading the ticket, before minting a token that can attach
to it.
- The QR modal's Done completes only on done; kept and an expired link close
it and say why; a timeout keeps it open so the attachment polling carries
on.
This asynchronous wait is not tied to the reservation that started it. While it is pending, the modal can be closed and a new reservation opened; when the old wait eventually returns done, it clears the shared local-storage key and closes the new modal, discarding the new resumable session. Track a reservation generation/current ID (or cancel/disable replacement while waiting) and ignore results that no longer match the active reservation.
This issue also appears on line 318 of the same file.
Reclaim E2E test is skipped in CI without VIDEOS_DIR
tests/e2e/tickets/pulsevault.spec.ts:519
This test is skipped in the normal automated E2E setup: tests/playwright.config.ts does not provide VIDEOS_DIR, and no workflow exports it. As a result, the new reclaim behavior is only exercised in the author's manual run and can regress unnoticed. Please make the test backend's video directory available to the Playwright process (or expose a test-only aging mechanism) so this case runs in CI.
This issue also appears on line 541 of the same file.
Document missing 400 and 401 responses in the status spec
meteor-backend/server/pulsevault-docs.js:278
The new status operation can return responses that this spec omits: an invalid artifact ID is rejected with 400, and createCapabilityAuthorize returns 401 when the pairing token is missing. Documenting only 403 makes generated clients treat these real responses as unexpected. Add 400 and 401 response entries alongside 403.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades
@mieweb/pulsevaultfrom^0.1.2to exactly0.5.0(protocol 2.3). There's no change to how Pulse is used in the app: reserving, the Pulse button and attaching work as onmain. What changes is how much of it this repo has to do itself.This PR was first written against 0.4.2, and most of what its reviews found — two security holes among them — was in code TimeHuddle had to write around PulseVault. Those findings became mieweb/pulsevault#80, and 0.5.0 (mieweb/pulsevault#81) moves that work into the package. This PR now deletes it here. #615 stays open as the reference for the destination flows that build on this.
Changes
Gone from
pulsevault.js(each replaced by a PulseVault 0.5.0 feature):pulsevault_reservationscollection + in-memory map, rehydrated at startup{ userId, target, ticketId }) is signed into the capability token as itscontext; PulseVault stores it with the upload and hands it toonUploadCompletereq.on('error')guardreclaim: a re-scan of the same link takes over an upload the app abandoned once it has been idle 5 minutes, only with the same token's kind andrelatedTo; the core guards aborted streams itselfassertPulseShapepulseShape(default on): a video only under the token's own id, a thumbnail/manifest/captions only under its own idrelatedTothe video — refused at create with 403storage.resolvecontent-type wrapper.mov/.m4v/.pulsewith their own typeswebReady: { completeAfter: true }: the video is made web-playable in the background andonUploadCompleteruns only once that's done/pulsevault/events/:idroute (unused by the web app)GET /pulsevault/artifacts/:id/statusfrom the package, documented on/pulsevault/docsKept: the Wormhole mount and its request logging, the Swagger page (now also documenting the status and poster routes and the delete lock), the
pulsevault.reserve/reserveForLibrary/getVideo/listVideosmethods with the same signatures,artifactBelongsTo(now reading the upload's context throughcore.getPulseinstead of a reservation), and the.mov/.m4vvideo extensions for the browser's device-upload fallback.Also: a video that landed can no longer be deleted with its pairing token (
lockWhenReady);/pulse/openverifies the link's token as a status read of the video rather than a create (a create now checks the shape of a pulse, which needs an upload's kind).Fixes after review of the rework (94d3984, e716f30):
onUploadCompletesettles an upload askept("Ticket … was deleted while the video was uploading") when the reserved ticket is gone at delivery, instead of attaching the video to a ticket that no longer exists. Any other failure is still thrown, so PulseVault replays it. A replay records the same outcome note as the first delivery.artifactBelongsToaccepts only a video:getPulsedescribes whatever artifact the id names, and a pulse's thumbnail or captions carry the uploader's context too, so a thumbnail's id passed as timesheet evidence.pulsevault.reservereusesexistingVideoidonly when it is a UUID (getStatusanswersunknownfor anything else instead of throwing, so"foo"was being reused) and only a video's.webReady.completeAfterthe video is filed only after the conversion, seconds after the last byte. The ticket's "Upload from this device" refreshed its attachments once on tus success and missed the new one (the e2e case failed 3/3 before this), and the profile feed polled for the media item for only 4 s. Both now wait forGET /pulsevault/artifacts/:id/status(with the upload's own token) to reportacknowledged(videoApi.waitUntilFiled).lockWhenReady. The e2e artifact test now expects the lock (DELETE with the pairing token → 403, video still served).Testing
Everything below was run locally on this branch at e716f30 (backend code as committed; frontend as committed).
Static:
prettier --checkonpulsevault.js,pulsevault-docs.js,pulse-link.js, the spec and the three frontend files: clean.eslinton the spec and frontend files: clean.tsc --noEmit(root): exit 0.vitest run src/features/pulse-upload: 4/4.Backend boot:
npm ci(resolves@mieweb/pulsevault0.5.0 from the registry),npm starton :3100 with a scratchVIDEOS_DIR;/pulsevault/capabilitiesreportsprotocolRevision: "2.3".Pulse-shaped uploads by script (token minted the way
reservemints it,issuer=ROOT_URL), one library and one ticket upload (real ticket in the dev DB), 16/16 checks each:relatedTothe video: 201/204 each; a thumbnail under the video's id: 403; a video under another id: 403;unknownbefore the video, thenprocessing→ready,acknowledged: true, nocontexton the route; outcome{ state: "done", note: "Added to the media library" }/"Attached to ticket <id>";image/jpeg;DELETEwith the pairing token 403; re-create of the finished id 409;/pulse/open200 with the real token, 403 with a tampered one;Replay (idempotence): set
acknowledged: false(and removedoutcome) on both sidecars, restarted the backend: the boot pass replayed both (ctx.replay), each recordeddoneagain, and Mongo still held 1 media item and 1 attachment. Once more for the ticket video without a restart: the periodic pass replayed it, still 1 attachment, same note as the first delivery.Failure paths: a token for a well-formed but nonexistent ticket → outcome
keptwith the reason, no attachment. A token whose ticket id is malformed (the attach throws) → statusready,acknowledged: false, no outcome, logged as "will be tried again".reserveover REST (two local users):existingVideoid"foo"→ fresh id; unknown UUID → reused; finished video → fresh; uploading video by the same user → reused; by another user → fresh; uploading thumbnail's id → fresh. A ticket reserve's token carries{ userId, target: "ticket", ticketId }; a missing ticket →not-found.artifactBelongsTo(evaluated in the running server viameteor shell): owner's ticket video → true; another user → false; that video's thumbnail id → false; malformed id → false.Playwright e2e against a :3101 backend on a scratch MongoDB replica set (
timehuddle_test) withVIDEOS_DIRset, frontend :3002 started by the config:tickets/pulsevault.spec.ts: 14/14 passed, no retries — including both shape cases (403), the abandoned thumbnail re-sent after aging 10 min (201/204), and the other person's token (409, owner's HEAD still 200). Before the frontend fix, 13 passed and the device-upload case failed on all 3 attempts (the attachment was created; the list was refreshed before it existed).huddle/pulsevault-video.spec.ts+huddle/composer-actions.spec.ts: 11/11 passed.After Copilot's review of e716f30 (eb8d937):
prettier,eslintandtsc --noEmitclean on the five changed files. Backend booted again on :3100: the scripted library upload passes 16/16 as before; a video reserved for a ticket that was soft-deleted (status: 'deleted', inserted directly in Mongo) endsready,acknowledged, outcome{ state: "kept", reason: "Ticket … was deleted while the video was uploading" }, with 0 attachments for that ticket. The frontend's handling ofkept/forbidden/timeoutis checked bytscand reading only.After Copilot's review of eb8d937 (3e65de6):
prettier,eslintandtsc --noEmitclean on the four changed files;node --checkon the backend file. The Redmine revalidation at delivery is checked by reading only (no Redmine instance); the QR modal's wait and the feed's message are checked bytscand reading.After Copilot's review of 3e65de6 (5ff316f):
prettier,eslint,tsc --noEmitandnode --checkclean. The team-membership check onreserveand the modal's outcome branches are checked by reading andtsc; not driven.Final run at b9243cb (the merge candidate), same scratch setup (backend :3101 on a scratch MongoDB replica set,
VIDEOS_DIRset, frontend :3002 from the config, listener PIDs fresh, capabilities 2.3):tests/e2e/tickets/pulsevault.spec.ts: 14 passed, 0 failed, 0 skipped, no retries (32 s) — including the device-upload case, both pulse-shape cases (403), the abandoned thumbnail re-sent, and the other person's token (409).tests/e2e/huddle/pulsevault-video.spec.ts+composer-actions.spec.ts: 11 passed, 0 failed, 0 skipped.prettier --checkon all seven changed files,eslinton the spec and the three frontend files,tsc --noEmit,vitest run src/features/pulse-upload(4/4): all clean.Not run: the rest of the e2e suite; a Redmine-target upload (no Redmine instance here; its path is unchanged from
mainand was checked by reading only); an upload from the Pulse app on a phone; HEVC transcode timing (only a faststart remux was exercised); the profile feed's upload path in a browser (the change is the same wait as the ticket button, checked bytscand reading).Upgrade note (inferred, not tested): an upload whose token was minted before this deploy has no context, so if it finishes afterwards it is settled
kept(not attached); thepulsevault_reservationscollection is no longer read and its TTL index expires its rows within a day.