Skip to content

test: lock format_router extensions to parse adapters - #419

Open
Frankie-Xu wants to merge 1 commit into
Ontos-AI:mainfrom
Frankie-Xu:test/Frankie-Xu/format-router-adapter-map
Open

Frankie-Xu wants to merge 1 commit into
Ontos-AI:mainfrom
Frankie-Xu:test/Frankie-Xu/format-router-adapter-map

Conversation

@Frankie-Xu

@Frankie-Xu Frankie-Xu commented Sep 14, 2026

Copy link
Copy Markdown

Summary

  • Add a worker unit lock for format_router.py: every SUPPORTED_FILE_TYPES extension is resolvable, and every DocumentFormat has an adapter (and the reverse).
  • Test-only. No router, admission, or README change.
  • Prevents a future KeyError from adding an extension without adapter_by_format, or an adapter that no supported extension can reach.

Verification

  • make lint — All checks passed
  • make typecheck — 0 errors, 0 warnings, 0 informations
  • cd apps/worker && uv run pytest -p no:postgresql tests/unit/test_format_router_adapter_map.py -q — 16 passed

-p no:postgresql is only to skip the autoloaded pytest-postgresql plugin in this environment (no libpq). The tests do not use Postgres.

Deployment Notes

  • No new or changed environment variables
  • No database migrations, queue changes, storage changes, or release-order requirements
  • Backwards compatible; rollback is reverting this PR

Checklist

  • Tests were added or updated when behavior changed
  • Public docs, examples, or OpenAPI contracts were updated when needed — N/A (test-only)
  • Database migrations are idempotent and safe to deploy — N/A
  • Logs, errors, and validation paths avoid leaking secrets or user data
  • The pull request description explains any breaking or user-visible change — none

Keep SUPPORTED_FILE_TYPES, resolve_document_format, and
get_document_parse_adapter as inverses so a new extension cannot
ship without an adapter (or the reverse).

Co-authored-by: Frankie-Xu <Frankie-Xu@users.noreply.github.com>
@Frankie-Xu
Frankie-Xu marked this pull request as ready for review September 14, 2026 18:51
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.

2 participants