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

Merge v2 entities into template context instead of overriding #1730

Closed
wants to merge 2 commits into from

Conversation

sfc-gh-fcampbell
Copy link
Contributor

@sfc-gh-fcampbell sfc-gh-fcampbell commented Oct 16, 2024

Pre-review checklist

  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated automated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • I've confirmed that my changes are working by executing CLI's commands manually on MacOS.
  • I've confirmed that my changes are working by executing CLI's commands manually on Windows.
  • I've confirmed that my changes are up-to-date with the target branch.
  • I've described my changes in the release notes.
  • I've described my changes in the section below.

Changes description

When converting PDFv1 to PDFv2 in-memory, we need to keep the v1 template context available since the user could have other files with templates still using v1 references in it, but we also need to have access to the generated v2 entities since converted package scripts refer to the package identifier, so let's merge them together. The proper solution would be to convert the whole project to v2, templates included, but that's a separate issue.

@sfc-gh-fcampbell sfc-gh-fcampbell marked this pull request as ready for review October 16, 2024 19:50
@sfc-gh-fcampbell sfc-gh-fcampbell requested review from a team as code owners October 16, 2024 19:50
Comment on lines +301 to +304
entities = {
k: e.model_dump(exclude_none=True, warnings=False, by_alias=True)
for k, e in pdfv2.entities.items()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels like that's not the right fix, since it can introduce a different behaviour once the contexts are merged (granted, I can't think of a way to trigger this with a valid set of templates, but still...). I expected we'd instead preserve the entire v1 context, separately, and decide at expansion time which of the contexts should apply. I'm still thinking through what it means to merge the contexts though, so I might be off here.

@sfc-gh-fcampbell sfc-gh-fcampbell marked this pull request as draft October 16, 2024 21:01
@sfc-gh-fcampbell
Copy link
Contributor Author

Closing in favour of #1735

@sfc-gh-fcampbell sfc-gh-fcampbell deleted the frank-in-memory-merge-entities branch October 17, 2024 16:26
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.

2 participants