Developer quality tooling
Developer quality tooling keeps the shared Helium patch and utility code safe to change. It checks code style, Python quality, utility behavior, repository configuration, patch structure, patch application, source tree preparation, and translation data before those changes reach a build or release workflow.
Quality gate model
The repository uses separate gates for code, repository data, source compatibility, and translations. Each gate returns a failing process status when it finds a problem, so local checks and GitHub Actions can use the same result.
Quality gate boundaries
The checks protect different kinds of contracts. Code checks ask whether the utility programs are readable and behave as expected. Configuration checks ask whether lists and patch metadata describe real, usable inputs. Patch checks ask whether the changes still fit the selected Chromium source. Translation checks ask whether generated source data and translated messages still agree.
The normal high-level path is:
flowchart LR
A[Utility or repository change] --> B[Format and lint]
B --> C[Utility test suites]
C --> D[Configuration checks]
D --> E[Patch application checks]
E --> F[Translation source and message checks]
F --> G[Build or release work]
Not every change needs every gate. A change to patch metadata needs the configuration and patch gates. A change to a Python utility needs the code and test gates. A change to translated strings also needs the translation gate.
References: devutils/check_all_code.sh• L1-22 .github/…/ci.yml• L15-58 .github/…/lint.yml• L1-33
Local command surface
The devutils directory provides both focused commands and wrappers. Use focused commands when you need a fast answer about one area. Use devutils/check_all_code.sh when you want one local pass over formatting, lint, and tests for both utils and devutils.
The wrappers use the repository-wide YAPF style in .style.yapf. They format files in place. The CI workflow runs the same style check in diff mode, so CI reports a formatting change instead of silently writing it.
References: devutils/check_all_code.sh• L3-22 devutils/run_utils_yapf.sh• L1-6 devutils/run_devutils_yapf.sh• L1-7 devutils/run_other_yapf.sh• L1-5 .style.yapf• L1-8 .github/…/ci.yml• L27-43
Code quality checks
The code quality checks cover the two Python utility areas that support patch assembly, downloads, resource work, configuration checks, and developer workflows. They combine a formatter, a static code checker, and tests with coverage output.
Formatting checks
YAPF keeps Python utility code aligned with one shared style. The utils and devutils wrappers skip vendored third_party code, while the general wrapper accepts a path for other modules.
Formatting is a source edit when run through the local wrappers. In continuous integration, the check uses a diff report and fails when the report is not empty. This makes formatting drift visible without changing the submitted files.
References: devutils/run_utils_yapf.sh• L1-6 devutils/run_devutils_yapf.sh• L1-7 devutils/run_other_yapf.sh• L1-5 .github/…/ci.yml• L27-37
Static code checks
Pylint checks Python source for problems that formatting cannot find. The utility-specific runners set the scope and exclusions for each area, then return a failure when Pylint reports a non-zero status.
The runners support two review modes. The default keeps fixme findings visible. The --hide-fixme option is used by CI to focus the gate on other findings. Vendored code is excluded, and utility tests are excluded from the utils lint scope.
References: devutils/run_utils_pylint.py• L15-52 devutils/run_devutils_pylint.py• L15-57 devutils/run_other_pylint.py• L33-64 .github/…/ci.yml• L30-40
Utility test suites
The test suites protect the behavior of the shared utility code and the developer commands that depend on it. devutils/run_utils_tests.sh runs tests for utils; devutils/run_devutils_tests.sh runs tests for devutils.
Both suites use pytest configuration that discovers the local tests directory and reports line coverage. The suites therefore check behavior at the level of the utility area while also showing which code lacks test coverage.
References: devutils/run_utils_tests.sh• L1-7 devutils/run_devutils_tests.sh• L1-7 utils/pytest.ini• L1-7 devutils/pytest.ini• L1-10 devutils/…/test_validate_patches.py• L24-75 devutils/…/test_check_patch_files.py• L24-49
Repository consistency checks
Repository consistency checks protect data that connects patch files, build inputs, and source lists. They turn stale references into a clear failure before a later build step has to discover the problem.
Configuration validation
validate_config.py is the compact gate for the repository's core configuration. It checks patch readability, patch-series uniqueness and use, GN flag order and duplication, and the schema of downloads.ini.
The checks use a zero exit status for a clean result and a non-zero status for warnings or errors. This distinction matters because an apparently small metadata change can otherwise leave a missing patch, an unused patch, a duplicate flag, or an invalid download entry behind.
References: devutils/validate_config.py• L7-55 devutils/check_patch_files.py• L7-17 devutils/check_gn_flags.py• L7-16 devutils/check_downloads_ini.py• L7-16
Reference integrity checks
The patch-file checker keeps the patch directory and its series order in agreement. It verifies that listed patches can be parsed, that no series entry is repeated, and that no unlisted patch remains in the directory. The file-list checker applies the same basic idea to lists of paths by confirming that each listed path exists under a chosen root.
The GN flag checker treats ordering and uniqueness as part of the configuration contract. The download checker treats the downloads.ini schema as the contract for source and dependency retrieval. Together these checks stop later commands from consuming incomplete or ambiguous inputs.
References: devutils/check_patch_files.py• L34-112 devutils/check_files_exist.py• L6-33 devutils/check_gn_flags.py• L28-57 devutils/check_downloads_ini.py• L28-40
Patch compatibility checks
Patch compatibility checks answer a different question from patch metadata checks: whether the patch series can still change the intended Chromium source. They are the quality boundary between a valid patch collection and a source tree that can accept that collection.
Patch application validation
validate_patches.py validates the complete series against either a local unmodified Chromium source tree or source files retrieved from Chromium's remote repositories. It loads the patch order, identifies the source files that the series needs, and checks each change in order.
The remote mode follows the Chromium dependency description and can use a cache. The local mode avoids downloads but is only meaningful when the source tree has not already been changed. A failure means that a patch no longer matches the source content or that a required input could not be obtained.
References: devutils/validate_patches.py• L7-11 devutils/validate_patches.py• L386-453 devutils/validate_patches.py• L623-705
Patch sanity validation
lint.py checks the Helium patch set for repository rules that are easy to miss during patch editing. These rules cover patch presence and series membership, meaningful patch content, trailing whitespace in additions, license headers for new Helium files, header guards, and hunks that contain only whitespace changes.
This check does not prove that patches apply to Chromium. It complements the application validator by checking the shape and maintenance rules of the patch files themselves. See Patch validation for the dedicated patch gate and its place in the wider patch workflow.
References: devutils/lint.py• L6-43 devutils/_lint_tests.py• L30-136 .github/…/lint.yml• L8-17
Source tree preparation
Source tree preparation removes files that are not needed for the selected build or source package. It also supplies a clean Chromium source tree and its tools when the normal source archive is not available.
Source checkout fallback
utils/clone.py provides the fallback source setup for the CI source-validation path. It checks out the pinned Chromium version and its matching depot_tools revision, then uses gclient to fetch the platform-specific dependencies and PGO profiles required by the selected target.
The command writes a controlled checkout configuration and requires a fresh directory named src. CI uses the result to create a reusable source archive when archive retrieval fails. A custom configuration or an explicit depot_tools revision can override the normal dependency selection.
References: utils/clone.py• L23-37 utils/clone.py• L40-109 utils/clone.py• L113-141 .github/…/ci.yml• L80-101
Binary pruning
utils/prune_binaries.py removes Python caches, optional source paths, and files listed by a pruning list from an unpacked source tree. The command can keep all contingent paths or exempt one supported sysroot when later build tooling needs those inputs.
The command treats an absent requested file as a failure after it tries to remove read-only files. This makes a stale pruning list visible instead of silently producing a source tree that differs from the requested contents.
References: utils/prune_binaries.py• L18-30 utils/prune_binaries.py• L164-183 utils/prune_binaries.py• L211-230 utils/prune_binaries.py• L233-265
CIPD dependency installation
utils/install_cipd_deps.py prepares the selected Chromium tools that the build host needs after the source tree is available. It reads the main and Dawn DEPS data, selects the host-specific GN, Siso, TypeScript, and Go tool packages, and installs them at their source-tree destinations through CIPD.
The command supports Linux, macOS, and Windows hosts. With --remote-exec, it also installs the Linux TypeScript package needed by remote workers. It fails for an unsupported host or CPU, a selected dependency that is not a CIPD package, or an unsuccessful package install. See Build configuration and downloads for the wider source-input flow.
References: utils/install_cipd_deps.py• L13-44 utils/install_cipd_deps.py• L47-65 utils/install_cipd_deps.py• L68-100
Translation quality checks
Translation tooling keeps Helium strings aligned across shared patches and platform repositories. It creates a source set, updates language files, removes stale entries, and checks that translated messages preserve the structure needed by the browser's string system.
Translation source flow
The i18n.py command groups the translation workflow into four actions: generate source strings, translate target languages, clean stale strings, and forage for existing Chromium translations. Generation reads relevant string changes from the main and platform patch series and writes the checked-in source set.
Translation work therefore starts from patch content rather than from a hand-maintained inventory. The generated source set is the shared input for language updates and validation. See Localization management for the broader ownership and data flow around languages.
References: devutils/i18n.py• L21-65 devutils/i18n.py• L68-92 devutils/i18n_generate.py• L52-75 devutils/i18n_generate.py• L139-164
Translation message validation
i18n_lint.py checks every translation file against the generated source set. It rejects invalid XML message content, source strings that no longer match, and placeholder changes. It also checks placeholders after conversion to the browser's XTB format.
The CI translation gate first regenerates the source set and compares it with the checked-in file. It then runs the translation validator. This catches both stale generated data and language entries that could break message substitution.
References: devutils/i18n_lint.py• L20-41 devutils/i18n_lint.py• L44-81 .github/…/lint.yml• L18-33
Workflow connections
GitHub Actions runs the quality gates as independent jobs so a contributor can see whether a failure concerns code, configuration, source compatibility, or translations. The code job runs formatting, lint, and both test suites. The configuration job checks repository metadata. The source job retrieves or prepares Chromium input, validates patch application, and compares generated source lists.
The workflow cancels older runs for the same branch or pull request when a newer run starts. This keeps feedback tied to the latest change. See GitHub workflow automation and Release versioning and automation for the wider automation model.
References: .github/…/ci.yml• L1-58 .github/…/ci.yml• L59-139 .github/…/lint.yml• L1-33
Change checklist
When these files or sections are changed, remember to consider these:
- When changing a patch or its
patches/seriesentry, run both repository consistency checks and source-tree patch validation. A readable patch can still fail to apply. - When changing utils/clone.py or the pinned Chromium and dependency inputs, check that the fallback source archive still uses the expected source revision, tool revision, target platform, and dependency set.
- When changing utils/prune_binaries.py or its pruning paths, check the source package inputs and the sysroot selected by the build. A path exemption can change which build data remains available.
- When changing utils/install_cipd_deps.py, Chromium
DEPSdata, or DawnDEPSdata, check host and remote-worker package selection against the paths that pruning and build steps expect. - When changing downloads.ini, deps.ini, chromium_version.txt, or source-list inputs, consider the source retrieval cache key and regenerate the checked-in lists before comparing them.
- When changing a translatable string in a patch or platform repository, regenerate i18n/source.gen.json before updating language files. Then run the placeholder and XML checks.
- When changing the YAPF style or lint runner options, compare local wrapper behavior with the CI commands. Local wrappers format in place, while CI checks for a clean diff.
- When adding a new quality command, connect its exit status to the relevant local wrapper or workflow job. A command that only prints warnings does not protect the CI gate.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
A patch is listed in series but the file is missing or unreadable | Patch assembly stops before the intended source changes are available | check_patch_files.py and validate_config.py check patch presence and readability |
A patch exists outside series or appears twice | The applied series does not match the patch directory or applies a change more than once | Patch membership and duplicate-entry checks |
| A patch context no longer matches the selected Chromium source | The source tree cannot receive the intended change safely | validate_patches.py checks the series against local or remote source files |
A fallback clone uses a non-empty directory or an output name other than src | gclient hooks can target the wrong tree or refuse to prepare the source | clone.py validates the output path before checkout |
| A GN flag is duplicated or out of order | Build configuration can become ambiguous or hard to review | check_gn_flags.py |
| A requested prune path is absent or cannot be removed | The prepared source tree is incomplete or retains files that should be pruned | prune_binaries.py reports unremovable files and fails |
| The host or CPU is not supported by the CIPD selector | Required build tools are not selected for the source tree | install_cipd_deps.py rejects unsupported platform values |
| A selected DEPS entry is not a CIPD package or the install fails | The build host lacks one or more required Chromium tools | install_cipd_deps.py validates the dependency type and propagates the CIPD failure |
| A translation source file is stale | New or changed UI text does not reach the translation workflow | Regeneration and diff check in the translation workflow |
| A translated message has invalid XML or changed placeholders | Runtime string conversion can fail or substitute the wrong values | i18n_lint.py |
| Utility code is not formatted or has a Pylint finding | CI rejects the change before later validation runs | YAPF and Pylint jobs |
Key files
| File | Why to read it |
|---|---|
| devutils/check_all_code.sh | Shows the complete local code-quality pass for utils and devutils. |
| .github/…/ci.yml | Shows the main CI gates for code, configuration, source compatibility, and generated lists. |
| .github/…/lint.yml | Shows patch sanity and translation drift gates. |
| devutils/validate_config.py | Defines the repository-level configuration gate. |
| devutils/validate_patches.py | Defines the source compatibility gate for the patch series. |
| devutils/_lint_tests.py | Defines the maintenance rules checked by the patch sanity command. |
| utils/clone.py | Defines the clean Chromium checkout used when the normal source archive is unavailable. |
| utils/install_cipd_deps.py | Defines how host and remote-worker Chromium tools are selected and installed. |
| utils/prune_binaries.py | Defines source tree cleanup and the options that control retained paths. |
| devutils/i18n.py | Defines the entry points for source extraction, translation, cleanup, and Chromium translation lookup. |
| devutils/i18n_lint.py | Defines the checks that protect translation structure and placeholders. |
| devutils/run_utils_tests.sh | Shows how the shared utility test suite is invoked. |
| devutils/run_devutils_tests.sh | Shows how the developer-tool test suite is invoked. |
.style.yapf | Defines the shared Python formatting policy. |
| utils/pytest.ini | Defines test discovery and coverage behavior for shared utilities. |
| devutils/pytest.ini | Defines test discovery and coverage behavior for developer utilities. |