Skip to content

fix(managers): sync universe jurisdiction fields for filtering#738

Merged
stranske merged 4 commits intomainfrom
codex/mopup-universe-jurisdictions-sync
Mar 2, 2026
Merged

fix(managers): sync universe jurisdiction fields for filtering#738
stranske merged 4 commits intomainfrom
codex/mopup-universe-jurisdictions-sync

Conversation

@stranske
Copy link
Copy Markdown
Owner

@stranske stranske commented Mar 2, 2026

Summary

  • update universe upserts to persist both jurisdiction and jurisdictions so imported managers behave correctly with jurisdiction-based API filters
  • ensure universe schema setup includes jurisdictions in both SQLite and Postgres compatibility paths
  • update seed_universe.py upsert logic to write synchronized jurisdiction fields and handle schemas with/without legacy role column
  • extend tests to assert jurisdiction filtering works after universe import and seeded rows include jurisdictions

Testing

  • PYTHONPATH=. pytest -q tests/test_manager_universe_api.py tests/test_seed_universe.py
  • ruff check api/managers.py scripts/seed_universe.py tests/test_manager_universe_api.py tests/test_seed_universe.py

Copilot AI review requested due to automatic review settings March 2, 2026 03:48
@stranske-keepalive
Copy link
Copy Markdown
Contributor

⚠️ Action Required: Unable to determine source issue for PR #738. The PR title, branch name, or body must contain the issue number (e.g. #123, branch: issue-123, or the hidden marker ).

@agents-workflows-bot
Copy link
Copy Markdown
Contributor

agents-workflows-bot bot commented Mar 2, 2026

🤖 Keepalive Loop Status

PR #738 | Agent: Codex | Iteration 0/5

Current State

Metric Value
Iteration progress [----------] 0/5
Action wait (missing-agent-label)
Disposition skipped (transient)
Gate success
Tasks 0/6 complete
Timeout 45 min (default)
Timeout usage 2m elapsed (5%, 43m remaining)
Keepalive ❌ disabled
Autofix ❌ disabled

🔍 Failure Classification

| Error type | infrastructure |
| Error category | resource |
| Suggested recovery | Confirm the referenced resource exists (repo, PR, branch, workflow, or file). |

@agents-workflows-bot
Copy link
Copy Markdown
Contributor

agents-workflows-bot bot commented Mar 2, 2026

Keepalive Work Log (click to expand)
# Time (UTC) Agent Action Result Files Tasks Progress Commit Gate
0 2026-03-02 03:51:24 Codex wait (missing-agent-label-transient) skipped 0 0/6 success
0 2026-03-02 04:17:47 Codex wait (missing-agent-label-transient) skipped 0 0/6 cancelled
0 2026-03-02 04:19:38 Codex wait (missing-agent-label-transient) skipped 0 0/6 success
0 2026-03-02 04:32:14 Codex wait (missing-agent-label-transient) skipped 0 0/6 success

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures that manager universe imports (both via the API and the seed_universe.py script) consistently populate both the jurisdiction scalar field and the jurisdictions array field, so that jurisdiction-based list filtering works correctly for managers imported through the universe import flow.

Changes:

  • api/managers.py: Adds jurisdictions column migration in _ensure_universe_schema and updates _upsert_universe_record to write jurisdictions as a single-element JSON array derived from jurisdiction.
  • scripts/seed_universe.py: Mirrors the api/managers.py schema migration; refactors the upsert logic into a new _upsert_universe_record function that handles presence/absence of the legacy role column (detected via a new _manager_columns helper); writes jurisdictions on insert/update.
  • Tests: Updated existing assertions to include the jurisdictions column, and added a new end-to-end test verifying jurisdiction filtering returns the correct result after a universe import.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
api/managers.py Adds jurisdictions column migration and upsert logic
scripts/seed_universe.py Adds jurisdictions column migration, _manager_columns helper, and refactored upsert
tests/test_manager_universe_api.py Updates existing DB assertions; adds new jurisdiction filter test
tests/test_seed_universe.py Updates existing DB assertions to include jurisdictions

stranske and others added 3 commits March 1, 2026 22:16
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@stranske stranske merged commit 18a1e74 into main Mar 2, 2026
33 checks passed
@stranske stranske deleted the codex/mopup-universe-jurisdictions-sync branch March 2, 2026 04:36
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