Repository navigation
ci(workflows): scope persistence workflows to tracker-core changes - #1747
josecelano merged 1 commit into
Conversation
Replace the broad `paths-ignore` trigger rules in db-compatibility and db-benchmarking with narrow `paths` rules that only run those workflows when `packages/tracker-core/**` or the workflow files themselves change. This is an intentional optimization tradeoff: the jobs call persistence methods directly against real database instances, so they are validating tracker-core's persistence layer specifically. General compile and cross-package regressions remain covered by the Testing workflow. Closes torrust#1744
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Scopes the DB compatibility and benchmarking GitHub Actions workflows to run only when tracker-core persistence code (or the workflow files themselves) changes, reducing unnecessary CI runs.
Changes:
- Replaced broad
paths-ignore(docs-only skip) with explicitpathsfilters targetingpackages/tracker-core/**. - Ensured CI config edits still trigger runs by including each workflow file in its own
pathslist.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| .github/workflows/db-compatibility.yaml | Limits DB compatibility workflow triggers to tracker-core and workflow-file changes. |
| .github/workflows/db-benchmarking.yaml | Limits DB benchmarking workflow triggers to tracker-core and workflow-file changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| paths: | ||
| - "packages/tracker-core/**" | ||
| - ".github/workflows/db-compatibility.yaml" | ||
| pull_request: | ||
| paths-ignore: | ||
| - "**/*.md" | ||
| - "project-words.txt" | ||
| paths: | ||
| - "packages/tracker-core/**" | ||
| - ".github/workflows/db-compatibility.yaml" |
There was a problem hiding this comment.
Thanks. We considered this and intentionally kept the narrow trigger scope for #1744: packages/tracker-core/** plus the workflow file itself. This is documented in the issue spec scope decision. The optimization is deliberate (not full dependency-closure analysis), and broader compile/cross-package regression coverage remains in the Testing workflow.
| paths: | ||
| - "packages/tracker-core/**" | ||
| - ".github/workflows/db-benchmarking.yaml" | ||
| pull_request: | ||
| paths-ignore: | ||
| - "**/*.md" | ||
| - "project-words.txt" | ||
| paths: | ||
| - "packages/tracker-core/**" | ||
| - ".github/workflows/db-benchmarking.yaml" |
There was a problem hiding this comment.
Same rationale as above: for #1744 we intentionally scope these persistence workflows to packages/tracker-core/** plus the workflow file itself. This change is an explicit optimization tradeoff documented in the issue spec; broader workspace-level regressions are covered by the Testing workflow.
| paths: | ||
| - "packages/tracker-core/**" | ||
| - ".github/workflows/db-compatibility.yaml" | ||
| pull_request: | ||
| paths-ignore: | ||
| - "**/*.md" | ||
| - "project-words.txt" | ||
| paths: | ||
| - "packages/tracker-core/**" | ||
| - ".github/workflows/db-compatibility.yaml" |
There was a problem hiding this comment.
Good point on duplication drift risk. For now we are keeping plain duplicated paths entries for readability and consistency with the rest of our workflow files, but we can revisit anchors/sync helpers in a follow-up cleanup.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1747 +/- ##
========================================
Coverage 79.40% 79.41%
========================================
Files 368 368
Lines 27129 27129
Branches 27129 27129
========================================
+ Hits 21543 21544 +1
Misses 5310 5310
+ Partials 276 275 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
ACK 35d03b3 |
da2ce7
left a comment
There was a problem hiding this comment.
This is a post-merge review of #1747 as it stands at e170b9620 on the default branch.
What still runs: both .github/workflows/db-compatibility.yaml and .github/workflows/db-benchmarking.yaml keep the positive paths allow-list that #1747 put in place of the docs-only paths-ignore from #1746, on both push and pull_request. At the tip the compatibility workflow triggers on packages/tracker-core/**, its own file and .github/actions/enable-sccache/** (.github/workflows/db-compatibility.yaml:13-23); the benchmarking workflow also triggers on packages/persistence-benchmark/**, added by a0ff8b043 when the benchmark runner moved out of tracker-core (.github/workflows/db-benchmarking.yaml:11-23). Neither workflow has a schedule or workflow_dispatch trigger, so these lists alone decide when the MySQL and PostgreSQL runs happen.
[Minor] Cargo.lock is in neither allow-list (.github/workflows/db-compatibility.yaml:13-23, .github/workflows/db-benchmarking.yaml:11-23), yet the locked versions of sqlx and testcontainers are exactly what the MySQL and PostgreSQL jobs exercise. packages/tracker-core/Cargo.toml:35 and :53 declare sqlx = "0.8" and testcontainers = "0" (the latter admits any 0.x release, breaking ones included), and packages/persistence-benchmark/Cargo.toml:27-28 does the same, so an in-range update changes only Cargo.lock, which is the shape the daily cargo entry at .github/dependabot.yaml:14-21 produces. This has happened: #2060 (merge ceaf16564, commit e5799609a) moved testcontainers from 0.27.3 to 0.28.0 without touching any triggering path, so neither workflow ran on it, and the MySQL and PostgreSQL suites first met 0.28.0 on whichever later pull request touched tracker-core, where a failure would have been charged to that unrelated change. Of the 846 merges after c3eab6e65, 143 changed Cargo.lock and 112 of those triggered neither workflow. The Testing workflow does not close the gap: it compiles the feature-gated driver suites (--all-features at .github/workflows/testing.yaml:111), but run_mysql_driver_tests and run_postgres_driver_tests return early without their environment variables (packages/tracker-core/src/databases/driver/mysql/mod.rs:205, packages/tracker-core/src/databases/driver/postgres/mod.rs:186). The goal in docs/issues/closed/1744-scope-persistence-workflows-by-path/ISSUE.md:25-26 is to run on files "that can affect database compatibility", and a lock bump of sqlx or testcontainers is such a change. Smallest fix: add "Cargo.lock" to the four paths lists. If that is too frequent for the purpose of #1744 (62 of the 846 merges triggered the compatibility workflow; the lock file would have added 112), add a schedule trigger to both workflows instead, so the default branch's current lock is exercised at the cadence the dependency updates arrive.
[Nit] packages/configuration/** is outside both allow-lists, and since #2103 that package builds the URL both network drivers connect with: Database::connection_url and network_connection_url at packages/configuration/src/v3_0_0/database.rs:66-88, called by the production setup at packages/tracker-core/src/databases/setup.rs:119 and :125 and by the MySQL and PostgreSQL suites (packages/tracker-core/src/databases/driver/mysql/mod.rs:197, packages/tracker-core/src/databases/driver/postgres/mod.rs:178). When #1747 merged, the configuration package passed the connection string through as a plain path field, so packages/tracker-core/** matched the layout of the time; now a pull request that changes only the URL builder (as 1b4ff141f did, although it landed together with tracker-core changes in #2103) is checked only against the string assertions in the configuration unit tests and never against a real server. Smallest fix: add "packages/configuration/src/v3_0_0/database.rs" to the four paths lists.
[Nit] The comment at .github/workflows/db-compatibility.yaml:7-11 says that "broader dependency closure is not required". The specification of #1744 asked for the trigger comment to present the scope as "an intentional optimization tradeoff, not full dependency closure analysis" (docs/issues/closed/1744-scope-persistence-workflows-by-path/ISSUE.md:78-79), and the two points above show the jobs do depend on inputs outside tracker-core. Rewording it as a deliberate trade-off that names what is left out (Cargo.lock, the configuration URL builder) gives the next edit of the list what it needs; the shorter comment at .github/workflows/db-benchmarking.yaml:7-9 reads the same way.
Checked and found sound: the diff of #1747 matches its description; every allow-listed path exists at the tip, and packages/tracker-core kept its folder through the crate rename in 33cca9f7b; the migrations the suites apply live under packages/tracker-core/migrations, inside the filter; the move of the benchmark runner to packages/persistence-benchmark was followed by the matching package and filter change in a0ff8b043; no merge since c3eab6e65 changed more than 300 files, the size past which a paths filter can miss a match; no secrets, tokens or permission changes are involved. Whether these checks are required by branch protection is not visible from the repository and was not checked.
Summary
Implements #1744 — scope persistence workflows by path.
Changes
Updated workflows:
.github/workflows/db-compatibility.yaml.github/workflows/db-benchmarking.yamlBoth workflows previously had a broad
paths-ignorefor docs (added in #1746). Those have been replaced with narrowpathsrules:Path policy
Workflows now run only when at least one changed file matches:
packages/tracker-core/**— the persistence layer under testRationale
The DB compatibility jobs run
cargo test -p bittorrent-tracker-core ... run_mysql_driver_tests / run_postgres_driver_tests. The benchmarks runcargo run -p bittorrent-tracker-core --bin persistence_benchmark_runner. Both exercise the persistence layer directly, not the broader workspace. Scoping them topackages/tracker-core/**is therefore both safe and correct.General compile and cross-package regression coverage remains the responsibility of the Testing workflow.
Branch protection
After merging, branch protection rules should be reviewed. These workflows will no longer run for unrelated pull requests, so they should not be set as required checks for all PRs.
Related