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

Add new files that are added in republishing in the Record bucket #2799

Open
ParthS007 opened this issue Apr 27, 2023 · 3 comments · May be fixed by #2806
Open

Add new files that are added in republishing in the Record bucket #2799

ParthS007 opened this issue Apr 27, 2023 · 3 comments · May be fixed by #2806
Assignees

Comments

@ParthS007
Copy link
Contributor

Reproducing steps:

  1. Create a draft and upload a file.
  2. Publish it.
  3. We can see the uploaded file.
  4. Change back to draft mode and add new file.
  5. We can see the newly added file in draft mode.
  6. Publish the new version and the newly added file is missing.

Expected outcome:

The newly added files should be there in the published version.

@ParthS007
Copy link
Contributor Author

Dump

My plan is to try both ways as we discussed earlier

  1. new bucket creation every time record is published.
  2. use the same bucket but copy the file instances in the previous bucket with some distinction (like revision number or version number).

--

I tried these couple of ways, does not seems to work.

For 1. since at the first record creation, the record is linked to a bucket already so at the time of republishing after editing, if I create a new bucket, i can't link it to the record because of AttributeError: 'CAPRecord' object has no attribute '_sa_instance_state

For 2, I tried to copy the new files in the previous bucket but I cannot since if bucket has existing files, the new one is not getting added. raise RuntimeError('Can not update existing files.')

--

I did not manage but I had some questions regarding this as I am trying to understand what should be expected behaviour.

  1. What is expected behaviour?

  2. In publish_edited, we create a new class(Record) instance and update the data in it. [Since we snapshot a bucket and add files in record during first publishing, it does not happens while publishing the edited version and there is already a bucket associated with the record with previous content]

  3. Ideally, what I understand when we put a record in draft mode, right now we don't index it either but why not? [Since it has new(updated) metadata and files so it should be in indexed and appear as another record, being said that we can have a relationship between records versions]

  4. What I propose is having a RFC for this and whatever we decide, that should be expected behavior.

@ParthS007
Copy link
Contributor Author

ParthS007 commented May 5, 2023

The expected behavior:

  1. Create draft - b1 = f1v1 + f2v1
  2. Publish - b2 = f1v1 + f2v1
  3. Record to Draft mode - b1 = f1v2 + f2v1 + f3v1
  4. Publish edited - b2 = f1v2 + f2v1 + f3v1

The 4 part is not happening right now and the steps to do it are as follows:

  1. Unlock the bucket b2 before publishing.
  2. Add the files not present in the bucket b2.
  3. In the end, b1 and b2 should have same file objects.

@ParthS007 ParthS007 linked a pull request May 8, 2023 that will close this issue
@ParthS007
Copy link
Contributor Author

ParthS007 commented May 8, 2023

The expected behavior is happening after addition of PR #2806.

Next steps:

@ParthS007 ParthS007 self-assigned this May 8, 2023
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 a pull request may close this issue.

1 participant