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

feat: taxonomy patch instead of re-generating #554

Merged
merged 27 commits into from
Dec 20, 2024
Merged

Conversation

alexgarel
Copy link
Member

@alexgarel alexgarel commented Oct 31, 2024

The goal is to be able to patch taxonomy text files instead of re-generating them completely.

This will avoid having a lot of changes that are not related to the real modifications made by a contributor.

For this we need to

  • add a "modified" property to entries (to track modified entries)
  • track lines location of entries (to know where to change the original file)
  • keeping removed entries (because we need to remove them from the original file)

Relates to: #541 and #366

TODO:

  • be able to patch taxonomy to generate the PR
  • add tests
  • add modified parameter in search
  • add sort on modified parameter in search (sort is not done at all, for now)
  • test it locally (see taxonomy: Update food_categories taxonomy openfoodfacts-bot/openfoodfacts-server#63)
  • avoid repeating comments when replacing entry
  • put children after parents, not the other way around
  • on entry id change, also re-output children (especially the parent line)
  • avoid adding empty line at end of file (it will accumulate otherwise)
  • fix bug of simple entry creation, not being exported

* adding a modified property
* adding lines location of entries
* keeping removed entries

The goal is to be able to patch taxonomy text files instead of re-generating them completely

Relates to: #541 and #366
@alexgarel alexgarel marked this pull request as ready for review November 29, 2024 19:40
@alexgarel
Copy link
Member Author

I still need to do some testing !

@alexgarel
Copy link
Member Author

I did a test openfoodfacts-bot/openfoodfacts-server#61 it results there are still some bugs that I have to solve.

The most problematic is if we change entry id. I think that along the entry last modification timestamp, I will also store the modified attributes, so that I know if entry id was modified.

@alexgarel alexgarel merged commit 928dfd0 into main Dec 20, 2024
7 checks passed
@alexgarel alexgarel deleted the feat-taxonomy-patch branch December 20, 2024 11:41
alexgarel added a commit that referenced this pull request Dec 20, 2024
##
[1.2.0](v1.1.0...v1.2.0)
(2024-12-20)


### Features

* first beauty and product taxonomies
([#559](#559))
([e66db34](e66db34))
* more readable default project names
([#557](#557))
([4036188](4036188))
* taxonomy patch instead of re-generating
([#554](#554))
([928dfd0](928dfd0))



### Bug Fixes

* bad tables dom on errors and search results
([#556](#556))
([31243c7](31243c7))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: Alex Garel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant