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:
4 files changed
+247
-73
No files matched your search
@@ -80,6 +80,16 @@ describe('video-upload', () => {
|
||||
expect(uploads[1]!.fastOnlyError).toBeUndefined();
|
||||
});
|
||||
|
||||
it('main file distrusts a server fast-path (forceFullOnFastPath); thumb does not (#145)', async () => {
|
||||
// Group/c2c video resources expire server-side: a fast-path hit can
|
||||
// reference a stale object the receiver shows as "资源已过期", so the
|
||||
// main file forces a fresh full upload. The thumb stays fast-path-OK.
|
||||
await uploadVideoMsgInfo({} as any, true, 12345, FINGERPRINT);
|
||||
const uploads = vi.mocked(pipeline.runNtv2Upload).mock.calls[0]![0].uploads;
|
||||
expect(uploads[0]!.forceFullOnFastPath).toBe(true);
|
||||
expect(uploads[1]!.forceFullOnFastPath).toBeUndefined();
|
||||
});
|
||||
|
||||
it('uploadInfo carries TWO entries (main mp4 + thumb jpg) with subFileType 0 and 100', async () => {
|
||||
await uploadVideoMsgInfo({} as any, true, 12345, FINGERPRINT);
|
||||
const uploadInfo = vi.mocked(pipeline.runNtv2Upload).mock.calls[0]![0].uploadInfo;
|
||||
|
||||
Reference in new issue
Block a user