Dependency Resolution Matrix & Orchestration ADR¶
This document records the Architecture Decision Record (ADR) and technical specification for multi-dimensional
dependency resolution and Python interpreter matrix testing in findfmt (Issues
#426,
#425, and
#349).
1. Context, Problem Statement & Architecture Decision¶
1.1. Context & Problem Statement¶
findfmt uses hatchling as its PEP 517 build backend in pyproject.toml and relies on uv for virtual
environment creation, lock file synchronization (uv.lock), and test execution. Standard CI jobs execute
uv sync --locked --all-groups, which validates only a single resolution point:
--resolution highest --prerelease disallow --fork-strategy fewest.
Relying solely on the default lock file leaves three failure modes untested:
Lower-Bound Drift: Direct dependency floors declared in
pyproject.toml(identify>=2.6,pathspec>=1.0.1,pyyaml>=6.0.1,rich>=13.8,typer>=0.16,typing-extensions>=4.4) can silently bit-rot when new code relies on features added in later minor releases.Upstream Pre-Release Breakages: Upcoming alpha, beta, or release-candidate versions of direct or transitive dependencies (
click,rich,typer,pathspec,pytest) can introduce breaking API changes before stable publication.Multi-Interpreter & Fork-Strategy Divergence: Marker evaluation across supported Python interpreters (
3.11through3.15) anduvresolver fork strategies can yield distinct package selections on minimum versus maximum runtimes.
1.2. Architecture Decision Summary¶
Status: Accepted (Milestone
v1.1.2, Issue #426).CI Orchestrator: Use native GitHub Actions
strategy.matrix(fail-fast: false) for parallel cloud execution:PR Smoke Gate: 2-cell
dependency-smoke-matrixjob in.github/workflows/ci.yml(lowest-direct+disallowandhighest+allow).Scheduled Exhaustive Matrix: 6-cell pruned matrix in
.github/workflows/dependency-matrix.ymltriggered nightly viascheduleand on-demand viaworkflow_dispatch(Issue #429).
Local Orchestrator: Extend
tools/verify_quality.pywith nativeuvprocess orchestration covering both the dependency resolution axis (Issue #427) and the multi-Python interpreter axis (Issue #349), adding zero external task-runner dependencies or secondary configuration files.
2. Orchestration Tooling Assessment¶
Five orchestration mechanisms were evaluated across both the dependency resolution axis (--resolution,
--prerelease, --fork-strategy) and the Python interpreter axis (3.11–3.15):
Orchestrator Candidate |
Configuration Surface |
CI Integration & Parallelism |
Local Ergonomics & Caching |
Dependency & Config Overhead |
Verdict |
|---|---|---|---|---|---|
GitHub Actions |
|
Native: parallel virtual machines, step summaries, and |
Not runnable locally without external container emulation. |
Zero extra packages; standard workflow YAML. |
Selected (CI) |
Native |
|
Invoked directly by CI quality gate and smoke steps. |
High: reuses local |
Zero new dependencies or config files. |
Selected (Local) |
Hatch Matrix ( |
|
Requires separate GHA matrix mapping to avoid serial execution on one runner. |
Requires global |
Adds |
Rejected |
|
|
Requires |
Good imperative matrix generation via |
Adds |
Rejected |
|
|
Requires |
Fast virtualenv creation via |
Adds |
Rejected |
Command Runners ( |
|
No native environment or matrix lifecycle management. |
Shell aliases only; must still delegate to |
Adds non-Python binary or task file without solving isolation. |
Rejected |
2.1. Rationale for Hybrid GitHub Actions + tools/verify_quality.py¶
Single Resolver & Zero Lock Drift:
uvis the sole environment manager and package resolver. Driving ephemeral virtual environments (uv venv+uv pip install) directly fromtools/verify_quality.pylocally andstrategy.matrixin GitHub Actions guarantees identical resolver semantics without translating flags throughtoxorhatchwrapper layers.Single Source of Truth for Python Versions:
tools/verify_quality.pyreads the supported interpreter list (3.11,3.12,3.13,3.14,3.15) directly from theProgramming Language :: Python :: 3.XTrove classifiers inpyproject.toml, preventing drift betweenpyproject.toml,.github/workflows/ci.yml, and local runner definitions.Minimal Dependency Surface: Keeping orchestration inside
tools/verify_quality.pyavoids addingnox,tox,tox-uv, or the fullhatchCLI to[dependency-groups].dev.
3. Combinatorial Space & Matrix Pruning Analysis¶
3.1. Raw Combinatorial Space (30 Permutations)¶
uv exposes three primary resolution control dimensions:
--resolution(3 values):highest,lowest,lowest-direct--prerelease(5 values):disallow,allow,if-necessary,explicit,if-necessary-or-explicit--fork-strategy(2 values):fewest,requires-python
The full Cartesian product yields $3 \times 5 \times 2 = 30$ permutations per Python interpreter (150 combinations across all 5 supported Python versions).
3.2. Pruning --prerelease Permutations¶
Inspecting [project].dependencies and [dependency-groups].test in pyproject.toml shows that every
dependency specifier uses a stable lower bound (>=X.Y or >=X.Y.Z) with zero explicit pre-release
specifiers (such as >=1.0a1 or >=2.0.0rc1):
Eliminate
explicitandif-necessary-or-explicit(-12 combinations): Because no specifier inpyproject.tomlopts into an explicit pre-release tag,--prerelease explicitis mathematically identical to--prerelease disallow, and--prerelease if-necessary-or-explicitis identical to--prerelease if-necessaryacross all resolutions and fork strategies.Eliminate
if-necessaryunderhighestandlowest-direct(-4 combinations): Every direct and transitive dependency offindfmthas published stable wheels satisfying>=3.11. Underhighestandlowest-direct, the solver never lacks a stable candidate, soif-necessaryproduces the exact same resolution graph asdisallow.Retain
(lowest, if-necessary, fewest)and eliminate(lowest, disallow, *)/(lowest, allow, *)(-5 combinations): Full transitive--resolution lowestattempts to pick the oldest historical release of every transitive package (click,pygments,markdown-it-py,mdurl,packaging). Usingif-necessaryallows the solver to fall back only when an ancient transitive sdist lacks metadata, whereaslowest+allowselects broken historical alpha tags from transitive dependencies that are unrelated tofindfmt’s own version bounds.
3.3. Pruning --fork-strategy Permutations¶
uv’s --fork-strategy flag (fewest versus requires-python) controls how the universal resolver splits
resolution forks across disjoint Python version ranges:
When resolving into a single target interpreter environment (
uv pip install --python <env>), environment markers (python_version < '3.12'fortyping-extensions>=4.4) evaluate to a fixed boolean for that interpreter.Consequently, varying
--fork-strategyacross alllowest-directandallowpermutations produces identical per-interpreter package sets (-8 combinations).Retaining a single
(highest, disallow, requires-python)cell verifies that--fork-strategy requires-pythonsucceeds cleanly againstfindfmt’srequires-python = ">=3.11"metadata.
3.4. Formal Pruned Matrix Specification¶
Pruning reduces the 30 raw combinations by 80% to 6 canonical non-redundant cells for the exhaustive matrix and 2 cells for the fast PR smoke gate:
Cell ID |
|
|
|
Execution Tier |
Primary Verification Target |
|---|---|---|---|---|---|
M1 |
|
|
|
PR Smoke & Full |
Verifies declared direct minimum bounds in |
M2 |
|
|
|
PR Smoke & Full |
Detects breaking changes in upstream alpha, beta, and release-candidate releases early. |
M3 |
|
|
|
Full (Nightly) |
Validates the latest stable upstream releases unpinned from |
M4 |
|
|
|
Full (Nightly) |
Verifies direct dependency floors when paired with pre-release transitive dependencies. |
M5 |
|
|
|
Full (Nightly) |
Stress-tests full transitive dependency floors across the entire dependency graph. |
M6 |
|
|
|
Full (Nightly) |
Validates |
4. Failure Diagnostic Architecture¶
When any resolution or pytest step fails in CI or local matrix execution, the runner executes a three-stage
diagnostic pipeline:
4.1. Stage 1 — Ephemeral Dependency Tree Capture¶
Immediately upon resolution or test failure (if: failure() in GitHub Actions or non-zero exit code in
tools/verify_quality.py), the runner captures the resolved dependency graph from the isolated environment:
uv pip tree --python <env_path>
In GitHub Actions, this output is appended as a fenced Markdown block to $GITHUB_STEP_SUMMARY under the
failing cell heading (### Dependency Tree (<resolution> / <prerelease> / <fork-strategy>)).
4.2. Stage 2 — Baseline Lock File Version Diffing¶
To isolate which package version triggered the regression, the runner compares the failing environment’s
installed package list (uv pip list --format json --python <env_path>) against the pinned versions in
uv.lock, reporting a concise delta table of downgraded or pre-release packages.
4.3. Stage 3 — Offending Bound Pinpointing & Remediation¶
The diagnostic reporter cross-references installed direct package versions against the specifiers in
pyproject.toml ([project].dependencies and [dependency-groups].test):
If a failure occurs under
lowest-direct(M1orM4), the report identifies the direct dependencies pinned at their floor versions and outputs the exactpyproject.tomllower bound that requires bumping.If a failure occurs under
prerelease=allow(M2orM4), the report highlights every installed package whose version matches a pre-release segment (a,b,rc,dev) so maintainers can file upstream reports or add temporary upper-bound exclusions.
5. Local Execution & Bound Troubleshooting Playbook¶
Contributors can run the dependency resolution matrix locally using tools/verify_quality.py (also documented
in CONTRIBUTING.md under Dependency Resolution Testing):
# Execute the 2-cell PR smoke matrix (M1 and M2)
uv run python tools/verify_quality.py --smoke
# Execute all 6 canonical pruned cells (M1 through M6)
uv run python tools/verify_quality.py --full
# Execute a targeted permutation against a specific Python interpreter
uv run python tools/verify_quality.py \
--resolution lowest-direct \
--prerelease disallow \
--fork-strategy fewest \
--python 3.11
5.1. Troubleshooting Lower-Bound & Pre-Release Failures¶
Read the Three-Stage Diagnostic Report: When
uv pip installorpytestexits non-zero, check Stage 1 (uv pip tree), Stage 2 (installed version deltas compared touv.lock), and Stage 3 (actionablepyproject.tomlremediation lines).Bisect Minimum Floor Regressions (
M1,M4,M5):Create a temporary environment (
uv venv --python 3.11 /tmp/dep-bisect) and install the failing combination.Upgrade the implicated package (
uv pip install --python /tmp/dep-bisect "<pkg>==<version>") until/tmp/dep-bisect/bin/pytestpasses with 100% coverage.Raise the floor specifier in
pyproject.toml([project].dependenciesor[dependency-groups].test) and refreshuv.lockviauv lock.
Triage Upstream Pre-Release Regressions (
M2,M4):Inspect the pre-release package flagged in Stage 3.
Update internal call sites if an upstream API deprecation was finalized, or add a documented temporary upper bound in
pyproject.tomlwhile reporting the issue upstream.