Skip to content

ACC-2624 Proposal of deletion policy / document lifecycle#249

Draft
thijslemmens wants to merge 9 commits intomainfrom
acc-2624
Draft

ACC-2624 Proposal of deletion policy / document lifecycle#249
thijslemmens wants to merge 9 commits intomainfrom
acc-2624

Conversation

@thijslemmens
Copy link
Contributor

@thijslemmens thijslemmens commented Mar 6, 2026

Need to review myself first

Thijs Lemmens and others added 9 commits March 6, 2026 16:49
Proposes a reference-counted content lifecycle system that tracks when
content objects can be safely deleted from the ContentStore, with a
configurable grace period and verified deletion via a K8s CronJob.

Content is write-once: each upload always produces a new unique
ContentReference. Content sharing (ref_count > 1) will be implemented
by copying an existing ContentReference between entities, not by
re-uploading.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Content lifecycle tracking is always enabled; there is no toggle to
turn it off. The domain module has a required (not optional) dependency
on the lifecycle module.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…letion

Tracks content object references to enable safe, grace-period-based
deletion from the underlying ContentStore.

- New `contentgrid-appserver-content-lifecycle` module with
  `ContentReferenceTracker`, `JooqContentReferenceTracker`,
  `DeferredContentReferenceTracker`, `ContentReferenceVerificationQuery`,
  `ContentDeletionJob`, and `ContentLifecycleProperties`
- `_content_references` table created via `JOOQTableCreator`
- Increment reference on upload (`ContentUploadAttributeMapper`)
- Decrement reference after entity update/delete clears content
  (`ContentAttributeModificationValidator` + `DatamodelApiImpl`)
- `ContentDeletionJob` implements `ApplicationRunner` for K8s CronJob use,
  with drift detection, Micrometer metrics, and configurable grace period
- `ContentLifecycleAutoConfiguration` wires all beans; registered in
  `AutoConfiguration.imports`; `ContentGridDomainAutoConfiguration` updated
  to inject `ContentReferenceTracker` into `DatamodelApiImpl`

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Track content object references via a _content_references table.
Increment on upload, decrement (deferred to post-commit) on content
cleared or entity deleted. ContentDeletionJob performs grace-period-based
safe deletion with drift detection and Micrometer metrics.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…greSQL ambiguity

PostgreSQL considers the column reference ambiguous in
  ON CONFLICT DO UPDATE SET reference_count = (reference_count + ?)
because reference_count could refer to either the existing row or the
EXCLUDED pseudo-table. Qualifying with the table name resolves it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Always run both ./gradlew check and the integration tests before pushing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 7, 2026

@thijslemmens thijslemmens changed the title Acc 2624 ACC-2624 Proposal of deletion policy / document lifecycle Mar 9, 2026
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