Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derive asset access field from asset blob #2010

Merged
merged 3 commits into from
Oct 17, 2024
Merged

Conversation

jjnesbitt
Copy link
Member

@jjnesbitt jjnesbitt commented Aug 20, 2024

Closes #1997

Previously, this field was left unaltered, which meant it assumed whatever value was provided during creation through the API. This meant a default of dandi:OpenAccess most of the time, but it could have actually had any value. This has led to almost all of the currently embargoed assets to mistakenly display an access value of dandi:OpenAccess.

This PR changes this behavior by instead using the asset blob embargoed field to determine the value of 'access'.

TODO

  • migration

Determine if asset is open access or embargoed based on if the asset
blob is embargoed.
@mvandenburgh
Copy link
Member

The AuditRecord model also stores a copy of Asset.metadata, which means that any asset audit records created up until this PR is merged will have an access field, while future ones won't.

This also made me realize we're just storing the metadata, not full_metadata in the asset audit record; i.e. all the "computed" fields are being left out of the audit records. I wonder if we should do the latter (@waxlamp).

@jjnesbitt
Copy link
Member Author

The AuditRecord model also stores a copy of Asset.metadata, which means that any asset audit records created up until this PR is merged will have an access field, while future ones won't.

Since the access field for assets has always been superfluous, I think it would be appropriate to also purge it from the existing audit records. What do you think @waxlamp?

@waxlamp
Copy link
Member

waxlamp commented Aug 24, 2024

This also made me realize we're just storing the metadata, not full_metadata in the asset audit record; i.e. all the "computed" fields are being left out of the audit records. I wonder if we should do the latter (@waxlamp).

I'm open to this. If the full metadata can be derived from the "small" metadata, I think leaving it as is would be ok too. But let's discuss next week.

@waxlamp
Copy link
Member

waxlamp commented Aug 24, 2024

The AuditRecord model also stores a copy of Asset.metadata, which means that any asset audit records created up until this PR is merged will have an access field, while future ones won't.

Since the access field for assets has always been superfluous, I think it would be appropriate to also purge it from the existing audit records. What do you think @waxlamp?

I think that would be ok.

Copy link
Member

@mvandenburgh mvandenburgh left a comment

Choose a reason for hiding this comment

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

LGTM, just need the migration for the audit record table 👍

Published assets actually MUST have this field present, and so removing
it here would violate a check constraint
@yarikoptic
Copy link
Member

PR gained approval 3 weeks ago. @jjnesbitt is there anything else to be done here or could be just merged?

@waxlamp
Copy link
Member

waxlamp commented Oct 9, 2024

PR gained approval 3 weeks ago. @jjnesbitt is there anything else to be done here or could be just merged?

This will require a migration; as such I'll move it back to draft status.

@waxlamp waxlamp marked this pull request as draft October 9, 2024 15:26
@yarikoptic
Copy link
Member

I have added to the PR description the TODO "section" with a checkbox for migration. Would be great if similar approach is adopted for other PRs to make it clear(er) on what outstanding TODOs left.

@jjnesbitt jjnesbitt marked this pull request as ready for review October 17, 2024 17:21
@jjnesbitt jjnesbitt added patch Increment the patch version when merged release Create a release when this pr is merged labels Oct 17, 2024
@jjnesbitt jjnesbitt merged commit da7b975 into master Oct 17, 2024
11 checks passed
@jjnesbitt jjnesbitt deleted the asset-access-metadata branch October 17, 2024 17:26
@dandibot
Copy link
Member

🚀 PR was released in v0.3.106 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged release Create a release when this pr is merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Asset's access/status is dandi:OpenAccess even though it is uploaded to an embargoed Dandiset
5 participants