tests.test_sync_ops moduleΒΆ
Conformance tests for the dependency-updater registry.
Each test enumerates SYNC_OPERATIONS and asserts a
shared invariant, so a new operation that breaks a convention fails by name.
The CI jobs running the operations are described here, in CI_JOBS, and
held against the workflows.
- tests.test_sync_ops.SHARED_JOB = 'sync-deps'ΒΆ
The
autofix.yamljob most operations share a checkout in.
- class tests.test_sync_ops.CiJob(write_domain, ci_flags, workflow='autofix.yaml', job='sync-deps')[source]ΒΆ
Bases:
objectWhere CI runs one operation, as the workflows declare it.
- property consolidated: boolΒΆ
Whether the operation shares the multi-bumper job.
The shared job runs the operations through one
sync-deps --pr-synccall, which resets the working tree before each, so the previous bumperβs diff never bleeds into its PR. An operation with a job to itself starts from a clean checkout and needs no reset.
- tests.test_sync_ops.CI_JOBS: dict[str, CiJob] = {'sync-action-pins': CiJob(write_domain=('.github/workflows/*.yaml', '.github/actions/**/*.yaml'), ci_flags=('--release-notes',), workflow='autofix.yaml', job='sync-deps'), 'sync-dep-sources': CiJob(write_domain=('uv.lock', 'pyproject.toml'), ci_flags=('--release-notes',), workflow='autofix.yaml', job='sync-deps'), 'sync-tool-versions': CiJob(write_domain=('repomatic/tooling/registry.py', 'repomatic/data/actionlint-matcher.json'), ci_flags=('--release-notes',), workflow='self-maintenance.yaml', job='sync-tool-versions'), 'sync-uv-lock': CiJob(write_domain=('uv.lock', 'pyproject.toml [tool.uv]'), ci_flags=('--release-notes',), workflow='autofix.yaml', job='sync-deps'), 'sync-workflow-pins': CiJob(write_domain=('.github/workflows/*.yaml', '.github/actions/**/*.yaml'), ci_flags=('--release-notes',), workflow='autofix.yaml', job='sync-deps')}ΒΆ
The CI job of each operation, keyed by operation name.
- tests.test_sync_ops.test_every_operation_has_a_ci_job()[source]ΒΆ
A new operation states where CI runs it, or every guard below skips it.
- Return type:
- tests.test_sync_ops.test_sync_deps_and_family_are_registered()[source]ΒΆ
sync-depsand every updater it drives are CLI commands.- Return type:
- tests.test_sync_ops.test_operation_has_pr_body_template(op)[source]ΒΆ
Each updater ships a PR-body template under its own name (naming rule 3).
- Return type:
- tests.test_sync_ops.test_operation_config_key_exists(op)[source]ΒΆ
Each
config_keynames a real boolean setting of the Config schema.- Return type:
The bumper label and the labellerβs rules name the same label.
The bumpers apply it to the PRs they open, and the labeller applies it to anyone elseβs PR touching a lockfile or
pyproject.toml. Both spellings are hand-written, so one renamed without the other silently splits the family across two labels, and the single filter this constant exists for stops finding half of it.- Return type:
- tests.test_sync_ops.test_write_domains_justify_serial_apply()[source]ΒΆ
Two updaters share the workflow files; the uv pair stays out of them.
This is the invariant behind the serial apply phase: the workflow-file rewriters cannot write concurrently, while
sync-uv-lockandsync-dep-sources(uv.lock,pyproject.toml) never touch workflow files and resolve in parallel with them, serialized only against each other through the uv-project mutex.- Return type:
- tests.test_sync_ops.test_is_enabled_reads_the_config_key(op)[source]ΒΆ
is_enabledmirrors the operationβs Config boolean.- Return type:
- tests.test_sync_ops.test_selected_operations_drops_disabled()[source]ΒΆ
A disabled flag removes its operation, even when named.
- Return type:
- tests.test_sync_ops.test_selected_operations_by_name_runs_a_subset_in_registry_order()[source]ΒΆ
Naming operations restricts to them, in registry order, not input order.
- Return type:
- tests.test_sync_ops.test_selected_operations_by_name_still_honors_config_flags()[source]ΒΆ
A named-but-disabled operation is dropped (feature flags are authoritative).
- Return type:
- tests.test_sync_ops.test_run_sync_operations_applies_in_input_order()[source]ΒΆ
Resolves run concurrently; applies run in the order passed in.
- Return type:
- tests.test_sync_ops.test_run_sync_operations_dry_run_skips_apply()[source]ΒΆ
dry_runresolves but never applies.- Return type:
- tests.test_sync_ops.test_run_sync_operations_isolates_a_failing_resolve()[source]ΒΆ
One operationβs resolve failure yields a
Noneplan, not a crash.- Return type:
- tests.test_sync_ops.test_sync_deps_reports_nothing_to_do_in_an_empty_tree(tmp_path, monkeypatch, pyproject, names, message)[source]ΒΆ
With no lockfile, workflows, or source, no updater applies.
A named updater runs whatever the tree holds, but never past its flag.
- Return type:
- tests.test_sync_ops.test_consolidated_job_covers_every_operation()[source]ΒΆ
Every registered operation has a step group in the job hosting it.
The drift guard: a new
SyncOperationadded toSYNC_OPERATIONSwithout wiring its sync command, PR body, and PR into a CI job fails here by name. Each operation is checked against its own entry inCI_JOBS, so moving one out of the consolidated job keeps the guard rather than dropping it. The command, the PR-body template and the PR branch all share the operationβs name.- Return type:
- tests.test_sync_ops.test_consolidated_job_passes_ci_flags(op)[source]ΒΆ
Each operationβs
ci_flagsreach its sync step in the autofix job.The drift guard: an updater that declares a CI capability (like
--release-notes) whose consolidated-job step never passes it silently drops the feature from the PR body. Fails by name when the registry and the YAML disagree.- Return type:
- tests.test_sync_ops.test_consolidated_job_uses_full_history()[source]ΒΆ
The job checks out the full history.
Repeated create-pull-request calls in one checkout then never trip gitβs βshallow file has changedβ race.
- Return type:
- tests.test_sync_ops.test_consolidated_job_labels_every_pr_consistently()[source]ΒΆ
Every PR the consolidated job opens carries the shared dependency label.
--pr-synclabels each pull request from the frontmatter of the template named after its operation.- Return type:
- tests.test_sync_ops.test_sync_deps_applies_in_place_and_writes_one_report(tmp_path, monkeypatch)[source]ΒΆ
Without
--pr-sync, each updater applies to the tree, then reports.- Return type:
- tests.test_sync_ops.test_sync_deps_fails_once_an_updater_cannot_resolve(tmp_path, monkeypatch)[source]ΒΆ
A resolve that raises applies nothing, and fails the command at the end.
- Return type:
- tests.test_sync_ops.test_pr_sync_mode_runs_each_operation_from_a_clean_tree(monkeypatch)[source]ΒΆ
Each operation starts from a tree put back to HEAD, then converges its PR.
One that fails leaves its pull request alone, never stops the next one, and fails the command once all ran. One with nothing to act on resolves nothing, but still converges its pull request, so a stale one closes.
- Return type:
- tests.test_sync_ops.test_pr_sync_mode_refuses_a_preview_or_a_report(flag)[source]ΒΆ
Each report goes into its pull request: there is nothing to preview.
- Return type:
- tests.test_sync_ops.test_pr_sync_mode_refuses_uncommitted_changes(tmp_path, monkeypatch, hermetic_git, staged)[source]ΒΆ
An edit to a tracked file survives: the mode refuses to start.
Each updater starts from a tree put back to
HEAD, which would discard the work of a developer running the mode on their own checkout. The refusal comes before the first reset, and names what it protects.- Return type:
- tests.test_sync_ops.test_pr_sync_mode_runs_beside_untracked_files(tmp_path, monkeypatch, hermetic_git)[source]ΒΆ
An untracked file never blocks the mode: no reset touches it.
- Return type:
- tests.test_sync_ops.test_pinned_with_packages_covers_every_registry_pin()[source]ΒΆ
Every
package==versionin the registry reaches the bumper.The drift guard: a plugin set added to a toolβs
with_packagesbut never scanned ages out silently, which is how mdformatβs ownruff==pin sat four minor versions behind the top-level ruff.- Return type:
- tests.test_sync_ops.test_pinned_with_packages_keeps_the_lowest_of_two_pins(monkeypatch)[source]ΒΆ
Two tools pinning one package resolve against the older of the two.
- Return type:
- tests.test_sync_ops.test_no_standalone_dependency_jobs_remain()[source]ΒΆ
The four bumpers live only in the consolidated job, not as separate jobs.
- Return type:
- tests.test_sync_ops.test_sync_tool_versions_routes_npm_tools_to_the_npm_registry(monkeypatch)[source]ΒΆ
npm-backed tools resolve versions through the npm registry datasource.
Recording the arguments
npm_candidatesreceives provestool_candidatesroutes every npm tool away from PyPI/GitHub. Empty candidate lists mean nothing is bumped, sotooling/registry.pystays put.- Return type:
- tests.test_sync_ops.test_tool_versions_plan_carries_the_jobs_width(monkeypatch)[source]ΒΆ
A binary bump keeps the
--jobswidth for the checksum recompute.The apply runs with no Click context, so the width the CLI resolved has to travel on the plan.
- Return type:
- tests.test_sync_ops.test_tool_versions_apply_downloads_with_the_jobs_width(tmp_path, monkeypatch)[source]ΒΆ
The checksum recompute downloads as wide as the plan says.
- tests.test_sync_ops.test_tool_versions_apply_reaches_only_what_the_bump_moved(tmp_path, monkeypatch, change, binary_overrides, actionlint_version, recomputes, refreshes)[source]ΒΆ
A binary bump recomputes checksums, and an actionlint bump the matcher.
- tests.test_sync_ops.test_actionlint_bump_refreshes_the_bundled_problem_matcher(tmp_path, monkeypatch)[source]ΒΆ
A bumped actionlint brings the problem matcher of its own tag.
The copy keeps the tabs the
format-jsonjob writes, so the two never fight over it.
- tests.test_sync_ops.test_actionlint_bump_keeps_the_matcher_on_a_failed_fetch(tmp_path, monkeypatch)[source]ΒΆ
A matcher that cannot be fetched leaves the bundled copy in place.
- tests.test_sync_ops.test_bundled_problem_matcher_is_written_like_a_refresh()[source]ΒΆ
The bundled matcher has the shape a refresh writes, so a bump diffs cleanly.
- Return type:
- tests.test_sync_ops.test_widest_changes(changes, expected)[source]ΒΆ
A name repeated across files collapses onto its lowest starting version.
- Return type:
- tests.test_sync_ops.test_bypass_only_plan_counts_as_changed_and_renders()[source]ΒΆ
A run that only edits cooldown bypasses still produces a PR report.
Pruning or freezing an
exclude-newer-packageentry rewritespyproject.tomleven when no package version moves; without this the sync PR would carry that hunk with an empty body.- Return type:
- tests.test_sync_ops.test_render_plan_markdown_closes_on_the_held_back_section()[source]ΒΆ
What the run did comes first; what it left alone closes the body.
The held-back section is the only forward-looking one, so it sits below the bypass table. A bypass-only run moves no version, and the old order opened its PR on releases it had not adopted.
- Return type:
- tests.test_sync_ops.test_render_plan_markdown_places_the_upgrade_invite_after_the_notes()[source]ΒΆ
The invitation follows the notes it asks the maintainer to work through.
- Return type:
- tests.test_sync_ops.SWAP_PYPROJECT = '[project]\nname = "basket"\nversion = "1.0.0"\ndependencies = [\n "cherry>=1.2",\n "mango>=2.1.0.dev0",\n]\n\n[tool.uv]\nexclude-newer = "1 week"\nexclude-newer-package = { mango = "2026-01-05T00:00:00Z" }\n\n[tool.uv.sources]\nmango = { git = "https://github.com/acme/mango", branch = "main" }\n'ΒΆ
A project tracking
mangoβs main branch while awaiting its2.1.0release.
- tests.test_sync_ops.SWAP_PRE_LOCK = 'version = 1\nrequires-python = ">=3.10"\n\n[options]\nexclude-newer = "0001-01-01T00:00:00Z"\nexclude-newer-span = "P1W"\n\n[[package]]\nname = "cherry"\nversion = "1.2.0"\nsource = { registry = "https://pypi.org/simple" }\nsdist = { url = "https://example.test/cherry.tar.gz", upload-time = "2026-06-01T10:00:00Z" }\n\n[[package]]\nname = "mango"\nversion = "2.1.0.dev0"\nsource = { git = "https://github.com/acme/mango?branch=main#abcdef12" }\n'ΒΆ
The lock before the swap:
mangoresolved from git, no upload time.
- tests.test_sync_ops.SWAP_POST_LOCK = 'version = 1\nrequires-python = ">=3.10"\n\n[options]\nexclude-newer = "0001-01-01T00:00:00Z"\nexclude-newer-span = "P1W"\n\n[[package]]\nname = "cherry"\nversion = "1.2.0"\nsource = { registry = "https://pypi.org/simple" }\nsdist = { url = "https://example.test/cherry.tar.gz", upload-time = "2026-06-01T10:00:00Z" }\n\n[[package]]\nname = "mango"\nversion = "2.1.0"\nsource = { registry = "https://pypi.org/simple" }\nsdist = { url = "https://example.test/mango.tar.gz", upload-time = "2026-07-10T09:00:00Z" }\n'ΒΆ
The lock a successful
uv lockproduces after the swap.
- tests.test_sync_ops.test_resolve_dep_sources_swaps_and_freezes(tmp_path, monkeypatch)[source]ΒΆ
The happy path: override dropped, floor tightened, release frozen.
- Return type:
- tests.test_sync_ops.test_resolve_dep_sources_dry_run_restores(tmp_path, monkeypatch)[source]ΒΆ
A dry run reports the full swap but leaves the project untouched.
- Return type:
- tests.test_sync_ops.test_resolve_dep_sources_is_all_or_nothing(tmp_path, monkeypatch, lock_outcome)[source]ΒΆ
A failed or wrong-version lock restores the project untouched.
- Return type:
- tests.test_sync_ops.test_resolve_dep_sources_noop_before_release(tmp_path, monkeypatch)[source]ΒΆ
With no qualifying release, the resolve never touches the project.
- Return type:
- tests.test_sync_ops.test_finish_uv_plan_attaches_the_held_back_probe_and_the_notes(tmp_path)[source]ΒΆ
A uv plan with a change gets its held-back table, notes and compare links.
- Return type:
- tests.test_sync_ops.SELF_PIN_WORKFLOW = 'env:\n UV_EXCLUDE_NEWER: "1 week"\n uvx --no-progress \'repomatic==7.11.0\' metadata\n'ΒΆ
A downstream workflow whose self-pin is current but carries no exemption.
- tests.test_sync_ops.test_plan_file_rewrites_backfills_exemption_without_a_version_bump(tmp_path)[source]ΒΆ
A splice-only rewrite is still a change, and still gets written.
The exemption backfill reports no
(name, old, new)triple, since it names a package rather than moving a version. Gating the write on that list threw the rewrite away, so a downstream repo already pinned at the newest release never got the flag and its whole test workflow stayed unresolvable.
- tests.test_sync_ops.test_plan_file_rewrites_reports_nothing_when_already_exempt(tmp_path)[source]ΒΆ
An exemption already in place leaves the plan empty, not endlessly dirty.
- tests.test_sync_ops.test_plan_file_rewrites_keeps_version_bumps_out_of_the_exemption_list(tmp_path)[source]ΒΆ
A file that also moved a version reports through
changes, not twice.
- tests.test_sync_ops.test_resolve_action_pins_and_init_owned_files(monkeypatch, tmp_path, in_source_repo)[source]ΒΆ
sync-action-pinsskips init-owned files downstream, bumps them upstream.The
publish-pypicomposite action is copied byte-for-byte from a bundled template, so downstream itssetup-uvpin is owned byrepomatic initand a bump would ping-pong with the nextsync-repomatic. In the source repo the bundled template is a symlink to this very file, so the pin is a normal source-of-truth ref and stays bumpable. A downstream-authored workflow pinning the same action always bumps.- Return type:
- tests.test_sync_ops.test_resolve_action_pins_converge_a_straggler_with_no_release(caplog)[source]ΒΆ
An older pin moves onto the highest one, with no release to adopt.
The highest pin already carries its commit, so the straggler needs no lookup. A release whose tag resolves to no commit is skipped with a warning, and its pin stays as written.
- Return type:
- tests.test_sync_ops.test_resolve_action_pins_skip_an_upstream_pin(slug)[source]ΒΆ
A root-form pin of the upstream repository, under any name, is left alone.
repomatic initmoves it, so the scan neither looks it up nor bumps it, while the action beside it still moves to its newest release.- Return type:
- tests.test_sync_ops.test_bundled_pin_bearing_files_are_excluded_from_pin_scan()[source]ΒΆ
Every init-owned file carrying a
uses:SHA pin is excluded from bumping.Generic guard for the ping-pong fix: any
BundledComponent.github/target that ships a pinneduses:ref (today only thepublish-pypiaction) must be listed inBUNDLED_VERBATIM_TARGETS, so_pinnable_filesdrops it and neithersync-action-pinsnorsync-workflow-pinsfights the verbatim init deploy.- Return type:
- tests.test_sync_ops.test_apply_file_writes_rebases_on_current_text(tmp_path)[source]ΒΆ
A sibling operationβs apply landing between plan and write survives.
Both
.github/pin updaters plan whole-file rewrites from the same pre-apply snapshot; writing the planned text verbatim would revert whichever sibling applied first.
- tests.test_sync_ops.UV_CANDIDATES = [Candidate(version='0.12.2', date='2026-08-05', ref='0.12.2'), Candidate(version='0.12.3', date='2026-08-07', ref='0.12.3'), Candidate(version='0.12.4', date='2026-08-13', ref='0.12.4')]ΒΆ
Three uv releases, all clear of the cooldown on
GATE_TODAY.
- tests.test_sync_ops.SETUP_UV_PIN = {PosixPath('lint.yaml'): 'jobs:\n lint:\n steps:\n - uses: astral-sh/setup-uv@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa # v10.0.0\n with:\n version: "0.12.3"\n'}ΒΆ
A workflow pinning both halves: the action commit and the uv it installs.
- tests.test_sync_ops.test_uv_gate_drops_unverifiable_releases()[source]ΒΆ
A uv the pinned action cannot checksum is not a candidate.
Without this,
sync-workflow-pinswalks uv past the table on its own schedule and CI installs it without a pinned hash.
- tests.test_sync_ops.test_uv_gate_reads_the_action_pin_out_of_the_scanned_files()[source]ΒΆ
The commit the table is fetched at comes from the files being synced.
The gateβs two halves are wired through the scanned text: miss the pin and it silently degrades to ungated, which is the failure it exists to prevent.
- tests.test_sync_ops.test_uv_gate_holds_the_pin_when_the_table_is_unknown(caplog)[source]ΒΆ
An unreadable table keeps out every release newer than the pin.
A blind bump can overshoot the table, and the next run that reads it steps the pin back again.
- tests.test_sync_ops.test_uv_gate_passes_everything_through_without_a_setup_uv_pin()[source]ΒΆ
With no action pinned there is no table to wait for, so nothing holds.
- tests.test_sync_ops.test_uv_gate_reports_a_pin_above_the_table()[source]ΒΆ
A pin past the table is signalled back, so the caller can step it down.
Reported rather than silently gated, because the sync only walks a version backwards on this one condition.
- tests.test_sync_ops.test_uv_gate_warns_when_the_pinned_uv_is_unverified(caplog)[source]ΒΆ
The pin on disk is audited too, not just the one about to replace it.
- tests.test_sync_ops.test_uv_gate_stays_quiet_when_the_pinned_uv_is_verified(caplog)[source]ΒΆ
A covered pin is the normal state and earns no warning.
- tests.test_sync_ops.test_uv_gate_reports_a_release_it_withheld(caplog)[source]ΒΆ
A newer uv the action cannot verify is announced, at info level.
uv ships weekly against
setup-uvβs monthly cadence, so this is the ordinary state between action bumps: a warning every run would train the reader to ignore the ones that mean something.
- tests.test_sync_ops.test_workflow_pins_step_a_uv_pin_back_onto_the_checksum_table(caplog)[source]ΒΆ
The repair is the pin move itself, not the warning beside it.
A repository whose uv pin overtook the table has no forward move left when the newest
setup-uvis the one it already pins, so the sync walks uv down to the newest release that action can verify.
- tests.test_sync_ops.test_workflow_pins_label_a_uv_step_back_in_the_table()[source]ΒΆ
A pin moving down says so in its own row, and links to why.
The arrow alone renders a step back like any bump, so without the label the repair reads as an update to an older release.
- tests.test_sync_ops.test_workflow_pins_label_nothing_on_a_forward_uv_bump()[source]ΒΆ
An ordinary uv bump inside the table carries no label.
- tests.test_sync_ops.test_workflow_pins_hold_the_uv_pin_on_an_unreadable_table()[source]ΒΆ
An unreadable table moves the uv pin neither forward nor back.
0.12.4cleared the cooldown, so only the hold keeps it out.
- tests.test_sync_ops.test_workflow_pins_invite_the_upgrade_review_on_a_repomatic_bump()[source]ΒΆ
A lockstep bump of the upstream pin carries the review launcher.
The
uses:refs already moved by hand, so realigning the inline pin is the pull request where a maintainer learns the repository now runs a newer release, and the one where both versions are known.- Return type:
- tests.test_sync_ops.test_workflow_pins_invite_nothing_without_a_repomatic_bump()[source]ΒΆ
An inline pin already aligned with the refs leaves the section out.
- Return type:
- tests.test_sync_ops.test_workflow_pins_align_on_the_newest_ref_of_any_file()[source]ΒΆ
The inline pin follows the newest
uses:ref, not the one beside it.- Return type:
- tests.test_sync_ops.HELD_PIN_RELEASES = {'shexli': [Candidate(version='0.2.0', date='2026-08-01', ref='0.2.0'), Candidate(version='0.2.1', date='2026-08-02', ref='0.2.1')], 'tree-sitter': [Candidate(version='0.25.2', date='2026-08-01', ref='0.25.2'), Candidate(version='0.26.0', date='2026-08-03', ref='0.26.0')]}ΒΆ
Two packages with a newer release each, all clear of the cooldown on
GATE_TODAY.
- tests.test_sync_ops.test_workflow_pins_leave_an_ignored_package_as_written(ignore, moved)[source]ΒΆ
A package in
workflow-pins.ignorekeeps its pin; the others still move.
- tests.test_sync_ops.test_workflow_pins_warn_about_a_pin_inside_the_cooldown(caplog)[source]ΒΆ
A pin still inside the cooldown is reported, with the day it ages out.
A
uvxinstall in CI reads no per-package exemption, so it fails until then.- Return type:
- tests.test_sync_ops.test_workflow_pins_walk_a_release_download_tag(ignore, tag)[source]ΒΆ
A
gh release downloadtag moves to the newest release past the cooldown.The tag is written as the repository spells it,
vincluded, and the slug is the nameworkflow-pins.ignoreholds it by.
- tests.test_sync_ops.test_workflow_pins_fetch_the_release_notes_of_a_release_download_bump()[source]ΒΆ
A
gh release downloadbump reads the notes of the repository it names.- Return type: