Skip to content

Conversation

@labkey-adam
Copy link
Contributor

Rationale

Old, slow action has been replaced by a simple query

Related Pull Requests

@labkey-adam labkey-adam requested a review from a team December 5, 2025 19:30
@labkey-adam labkey-adam self-assigned this Dec 5, 2025
@labkey-adam labkey-adam changed the title Get rid of old Attachments action Get rid of old Attachments action, adjust new actions Dec 7, 2025
Copy link
Contributor

@labkey-jeckels labkey-jeckels left a comment

Choose a reason for hiding this comment

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

Manually tested with site admin, troubleshooter, and reader access. Permissions functioned as expected, including on the backing core.Documents table.

Would be nice to have a little more automated coverage, unless I'm missing something that's already been merged. Maybe just check that the documents table is/isn't available for a few representative roles.

FWIW, on my dev DB, the majority of documents have no parent type. Is that expected?

Image

@labkey-adam
Copy link
Contributor Author

labkey-adam commented Dec 15, 2025

Manually tested with site admin, troubleshooter, and reader access. Permissions functioned as expected, including on the backing core.Documents table.

Would be nice to have a little more automated coverage, unless I'm missing something that's already been merged. Maybe just check that the documents table is/isn't available for a few representative roles.

FWIW, on my dev DB, the majority of documents have no parent type. Is that expected?

Image

I added AttachmentsTest with previous merges. Feel free to review and/or augment that test.

I have one unkonwn attachment in my long-running database, but I was running with a full set of modules. I would expect lots of blanks if you're not running with one or more modules that are responsible for attachments in your DB. If the AttachmentParentTypes aren't present, we can't resolve their attachments. (Going forward, though, modules coming and going won't affect the ParentType column.) If you click through, the listing should show you attachment names and folder names, which should provide some clues as to what these are.

If clicking through doesn't resolve the mystery, you can try the hidden action admin-findAttachmentParents.view. This will crank for a while, looking for EntityIds that match your unknown attachments' parents. Primitive, but it may help.

@labkey-jeckels
Copy link
Contributor

I added AttachmentsTest with previous merges. Feel free to review and/or augment that test.

Perhaps worth a quick addition to try as a troubleshooter (since that took extra work) and also make sure you can't see core.Documents in a folder as a simple reader.

I have one unkonwn attachment in my long-running database, but I was running with a full set of modules. I would expect lots of blanks if you're not running with one or more modules that are responsible for attachments in your DB. If the AttachmentParentTypes aren't present, we can't resolve their attachments. (Going forward, though, modules coming and going won't affect the ParentType column.) If you click through, the listing should show you attachment names and folder names, which should provide some clues as to what these are.

If clicking through doesn't resolve the mystery, you can try the hidden action admin-findAttachmentParents.view. This will crank for a while, looking for EntityIds that match your unknown attachments' parents. Primitive, but it may help.

Looking at those orphaned attachments, the vast majority are repeated many times and look to be from folder import/export testing. Seems like they're related to samples (I still have the exploded folder archive), but samples use Files, not Attachments. I'm confused.

@labkey-adam
Copy link
Contributor Author

I added AttachmentsTest with previous merges. Feel free to review and/or augment that test.

Perhaps worth a quick addition to try as a troubleshooter (since that took extra work) and also make sure you can't see core.Documents in a folder as a simple reader.

I have one unkonwn attachment in my long-running database, but I was running with a full set of modules. I would expect lots of blanks if you're not running with one or more modules that are responsible for attachments in your DB. If the AttachmentParentTypes aren't present, we can't resolve their attachments. (Going forward, though, modules coming and going won't affect the ParentType column.) If you click through, the listing should show you attachment names and folder names, which should provide some clues as to what these are.
If clicking through doesn't resolve the mystery, you can try the hidden action admin-findAttachmentParents.view. This will crank for a while, looking for EntityIds that match your unknown attachments' parents. Primitive, but it may help.

Looking at those orphaned attachments, the vast majority are repeated many times and look to be from folder import/export testing. Seems like they're related to samples (I still have the exploded folder archive), but samples use Files, not Attachments. I'm confused.

Test has been updated. I don't know what's going on with those attachments. What does admin-findAttachmentParents.view say?

@labkey-adam labkey-adam merged commit d51bcb6 into develop Dec 16, 2025
8 of 9 checks passed
@labkey-adam labkey-adam deleted the fb_attachments_action branch December 16, 2025 16:10
@labkey-jeckels
Copy link
Contributor

Test has been updated. I don't know what's going on with those attachments. What does admin-findAttachmentParents.view say?

It doesn't add much. They show in the listing. The right-most column, tablename, is blank for them.

image

@labkey-adam
Copy link
Contributor Author

Test has been updated. I don't know what's going on with those attachments. What does admin-findAttachmentParents.view say?

It doesn't add much. They show in the listing. The right-most column, tablename, is blank for them.

Well, that's weird. I know @labkey-tchad identified a couple places where we orphan attachments, i.e., when deleting a parent, we fail to delete the associated attachments. For example, https://github.com/LabKey/internal-issues/issues/707

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.

3 participants