Skip to content

feat: noncurrent lifecycle compilation, candidates and attempts - #1371

Merged
ferhatelmas merged 1 commit into
masterfrom
ferhat/lifecycle-planning
Sep 9, 2026
Merged

ferhatelmas merged 1 commit into
masterfrom
ferhat/lifecycle-planning

Conversation

@ferhatelmas

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

feat

What is the new behavior?

  • compile enabled noncurrent-expiration rules against a frozen UTC snapshot into cutoffs and drop dominated rules.
  • build the bounded candidate query (archived time, C-collated name, snapshot bound, retention count) and journal for continuation of unfinished deletes.

Copilot AI lite review requested due to automatic review settings September 9, 2026 07:11
@ferhatelmas
ferhatelmas requested a review from a team as a code owner September 9, 2026 07:11
@ferhatelmas
ferhatelmas force-pushed the ferhat/lifecycle-planning branch from 5ba207b to 941d84d Compare September 9, 2026 07:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new keyset pagination cursor/order appears non-unique (archivedAt+name only), which can cause skipped/duplicated rows across pages in multi-version scenarios.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR introduces foundational pieces for noncurrent object lifecycle execution: compiling enabled noncurrent-expiration rules against a frozen UTC snapshot (including dominated-rule pruning), building a bounded DB page query for candidates, and adding a durable “continuation” journal to resume multi-step delete batches safely.

Changes:

  • Add lifecycle schema types/constants for evaluation pages, candidates, cursors, and durable continuation/journaling.
  • Implement lifecycle continuation creation/decoding and state transitions for staging batches, arming attempts, recording artifact outcomes, and committing/advancing.
  • Add SQL statement builder + decoders for noncurrent lifecycle candidate paging, including BC timestamp binding and microsecond-sensitive cursor handling.
File summaries
File Description
src/storage/schemas/lifecycle.ts Adds lifecycle evaluation + continuation/journal schema types and constants.
src/storage/lifecycle/index.ts Exposes the new continuation module via the lifecycle barrel export.
src/storage/lifecycle/continuation.ts Implements durable continuation decoding and batch/attempt transition helpers.
src/storage/lifecycle/continuation.test.ts Adds coverage for continuation decoding constraints and transition invariants.
src/storage/lifecycle/configuration.ts Adds enabled-rule detection and compilation of evaluation rules from frozen snapshot time.
src/storage/lifecycle/configuration.test.ts Adds tests for cutoff computation, dominated-rule pruning, and DST independence.
src/storage/database/lifecycle.ts Adds the noncurrent lifecycle evaluation page SQL builder and row decoders.
src/storage/database/lifecycle.test.ts Adds tests for BC timestamp parameterization, query shape, and decoding behaviors.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/storage/database/lifecycle.ts
Comment thread src/storage/schemas/lifecycle.ts
@coveralls

coveralls commented Sep 9, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 34399180467

Coverage increased (+0.1%) to 82.463%

Details

  • Coverage increased (+0.1%) from the base build.
  • Patch coverage: 28 uncovered changes across 3 files (231 of 259 lines covered, 89.19%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/storage/lifecycle/continuation.ts 158 139 87.97%
src/storage/database/lifecycle.ts 69 62 89.86%
src/storage/lifecycle/configuration.ts 30 28 93.33%
Total (4 files) 259 231 89.19%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 13962
Covered Lines: 11963
Line Coverage: 85.68%
Relevant Branches: 8425
Covered Branches: 6498
Branch Coverage: 77.13%
Branches in Coverage %: Yes
Coverage Strength: 663.2 hits per line

💛 - Coveralls

@ferhatelmas
ferhatelmas requested a lite review from Copilot September 9, 2026 07:27
@ferhatelmas

Copy link
Copy Markdown
Member Author

@claude review always

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new lifecycle rule compilation currently allows out-of-contract noncurrentDays/newerNoncurrentVersions values, which can silently alter retention semantics or produce rules that later fail at query-build time.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

src/storage/lifecycle/configuration.ts:153

  • noncurrentCutoffAt validates noncurrentDays up to Number.MAX_SAFE_INTEGER, but the lifecycle contract elsewhere bounds this field to LIFECYCLE_MAX_NONCURRENT_DAYS (2^31-1). Using MAX_SAFE_INTEGER can silently accept out-of-contract configs and compile them to '-infinity', changing retention semantics. Align the bound with LIFECYCLE_MAX_NONCURRENT_DAYS.
  assertIntegerInRange(noncurrentDays, 1, Number.MAX_SAFE_INTEGER, 'NoncurrentDays')
  • Files reviewed: 8/8 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/storage/lifecycle/configuration.ts Outdated
@ferhatelmas
ferhatelmas force-pushed the ferhat/lifecycle-planning branch from 941d84d to 93fe733 Compare September 9, 2026 07:38
@ferhatelmas
ferhatelmas requested a lite review from Copilot September 9, 2026 07:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread src/storage/database/lifecycle.ts

@claude claude 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.

Code review found no issues

No high-confidence issues detected in this change.

@ferhatelmas
ferhatelmas force-pushed the ferhat/lifecycle-planning branch from 93fe733 to 58d6eee Compare September 9, 2026 09:38

@claude claude 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.

Code review found no issues

No high-confidence issues detected in this change.

@ferhatelmas
ferhatelmas force-pushed the ferhat/lifecycle-planning branch from 58d6eee to ecdbd99 Compare September 9, 2026 12:26

@claude claude 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.

Code review found no issues

No high-confidence issues detected in this change.

@ferhatelmas
ferhatelmas force-pushed the ferhat/lifecycle-planning branch from ecdbd99 to 2d66bfc Compare September 9, 2026 19:01

@claude claude 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.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Comment thread src/storage/lifecycle/continuation.ts
@ferhatelmas
ferhatelmas force-pushed the ferhat/lifecycle-planning branch from 2d66bfc to f5919cb Compare September 9, 2026 19:32

@claude claude 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.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Comment thread src/storage/lifecycle/continuation.ts
Signed-off-by: Ferhat Elmas <elmas.ferhat@gmail.com>
@ferhatelmas
ferhatelmas force-pushed the ferhat/lifecycle-planning branch from f5919cb to b6026c6 Compare September 9, 2026 20:07

@claude claude 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.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Comment thread src/storage/lifecycle/continuation.ts
@ferhatelmas
ferhatelmas merged commit 91eabb5 into master Sep 9, 2026
29 of 30 checks passed
@ferhatelmas
ferhatelmas deleted the ferhat/lifecycle-planning branch September 9, 2026 20:30
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.

4 participants