Skip to content

ci: Scope the remaining setup-uv PR saves with a pr-<N> cache suffix (#962) - #2590

Merged
zackees merged 1 commit into
masterfrom
ci/962-cache-013-pr-suffix
Oct 27, 2026
Merged

zackees merged 1 commit into
masterfrom
ci/962-cache-013-pr-suffix

Conversation

@zackees

@zackees zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member

ci-lint's CACHE-013 flags a astral-sh/setup-uv step that can save a cache in PR context whose key has no delimited pr-<N> component: the janitor deletes a closed PR's entries by that component, so an unsuffixed PR save is never reclaimed. Five steps are still unapproved findings against the #962 baseline:

file job
.github/workflows/check-format.yaml checks
.github/workflows/ci.yml cancel-superseded
.github/workflows/ci.yml native-cache-consumer
.github/workflows/ci.yml ci-gate
.github/workflows/ci.yml cache-janitor

Each already scopes its save to the writer flow (save-cache: ${{ github.ref == 'refs/heads/master' }}); what was missing is the key's pr-<N> component. The steps that pass enable-cache: false are exempt and are untouched.

The fix adds the checker's recommended inline suffix:

cache-suffix: ${{ github.event.pull_request.number && format('pr-{0}', github.event.pull_request.number) || '' }}

On a master push the suffix is empty, so the writer key is unchanged; on a PR the save carries pr-<N> for the janitor. This is a cache-key change only — no job graph, trigger or step behavior changes.

RED → GREEN

Focused CI/configuration fix (coordination.md §4): local RED evidence, one fix commit.

  • RED — ci-lint precheck on origin/master (0ef8117b8): 24 violation(s), including 5 [CACHE-013] VIOLATION (the table above).
  • GREEN — same command on this branch: 19 violation(s), 0 [CACHE-013] VIOLATION. No new finding; the count drops by exactly the 5 fixed.
  • uv run python -m unittest ci.test_ci_toml → Ran 19 tests ... OK.

ci-lint is the guard for this rule, so the fix needs no new offline test (an offline mirror of CACHE-013 would have to reproduce its "can this job save on a pull_request" analysis, and a naive version over-flags every setup-uv step).

Refs #962

…962)

ci-lint CACHE-013 flags a setup-uv step that can save in PR context but
whose cache key has no delimited pr-<N> component, so the janitor cannot
delete a closed PR's entry. Five steps are still unapproved findings:
- .github/workflows/check-format.yaml jobs.checks (save-cache scoped to
  master, but a PR-context save would still be unsuffixed)
- .github/workflows/ci.yml: cancel-superseded, native-cache-consumer,
  ci-gate, cache-janitor

Add cache-suffix (the checker's recommended inline expression) to each.
On master the suffix is empty, so the writer key is unchanged; on a PR it
carries pr-<N> for the janitor. Steps that already pass enable-cache:
false are untouched.

RED:  ci-lint precheck -> 5 CACHE-013 VIOLATION, 24 total (master).
GREEN: ci-lint precheck -> 0 CACHE-013 VIOLATION, 19 total.
Also: uv run python -m unittest ci.test_ci_toml (19 OK).

Refs #962
@zackees
zackees added this pull request to the merge queue Oct 27, 2026
Merged via the queue into master with commit ee6400f Oct 27, 2026
31 checks passed
@zackees
zackees deleted the ci/962-cache-013-pr-suffix branch October 27, 2026 10:07
zackees added a commit that referenced this pull request Oct 27, 2026
)

The composite action's Set Up uv step saved its cache with no
cache-suffix and its Save Timestamp Cache step wrote an
actions/cache/save key with no pr-<N> component, so the janitor could
never reclaim either from a closed PR. Both now carry the expression
#2590/#2663 used; the Restore Timestamp Cache key gets the same
component so restore and save still agree (empty off a PR). The file's
CACHE-013 [[exceptions]] block in ci.toml is deleted.
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…bs-rust#962) (obs-rust#2668)

* test(ci): Pin services-validator's CACHE-013 pr-<N> suffixes (obs-rust#962)

The composite action's setup-uv step has no cache-suffix and its
Save Timestamp Cache step's actions/cache/save key has no pr-<N>
component; extend ci/test_cache013_actions.py to require both, so it
fails on master until they carry one.

* ci: Give services-validator's uv and timestamp caches a pr-<N> key (obs-rust#962)

The composite action's Set Up uv step saved its cache with no
cache-suffix and its Save Timestamp Cache step wrote an
actions/cache/save key with no pr-<N> component, so the janitor could
never reclaim either from a closed PR. Both now carry the expression
obs-rust#2590/obs-rust#2663 used; the Restore Timestamp Cache key gets the same
component so restore and save still agree (empty off a PR). The file's
CACHE-013 [[exceptions]] block in ci.toml is deleted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant