Skip to content

🐛 Rerun attaches a file set left without a work - #1329

Open
laritakr wants to merge 1 commit into
mainfrom
fix-file-set-reattach-1304
Open

laritakr wants to merge 1 commit into
mainfrom
fix-file-set-reattach-1304

Conversation

@laritakr

@laritakr laritakr commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Refs #1304

🐛 Rerun attaches a file set left without a work

A file set row that runs again now attaches its file set to the row's
work when no work holds it, with the work's visibility and, on
Valkyrie, the row's file; a file set another work holds fails the row.

A row that stopped after saving its file set but before attaching it,
such as on a worker restart or a failed work save, left the file set
without a work, and on Valkyrie without its file, while every rerun
reported success. A file set can't belong to more than one work, so
one held elsewhere is not moved.

@laritakr laritakr added the patch-ver for release notes label Dec 1, 2026
@laritakr
laritakr requested a balanced review from Copilot December 1, 2026 22:38

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

Concurrent retries can attach the same file set to multiple works, while failed parent saves and thumbnail-only retries can report success despite missing membership or content.

3 open issues
What changed in this PR

This PR adds recovery for file-set imports interrupted before attachment, allowing reruns to attach orphaned file sets to their intended works.

Changes:

  • Adds attachment recovery and ownership checks to both object factories.
  • Restores missing Valkyrie file content and inherits work visibility when appropriate.
  • Adds regression coverage for recovery, ownership conflicts, visibility, and repeated runs.
File Description
spec/​models/​bulkrax/​valkyrie_object_factory_spec.rb Tests attachment recovery, ingestion, visibility, and concurrent retries.
spec/​models/​bulkrax/​object_factory_spec.rb Tests orphan attachment and ownership checks.
spec/​models/​bulkrax/​csv_file_set_entry_spec.rb Tests visibility handling for orphaned file sets.
app/​models/​concerns/​bulkrax/​file_set_entry_behavior.rb Leaves orphan visibility unset for inheritance from the work.
app/​factories/​bulkrax/​valkyrie_object_factory.rb Adds orphan attachment and missing-file recovery.
app/​factories/​bulkrax/​object_factory.rb Adds actor-based attachment recovery and ownership checks.
app/​factories/​bulkrax/​object_factory_interface.rb Defines the shared ownership-query interface.

Review effort: Balanced

Comment thread app/factories/bulkrax/object_factory.rb Resolved
@laritakr
laritakr force-pushed the fix-file-set-reattach-1304 branch from 60e964f to 3d4fd8f Compare December 2, 2026 16:49
@laritakr
laritakr requested a balanced review from Copilot December 2, 2026 16:50

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

Ownership validation occurs after metadata and file updates in both factories, allowing rows naming a different parent to modify existing file sets before failing.

2 open issues
3 resolved since last review

Review effort: Balanced

Comment thread app/factories/bulkrax/object_factory.rb Resolved
@laritakr
laritakr force-pushed the fix-file-set-reattach-1304 branch from 3d4fd8f to effdcb5 Compare December 2, 2026 21:29
A file set row that runs again now attaches its file set to the row's
work when no work holds it, with the work's visibility and, on
Valkyrie, the row's file; a file set another work holds fails the row.

A row that stopped after saving its file set but before attaching it,
such as on a worker restart or a failed work save, left the file set
without a work, and on Valkyrie without its file, while every rerun
reported success. A file set can't belong to more than one work, so
one held elsewhere is not moved.

Assisted by: Claude Opus 5.5

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.

🟢 Approval recommended

No active review issues block approval of the file-set rerun recovery changes.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@laritakr
laritakr marked this pull request as ready for review December 2, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch-ver for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants