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

[Due for payment 2025-02-13] Add GitHub Action to verify parser updates when parser files change #55939

Open
sumo-slonik opened this issue Jan 29, 2025 · 13 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Weekly KSv2

Comments

@sumo-slonik
Copy link
Contributor

sumo-slonik commented Jan 29, 2025

Ensure Search Parser Consistency: Add GitHub Action for Verification

Problem

Currently, it is possible to modify the search parser .js files without updating the corresponding .peggy grammar files. This can lead to inconsistencies and discrepancies between the parser implementation and its intended structure. Since we do not have any verification in place to ensure that changes in one are properly reflected in the other, errors may go unnoticed.

Proposal

To prevent this issue, we should add a GitHub Action that verifies whether changes in the .js parser files only occur when there are corresponding modifications in the .peggy files. This check would help maintain consistency and ensure that all updates to the parser are properly reflected in its configuration.

Expected Outcome

  • Reduce inconsistencies between parser implementation and configuration.
  • Prevent accidental modifications that could lead to incorrect parsing behavior.

@Kicu @blazejkustra

Issue OwnerCurrent Issue Owner: @slafortune
@sumo-slonik sumo-slonik added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Jan 29, 2025
Copy link

melvin-bot bot commented Jan 29, 2025

Triggered auto assignment to @slafortune (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@sumo-slonik sumo-slonik changed the title Add GitHub Action to Verify Parser Updates When Parser Files Change Add GitHub Action to verify parser updates when parser files change Jan 29, 2025
@sumo-slonik
Copy link
Contributor Author

Here is an example of such an inconsistency between files that once appeared because there is no such check
https://github.com/Expensify/App/pull/53158/files

@Kicu
Copy link
Member

Kicu commented Jan 29, 2025

CC @luacmartins

We think it's not a lot of work but will be useful to prevent mistakes when editing parser

@sumo-slonik
Copy link
Contributor Author

I can solve this by adding an action that will be triggered by changes in the folder:
src/libs/SearchParser, which will check if the generated .js files are consistent with what will be generated from the .peggy files. This doesn’t seem like a lot of work, and it will help us ensure consistency.

@luacmartins
Copy link
Contributor

I wonder if creating a script to automatically generate the .js file on build would be a better solution, so we:

  1. Don't have to manually do it
  2. Wouldn't allow changes to it in the first place

What do you think?

@sumo-slonik
Copy link
Contributor Author

Currently we already have two such scripts, but it does not protect us from the possibility of changing an already generated file. I have prepared a draft PR in which you can see how such an action could look like:

#55957

Wouldn't allow changes to it in the first place
Here it would be better if @Kicu spoke out

@slafortune
Copy link
Contributor

@sumo-slonik should I assign you to this GH? Does this really need an external label, you aren't really looking for help with this, are you?

@Kicu
Copy link
Member

Kicu commented Jan 30, 2025

I wonder if creating a script to automatically generate the .js file on build would be a better solution

The only problem to this approach is that it probably is more work. We would need to either run it on commits - which would definitely confuse and irritate some developers (extra few seconds 😅) or most likely do it on the CI.
The script has to be committed, so I guess on the CI we would need to generate extra commit IF there is a mismatch between the files.

At this point I thought that a check that verifies if the files were touched is just simpler and faster.

@sumo-slonik
Copy link
Contributor Author

sumo-slonik commented Jan 30, 2025

@sumo-slonik should I assign you to this GH? Does this really need an external label, you aren't really looking for help with this, are you?

If you can please assign me, PR is ready if only the approach with check on the github actions side will be accepted by you.

@luacmartins
Copy link
Contributor

That sounds good. Let's go with the current solution.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Weekly KSv2 labels Jan 31, 2025
@melvin-bot melvin-bot bot changed the title Add GitHub Action to verify parser updates when parser files change [Due for payment 2025-02-13] Add GitHub Action to verify parser updates when parser files change Feb 6, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 6, 2025
Copy link

melvin-bot bot commented Feb 6, 2025

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Feb 6, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.94-25 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2025-02-13. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Feb 6, 2025

@luacmartins @slafortune @sumo-slonik The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Weekly KSv2
Projects
None yet
Development

No branches or pull requests

4 participants