Skip to content

feat(sqlite): port job crate to SQLite backend#48

Draft
bodymindarts wants to merge 5 commits intomainfrom
task/job-sqlite-compat-019ce262
Draft

feat(sqlite): port job crate to SQLite backend#48
bodymindarts wants to merge 5 commits intomainfrom
task/job-sqlite-compat-019ce262

Conversation

@bodymindarts
Copy link
Copy Markdown
Member

Summary

  • Port the job crate from Postgres to SQLite, using the es-entity task/sqlite-backend-019cdf3d branch
  • Rewrite all SQL (migrations, poller, dispatcher, spawner) from Postgres to SQLite syntax
  • Remove PgListener (LISTEN/NOTIFY) in favor of timer-based polling with real-time fallback
  • Convert compile-time sqlx::query!() to runtime sqlx::query() to match es-entity-macros-sqlite
  • Handle SQLite constraint error classification (no structured constraint names)
  • Add nextest-sqlite CI workflow matching the es-entity pattern

Test plan

  • All 33 tests pass locally via cargo nextest run
  • cargo clippy --all-targets -- -D warnings clean
  • cargo fmt -- --check clean
  • CI runs nix run .#nextest-sqlite via GitHub Actions

🤖 Generated with Claude Code

@bodymindarts bodymindarts force-pushed the task/job-sqlite-compat-019ce262 branch from f4924d5 to 10591e5 Compare March 12, 2026 19:05
bodymindarts and others added 4 commits March 15, 2026 16:51
Migrate the job crate to work exclusively with SQLite via the
es-entity sqlite branch. Key changes:

- Rewrite all SQL from Postgres to SQLite syntax (? params, TEXT
  types, no ENUM/INTERVAL/UNNEST/FOR UPDATE)
- Remove PgListener (LISTEN/NOTIFY) — use timer-based polling with
  real-time fallback to avoid deadlocks with manual clocks
- Convert compile-time sqlx::query!() to runtime sqlx::query()
- Change JobType inner type from Cow<'static, str> to String to fix
  sqlx Encode lifetime issues with the EsRepo derive macro
- Handle SQLite constraint errors (no structured constraint names)
  by parsing error messages and extended error codes
- Use shared-cache in-memory SQLite for tests
- Delete .sqlx query cache (no longer needed with runtime queries)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace local path dependency with a git branch reference so the
build works in CI and nix sandboxed environments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add nextest-sqlite package to flake.nix and update the GitHub Actions
test workflow to run SQLite tests via nix run .#nextest-sqlite,
matching the es-entity sqlite branch CI pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bodymindarts bodymindarts force-pushed the task/job-sqlite-compat-019ce262 branch from a514a9d to e6c03e8 Compare March 15, 2026 15:54
Port the cancel_job SQL query from Postgres ($1) to SQLite (?)
parameter syntax and add the .sqlx offline cache file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bodymindarts bodymindarts force-pushed the task/job-sqlite-compat-019ce262 branch from e6c03e8 to 4273cf6 Compare March 15, 2026 16:45
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