fix(highway): force full video upload when server fast-paths a stale resource (#145)

Group/c2c video resources expire server-side. When the bot re-sends a
video whose md5 the server already cached, the NTV2 OIDB returns no uKey
for the main file (fast-upload hit) and SnowLuma trusted it — the send
"succeeds" but the receiver sees 资源已过期, because the reused object had
expired. Confirmed by the reporter: same MP4 fast-paths and breaks, but
mutating one byte (new md5) forces a full upload and plays fine.

Add a per-sub `forceFullOnFastPath` flag on MediaSubFileUpload. When a
flagged sub-file (video main) carries real bytes but the server fast-paths
it, runNtv2Upload re-issues the OIDB request with tryFastUploadCompleted
disabled (proton drops a `false` bool, which the server reads as "no
fast-upload"), forcing a fresh resource + full PUT. The thumb stays
fast-path-OK so a cached thumb never re-pushes the main video; forwarding
paths carry no bytes so they never trigger the retry.

Also fixes the observability gap the reporter hit: the main file being
silently skipped on a fast-path now logs explicitly, and so does the
forced-retry, instead of only the thumb PUT showing up.

Note: the retry relies on the server treating an absent
tryFastUploadCompleted as "no fast-upload" — needs real-device
confirmation that the forced round actually returns a uKey.
This commit is contained in:
DrSmoothl committed 2026-06-25 20:52:11 +08:00
1 parent 78b0e1a124
commit 3eba2a677c
4 files changed
+247 -73

No files matched your search

@@ -443,6 +443,12 @@ export async function uploadVideoMsgInfo(
sha1: video.sha1Blocks,
subFileIndex: 0,
fastOnlyError: 'video fast-upload not available (server requires bytes)',
// Distrust a server fast-path for the main video: group/c2c video
// resources expire server-side, so reusing a cached object can show
// "资源已过期" on the receiver even though the send "succeeded".
// When we hold the real bytes, force a fresh full upload instead.
// (Forwarding carries no bytes, so this never fires there.) See #145.
forceFullOnFastPath: true,
},
{
source: 0, // upload.subFileInfos[0]