Metadata-Version: 2.4
Name: resolvewhy
Version: 0.1.0rc1
Summary: Independently verifiable dependency-resolution explanations
License-Expression: MIT
Requires-Python: <3.13,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: pip-resolvelib
Requires-Dist: resolvelib<2,>=1.2; extra == "pip-resolvelib"
Requires-Dist: packaging>=24; extra == "pip-resolvelib"
Dynamic: license-file

# resolvewhy

Research prototype for formally verified explanations of dependency-resolution failures from structured evidence.

## Release-candidate support

The proposed `0.1.0rc1` bounded library candidate supports Python 3.10, 3.11,
and 3.12. Python 3.13 and later are not declared supported by this candidate.
This scope does not establish a general package resolver, universal resolver
compatibility, a hosted service, or general production readiness.

## Installation and quick start

Install the production semantic core from a checkout:

```bash
python -m pip install .
```

Install the optional pip/resolvelib adapter dependencies when using that
adapter or its integration tests:

```bash
python -m pip install ".[pip-resolvelib]"
```

The canonical production fixture can be decoded, independently verified, and
rendered without invoking a package resolver:

```python
from importlib.resources import files

from resolvewhy.explanation import build_explanation, render_explanation
from resolvewhy.solving import SemanticProblem
from resolvewhy.trace import deserialize_trace
from resolvewhy.verification import verify

fixture = files("resolvewhy").joinpath("production_trace.json")
trace = deserialize_trace(fixture.read_bytes())
result = verify(trace)
problem = SemanticProblem.from_trace(
    trace,
    trace.semantic_constraints,
    trace.runtime_contexts,
    trace.proof_claim.quantifier,
)
print(render_explanation(build_explanation(problem, result)))
```

Only `VERIFIED_SAT` and `VERIFIED_UNSAT` results are independently
established within the declared finite fragment. `INSUFFICIENT_EVIDENCE` and
`INVALID_TRACE` are conservative outcomes, not failed proof attempts to
reinterpret as resolver results.

## Research status

**Technical validation:** complete for the declared finite semantic fragment.
**H2d:** PARTIALLY SUPPORTED — bounded semantic portability.
**H2e:** NOT TESTED — no substantive maintainer feedback was obtained.
**Production implementation:** not established or approved by this research.

## Production implementation status

**Phase 1 — Production Semantic Core:** complete.

**Phase 2 — Production Trace Format:** extras-aware writes use `resolvewhy-trace/1.1`; strict historical `1.0` traces remain readable.

**Phase 3A — pip/resolvelib Adapter:** implemented and covered by controlled
pip/resolvelib integration tests. The CI workflow runs the production suite,
research tests, and reproducibility harness on the supported Linux and Windows
Python versions. These checks validate the declared finite implementation; they
do not establish general resolver correctness.

**Phase 4A — Production Independent Verifier:** implemented for the declared finite semantic fragment. The verifier independently reconstructs and evaluates supported production `resolvewhy-trace/1.0` and `1.1` traces and returns typed `VERIFIED_SAT`, `VERIFIED_UNSAT`, `INSUFFICIENT_EVIDENCE`, or `INVALID_TRACE` results. It does not import the research verifier or depend on a resolver.

Phase 4B — Independent Solver + Minimal-Core Engine: implemented and tested for the established finite semantic fragment. The reusable solver operates on a typed semantic problem, independently computes SAT/UNSAT, and provides deterministic subset-minimal core extraction and core verification. Phase 4B does not imply general production readiness. Unsupported semantics continue to fail closed. Phase 5 provides the explanation layer, and the supported Python API is documented in [PUBLIC_API.md](docs/PUBLIC_API.md). A CLI and additional resolver adapters remain future work.

See `docs/PRODUCTION_SEMANTIC_CORE.md`, `docs/PRODUCTION_TRACE_FORMAT.md`, `docs/PRODUCTION_VERIFIER.md`, and `AI_BUILD_CONTEXT.md`.

## Production trace format

**Phase 2 — Production Trace Format:** implemented with `1.1` extras fields and strict `1.0` historical reads.

The production trace boundary provides deterministic UTF-8 JSON serialization and safe reconstruction of the typed semantic model. Unknown schema versions, unknown fields, malformed references, invalid enums, malformed markers, and invalid proof/coverage structures are rejected; incomplete evidence remains distinguishable from invalid structure.

For the documented Python integration surface, typed verification categories,
safe diagnostic behavior, and pre-1.0 compatibility policy, see
[`docs/PUBLIC_API.md`](docs/PUBLIC_API.md). The package remains a library: it
does not provide a CLI, HTTP API, hosted service, or universal resolver adapter.

See `docs/PRODUCTION_TRACE_FORMAT.md` and the canonical fixture at `tests/fixtures/production_trace.json`.

## Research question

The project asks whether sufficiently rich structured dependency-resolution evidence can be normalized into a small semantic trace from which an independent verifier can derive a formally checked explanation without parsing human-readable diagnostics or depending on native resolver state.

The research separates:

- **H1:** Given sufficiently rich structured evidence, can a downstream engine compute a verified subset-minimal explanation?
- **H2:** Can resolver/tooling ecosystems expose sufficiently rich evidence in a stable and portable form for independent downstream use?

## Strongest technical result

Within the tested finite semantic fragment, a serialized trace can act as a self-contained proof-supporting evidence artifact. The independent verifier can reconstruct the semantic problem, respect runtime context, finite evaluation domains, policy, activation conditions, candidate/artifact distinctions, coverage attestations, provenance, and explicit proof claims, then independently classify SAT/UNSAT and verify subset-minimality without consulting the original resolver or external state.

