failslice 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- failslice-0.1.1/.gitignore +34 -0
- failslice-0.1.1/CHANGELOG.md +59 -0
- failslice-0.1.1/CITATION.cff +18 -0
- failslice-0.1.1/CONTRIBUTING.md +65 -0
- failslice-0.1.1/LICENSE +21 -0
- failslice-0.1.1/PKG-INFO +284 -0
- failslice-0.1.1/README.md +249 -0
- failslice-0.1.1/benchmarks/README.md +38 -0
- failslice-0.1.1/benchmarks/results.json +119 -0
- failslice-0.1.1/benchmarks/run.py +208 -0
- failslice-0.1.1/docs/artifacts.md +86 -0
- failslice-0.1.1/docs/assets/demo.gif +0 -0
- failslice-0.1.1/docs/cli.md +92 -0
- failslice-0.1.1/docs/configuration.md +78 -0
- failslice-0.1.1/docs/decisions/0001-python-version.md +26 -0
- failslice-0.1.1/docs/decisions/0002-fk-strategy-cascade.md +40 -0
- failslice-0.1.1/docs/decisions/0003-predicate-outcomes.md +27 -0
- failslice-0.1.1/docs/decisions/0004-cache-negative-only.md +19 -0
- failslice-0.1.1/docs/decisions/0005-evaluator-supervisor-timeouts.md +29 -0
- failslice-0.1.1/docs/decisions/0006-interfaces-and-dependencies.md +20 -0
- failslice-0.1.1/docs/decisions/0007-safety-model.md +22 -0
- failslice-0.1.1/docs/decisions/0008-run-directory-contract.md +28 -0
- failslice-0.1.1/docs/decisions/0009-artifacts-and-portable-test.md +48 -0
- failslice-0.1.1/docs/decisions/0010-cli-contract.md +29 -0
- failslice-0.1.1/docs/decisions/0011-mcp-server.md +83 -0
- failslice-0.1.1/docs/decisions/0012-examples-and-raises-signature.md +59 -0
- failslice-0.1.1/docs/decisions/0013-packaging-and-release.md +75 -0
- failslice-0.1.1/docs/decisions/0014-release-environments-and-reruns.md +52 -0
- failslice-0.1.1/docs/decisions/0015-first-pypi-release-0.1.1.md +34 -0
- failslice-0.1.1/docs/demo.tape +43 -0
- failslice-0.1.1/docs/design.md +436 -0
- failslice-0.1.1/docs/failslice_prompt.md +251 -0
- failslice-0.1.1/docs/foreign-keys.md +53 -0
- failslice-0.1.1/docs/guide-fa.md +449 -0
- failslice-0.1.1/docs/index.md +57 -0
- failslice-0.1.1/docs/mcp.md +141 -0
- failslice-0.1.1/docs/predicates.md +95 -0
- failslice-0.1.1/docs/releasing.md +113 -0
- failslice-0.1.1/examples/date_parse_crash/README.md +61 -0
- failslice-0.1.1/examples/date_parse_crash/failslice.yaml +21 -0
- failslice-0.1.1/examples/date_parse_crash/make_data.py +52 -0
- failslice-0.1.1/examples/latest_tie/README.md +67 -0
- failslice-0.1.1/examples/latest_tie/failslice.yaml +22 -0
- failslice-0.1.1/examples/latest_tie/make_data.py +51 -0
- failslice-0.1.1/examples/null_not_in/README.md +62 -0
- failslice-0.1.1/examples/null_not_in/failslice.yaml +20 -0
- failslice-0.1.1/examples/null_not_in/make_data.py +43 -0
- failslice-0.1.1/examples/quickstart/failslice.yaml +14 -0
- failslice-0.1.1/examples/quickstart/make_data.py +40 -0
- failslice-0.1.1/examples/quickstart/run.py +17 -0
- failslice-0.1.1/examples/run.py +218 -0
- failslice-0.1.1/examples/tpch_fanout/README.md +82 -0
- failslice-0.1.1/examples/tpch_fanout/failslice.yaml +29 -0
- failslice-0.1.1/examples/tpch_fanout/make_data.py +153 -0
- failslice-0.1.1/packages/failslice-mcp/LICENSE +21 -0
- failslice-0.1.1/packages/failslice-mcp/README.md +83 -0
- failslice-0.1.1/packages/failslice-mcp/pyproject.toml +49 -0
- failslice-0.1.1/pyproject.toml +128 -0
- failslice-0.1.1/scripts/smoke_installed.py +138 -0
- failslice-0.1.1/server.json +32 -0
- failslice-0.1.1/src/failslice/__init__.py +49 -0
- failslice-0.1.1/src/failslice/_demo/failslice.yaml +14 -0
- failslice-0.1.1/src/failslice/_demo/make_data.py +40 -0
- failslice-0.1.1/src/failslice/api.py +363 -0
- failslice-0.1.1/src/failslice/artifacts.py +421 -0
- failslice-0.1.1/src/failslice/cli.py +646 -0
- failslice-0.1.1/src/failslice/config.py +409 -0
- failslice-0.1.1/src/failslice/demo.py +68 -0
- failslice-0.1.1/src/failslice/engine.py +674 -0
- failslice-0.1.1/src/failslice/explain.py +247 -0
- failslice-0.1.1/src/failslice/inference.py +532 -0
- failslice-0.1.1/src/failslice/inspect.py +415 -0
- failslice-0.1.1/src/failslice/mcp_server.py +1092 -0
- failslice-0.1.1/src/failslice/portable.py +754 -0
- failslice-0.1.1/src/failslice/predicate.py +86 -0
- failslice-0.1.1/src/failslice/py.typed +0 -0
- failslice-0.1.1/src/failslice/pytest_export.py +283 -0
- failslice-0.1.1/src/failslice/reducer.py +381 -0
- failslice-0.1.1/src/failslice/report.py +183 -0
- failslice-0.1.1/src/failslice/runspec.py +203 -0
- failslice-0.1.1/src/failslice/safety.py +254 -0
- failslice-0.1.1/src/failslice/supervisor.py +544 -0
- failslice-0.1.1/src/failslice/verify.py +251 -0
- failslice-0.1.1/tests/__init__.py +0 -0
- failslice-0.1.1/tests/conftest.py +92 -0
- failslice-0.1.1/tests/data/server.schema.2025-12-11.json +577 -0
- failslice-0.1.1/tests/reference.py +179 -0
- failslice-0.1.1/tests/test_artifacts.py +424 -0
- failslice-0.1.1/tests/test_audit_regressions.py +529 -0
- failslice-0.1.1/tests/test_cancellation.py +89 -0
- failslice-0.1.1/tests/test_cli.py +268 -0
- failslice-0.1.1/tests/test_config.py +172 -0
- failslice-0.1.1/tests/test_demo.py +164 -0
- failslice-0.1.1/tests/test_engine.py +320 -0
- failslice-0.1.1/tests/test_examples.py +395 -0
- failslice-0.1.1/tests/test_index_check.py +184 -0
- failslice-0.1.1/tests/test_inference.py +900 -0
- failslice-0.1.1/tests/test_inspect.py +633 -0
- failslice-0.1.1/tests/test_mcp_server.py +251 -0
- failslice-0.1.1/tests/test_phase3_review.py +435 -0
- failslice-0.1.1/tests/test_phase4_review.py +319 -0
- failslice-0.1.1/tests/test_phase6_review.py +112 -0
- failslice-0.1.1/tests/test_portability.py +35 -0
- failslice-0.1.1/tests/test_predicate.py +179 -0
- failslice-0.1.1/tests/test_properties.py +102 -0
- failslice-0.1.1/tests/test_raises_signature.py +62 -0
- failslice-0.1.1/tests/test_reducer.py +231 -0
- failslice-0.1.1/tests/test_regressions.py +203 -0
- failslice-0.1.1/tests/test_release.py +89 -0
- failslice-0.1.1/tests/test_safety.py +452 -0
- failslice-0.1.1/tests/test_smoke.py +7 -0
- failslice-0.1.1/tests/test_verify_and_api.py +380 -0
- failslice-0.1.1/uv.lock +1585 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Agent hand-off notes (Codex prompts/outputs) — never committed
|
|
2
|
+
.handoff/
|
|
3
|
+
|
|
4
|
+
# Python
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
*.egg-info/
|
|
8
|
+
build/
|
|
9
|
+
dist/
|
|
10
|
+
.venv/
|
|
11
|
+
.python-version.local
|
|
12
|
+
|
|
13
|
+
# Tooling caches
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
.mypy_cache/
|
|
16
|
+
.ruff_cache/
|
|
17
|
+
.hypothesis/
|
|
18
|
+
.coverage
|
|
19
|
+
.coverage.*
|
|
20
|
+
coverage.xml
|
|
21
|
+
htmlcov/
|
|
22
|
+
|
|
23
|
+
# FailSlice run outputs and generated example data
|
|
24
|
+
.failslice/
|
|
25
|
+
failslice-out/
|
|
26
|
+
examples/**/data/generated/
|
|
27
|
+
benchmarks/.work/
|
|
28
|
+
*.duckdb
|
|
29
|
+
*.duckdb.wal
|
|
30
|
+
|
|
31
|
+
# Editors / OS
|
|
32
|
+
.vscode/
|
|
33
|
+
.idea/
|
|
34
|
+
.DS_Store
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
## 0.1.1 (2026-12-01)
|
|
6
|
+
|
|
7
|
+
First release on PyPI. Packaging and documentation only; apart from the version number,
|
|
8
|
+
the library code is unchanged from 0.1.0.
|
|
9
|
+
|
|
10
|
+
- The PyPI pages are English only: the Persian section is gone from the README (PyPI does
|
|
11
|
+
not lay out right-to-left text), which now links to the complete Persian guide
|
|
12
|
+
(`docs/guide-fa.md`). The `failslice-mcp` page describes the server, its setup, tools
|
|
13
|
+
and safety rules.
|
|
14
|
+
- The release workflow publishes `failslice-mcp` from its own environment, checks the
|
|
15
|
+
index before uploading and refuses a PyPI upload that differs from the TestPyPI
|
|
16
|
+
rehearsal (ADR 0014).
|
|
17
|
+
|
|
18
|
+
## 0.1.0 (2026-11-23)
|
|
19
|
+
|
|
20
|
+
Published on TestPyPI only, as the release rehearsal (ADR 0015). Two distributions:
|
|
21
|
+
`failslice` (library, CLI, MCP server) and `failslice-mcp` (provides the `failslice-mcp`
|
|
22
|
+
command so `uvx failslice-mcp` works).
|
|
23
|
+
|
|
24
|
+
- Phase 6: `failslice demo [DIR]` writes the quickstart example without a checkout;
|
|
25
|
+
`failslice-mcp` validates its budget flags and reports a bad `--root` as a usage error;
|
|
26
|
+
`explain` wording; a CI job that installs the built wheels outside the checkout and runs
|
|
27
|
+
the CLI, the demo, the generated test and the MCP server over stdio; a manual release
|
|
28
|
+
workflow with Trusted Publishing; `server.json` for the MCP Registry; a vhs tape and
|
|
29
|
+
workflow for the demo GIF; README rewritten as a landing page with absolute links;
|
|
30
|
+
`CONTRIBUTING.md`, `docs/releasing.md` (ADR 0013). The quickstart generator now quotes
|
|
31
|
+
its output paths.
|
|
32
|
+
|
|
33
|
+
- Phase 5: four example scenarios (`tpch_fanout`, `null_not_in`, `date_parse_crash`,
|
|
34
|
+
`latest_tie`) with a driver `examples/run.py` and generated README sections, and
|
|
35
|
+
`benchmarks/run.py` with a generated README table (ADR 0012). A matching `raises` error's
|
|
36
|
+
signature is now its concrete class plus the matched text, so a file with several bad
|
|
37
|
+
values passes the determinism check; `PORTABLE_VERSION` 2.
|
|
38
|
+
|
|
39
|
+
- Phase 4: MCP server `failslice-mcp` (stdio; tools `inspect_dataset`,
|
|
40
|
+
`suggest_relationships`, `check_predicate`, `reduce_failure`, `verify_reproducer`,
|
|
41
|
+
`explain_reproducer`, `export_pytest`; run resources; prompt `debug-data-bug`; ADR 0011),
|
|
42
|
+
predicate-free dataset inspection, and cancellation through reduce, check, supervisor,
|
|
43
|
+
recovery, replay and artifacts (status `cancelled`). CI on Linux, macOS and Windows.
|
|
44
|
+
|
|
45
|
+
- Phase 3: `failslice` CLI (`init`, `check`, `reduce`, `verify`, `export-test`, `explain`)
|
|
46
|
+
with a documented exit-code contract and `--json` (ADR 0010); `manifest.json` (replaces
|
|
47
|
+
`result.json`), `report.md`, CSV copies, `explain` observations, PK/FK suggestions for
|
|
48
|
+
`init`, and a self-contained pytest bundle that shares `failslice/portable.py` with the
|
|
49
|
+
tool (ADR 0009); `check(isolate=True)`; `spec.json` format 3.
|
|
50
|
+
- Persian user guide `docs/guide-fa.md`.
|
|
51
|
+
|
|
52
|
+
- Core engine (Phase 2): config, loading, predicate outcomes, cascade ddmin, negative
|
|
53
|
+
cache, budgets, supervisor with checkpoints and recovery, independent replay.
|
|
54
|
+
- Independent audit fixes: exact typed result comparison, glob-safe paths, typed
|
|
55
|
+
run-directory contract `spec.json` format 2 (ADR 0008) with ENUM type restoration in
|
|
56
|
+
replay, validated orphan metadata, supervisor that cannot be blocked by a stalled
|
|
57
|
+
child or a slow progress callback, statistics kept for unconfirmed and recovered runs,
|
|
58
|
+
volatile functions taken from DuckDB's catalog, `expected: null` support.
|
|
59
|
+
- README in English and Persian; runnable quickstart example.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use FailSlice in your work, please cite it as below."
|
|
3
|
+
title: "FailSlice: a failure-preserving, FK-consistent data reducer"
|
|
4
|
+
type: software
|
|
5
|
+
authors:
|
|
6
|
+
- family-names: Mahdian
|
|
7
|
+
given-names: Saeed
|
|
8
|
+
email: saeed.mahdian@gmail.com
|
|
9
|
+
license: MIT
|
|
10
|
+
repository-code: "https://github.com/sdmhdn/failslice"
|
|
11
|
+
version: 0.1.1
|
|
12
|
+
date-released: "2026-12-01"
|
|
13
|
+
keywords:
|
|
14
|
+
- delta debugging
|
|
15
|
+
- test case reduction
|
|
16
|
+
- DuckDB
|
|
17
|
+
- data quality
|
|
18
|
+
- MCP
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Contributing to FailSlice
|
|
2
|
+
|
|
3
|
+
Thanks for your interest. Bug reports with a small reproducer (a `failslice.yaml` and the
|
|
4
|
+
data, or the run directory FailSlice wrote) are the most useful contribution. Before a
|
|
5
|
+
larger change, please open an issue to agree on the approach.
|
|
6
|
+
|
|
7
|
+
## Development setup
|
|
8
|
+
|
|
9
|
+
Requirements: Python 3.11+ and [uv](https://docs.astral.sh/uv/).
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
git clone https://github.com/sdmhdn/failslice.git
|
|
13
|
+
cd failslice
|
|
14
|
+
uv sync # the package, the failslice-mcp shim and the dev tools
|
|
15
|
+
uv run failslice --help
|
|
16
|
+
uv run failslice-mcp --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The repository is a uv workspace: the root project is the `failslice` distribution and
|
|
20
|
+
`packages/failslice-mcp/` is the small distribution that only provides the
|
|
21
|
+
`failslice-mcp` command (ADR 0013).
|
|
22
|
+
|
|
23
|
+
## Checks
|
|
24
|
+
|
|
25
|
+
Every pull request must pass these, as CI does on Linux, macOS and Windows with Python
|
|
26
|
+
3.11 to 3.14:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
uv run ruff check . && uv run ruff format --check .
|
|
30
|
+
uv run mypy # strict, on src/failslice
|
|
31
|
+
uv run pytest --cov # coverage of at least 90%
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The suite includes Hypothesis property tests on random multi-table schemas, a brute-force
|
|
35
|
+
oracle for small inputs, the examples as smoke tests and the MCP server through the SDK's
|
|
36
|
+
in-memory client. The TPC-H example downloads DuckDB's `tpch` extension and is skipped
|
|
37
|
+
when that is not possible (set `FAILSLICE_REQUIRE_TPCH=1` to make it fail instead).
|
|
38
|
+
|
|
39
|
+
To check the built packages the way a user installs them:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
uv build --no-sources --out-dir dist
|
|
43
|
+
uv build --no-sources --package failslice-mcp --out-dir dist
|
|
44
|
+
uv venv /tmp/fs-smoke/venv
|
|
45
|
+
uv pip install --python /tmp/fs-smoke/venv dist/*.whl pytest
|
|
46
|
+
cp scripts/smoke_installed.py /tmp/fs-smoke/
|
|
47
|
+
cd /tmp/fs-smoke && venv/bin/python -I smoke_installed.py --expect-version <version> run
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Ground rules
|
|
51
|
+
|
|
52
|
+
- Every guarantee stated in the README or the docs must be enforced by code and covered
|
|
53
|
+
by a test. Say "reduced" unless the 1-minimality check ran to completion; never claim a
|
|
54
|
+
smallest possible result or a root cause; key inference is always a suggestion.
|
|
55
|
+
- Benchmark numbers are generated (`uv run python benchmarks/run.py`), never typed in;
|
|
56
|
+
the example READMEs' result sections come from `uv run python examples/run.py all
|
|
57
|
+
--update-readme`.
|
|
58
|
+
- `src/failslice/_demo/` must stay byte-identical to `examples/quickstart/` (a test checks
|
|
59
|
+
it).
|
|
60
|
+
- Design decisions go into a short ADR in `docs/decisions/`.
|
|
61
|
+
- Documentation: the README is a landing page; details live in `docs/*.md` (English) and
|
|
62
|
+
`docs/guide-fa.md` (Persian, where every line starts with a Persian word).
|
|
63
|
+
- Add an entry to `CHANGELOG.md` for user-visible changes.
|
|
64
|
+
|
|
65
|
+
Releasing is described in [docs/releasing.md](docs/releasing.md).
|
failslice-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Saeed Mahdian <saeed.mahdian@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
failslice-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: failslice
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Shrink multi-table data to a small, FK-consistent, verified reproducer of a data bug.
|
|
5
|
+
Project-URL: Homepage, https://github.com/sdmhdn/failslice
|
|
6
|
+
Project-URL: Documentation, https://github.com/sdmhdn/failslice/blob/main/docs/index.md
|
|
7
|
+
Project-URL: Source, https://github.com/sdmhdn/failslice
|
|
8
|
+
Project-URL: Issues, https://github.com/sdmhdn/failslice/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/sdmhdn/failslice/blob/main/CHANGELOG.md
|
|
10
|
+
Author-email: Saeed Mahdian <saeed.mahdian@gmail.com>
|
|
11
|
+
Maintainer-email: Saeed Mahdian <saeed.mahdian@gmail.com>
|
|
12
|
+
License-Expression: MIT
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: data-quality,delta-debugging,duckdb,mcp,test-case-reduction
|
|
15
|
+
Classifier: Development Status :: 3 - Alpha
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
25
|
+
Classifier: Topic :: Software Development :: Testing
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Python: >=3.11
|
|
28
|
+
Requires-Dist: duckdb>=2.0
|
|
29
|
+
Requires-Dist: mcp>=2.3.0
|
|
30
|
+
Requires-Dist: pydantic>=2.14
|
|
31
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
32
|
+
Requires-Dist: sqlglot>=30.31
|
|
33
|
+
Requires-Dist: typer>=0.29.1
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# FailSlice
|
|
37
|
+
|
|
38
|
+
**Shrink a multi-table dataset to the handful of rows that still trigger your data bug,
|
|
39
|
+
keep foreign keys intact, prove it with an independent replay, and get a ready-to-run
|
|
40
|
+
pytest regression test.**
|
|
41
|
+
|
|
42
|
+
[](https://github.com/sdmhdn/failslice/actions/workflows/ci.yml)
|
|
43
|
+
|
|
44
|
+
[Documentation](https://github.com/sdmhdn/failslice/blob/main/docs/index.md) · [Persian guide (راهنمای فارسی)](https://github.com/sdmhdn/failslice/blob/main/docs/guide-fa.md)
|
|
45
|
+
|
|
46
|
+
> **Status: alpha (0.1.1).** The engine, the `failslice` command line, the run report and
|
|
47
|
+
> manifest, the generated pytest test and the `failslice-mcp` server for AI agents work
|
|
48
|
+
> and are tested on Linux, macOS and Windows. The Python API and file formats may still
|
|
49
|
+
> change before 1.0.
|
|
50
|
+
|
|
51
|
+
<!-- mcp-name: io.github.sdmhdn/failslice -->
|
|
52
|
+
|
|
53
|
+

|
|
54
|
+
|
|
55
|
+
*Recorded in real time, not sped up ([tape](https://github.com/sdmhdn/failslice/blob/main/docs/demo.tape)).*
|
|
56
|
+
|
|
57
|
+
## Why FailSlice
|
|
58
|
+
|
|
59
|
+
A pipeline produces a wrong number on 26,001 rows spread over three tables. Logs tell you
|
|
60
|
+
*which* step failed; data-quality checks flag rows that break a *row-level* rule. But the
|
|
61
|
+
hardest data bugs come from a *combination* of rows across tables (a duplicated key plus
|
|
62
|
+
a join that double-counts, a NULL inside `NOT IN`, a timestamp tie in "latest record per
|
|
63
|
+
key"), where no single row is wrong. You cannot attach 26k rows to a bug report, and
|
|
64
|
+
deleting rows by hand breaks the foreign keys and changes the bug.
|
|
65
|
+
|
|
66
|
+
FailSlice answers: *what is the smallest slice of these tables that still makes this
|
|
67
|
+
failure happen?* The ideas are not new (delta debugging to shrink failing inputs, database
|
|
68
|
+
subsetting to keep foreign keys intact); what FailSlice adds is their combination with
|
|
69
|
+
checked claims:
|
|
70
|
+
|
|
71
|
+
- the search is **guided by your failure predicate**, a DuckDB SQL query that says "the
|
|
72
|
+
bug is present";
|
|
73
|
+
- removing rows **never creates a dangling reference**; orphans already in your input
|
|
74
|
+
are never "repaired", and those that survive are recorded;
|
|
75
|
+
- the result is **replayed in a fresh process** from the exported files only, and called
|
|
76
|
+
`1-minimal (verified)` only when that check really ran;
|
|
77
|
+
- you get a **self-contained pytest test** (only `pytest` and `duckdb` needed) that
|
|
78
|
+
passes while the bug reproduces; after your fix, export it with `--expect passes` to
|
|
79
|
+
guard against the bug's return;
|
|
80
|
+
- an **MCP server** (`failslice-mcp`), so an AI agent can go from "here are my files" to
|
|
81
|
+
"here is a failing test" without loading millions of rows into its context.
|
|
82
|
+
|
|
83
|
+
FailSlice isolates rows; it does not determine the root cause.
|
|
84
|
+
|
|
85
|
+
## Quickstart (under a minute)
|
|
86
|
+
|
|
87
|
+
Requirements: [uv](https://docs.astral.sh/uv/) (it fetches Python 3.11+ if needed).
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
uvx failslice demo shop # a 3-table example: order 4242 was loaded twice
|
|
91
|
+
cd shop
|
|
92
|
+
uvx failslice reduce --out run # reduce, replay in a fresh process, write the test
|
|
93
|
+
uvx --with duckdb pytest -q run/pytest
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```text
|
|
97
|
+
1-minimal (verified): 26,001 -> 4 rows (0.02%); replay verified
|
|
98
|
+
run directory: .../shop/run
|
|
99
|
+
report: .../shop/run/report.md
|
|
100
|
+
test: pytest .../shop/run/pytest
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The four rows: one customer, order 4242 twice, one order line. Joining lines to orders
|
|
104
|
+
double-counts revenue. `uvx failslice explain run` lists what is special about them (order
|
|
105
|
+
4242 has two parent rows), and `run/report.md` has the whole story. The generated test
|
|
106
|
+
needs only `pytest` and `duckdb`, not FailSlice.
|
|
107
|
+
|
|
108
|
+
**Your own data:**
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
cd path/to/your/data
|
|
112
|
+
uvx failslice init # failslice.yaml with every table and key *suggestions*
|
|
113
|
+
# review the suggestions, write the predicate, then:
|
|
114
|
+
uvx failslice check
|
|
115
|
+
uvx failslice reduce
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`init` writes the key suggestions commented out, for you to review; the predicate is a SQL
|
|
119
|
+
query that is TRUE while the bug is present
|
|
120
|
+
([predicates](https://github.com/sdmhdn/failslice/blob/main/docs/predicates.md)). The
|
|
121
|
+
demo's `failslice.yaml` is a complete example. To install instead of using `uvx`:
|
|
122
|
+
`uv tool install failslice` or `pip install failslice`.
|
|
123
|
+
|
|
124
|
+
## How it works
|
|
125
|
+
|
|
126
|
+
```mermaid
|
|
127
|
+
flowchart LR
|
|
128
|
+
CFG[failslice.yaml] --> LOAD[load files into DuckDB<br/>hash every input]
|
|
129
|
+
LOAD --> CHECK[determinism check:<br/>predicate TRUE 4x, same signature]
|
|
130
|
+
CHECK --> RED[cascade ddmin:<br/>delete row ranges, cascade to children]
|
|
131
|
+
RED --> CERT[certification:<br/>every single-row deletion is not TRUE?]
|
|
132
|
+
CERT --> EXP[export run directory<br/>spec.json + Parquet]
|
|
133
|
+
EXP --> VER[replay in a fresh process<br/>from the exported files only]
|
|
134
|
+
VER --> ART[report.md, manifest.json,<br/>CSV, pytest bundle]
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Rows are removed in ranges, table by table, parents first; removing a parent also removes
|
|
138
|
+
the child rows that would lose their parent. A candidate is kept only if the predicate is
|
|
139
|
+
freshly evaluated TRUE on it. Details: [foreign keys and minimality](https://github.com/sdmhdn/failslice/blob/main/docs/foreign-keys.md).
|
|
140
|
+
|
|
141
|
+
## Guarantees and limits
|
|
142
|
+
|
|
143
|
+
Each guarantee is enforced in code and covered by tests:
|
|
144
|
+
|
|
145
|
+
- a configuration is kept only after a fresh TRUE evaluation (the cache holds negative
|
|
146
|
+
results only);
|
|
147
|
+
- no new dangling references, ever; input orphans may survive as recorded exemptions;
|
|
148
|
+
- independent replay from the exported files; `verified` means predicate TRUE and
|
|
149
|
+
integrity intact there;
|
|
150
|
+
- `1-minimal (verified)` only when certification completed, the replay is verified and the
|
|
151
|
+
export was lossless; otherwise "reduced". Never a claim of the smallest possible
|
|
152
|
+
result or of a root cause; `explain` reports observations; `init` makes suggestions;
|
|
153
|
+
- same inputs, settings and seed give the same result, unless a run is stopped by its
|
|
154
|
+
wall-clock budget or an evaluation times out;
|
|
155
|
+
- a predicate must be a single read-only `SELECT` (other statements and file-reading
|
|
156
|
+
functions are rejected); every data file named in the config, every output path of the
|
|
157
|
+
CLI and every path an MCP client passes stays inside an allowed root (a Python caller
|
|
158
|
+
chooses its own `out_dir`); DuckDB's external file access is switched off after loading,
|
|
159
|
+
and FailSlice's own DuckDB connections never write spill files.
|
|
160
|
+
|
|
161
|
+
Limits: single-column, acyclic foreign keys; data loaded into memory; in-process runs have
|
|
162
|
+
cooperative timeouts; the predicate must be deterministic.
|
|
163
|
+
|
|
164
|
+
## For AI agents (MCP)
|
|
165
|
+
|
|
166
|
+
`failslice-mcp` exposes the loop *inspect, check the predicate, reduce, verify, explain,
|
|
167
|
+
export a test* to MCP clients over stdio. The agent passes paths and SQL, never the data.
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
claude mcp add failslice -- uvx failslice-mcp --root /absolute/path/to/your/data # Claude Code
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Claude Desktop (Settings → Developer → Edit Config opens `claude_desktop_config.json`)
|
|
174
|
+
and Cursor (`.cursor/mcp.json`) use the same entry:
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"mcpServers": {
|
|
179
|
+
"failslice": {
|
|
180
|
+
"command": "uvx",
|
|
181
|
+
"args": ["failslice-mcp", "--root", "/absolute/path/to/your/data"]
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Claude Desktop does not read your shell's `PATH`: if it cannot start `uvx`, put the
|
|
188
|
+
absolute path that `which uvx` prints in `command`. The server reads files only inside
|
|
189
|
+
`--root` and writes only under `<root>/.failslice/`.
|
|
190
|
+
`uvx failslice-mcp@latest` picks up a newer release. Tools, resources, budgets and tested
|
|
191
|
+
clients: [MCP server](https://github.com/sdmhdn/failslice/blob/main/docs/mcp.md).
|
|
192
|
+
|
|
193
|
+
## Examples and benchmarks
|
|
194
|
+
|
|
195
|
+
Four more scenarios, each runnable with one command from a checkout and each needing a
|
|
196
|
+
*combination* of rows across tables:
|
|
197
|
+
|
|
198
|
+
- [TPC-H fan-out](https://github.com/sdmhdn/failslice/blob/main/examples/tpch_fanout/): a
|
|
199
|
+
late-arriving duplicate order inflates revenue by region (TPC-H data from DuckDB's
|
|
200
|
+
`tpch` extension).
|
|
201
|
+
- [NULL in `NOT IN`](https://github.com/sdmhdn/failslice/blob/main/examples/null_not_in/):
|
|
202
|
+
one NULL in a suppression list empties a mailing.
|
|
203
|
+
- [Date-parsing crash](https://github.com/sdmhdn/failslice/blob/main/examples/date_parse_crash/):
|
|
204
|
+
a depot switches date format and the staging query fails (`raises` predicate).
|
|
205
|
+
- [Latest record per key](https://github.com/sdmhdn/failslice/blob/main/examples/latest_tie/):
|
|
206
|
+
a timestamp tie across two event streams gives an account two "current" rows.
|
|
207
|
+
|
|
208
|
+
<!-- benchmarks:start -->
|
|
209
|
+
<!-- Generated by `uv run python benchmarks/run.py` from benchmarks/results.json; do not edit by hand. -->
|
|
210
|
+
|
|
211
|
+
| scenario | input rows | output rows | kept | evaluations | wall time | minimality |
|
|
212
|
+
|---|---:|---:|---:|---:|---:|---|
|
|
213
|
+
| [quickstart](https://github.com/sdmhdn/failslice/blob/main/examples/quickstart/) | 26,001 | 4 | 0.0154% | 37 | 1.1 s | 1-minimal (verified) |
|
|
214
|
+
| [tpch_fanout](https://github.com/sdmhdn/failslice/blob/main/examples/tpch_fanout/) | 76,706 | 6 | 0.0078% | 57 | 2.2 s | 1-minimal (verified) |
|
|
215
|
+
| [tpch_fanout (sf 0.1)](https://github.com/sdmhdn/failslice/blob/main/examples/tpch_fanout/) | 765,603 | 6 | 0.0008% | 63 | 4.0 s | 1-minimal (verified) |
|
|
216
|
+
| [null_not_in](https://github.com/sdmhdn/failslice/blob/main/examples/null_not_in/) | 6,101 | 3 | 0.0492% | 21 | 1.0 s | 1-minimal (verified) |
|
|
217
|
+
| [date_parse_crash](https://github.com/sdmhdn/failslice/blob/main/examples/date_parse_crash/) | 30,007 | 2 | 0.0067% | 31 | 0.9 s | 1-minimal (verified) |
|
|
218
|
+
| [latest_tie](https://github.com/sdmhdn/failslice/blob/main/examples/latest_tie/) | 11,000 | 3 | 0.0273% | 37 | 1.1 s | 1-minimal (verified) |
|
|
219
|
+
|
|
220
|
+
Measured 2026-11-29 on one machine (12th Gen Intel(R) Core(TM) i7-1260P, 16 logical CPUs, 7.5 GiB RAM; Linux 6.6.87.2-microsoft-standard-WSL2; Python 3.12.15, DuckDB 2.0.0, FailSlice 0.1.1 at 57361ba). Wall time is the median of 3 runs of `reduce(isolate=True)` including the replay and artifacts, without data generation; it depends on the machine. [Method](https://github.com/sdmhdn/failslice/blob/main/benchmarks/README.md).
|
|
221
|
+
<!-- benchmarks:end -->
|
|
222
|
+
|
|
223
|
+
## Related tools
|
|
224
|
+
|
|
225
|
+
FailSlice builds on established ideas and complements these tools rather than replacing
|
|
226
|
+
them:
|
|
227
|
+
|
|
228
|
+
- [dfshrink](https://github.com/Tomperez98/dfshrink) shrinks a single Polars DataFrame
|
|
229
|
+
against a validator; it has no notion of relations between tables.
|
|
230
|
+
- [dbslice](https://github.com/nabroleonx/dbslice) extracts referentially intact database
|
|
231
|
+
subsets from a seed record; the subset is not guided by a failure.
|
|
232
|
+
- [SQLancer](https://github.com/sqlancer/sqlancer)'s reducers,
|
|
233
|
+
[sql-reduce](https://github.com/jonamuen/sql-reduce) and
|
|
234
|
+
[SQLreduce](https://github.com/credativ/sqlreduce) shrink SQL scripts and statements
|
|
235
|
+
(SQLancer's reducer can also drop rows written as `INSERT`s); they do not work on table
|
|
236
|
+
files with declared foreign keys.
|
|
237
|
+
- RATest (SIGMOD 2019) computes small relational counterexamples for wrong queries, as a
|
|
238
|
+
research prototype.
|
|
239
|
+
|
|
240
|
+
FailSlice combines predicate-guided, multi-table, FK-consistent row reduction on local
|
|
241
|
+
files with a verified replay, regression-test export and an MCP interface.
|
|
242
|
+
|
|
243
|
+
## Documentation
|
|
244
|
+
|
|
245
|
+
| | |
|
|
246
|
+
|---|---|
|
|
247
|
+
| [Overview](https://github.com/sdmhdn/failslice/blob/main/docs/index.md) | what FailSlice adds, and the map of the docs |
|
|
248
|
+
| [Configuration](https://github.com/sdmhdn/failslice/blob/main/docs/configuration.md) | `failslice.yaml`, settings, `init` |
|
|
249
|
+
| [Predicates](https://github.com/sdmhdn/failslice/blob/main/docs/predicates.md) | the three forms, outcomes, comparison rules |
|
|
250
|
+
| [Foreign keys and minimality](https://github.com/sdmhdn/failslice/blob/main/docs/foreign-keys.md) | semantics, orphans, cascade, what 1-minimal means |
|
|
251
|
+
| [Command line and Python API](https://github.com/sdmhdn/failslice/blob/main/docs/cli.md) | commands, options, exit codes, `--json` |
|
|
252
|
+
| [Run artifacts](https://github.com/sdmhdn/failslice/blob/main/docs/artifacts.md) | manifest, report, CSV, `explain`, the generated test, replay |
|
|
253
|
+
| [MCP server](https://github.com/sdmhdn/failslice/blob/main/docs/mcp.md) | `failslice-mcp` for AI agents: client setup, tools, resources |
|
|
254
|
+
| [Design](https://github.com/sdmhdn/failslice/blob/main/docs/design.md) and [decisions](https://github.com/sdmhdn/failslice/tree/main/docs/decisions) | architecture and its reasoning |
|
|
255
|
+
| [راهنمای فارسی](https://github.com/sdmhdn/failslice/blob/main/docs/guide-fa.md) | the complete guide in Persian |
|
|
256
|
+
|
|
257
|
+
## Roadmap
|
|
258
|
+
|
|
259
|
+
Not in 0.1 and planned for later; the architecture leaves room for the first two:
|
|
260
|
+
|
|
261
|
+
- column dropping (removing columns the bug does not need);
|
|
262
|
+
- parallel predicate evaluation;
|
|
263
|
+
- composite and cyclic foreign keys;
|
|
264
|
+
- value-level simplification (shrinking strings and numbers);
|
|
265
|
+
- live warehouse connections;
|
|
266
|
+
- Polars or pandas predicates;
|
|
267
|
+
- a web UI.
|
|
268
|
+
|
|
269
|
+
## Contributing
|
|
270
|
+
|
|
271
|
+
Bug reports and pull requests are welcome; see
|
|
272
|
+
[CONTRIBUTING.md](https://github.com/sdmhdn/failslice/blob/main/CONTRIBUTING.md) for the
|
|
273
|
+
development setup and checks. Changes: [CHANGELOG.md](https://github.com/sdmhdn/failslice/blob/main/CHANGELOG.md).
|
|
274
|
+
|
|
275
|
+
## License
|
|
276
|
+
|
|
277
|
+
MIT, see [LICENSE](https://github.com/sdmhdn/failslice/blob/main/LICENSE). To cite
|
|
278
|
+
FailSlice, see [CITATION.cff](https://github.com/sdmhdn/failslice/blob/main/CITATION.cff).
|
|
279
|
+
|
|
280
|
+
## Author
|
|
281
|
+
|
|
282
|
+
Created and maintained by Saeed Mahdian ([@sdmhdn](https://github.com/sdmhdn),
|
|
283
|
+
<saeed.mahdian@gmail.com>).
|
|
284
|
+
|