Skip to content

Add the runtime attempt list table and its admin reads (ADR-055, v065) - #907

Open
hardbyte wants to merge 2 commits into
mainfrom
claude/adr055-schema
Open

hardbyte wants to merge 2 commits into
mainfrom
claude/adr055-schema

Conversation

@hardbyte

@hardbyte hardbyte commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Summary

First of four PRs for ADR-055, tracked in #905: the schema and the admin reads. Runtimes do not publish yet; that is the next PR.

  • Migration v065 adds awa.runtime_attempts (one row per instance, fillfactor 50, per-table autovacuum thresholds, no foreign key and no trigger) and a nullable awa.runtime_instances.attempts_unpublished_since.
  • admin::attempt_instances(pool, &[(job_id, run_lease)]) returns the instance that lists each attempt for the active storage schema. A newer attempt of the same job, or another schema's job id, never matches.
  • admin::runtime_attempts(pool, instance_id) reads one instance's list.
  • RuntimeInstance gains attempts_unpublished_since. list_runtime_instances reads it through to_jsonb(row), so an admin binary on a schema before v065 reads null instead of failing.
  • admin::cleanup_runtime_attempts deletes lists whose instance has no snapshot and that are older than the snapshot retention. The maintenance leader runs it after snapshot cleanup.
  • CHANGELOG and an upgrade-guide section for v065, including the runtime-role grant on the new table.

Rolling upgrade

  • The table and column are additive. Binaries before v065 never touch them, and their snapshot upserts name their columns.
  • Every new read checks for the table first and treats a missing table or column as "not reported".
  • Adding the column takes ACCESS EXCLUSIVE on runtime_instances for a catalog change only.

Migration number

Open PRs #884 and #887 also add migrations numbered v064 and v065. Whichever merges second renumbers.

Testing

  • awa-model/tests/runtime_attempts_test.rs:
    • reads on a v064 schema return nothing;
    • v065 applies and replays;
    • an old-shape snapshot upsert still works after v065;
    • the column is read once present;
    • the table's storage options and constraints, and no triggers;
    • run-lease and schema matching;
    • cleanup keeps a live instance's old list and a dead instance's recent one.
  • migrations unit tests (DDL guards, transaction safety) pass.
  • clippy and the workspace build are clean.
  • migration_test was run locally in parallel and timed out on shared-database contention; one of the slow tests passes alone. CI runs that binary serially.

Generated by Claude Code

Migration v065 adds awa.runtime_attempts, one row per runtime instance listing the long-running attempts it holds, and a nullable runtime_instances.attempts_unpublished_since. admin::attempt_instances and admin::runtime_attempts read them, RuntimeInstance gains attempts_unpublished_since, and the maintenance leader deletes a dead instance's list with its snapshot. Every read treats a schema before v065 as not reported. Runtimes do not publish yet.
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9c51913 and a27c739.

Files selected for processing: 7

  • CHANGELOG.md
  • awa-model/migrations/v065_runtime_attempts.sql
  • awa-model/src/admin.rs
  • awa-model/src/migrations.rs
  • awa-model/tests/runtime_attempts_test.rs
  • awa-worker/src/maintenance.rs
  • docs/upgrade-0.6-to-0.7.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-01T11:46:34.051418Z 933c5de PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://hardbyte.github.io/awa/pr-preview/pr-907/

Built to branch gh-pages at 2026-12-01 11:51 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 933c5decf0

ℹ️ 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".

Comment thread awa-model/src/admin.rs Resolved
attempt_instances read the active schema from the runtime_storage_backends marker, so a database whose marker row was lost matched no published list. It now asks awa.active_queue_storage_schema(), which falls back to the transition state as v020 made it.
@hardbyte hardbyte added the full-ci Run the full CI matrix (Python build+test, E2E) on this PR label Dec 1, 2026 — with Claude

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Run the full CI matrix (Python build+test, E2E) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant