Skip to content

Add a keywords box to the review page form - #189

Merged
A21-devs merged 2 commits into
mainfrom
feat/keywords-form-field
Dec 5, 2026
Merged

A21-devs merged 2 commits into
mainfrom
feat/keywords-form-field

Conversation

@A21-devs

@A21-devs A21-devs commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Closes #122

The review page form had no way to pass --keywords, even though the CLI, MCP tool and serve API all take it.

What changed in web/index.html:

  • A full-width "Favor moments where these are said" box under the other options, placeholder clutch, no way, maxlength 500 to match MAX_KEYWORDS_TEXT.
  • It's disabled while Captions is unchecked. A disabled input isn't in the FormData, so the job goes out with keywords: null and the server doesn't reject it with "keywords ... need captions on". An empty box is sent as null too.
  • The run summary line reads 2 clips, keywords: no way, golden sword when the manifest has keywords. Runs without keywords look the same as before.

The reasons line already shows said "..." per clip, so nothing changed there.

Testing

  • uv run ruff check src tests, uv run mypy, uv run pytest -q: 769 passed.
  • New test_form_keywords_field_matches_parse_job: the input is named keywords, its maxlength equals MAX_KEYWORDS_TEXT, the submit handler sends it, and the placeholder text parses to ["clutch", "no way"].
  • Real run: clipwright serve --port 8799, driven with headless Edge over CDP on a 4 min TTS-over-gameplay video, whisper tiny:
    • box enabled at load, disabled after unchecking Captions, enabled again after checking it
    • typed No way, golden SWORD, the POST body had "keywords": "No way, golden SWORD"
    • log: keywords: "no way" 3x, "golden sword" 3x, summary: 2 clips, keywords: no way, golden sword, both clips' reasons include said "no way", "golden sword"
    • Captions off with text still in the box: POST had keywords: null, no form error

Sent as the keywords string parse_job already reads, disabled while
captions are off, and the finished run's summary lists the keywords
from the manifest.

@A21-devs A21-devs left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the diff after the headless run. The field name, the null for an empty or disabled box, and the summary line all line up with parse_job and the manifest, and old manifests without keywords still render (m.keywords?.length). Two things on the input itself.

Comment thread src/clipwright/web/index.html Outdated
</label>
<!-- matched against the transcript, so it's off with captions (the server would refuse it) -->
<label class="wide" id="keywords">Favor moments where these are said
<input type="text" name="keywords" placeholder="clutch, no way" maxlength="500" autocomplete="off">

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxlength="500" makes the browser cut pasted text at 500 characters without saying anything. If someone pastes a long list, the last phrase gets chopped mid-word (golden swo) and that fragment becomes a keyword they never typed, which is worse than the server's keywords can be at most 500 characters. Without maxlength the 400 lands in #form-error like every other limit. The test then shouldn't pin maxlength either.

Comment thread src/clipwright/web/index.html Outdated

// keywords are looked for in the transcript, which only exists with captions on
const captionsBox = document.querySelector('input[name="captions"]');
const syncKeywords = () => { $("new-job").elements.keywords.disabled = !captionsBox.checked; };

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When captions are off the box just goes grey (the page has no :disabled style for inputs, so it's the browser default, which is faint in dark mode) and nothing says why. Someone who unchecked Captions earlier will see a box they can't type in. A title on the input saying it needs captions, set in syncKeywords, would cover it.

@A21-devs

A21-devs commented Dec 5, 2026

Copy link
Copy Markdown
Owner Author

Fixed both in 846ab66.

  • maxlength is gone. In headless Edge, a 602-character paste now stays in the box as typed and submitting shows keywords can be at most 500 characters in the form error. The test asserts there's no maxlength and that a 560-character string gets the 400 from parse_job.
  • syncKeywords sets the title looked for in the transcript, so it needs Captions on while the box is disabled and clears it when it's enabled again. I also added input:disabled { opacity: .5 } so it looks the same as the disabled buttons. Computed opacity was 0.5 with Captions off and 1 with it back on.

ruff, mypy and the server tests pass.

@A21-devs A21-devs left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second pass on 846ab66. Both points are fixed: the input has no maxlength, so a long paste reaches the server and comes back as the 500-character error, and the disabled box now has a title and the 0.5 opacity. input:disabled is a page-wide rule, but the keywords box is the only input the page ever disables, so nothing else changes. The new test case is 560 characters ("golden sword, " * 40), so it really does go over the limit. Nothing else from me.

maxlength cut a long paste mid-word without telling anyone. The
disabled box now has a title and a visible disabled style.
@A21-devs
A21-devs merged commit 8a727d6 into main Dec 5, 2026
4 checks passed
@A21-devs
A21-devs deleted the feat/keywords-form-field branch December 5, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keywords box on the review page form

1 participant