Skip to content

[qa] Share the streamed listing code between assets, shots and edits - #1192

Merged
frankrousseau merged 1 commit into
cgwire:mainfrom
frankrousseau:main
Aug 7, 2026
Merged

[qa] Share the streamed listing code between assets, shots and edits#1192
frankrousseau merged 1 commit into
cgwire:mainfrom
frankrousseau:main

Conversation

@frankrousseau

Copy link
Copy Markdown
Contributor

Problem

  • The with-tasks routes of assets and shots carried the same twenty lines twice:
    the header, the generate() closure yielding NDJSON, and the comment above
    them. The vendor scoping was a third copy, in edits too.
  • rebuild_from_compact was duplicated in the two test files.

Solution

  • Answer through flask_utils.rows_response, scope through
    permissions_service.scope_criterions_to_vendor, and move the compact decoder
    to tests/base.
  • EditsResource.get keeps its own partial copy: get_edits does not know
    vendor_departments, so the two edit listings still disagree on whether a
    vendor is held to their departments.

…ources

The with-tasks routes of assets and shots carried the same twenty lines
twice: the same five line comment, the same header, the same generate()
closure yielding NDJSON. The vendor scoping was a third copy, in edits too,
recognisable by the one line of each file that runs past 79 characters.

Three helpers, one per duplication. flask_utils.rows_response answers a
listing as one object or as a stream, and reads no row, so it stays in
utils. permissions_service.scope_criterions_to_vendor loads the caller and
their departments, so it is a service. tests/base gets the compact decoder
the two test files were both carrying.

EditsResource.get keeps its own partial copy on purpose: get_edits does not
know vendor_departments, and passing it would filter Entity on a column that
does not exist. The two edit listings therefore still disagree on whether a
vendor is held to their departments.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@frankrousseau
frankrousseau merged commit 3398892 into cgwire:main Aug 7, 2026
14 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.

1 participant