The research record reports **18/18 trace-only classification agreement**, **18/18 serialization round-trip agreement**, **18/18 isolated replays**, **2** independently rechecked nontrivial subset-minimal UNSAT proofs, **250** serialization mutations with zero incorrectly accepted verified proofs, and an extended **256-world** post-repair projection search with zero semantic collisions.

The clean executable reproducibility runner currently regenerates the finite verifier fixture, its SAT/UNSAT and minimality checks, exactly 250 deterministic mutation cases, and the extended 256-world projection harness. The 18-case result remains historical research-record evidence rather than a fresh execution of every historical resolver incident; the 256-world projection search is part of the clean runner.

These results are bounded experimental evidence, not universal correctness claims.

## Reproducibility

Run `python research/run_reproducibility.py` for the clean, network-free research-harness checks. See `research/REPRODUCIBILITY_INDEX.md` for the exact executable versus historical evidence boundary.

## Proven semantic boundary

### Inside the established guarantee

- normalized version constraints and dependency conjunctions;
- parent-linked dependency edges;
- tested activation-marker semantics;
- opaque/source-aware candidate identity;
- candidate/artifact separation when artifact feasibility matters;
- runtime context;
- finite explicit evaluation domains;
- singleton, existential, universal, and branch proof scopes within that finite domain model;
- resolution policy where it changes admissibility;
- scoped candidate-domain coverage and completeness attestation;
- semantic constraints/literals;
- evidence states and provenance;
- explicit proof-claim binding;
- independent SAT/UNSAT recomputation;
- subset-minimality by individual deletion.

### Supported only in reduced/tested form

Nested and/or PEP 508 markers, arbitrary extras-marker combinations, wheel/sdist mixtures, local/editable/workspace candidates, hash constraints, lockfile restrictions, richer artifact-selection rules, and multi-dimensional environment partitions are semantically representable in the model, but their full interactions have not been independently established. The bounded extras model checks canonical requested/declared names and simple optional-edge contexts; missing or unknown metadata is not treated as an empty declaration.

### Outside the current guarantee

- arbitrary dynamic build-backend metadata generation;
- hidden build-environment effects;
- complete wheel/sdist build-selection and build-failure semantics;
- complete cross-resolver hash/reproducibility semantics;
- complete lockfile semantics;
- implicit virtual/provided/system-package satisfaction relations;
- symbolic or infinite environment-domain reasoning;
- exhaustive arbitrary PEP 508 semantics;
- future resolver-specific semantics not represented by the normalized model.

"Outside the current guarantee" means **not established by the present evidence**, not impossible.

## What H2d establishes

The portability experiments support a bounded common semantic layer across the tested pip/resolvelib and uv evidence shapes, with source-level mappings for Poetry/Mixology and pipgrip/PubGrub.

The evidence does **not** establish a stable public interchange API, ecosystem-wide wire compatibility, or identical native resolver semantics. Resolver-native derivation trees, decision levels, backjump state, provider internals, index machinery, and detailed rejection structures remain resolver-specific/namespaced.

The projection-collision experiment also showed why explicit evaluation-domain semantics are necessary for multi-environment proof claims.

## What H2e says

H2e remains **NOT TESTED**. The project has no substantive maintainer response to incorporate into the technical conclusion. Four individualized outreach attempts were successfully sent; a fifth named maintainer was not contacted because the connected Outlook account was suspended. No silence, delivery state, generic acknowledgement, or failed contact is treated as evidence.

The RFC therefore records technical questions for maintainer feedback, not endorsement claims.

## Reproducibility

The research harness is runnable without resolver packages, package indexes, or network access:

```bash
python research/run_reproducibility.py
```

The explicit research tests are:

```bash
python -m unittest research.test_reproducibility
```

Run the production tests with:

```bash
python -m unittest discover -s tests -v
```

The current suite computes 18/18 deterministic serialized-fixture replay, 18/18 round trips, 18/18 hermetic replays, 2 executable subset-minimality checks, 250 mutation cases with zero false verified-proof acceptances, and 256 projection worlds with zero post-repair collisions.

The 18-case replay is a deterministic serialized semantic fixture replay of the documented corpus classifications. It is not a fresh execution of all historical public resolver incidents. See `research/REPRODUCIBILITY_README.md` and `research/REPRODUCIBILITY_INDEX.md` for the exact evidence boundary.

## Research artifacts

Key research records are under research/, including:

- FINAL_SEMANTIC_BOUNDARY.md
- BOUNDARY_CASES.md
- REAL_WORLD_TRACE_CORPUS.md
- REAL_WORLD_TRACE_VALIDATION.md
- H2D_CROSS_RESOLVER_VALIDATION.md
- H2D_CONFORMANCE_MATRIX.md
- PORTABLE_CORE_SUFFICIENCY.md
- PORTABLE_CORE_MINIMALITY.md
- TRACE_ONLY_FULL_CORPUS.md
- TRACE_PROOF_CLAIM_FALSIFICATION.md
- TRACE_PROOF_ARTIFACT_SPEC.md
- TRACE_ARTIFACT_CONFORMANCE.md
- REVISED_TRACE_SCHEMA.md

The repository preserves earlier research documents so that discovered defects and their repairs remain auditable.

## Status statement

This repository is a research record. It does not claim a production resolver, ecosystem standard, maintainer endorsement, or production readiness.

**Phase 5 — Human Explanation Layer:** implemented and tested for already independently verified semantic results. The deterministic explanation layer renders verified SAT/UNSAT, insufficient-evidence, and invalid-trace outcomes without trusting resolver diagnostics or establishing new proof claims. See docs/PRODUCTION_EXPLANATION.md.

## Development and contributions

See [CONTRIBUTING.md](CONTRIBUTING.md) for the development setup, required
checks, and rules for preserving the project's verification and research
boundaries.
