Skip to content

Fix batch QA report row parsing - #63

Merged
blixvip merged 4 commits into
blixvip:mainfrom
Aaqibhafeezkhan:fix/51-qa-report-row-parsing
Nov 15, 2026
Merged

blixvip merged 4 commits into
blixvip:mainfrom
Aaqibhafeezkhan:fix/51-qa-report-row-parsing

Conversation

@Aaqibhafeezkhan

Copy link
Copy Markdown
Contributor

Summary

  • Parse all shot rows correctly, including picked, flagged and unmarked entries.
  • Handle shot indexes with three or more digits.
  • Count flagged shots and title-card/repeat flags when evaluating the QA review threshold.
  • Add regression tests for mixed markers, large indexes and empty reports.

Closes #51

@Aaqibhafeezkhan Aaqibhafeezkhan left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  • Replaced the brittle fixed-width row detection with a dedicated _qa_shot_counts() helper that correctly parses picked (*), flagged (x), and unmarked shot rows.
  • Added support for shot indexes with three or more digits, preventing valid rows from being incorrectly excluded.
  • Updated the QA review threshold to account for explicitly flagged shots as well as title-card? and repeat flags.
  • Added regression tests covering mixed row markers, large shot indexes, flagged-shot thresholds, and reports containing no shot rows.
  • Kept the changes focused on the existing QA parsing and curation flow without altering unrelated behavior.

The implementation addresses the reported parsing issue and includes regression coverage for the affected scenarios.

@blixvip blixvip left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks @Aaqibhafeezkhan, this is very close. The regex parser is right, the three-digit index case is covered, and parsing the flags column as a set is better than the old substring check (it also catches short,repeat, which the old " repeat" test missed). I ran python -m unittest discover on your branch: 69 tests, all OK.

One thing to change before I merge:

Rows marked x shouldn't all count as bad. In sheet.report a row gets x whenever it has any flag, and that includes short (a shot under 1 second). The gate was only ever meant to trip on title-card? and repeat. Short shots are normal in a fast-cut movie, so with the match.group(2) == "x" clause a healthy pool where more than one sixth of the shots are short would be sent to NEEDS_REVIEW and skipped. The fix is one line in _qa_shot_counts:

-        if match.group(2) == "x" or {"title-card?", "repeat"} & flag_set:
+        if {"title-card?", "repeat"} & flag_set:

The tests then need these expectations (I tried this locally and it passes):

             _shot_row(4, "*"),
+            _shot_row(5, "x", "short,repeat"),
             _shot_row(105, "x", "repeat"),
         ])
-        self.assertEqual(batch_edit._qa_shot_counts(report), (6, 3))
+        self.assertEqual(batch_edit._qa_shot_counts(report), (7, 3))

and in the second test (3, 1) becomes (3, 0). The short row in the first test is worth keeping, because it now proves that a short shot alone doesn't count.

Optional, not blocking: a quote line that starts with a number (for example 300 men stood ...) also matches the row regex. Only counting rows after the idx id ... header line would rule that out.

Push that and I'll merge it straight away.

@Aaqibhafeezkhan Aaqibhafeezkhan left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@blixvip

Thanks for the review. I've addressed the feedback and pushed the updates:

  • Updated the QA gate to count only title-card? and repeat flags as suspect shots.
  • Kept short-only shots valid while still detecting combined flags.
  • Restricted row parsing to the shot table, preventing numeric text before the table from being misinterpreted.
  • Added regression tests covering these cases, including three-digit indexes and reports without shot rows.

Please take another look. Thanks!

@blixvip

blixvip commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Thanks for the fix! Reviewed and merging. 🙏

@blixvip
blixvip merged commit b3216a7 into blixvip:main Nov 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix batch_edit's QA gate, which reads the wrong column of report.txt

2 participants