Track rule execution failures for collection media evaluation#2949
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds persisted tracking for rule-evaluation failures on collection_media records, then uses that state to (a) prevent rule-driven removals when evaluation data was transiently unavailable and (b) prevent the collection worker from acting on media that’s in a failed-evaluation state.
Changes:
- Add
ruleEvaluationFailedboolean toCollectionMedia, plus a migration and updated test fixtures. - Update
RuleExecutorServiceto persist/clear failure flags when transient evaluation failures occur and later recover. - Update
CollectionWorkerServiceand unit tests to skip handling media flagged withruleEvaluationFailed.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/server/test/utils/data.ts | Updates createCollectionMedia fixture to include ruleEvaluationFailed. |
| apps/server/src/modules/rules/tasks/rule-executor.service.ts | Persists transient rule evaluation failure state and clears it on recovery. |
| apps/server/src/modules/rules/tasks/rule-executor.service.spec.ts | Adds/updates tests for transient failure preservation and flag clearing. |
| apps/server/src/modules/rules/entities/rule-group.entities.ts | Makes dataType column type explicit (varchar). |
| apps/server/src/modules/rules/entities/exclusion.entities.ts | Makes type column type explicit (varchar). |
| apps/server/src/modules/logging/entities/logSettings.entities.ts | Makes level column type explicit (varchar). |
| apps/server/src/modules/collections/interfaces/collection-media.interface.ts | Extends CollectionMediaRecord with ruleEvaluationFailed. |
| apps/server/src/modules/collections/entities/collection.entities.ts | Makes type column type explicit (varchar). |
| apps/server/src/modules/collections/entities/collection_media.entities.ts | Adds persisted ruleEvaluationFailed column. |
| apps/server/src/modules/collections/entities/collection_log.entities.ts | Makes type column type explicit (integer). |
| apps/server/src/modules/collections/collections.service.ts | Adds setCollectionMediaRuleEvaluationFailed + initializes new records with false. |
| apps/server/src/modules/collections/collection-worker.service.ts | Skips due media that has ruleEvaluationFailed: true. |
| apps/server/src/modules/collections/collection-worker.server.spec.ts | Updates worker spec to assert ruleEvaluationFailed: false filtering. |
| apps/server/src/database/migrations/1779215202958-AddCollectionMediaRuleEvaluationFailed.ts | Adds DB column with default + table rebuild migration for SQLite. |
Collaborator
|
@SmolSoftBoi Thanks! Did you test this end to end? |
enoch85
reviewed
May 22, 2026
…tracking - collection-worker.server.spec: drop mock for non-existent SettingsDataService.testConnections (failed check-types CI) - collection-worker: keep original mediaToHandle naming, apply the ruleEvaluationFailed filter inline (per review feedback) - collections.service: make setCollectionMediaRuleEvaluationFailed best-effort so a failed flag write can't abort the rule run
Collaborator
|
@SmolSoftBoi Good job on this! Super clean, tight and minimal. 🎉 |
Contributor
|
🎉 This PR is included in version 3.12.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Testing