You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
db: keep updated_at when a sandbox's idle deadline changes - #1616
Adds next_auto_event_at to the columns the sandboxes_set_updated_at trigger ignores. The migration 20261106045040_sandboxes_updated_at_ignores_idle_deadline replaces only the trigger function, set_sandbox_updated_at.
sandboxes.next_auto_event_at is the idle deadline that getSandbox and listSandboxes report as expires_at. The stacked change #1617 has nodes publish it. It then moves whenever the sandbox is used, as last_access_at and last_command_at do. The trigger already ignores those activity clocks so that use doesn't read as a modification. Without this migration, every published deadline change would advance the public updated_at, about once a minute on an active sandbox.
Validation
scripts/check-migration-versions.sh, scripts/check-postgres-migrations-isolated.sh and scripts/check-postgres-migrations-squawk.sh against origin/main: all pass (squawk 0 issues).
At 574d29d: cargo test for pplx-space-db-migrate (59 passed) and pplx-space-sandbox-store (33 passed), which apply every migration to a fresh database; cargo clippy with -D warnings on both; cargo check --workspace --all-targets --locked; and cargo fmt --check. All pass.
Severity and risk
Severity: does not apply on its own. It prepares #1617.
Risk: the function body is otherwise identical to the baseline's. The migration sets lock_timeout and statement_timeout, and it changes no rows. Rolling back restores the previous function. That is harmless until #1617 runs, after which deadline publications would advance updated_at again.
Rollout
Deploy with or before #1617. Until #1617, nothing writes the column except the existing reset to NULL, so behavior does not change.
`sandboxes.next_auto_event_at` is the idle deadline that `getSandbox`
reports as `expires_at`. Once nodes publish it, it moves whenever the
sandbox is used, as `last_access_at` and `last_command_at` do. The
`sandboxes_set_updated_at` trigger ignores those activity clocks so that
use does not read as a modification. This adds the deadline to the same
list, so publishing it will not advance the public `updated_at`.
The migration only replaces the trigger function; it changes no rows.
The down migration restores the previous function.
Automatic approval is disabled by the configured approval policy for this pull request. Review comments and requests for changes continue normally.
Commit: 574d29d2cee7.
No actionable comments were generated in the recent review.
Walkthrough
The up and down migrations set local lock and statement timeouts and define public.set_sandbox_updated_at(). Both preserve an explicitly changed updated_at and advance it when other compared columns differ. The up migration excludes next_auto_event_at from those comparisons; the down migration does not.
Merge Risk: Moderate · up to 574d2
Deadline-only updates will no longer advance a sandbox’s public timestamp. This is the intended behavior, but it changes a database row-write contract and warrants explicit acceptance before merge.
Architecture risk: Low · up to 574d2
The change affects 1 system.
Changed systems:db
Architecture concerns
No architecture-level concerns identified.
Review details
Systems and components
observed — db (service) was modified; 2 changed files map to changed impact.
Before / after behavior
observed — Modified behavior in db/postgres/20261106045040_sandboxes_updated_at_ignores_idle_deadline.down.sql: Adds transaction-local lock and statement timeouts and replaces public.set_sandbox_updated_at() with trigger logic that preserves explicitly changed timestamps, updates the timestamp for changes outside the four excluded columns, and retains the old timestamp for changes limited to those columns.
observed — Modified behavior in db/postgres/20261106045040_sandboxes_updated_at_ignores_idle_deadline.up.sql: Adds local lock and statement timeouts, then defines a trigger function that preserves explicitly changed updated_at; otherwise, it updates the timestamp only when a non-excluded column differs, excluding updated_at, last_used_at, last_access_at, last_command_at, and next_auto_event_at.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title describes the main change and meets the required format.
Description Follows The Pr Template
The description contains all four required items: Summary, Validation, Severity and risk, and an AI assistance line.
Bug Fixes Name A Regression Test
The PR changes only database migrations. Its Validation section also names writing_the_idle_deadline_leaves_updated_at_alone and states that it fails without the migration and passes with it.
Weakened Safeguards Are Justified
The diff adds two database migration files. It does not weaken tests, assertions, lints, CI checks, or repository guards.
Public-Safe Content
The diff, title, and description contain no content prohibited by this check.
Recent review info
Automatic approval policy
Commit: 574d29d2cee7.
Setting
Effective value
Source
Automatic approvals
Disabled
Override 4
Merge risk
Low
Override 2
Security risk
Not set
Global configuration
Matching overrides (numbered as in the resolved configuration):
Any matching disabled override withholds approval, regardless of risk. Otherwise, the strictest explicitly set limit wins for each score. Limits omitted by all matching overrides inherit the global configuration.
Not set means no limit was configured after inheritance. Use @coderabbitai configuration to inspect the resolved settings and their sources.
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
next_auto_event_atto the columns thesandboxes_set_updated_attrigger ignores. The migration20261106045040_sandboxes_updated_at_ignores_idle_deadlinereplaces only the trigger function,set_sandbox_updated_at.sandboxes.next_auto_event_atis the idle deadline thatgetSandboxandlistSandboxesreport asexpires_at. The stacked change #1617 has nodes publish it. It then moves whenever the sandbox is used, aslast_access_atandlast_command_atdo. The trigger already ignores those activity clocks so that use doesn't read as a modification. Without this migration, every published deadline change would advance the publicupdated_at, about once a minute on an active sandbox.Validation
scripts/check-migration-versions.sh,scripts/check-postgres-migrations-isolated.shandscripts/check-postgres-migrations-squawk.shagainstorigin/main: all pass (squawk 0 issues).The behavior is pinned by tests in fix(api): report the node's idle deadline as a sandbox's expires_at #1617, because this PR's isolation guard allows only migration files:
writing_the_idle_deadline_leaves_updated_at_alone(sandbox store), which also checks that a real change still bumpsupdated_at;updated_atassertion inpublish_sandbox_state_records_the_idle_deadline_without_touching_updated_at(internal API).Both fail with this migration removed ("a published idle deadline must not bump updated_at") and pass with it.
Applied by the Kind bring-up (
_sqlx_migrationsrecords20261106045040, success). With fix(api): report the node's idle deadline as a sandbox's expires_at #1617 deployed on top,updated_atstayed at its:set_timeoutvalue while the published deadline landed.At 574d29d:
cargo testforpplx-space-db-migrate(59 passed) andpplx-space-sandbox-store(33 passed), which apply every migration to a fresh database;cargo clippywith-D warningson both;cargo check --workspace --all-targets --locked; andcargo fmt --check. All pass.Severity and risk
Severity: does not apply on its own. It prepares #1617.
Risk: the function body is otherwise identical to the baseline's. The migration sets
lock_timeoutandstatement_timeout, and it changes no rows. Rolling back restores the previous function. That is harmless until #1617 runs, after which deadline publications would advanceupdated_atagain.Rollout
Deploy with or before #1617. Until #1617, nothing writes the column except the existing reset to NULL, so behavior does not change.
Stack
Base of the stack: this PR, then #1617.
AI assistance: Claude Code drafted the code, tests, and this description; the author reviewed them.