Repository navigation
Link a clip's post text on the review page - #181
Conversation
A21-devs
left a comment
There was a problem hiding this comment.
Checked the page side:
showFiles()reads theclipobject the closure already holds, and Write title updatesclip.postbefore calling it, so the link shows up without the card being rebuilt (the headless run in the description confirms the videos stay).- A Rewrite keeps the same .txt name, so the link doesn't change. Files are served with
Cache-Control: no-cache, so a second download revalidates instead of handing back the old title. - Clips without a post file get no link, same as srt and cover.
One real problem, in the new test, inline. It only shows up once #180 is merged.
| manifest.write_text(json.dumps(data)) | ||
| return dict(data["clips"][n - 1]) | ||
|
|
||
| monkeypatch.setattr(server, "write_clip_copy", fake) |
There was a problem hiding this comment.
#180 (open, CI running) removes write_clip_copy from server's imports: the endpoint now calls draft_clip_copy and then save_clip_copy. If that merges first, monkeypatch.setattr(server, "write_clip_copy", fake) raises AttributeError (setattr's default raising=True) and this test fails on main. The two PRs touch different lines, so git won't flag a conflict. Whichever merges second has to follow the other. With #180 in, the fake should be a draft_clip_copy that returns a draft, and .txt writing then goes through the real save_clip_copy, which tests the download better anyway.
The .txt that --copy and Write title make was served but not linked, so batch uploads meant copying title, description and hashtags by hand. The files row now has 'download text' for clips with a post file and is rebuilt after Write title, so the first title adds the link.
3f35dda to
b14c502
Compare
|
#180 merged first, so I rebased onto main (force-pushed, now b14c502). The new test and #180's tests were both added at the end of
The page code is unchanged from the first push. |
A21-devs
left a comment
There was a problem hiding this comment.
Second pass over the rebased b14c502. The finding is fixed: the test no longer touches server.write_clip_copy. It fakes draft_clip_copy, which exists on main since #180, and goes through the real save_clip_copy, so the .txt it downloads is the one the endpoint actually wrote. I diffed index.html against the first push and it's identical. The rest of the test file is #180's tests unchanged plus the page check. Clean.
Closes #115.
What
showFiles(), which addsdownload text(the<clip>.txtfrom--copyor Write title,clip.postin the manifest) after mp4, srt and cover when the clip has one. Like the others it uses thedownloadattribute with the file's own name, so a batch of clips lands next to their text files.postfrom the returned manifest along withcopyand rebuilds just the files row. The first title on a run without--copyadds the link without rebuilding the card, so the videos keep playing.Testing
uv run ruff check src tests,uv run pytest -q tests/test_write_title.py: 15 passed (the page has no JS test setup, so the full suite and CI cover the Python side).postfile downloads through/api/jobs/<id>/files/<name>byte-for-byte (UTF-8,text/plain). A check on index.html that the files row includesclip.postand that the Write title handler setsclip.postand callsshowFiles().clipwright servewithCLIPWRIGHT_OPENAI_URLpointing at a local stub backend, job on a 240 s synthetic video (TTS speech over Roblox gameplay), 2 clips, no--copy:download mp4 / srt / cover, no text link (no post file yet)download text, clip 2 is unchangeddownloadname istalk_clip01.txt, and fetching it returns the stub's title, description and#roblox<video>elements on the page, the cards weren't rebuilt