[iris] Remove ORM query builder, replace with raw SQL#4181
Conversation
|
Claude finished @rjpower's task in 6m 31s —— View job PR Review: [iris] Remove ORM query builder, replace with raw SQL
Clean mechanical removal of the ORM query builder (~550 lines net deletion) replacing ~100 callsites with raw SQL + Findings:
No bugs, resource leaks, race conditions, or guideline violations found. The conversion is mechanically correct. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59fa6cbabb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| tasks = decode_rows( | ||
| Task, | ||
| q.fetchall( | ||
| "SELECT * FROM tasks WHERE job_id = ? ORDER BY task_id, task_index", |
There was a problem hiding this comment.
Order tasks by numeric index for per-job reads
tasks_for_job_with_attempts now orders rows by task_id text, which changes the previous numeric task ordering to lexicographic ordering (e.g., .../10 comes before .../2) for jobs with 10+ replicas. This helper is used by job-status/listing paths, so task arrays can be returned in a misleading order and no longer align with task indices. Ordering should remain index-based (task_index) to preserve stable, numeric task sequence.
Useful? React with 👍 / 👎.
|
@claude merge this branch with main/rebase & fix the conflict, address the concern from code review as well. |
|
Claude finished @rjpower's task in 5m 17s —— View job Rebase & fix review concerns
Summary: Rebased on Testing: All 273 iris tests pass (212 from test_db/test_query/test_transitions/test_scheduler + 61 from test_heartbeat/test_direct_controller/test_dashboard/test_dry_run). Pre-commit passes clean. |
Delete Table, Column, Predicate, SelectExpr, Order, Join, JoinedQuery and all 16 module-level table constants from db.py. Replace ~100 callsites across 8 production files and 12 test files with raw SQL + decode_rows/decode_one helpers. Every query is now visible as plain SQL at its callsite. Net -556 lines.
Address code review: change ORDER BY from task_id,task_index to task_index,task_id so tasks sort numerically rather than lexicographically. Also resolve rebase conflict (removed stale ORM table constants from main). Co-authored-by: Russell Power <rjpower@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
59fa6cb to
bd77a6e
Compare
yonromai
left a comment
There was a problem hiding this comment.
🤖 I re-reviewed the current PR head after the task-ordering follow-up commit and re-ran the targeted controller/query suites. I did not find a merge-blocking behavior regression in the raw-SQL rewrite, so this is safe to approve.
Non-blocking follow-up: lib/iris/docs/sql-canonical.md still documents the removed query DSL (q.select(), q.one(), q.count(), tx.insert()/update()/delete()). That doc should be updated in a follow-up so it matches the new explicit-SQL API surface.
Generated with Codex
Delete Table, Column, Predicate, SelectExpr, Order, Join, JoinedQuery and all 16 module-level table constants from db.py. Replace ~100 callsites across 8 production files and 12 test files with raw SQL + decode_rows/decode_one helpers. Every query is now visible as plain SQL at its callsite. Net -556 lines. Follows #4179 which fixed the immediate scheduling perf issue. --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Russell Power <rjpower@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Delete Table, Column, Predicate, SelectExpr, Order, Join, JoinedQuery
and all 16 module-level table constants from db.py. Replace ~100
callsites across 8 production files and 12 test files with raw SQL +
decode_rows/decode_one helpers. Every query is now visible as plain SQL
at its callsite. Net -556 lines.
Follows #4179 which fixed the immediate scheduling perf issue.