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

[GSoC' 24]: Create a wiki page for debugging the new partial ci tests structure. #328

Merged
merged 10 commits into from
Jun 21, 2024

Conversation

jnvtnguyen
Copy link
Contributor

No description provided.

@jnvtnguyen jnvtnguyen changed the title [GSoC' 24]: Create a wiki page for debugging the new partical ci tests structure. [GSoC' 24]: Create a wiki page for debugging the new partial ci tests structure. Jun 5, 2024
@jnvtnguyen
Copy link
Contributor Author

HI @seanlip, given this comment, is the name fine for the wiki page fine and should I get this merged before putting information or is it fine to put a link in the error message to a WIKI page that will be created later when I fill this PR.

@seanlip
Copy link
Member

seanlip commented Jun 8, 2024

Hi @jnvtnguyen -- TBH I think this flow is kind of weird, we'll end up with an orphaned wiki page which no one knows what's supposed to go in there :P

Can you fill in this wiki page properly and link it from the sidebar as needed, so that when your PR gets merged, the whole dev flow works correctly (including going to the wiki page and understanding what's going on)? If your PR will go in soon then I think that's all that needs to be done. Otherwise, if it'll take a while more to merge, then don't link this page from the sidebar yet, and file an issue on the wiki repo to do so once PR #XYZ on oppia/oppia is merged.

Does that sound good? Also /cc @vojtechjelinek.

@jnvtnguyen
Copy link
Contributor Author

@seanlip Sounds good to me, PR is close to getting merged, just need @chris7716 to approve. PTAL at the changes, Thanks.

@jnvtnguyen jnvtnguyen requested a review from seanlip June 8, 2024 17:48
@@ -0,0 +1,11 @@
## Overview

For non-python files, we run partial ci tests depending on the tests that a specific file effects. The process of determining which tests to run goes like this:
Copy link
Member

Choose a reason for hiding this comment

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

effects --> affects

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -0,0 +1,11 @@
## Overview
Copy link
Member

Choose a reason for hiding this comment

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

I think this intro is a bit abrupt / lacks context. Could you think through why a developer would reach this page (what will they have been trying to do beforehand) and tailor this page to explain how to do the thing they are seeking to do? A bit like this: https://github.com/oppia/oppia/wiki/If-CI-checks-fail-on-your-PR

Then you can have the other sections as references. But let's make sure that the main part of this is written so that it's easy for developers to do what they need to quickly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

_Sidebar.md Outdated
@@ -127,6 +127,7 @@
* [[Mobile device testing|Mobile-device-testing]]
* [[Performance testing|Performance-Testing]]
* [[Build process|Build-process]]
* [[Partial CI Tests Structure|Partial-CI-Tests-Structure]]
Copy link
Member

Choose a reason for hiding this comment

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

Should this go under some set of pages that relate to testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, put it under Testing.

Copy link
Member

@seanlip seanlip left a comment

Choose a reason for hiding this comment

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

Thanks @jnvtnguyen -- took a more detailed pass, PTAL.


## Overview of Partial CI Tests Structure

For non-python files, we run partial ci tests depending on the tests that a specific file affects. The process of determining which tests to run goes like this:
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a sentence after the first one to explain the benefits of doing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


For non-python files, we run partial ci tests depending on the tests that a specific file affects. The process of determining which tests to run goes like this:

1. Generate a root files mapping which maps files to their root files.
Copy link
Member

Choose a reason for hiding this comment

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

Here and below: explain where in the codebase this is stored -- perhaps link to the specific files etc. That makes this much more concrete and developers can examine the code. Currently it's a bit vague.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


# Root Files Config

The root files config at `core/tests/root-files-config.json` contains all the valid root files that are generated in the root files mapping. This ensures that all files in the codebase either lead to a root file or are a root file themselves. We also have a list of root files that should run all tests, the valid root files are stored in the field `VALID_ROOT_FILES`, while the run all tests root files are stored in the field `RUN_ALL_TESTS_ROOT_FILES`. If you get an error that there is a root file not contained in these lists, please add them to one of these lists depending on the context of the file. If the specific file has a chance to break some part of the Oppia website, like `src/index.html`, please add it to the `RUN_ALL_TESTS_ROOT_FILES`, otherwise if it is a file like `README.md`, please add it to the `VALID_ROOT_FILES`.
Copy link
Member

Choose a reason for hiding this comment

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

Put a period after "We also have a list of root files that should run all tests."

Put a paragraph break before "If you get an error".

After "depending on the context of the file", put a colon, and then have each of the two possible cases be under separate bullet points.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

_Sidebar.md Outdated
@@ -58,6 +58,7 @@
* [[End-to-end tests|End-to-End-Tests]]
* [[Acceptance Tests|Acceptance-Tests]]
* [[Lighthouse Tests|Lighthouse-Tests]]
* [[Partial CI Tests Structure|Partial-CI-Tests-Structure]]
Copy link
Member

Choose a reason for hiding this comment

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

Maybe you could rename this to: "Determining which CI tests run for a PR"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -0,0 +1,17 @@
## Introduction

If your PR fails due to the `check_ci_test_suites_to_run` workflow, please look at the error log and depending on the error, do the following:
Copy link
Member

Choose a reason for hiding this comment

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

Add an intro pargraph: Our CI process has a workflow, check_ci_test_suites_to_run, that determines which test suites to run for a given PR based on the files that that PR modifies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


If your PR fails due to the `check_ci_test_suites_to_run` workflow, please look at the error log and depending on the error, do the following:

* If you see an error about the root files config, then see the [root files config section](#root-files-config) below.
Copy link
Member

Choose a reason for hiding this comment

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

There's only one bullet point here ... are there other types of errors? Or should they do something else (catch-all) if they run into some error that's not this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, this was the only error that I felt needed explanation, the others can be explained by the overview of this system and the errors are self explanatory.

Copy link
Member

Choose a reason for hiding this comment

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

OK, but a one-bullet-point list is still quite weird. At the very least, you should probably have another bullet point that says something like "If you see any other error, ..."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@jnvtnguyen jnvtnguyen assigned seanlip and unassigned jnvtnguyen Jun 18, 2024
@jnvtnguyen
Copy link
Contributor Author

FYI do need to merge before this one: oppia/oppia#20435

Copy link
Member

@seanlip seanlip left a comment

Choose a reason for hiding this comment

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

Thanks @jnvtnguyen, did a full pass. PTAL and lmk if you have any questions about the comments.


If your PR fails due to the `check_ci_test_suites_to_run` workflow, please look at the error log and depending on the error, do the following:

* If you see an error about the root files config, then see the [root files config section](#root-files-config) below.
Copy link
Member

Choose a reason for hiding this comment

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

OK, but a one-bullet-point list is still quite weird. At the very least, you should probably have another bullet point that says something like "If you see any other error, ..."


## Overview of Partial CI Tests Structure

For non-python files, we run partial ci tests depending on the tests that a specific file affects. Running partial tests like this allow for PRs to be checked faster on the tests that a PR actually modifies. This faster test speed allows developers to get feedback faster and allows CI resources to be free more. The process of determining which tests to run goes like this:
Copy link
Member

Choose a reason for hiding this comment

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

ci --> CI

allow for --> allows

on the tests --> using the tests

allows CI resources to be free more --> frees up CI resources

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

For non-python files, we run partial ci tests depending on the tests that a specific file affects. Running partial tests like this allow for PRs to be checked faster on the tests that a PR actually modifies. This faster test speed allows developers to get feedback faster and allows CI resources to be free more. The process of determining which tests to run goes like this:

1. Generate a root files mapping which maps files to their root files. This file is generated at the start of every PR check run and is stored at `root-files-mapping.json`.
2. Store golden files containing the page modules that a specific test uses. These golden files are stored at `core/tests/test-modules-mappings/{{test-type}}/{{test-name}}`.
Copy link
Member

Choose a reason for hiding this comment

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

This is actually already part of the codebase, right? If so, mention it in the paragraph above this list (describe these files in the codebase and what they represent) before describing the process, and only have steps 1 and 3 as part of the "process".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well the PR hasn't been merged yet for the test-modules-mappings and the root-files-mapping is generated for every PR.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, my comment was taking into account that you'd merge the other PR before this one. Could you please read it again with that in mind?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So are you suggesting that I move the 2nd bullet point out (and describe in more in depth with examples)? Though @U8NWXD commented that I should merge a wiki page for Partial-CI-Tests-Structure beforehand, so I suppose I can give references to files that will exist?

Copy link
Member

Choose a reason for hiding this comment

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

Let's have your wiki page refer to the correct eventual locations of files. If a file doesn't exist yet and there's going to be a bit of a gap before it does, add a note to say that it'll be introduced in PR XXX and file an issue on oppia-web-developer-docs to discard the note later. Otherwise it's probably OK to have an inconsistency for a short time (a couple of days), or wait a couple of days to merge the wiki PR.

Thinking about the ideal page, I was pointing out that the process that happens for each PR seems to constitute 1 and 3 only, because 2 is already part of the codebase -- so 2 doesn't really belong with the process that is executed for each PR, which consists of 1 and 3 only. (Or am I misunderstanding how the process works?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


# Root Files Config

The root files config at `core/tests/root-files-config.json` contains all the valid root files that are generated in the root files mapping. This ensures that all files in the codebase either lead to a root file or are a root file themselves. We also have a list of root files that should run all tests. The valid root files are stored in the field `VALID_ROOT_FILES`, while the run all tests root files are stored in the field `RUN_ALL_TESTS_ROOT_FILES`.
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit confusing. The root files mapping seems to be generated at the start of each PR check run, but this root files config seems to be a static file in the codebase. Wouldn't the root files mapping differ for each PR, and if so, how can its files match the static file all the time?

Also, as a general note, you can use hyphenation or quotes to make some of the "idea boundaries" clearer, e.g. "root-files config" and "run-all-tests root files" or "run all tests" root files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, can you elaborate on your first paragraph. The root files config is a way to validate that all root files are captured, so if a PR adds a new root file, there should be an error as we compare the dynamic root files mapping with the root files config and if it isn't there, the developer should add it to VALID_ROOT_FILES or RUN_ALL_TESTS_ROOT_FILES.

Copy link
Member

Choose a reason for hiding this comment

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

You say, above, "Generate a root files mapping which maps files to their root files. This file is generated at the start of every PR check run." That's what I'm referring to at the start of my first paragraph.

Then you have this "root file config", which seems to be a static file. The paragraph here says "The root files config at core/tests/root-files-config.json contains all the valid root files that are generated in the root files mapping." which implies that the files in root-files-mapping and root-files-config match. Did you mean to say something like "the root files config contains a list of all the valid root files, and the root files mapping generated in each PR is a subset of this list"? (Also not sure what "valid" means here -- I took it to mean "exists in the codebase" but if you had a different meaning for it like below, that might be worth clarifying too.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The root-files-config.json and the root files mapping should match or the check will give an error and therefore the developer should update the root-files-config.json so they do match. Valid means that it is a root file that should have no parents (README, page modules, etc.). Most of the time the root-files-config.json will contain the same valid root files as the root files mapping, as a developer isn't adding any new pages or files (that aren't referenced by another file).

Given this, I think I can explain more about how the root-files-mapping and root-files-config can differ and in this case it will give an error?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I think that might help. I also wonder if it's better to find a name that's not "valid" as it's not clear to a general developer what "valid" means in this context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

If you get an error that there is a root file not contained in these lists, please add them to one of these lists depending on the context of the file:

* If the specific file has a chance to break some part of the Oppia website, like `src/index.html`, please add it to the `RUN_ALL_TESTS_ROOT_FILES`.
* If it is a file like `README.md` which doesn't affect any test, please add it to the `VALID_ROOT_FILES`.
Copy link
Member

Choose a reason for hiding this comment

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

I think "VALID" is not clear naming, it is not clear that "RUN ALL TESTS ROOT FILES" are "invalid" in some way. Perhaps give this a clearer name, e.g. RUN_NO_TESTS_ROOT_FILES?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that is a better name, in that case which PR should I add it to?

Copy link
Member

Choose a reason for hiding this comment

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

Whichever PR introduces VALID_ROOT_FILES -- let's fix that name. (Or a separate PR if VALID_ROOT_FILES is already in develop.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its already in develop.

Copy link
Member

Choose a reason for hiding this comment

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

OK, suggest making a separate PR for this change, then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@seanlip seanlip assigned jnvtnguyen and unassigned seanlip Jun 18, 2024
@jnvtnguyen
Copy link
Contributor Author

@seanlip Updated, PTAL. Thanks.

Copy link
Member

@seanlip seanlip left a comment

Choose a reason for hiding this comment

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

Thanks @jnvtnguyen, just minor comments.

Do you want this PR merged right after you fix those, or should we wait?


# Root Files Config

The root files config at `core/tests/root-files-config.json` contains all the valid root files that are generated in the root files mapping. A root file is a file in the dependency graph which has no parents, the most common root files in the codebase are page modules and other files like `README.md`. The "root files mapping generator" validates the `root-files-config.json` by comparing the PR's root files in the mapping with the root files found in the config, if there are any discrepancies, the generator will error. This ensures that the "root-files config" is always up to date with every PR.
Copy link
Member

Choose a reason for hiding this comment

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

...in the config. If there are ...

... will error; this ensures ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

# Root Files Config

The root files config at `core/tests/root-files-config.json` contains all the valid root files that are generated in the root files mapping. A root file is a file in the dependency graph which has no parents, the most common root files in the codebase are page modules and other files like `README.md`. The "root files mapping generator" validates the `root-files-config.json` by comparing the PR's root files in the mapping with the root files found in the config, if there are any discrepancies, the generator will error. This ensures that the "root-files config" is always up to date with every PR.
If you get an error that there is a root file not contained in these lists, please add them to one of these lists depending on the context of the file:
Copy link
Member

Choose a reason for hiding this comment

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

Put another blank line above this, it can be a separate paragraph.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

The root files config at `core/tests/root-files-config.json` contains all the valid root files that are generated in the root files mapping. A root file is a file in the dependency graph which has no parents, the most common root files in the codebase are page modules and other files like `README.md`. The "root files mapping generator" validates the `root-files-config.json` by comparing the PR's root files in the mapping with the root files found in the config, if there are any discrepancies, the generator will error. This ensures that the "root-files config" is always up to date with every PR.
If you get an error that there is a root file not contained in these lists, please add them to one of these lists depending on the context of the file:

* If the specific file has a chance to break some part of the Oppia website, like `src/index.html`, please add it to the `RUN_ALL_TESTS_ROOT_FILES`.
Copy link
Member

Choose a reason for hiding this comment

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

...to the RUN_ALL_TESTS_ROOT_FILES file.

Ditto below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put to the RUN_ALL_TESTS_ROOT_FILES in root-files-config.json

@seanlip seanlip removed their assignment Jun 21, 2024
@jnvtnguyen
Copy link
Contributor Author

@seanlip Done, preferably after fixes since I still need to merge the other PR, Thanks.

@jnvtnguyen jnvtnguyen assigned seanlip and unassigned jnvtnguyen Jun 21, 2024
Copy link
Member

@seanlip seanlip left a comment

Choose a reason for hiding this comment

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

LGTM. Feel free to request merge whenever you like, thanks!

@seanlip seanlip assigned jnvtnguyen and unassigned seanlip Jun 21, 2024
@jnvtnguyen
Copy link
Contributor Author

Oh sorry @seanlip, I meant preferably after the fixes for this PR (so now), so I can merge the other PR.

@jnvtnguyen jnvtnguyen assigned seanlip and unassigned jnvtnguyen Jun 21, 2024
@seanlip
Copy link
Member

seanlip commented Jun 21, 2024

Ah ok! Doing that now :)

@seanlip seanlip merged commit b3699bc into oppia:develop Jun 21, 2024
3 checks passed
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.

None yet

2 participants