VersionControl:PRs/maybelle-config/298

From PickiPedia: A knowledge base of bluegrass, old time psychedelic jams, and other public domain music
Jump to navigationJump to search
maybelle-config#298: delivery-kid: /enrich/repackage, so the 26 older video releases play on iPhones
State 🟣 merged 2026-11-10 16:27:30
Worked on by magent, with skyler (testing on an iphone 17), justin
Moods #uploads-and-embeds
Deploy not said
Branch magent/resdtp-releases → production, by magent-cryptograss
Opened · last pushed 2026-11-09 18:32:00 · 2026-11-09 18:31:01
## Why

#297 stops new encodes writing the empty `sdtp` box that iPhone Safari refuses. 26 video Releases were published before it and still have one. Justin, in #uploads-and-embeds: redo them all; a new CID is fine.

## What

`POST /enrich/repackage {"cid": ..., "dry_run": false}` (API key, like `/enrich/torrent`), in its own routes file so it doesn't collide with #290.

Inside the IPFS node, through MFS (`services/repackage.py`):
1. Find every `stream_*/init*.mp4` and remove any empty `sdtp` (the same code as #297, split into `drop_empty_sdtp_bytes`).
2. `files/cp` the release by reference, `files/write` only the fixed init segments, plus `metadata.json` with `repackaged_from: <old CID>`.
3. `files/stat` for the new CID, `pin/add` it, remove the MFS scratch copy.

Nothing is downloaded, re-added or re-encoded, so the 1.4 GB release costs about as much as a short clip. The old CID stays pinned. There's no timestamp in what's written, so the same release always gives the same new CID: running it twice pins nothing new.

## Checked

- **Against a real kubo 0.43** (a throwaway offline container on hunter), on a release built from `QmbYnW…`'s own 360p files: the new init segment is byte-identical to test 18, the one Skyler's iPhone played. Every media segment and the audio rendition keep the same blocks. Both CIDs are pinned, the MFS scratch copy is gone, and a second run gives the same CID.
- That run caught a bug the first fake didn't: kubo reads a `/` in the multipart filename as a directory. Fixed, and the test's fake kubo now refuses it the same way.
- 149 delivery-kid tests pass (5 new in `tests/test_repackage.py`). The endpoint answers 401 without a key. Merges cleanly with #290.
- Not checked: on delivery-kid itself.

## After deploy

1. With the API key, dry run first, then for real:
   ```
   for c in $(cat sdtp26.txt); do curl -s -X POST https://delivery-kid.cryptograss.live/enrich/repackage -H "X-API-Key: $KEY" -H 'Content-Type: application/json' -d "{\"cid\":\"$c\",\"dry_run\":true}"; echo; done
   ```
2. Move each `Release:<old>` to `Release:<new>`, keeping its history; the old title redirects. 24 of them have a `bittorrent_infohash` for the old bytes. That field has to go, so the Blue Railroad job makes a torrent of the new ones.
3. Unpin the old CIDs once the pages have moved.

The 26 (every Release whose video init segment has the box; the other 18 video Releases have none):
    QmPTDWdthu1ZMtJwr5KHehXBk7X3FrLsA8wxdqnoX9LeW9
    QmRpqcstuYx2yhZ5TjXdVHSUefwDGrPoe65sNTkuNUGkqz
    QmRxSwLvRjsDP8p7gitKP1rg9cExUahDudU2dr2Z8kMzFi
    QmSAeiTZ2gMUYPfF9p8kj5ApuKohSgEru3RzRBBc82o8xS
    QmSGrjxtHayqBhJMxWKVFuLP55YT3QxkVLzGmpYycqg6tF
    QmTrp8gYj4tiHFcovJoe26FzeN3NMULZWkVg3cW7NBdAbF
    QmTx3csugrGr5twKXmwQi5okCr1MWaBJfQNj1Vde9TwZim
    QmU2rS8zrVcGPL2tz7jhKE6KdNj5mAy7FMFpY9iX9x54ms
    QmUQwnWJMcwMGkVSo45XLwiqWZg8esLnecSzFCwdASDvNg
    QmV583L78ruF7KpdmhZC8p5rYPBSkbPcTYjA31P22q3grJ
    QmVJG32Xewr62X1dSg8wtQrwyYMsEhSD1ujXZVTrXfpXam
    QmVYU5wNxPMUMjiDJAuYuKYeQPNdANnf8weFNrY2u4JQ1i
    QmW14popPbxcgj39UQ5XPPb3yKbjPgRUV3FeXk85fSqzJ6
    QmYacRRA9WjdwwvbcmF8ujYZDvBN9n5m39atTSmoX4fWV1
    QmZLS8LUoJvjDvVLdan7R8FGYWSCTs3vo2jw6H943e4WpU
    QmZSLe6SkfRB65DdyYeQFVyF1L6p7pFbyk1t4TCV65o4pB
    QmZXZ4iTtBUi5HZmLVBfHde6PESnezj2K2QYixbTMNCYgk
    QmZerxBKPBcTd39xvv5xYG7Kdw2FGVVW4SZCet7XdPPvWR
    Qmaj8XBvuYohG9aot5fDrwgPiDFxC2r8pYfDZxvNurfNKh
    QmbBrpe8U8cxgkf24bteRATQ9Td1RrEdCz7RJM3a3bRBCj
    QmbYnW2BpVxwvJZDE3e4iaJcH3xn1QDugRZuofuv1JDkJg
    QmdGoubKAb5f8aE5czYTxCUUmAbE7FgbLTLGwun88ZtSpw
    QmdgxqVbPpLu1Rp8Sn46BqQzRbbpnwrYG3X2FTFfUVGDvQ
    QmdyjTo2M4WYSHUbRy5odkj8vfgAwKumAcXD59gmc8PmFE
    QmeN1JDvkE1JnJWqT9rAaPcafLpBtGLy6oVkwZYBjG7qhH
    Qmet33eDDm8p2rHciP1k9HVoQwmoAYT9ePn1zy7CnbumoZ

Redeploy delivery-kid.
Worked on by: magent, with Skyler (testing on an iPhone 17) and Justin, in #uploads-and-embeds