icetrace 0.1.0__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.
- icetrace-0.1.0/.github/workflows/ci.yml +37 -0
- icetrace-0.1.0/.github/workflows/release.yml +41 -0
- icetrace-0.1.0/.gitignore +46 -0
- icetrace-0.1.0/CHANGELOG.md +28 -0
- icetrace-0.1.0/CONTRIBUTING.md +34 -0
- icetrace-0.1.0/Formula/icetrace.rb +27 -0
- icetrace-0.1.0/LICENSE +191 -0
- icetrace-0.1.0/PKG-INFO +231 -0
- icetrace-0.1.0/README.md +185 -0
- icetrace-0.1.0/ROADMAP.md +41 -0
- icetrace-0.1.0/pyproject.toml +89 -0
- icetrace-0.1.0/skills/icetrace/SKILL.md +30 -0
- icetrace-0.1.0/src/icetrace/__init__.py +4 -0
- icetrace-0.1.0/src/icetrace/catalog/__init__.py +5 -0
- icetrace-0.1.0/src/icetrace/catalog/adapter.py +212 -0
- icetrace-0.1.0/src/icetrace/catalog/bounds.py +114 -0
- icetrace-0.1.0/src/icetrace/cli/__init__.py +1 -0
- icetrace-0.1.0/src/icetrace/cli/main.py +355 -0
- icetrace-0.1.0/src/icetrace/demo.py +84 -0
- icetrace-0.1.0/src/icetrace/engine/__init__.py +1 -0
- icetrace-0.1.0/src/icetrace/engine/audit.py +357 -0
- icetrace-0.1.0/src/icetrace/engine/diff.py +187 -0
- icetrace-0.1.0/src/icetrace/engine/overlap.py +204 -0
- icetrace-0.1.0/src/icetrace/engine/planner.py +748 -0
- icetrace-0.1.0/src/icetrace/engine/predicate.py +215 -0
- icetrace-0.1.0/src/icetrace/mcp/__init__.py +5 -0
- icetrace-0.1.0/src/icetrace/mcp/server.py +185 -0
- icetrace-0.1.0/src/icetrace/models.py +271 -0
- icetrace-0.1.0/tests/test_engine.py +194 -0
- icetrace-0.1.0/tests/test_mcp_and_cli.py +58 -0
- icetrace-0.1.0/tests/test_overlap.py +42 -0
- icetrace-0.1.0/tests/test_predicate.py +60 -0
- icetrace-0.1.0/uv.lock +3372 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: uv sync --extra dev
|
|
26
|
+
|
|
27
|
+
- name: Lint (ruff)
|
|
28
|
+
run: uv run ruff check src tests
|
|
29
|
+
|
|
30
|
+
- name: Typecheck (mypy)
|
|
31
|
+
run: uv run mypy src
|
|
32
|
+
|
|
33
|
+
- name: Test (pytest)
|
|
34
|
+
run: uv run pytest -v
|
|
35
|
+
|
|
36
|
+
- name: Smoke test demo
|
|
37
|
+
run: uv run icetrace demo --json > /dev/null
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
id-token: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build-and-publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment: pypi
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
|
|
24
|
+
- name: Verify tests before release
|
|
25
|
+
run: |
|
|
26
|
+
uv sync --extra dev
|
|
27
|
+
uv run ruff check src tests
|
|
28
|
+
uv run mypy src
|
|
29
|
+
uv run pytest -v
|
|
30
|
+
|
|
31
|
+
- name: Build sdist & wheel
|
|
32
|
+
run: uv build
|
|
33
|
+
|
|
34
|
+
- name: Publish to PyPI (Trusted Publisher)
|
|
35
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
36
|
+
|
|
37
|
+
- name: Create GitHub Release
|
|
38
|
+
uses: softprops/action-gh-release@v2
|
|
39
|
+
with:
|
|
40
|
+
generate_release_notes: true
|
|
41
|
+
files: dist/*
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Internal discovery / planning docs (never commit to public OSS repo)
|
|
2
|
+
.internal/
|
|
3
|
+
|
|
4
|
+
# Python
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
*$py.class
|
|
8
|
+
*.so
|
|
9
|
+
.Python
|
|
10
|
+
build/
|
|
11
|
+
develop-eggs/
|
|
12
|
+
dist/
|
|
13
|
+
downloads/
|
|
14
|
+
eggs/
|
|
15
|
+
.eggs/
|
|
16
|
+
lib/
|
|
17
|
+
lib64/
|
|
18
|
+
parts/
|
|
19
|
+
sdist/
|
|
20
|
+
var/
|
|
21
|
+
wheels/
|
|
22
|
+
*.egg-info/
|
|
23
|
+
.installed.cfg
|
|
24
|
+
*.egg
|
|
25
|
+
|
|
26
|
+
# Virtual environments
|
|
27
|
+
.venv/
|
|
28
|
+
venv/
|
|
29
|
+
ENV/
|
|
30
|
+
|
|
31
|
+
# Testing & linting
|
|
32
|
+
.pytest_cache/
|
|
33
|
+
.mypy_cache/
|
|
34
|
+
.ruff_cache/
|
|
35
|
+
.coverage
|
|
36
|
+
htmlcov/
|
|
37
|
+
|
|
38
|
+
# Editors & OS
|
|
39
|
+
.DS_Store
|
|
40
|
+
.idea/
|
|
41
|
+
.vscode/
|
|
42
|
+
*.swp
|
|
43
|
+
*.swo
|
|
44
|
+
.env
|
|
45
|
+
.env.*
|
|
46
|
+
!.env.example
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `icetrace` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-11-24
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **4-Stage Instrumented Scan Planner (`explain_scan`)**:
|
|
12
|
+
- Simulates Iceberg's Manifest-List pruning, evolved Partition-Tuple pruning, Column-Bounds pruning (`InclusiveMetricsEvaluator`), and Delete-File amplification (V2 position/equality deletes & V3 Puffin deletion vectors) using metadata only.
|
|
13
|
+
- Verified against PyIceberg's `plan_files()` for 100% file-set parity.
|
|
14
|
+
- Per-file root-cause survival attribution: `MISSING_METRICS_COL_LIMIT`, `MISSING_METRICS_WRITER`, `TRUNCATED_BOUNDS`, `OVERLAPPING_RANGES`, `SPEC_EVOLUTION_MISMATCH`, `UNPUSHABLE_PREDICATE`, and `MATCHING_BOUNDS`.
|
|
15
|
+
- **O(N log N) Sweep-Line Pruning Health Auditor (`audit_pruning_health`)**:
|
|
16
|
+
- Computes exact domain-weighted expected overlap depth and normalized overlap ratio (`0.0`–`1.0`) per column.
|
|
17
|
+
- Detects 32-column default metrics blind spots, `truncate(N)` prefix collisions, manifest interleaving, small files, delete-file accumulation, and unbounded snapshot growth.
|
|
18
|
+
- **Snapshot Regression Differ (`diff_snapshots`)**:
|
|
19
|
+
- Compares two snapshots on manifest growth, file/byte deltas, bounds coverage drops, overlap regressions, and predicate-level surviving file deltas.
|
|
20
|
+
- **Table Layout Inspector (`inspect_table_layout`)**:
|
|
21
|
+
- Zero-manifest-read inspection of `metadata.json` (format version, column ordinals & resolved metrics modes, active + historical partition specs, sort orders, retention properties, snapshot timeline).
|
|
22
|
+
- **Agent-Native MCP Server (`icetrace-mcp`) & Agent Skill**:
|
|
23
|
+
- Exposes 5 strictly read-only tools (`readOnlyHint=True`, `destructiveHint=False`) over stdio for Cursor and Claude Code.
|
|
24
|
+
- Includes companion `skills/icetrace/SKILL.md`.
|
|
25
|
+
- **Zero-Credential Demo & CLI (`icetrace demo`)**:
|
|
26
|
+
- Self-contained local SQLite Iceberg demo demonstrating `truncate(16)` collision, 32-column cutoff, and unsorted overlap in one command.
|
|
27
|
+
- **Packaging & Distribution**:
|
|
28
|
+
- `uvx` / PyPI packaging, Homebrew Formula (`Formula/icetrace.rb`), and GitHub Actions CI + release workflows.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Contributing to `icetrace`
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in contributing to `icetrace`!
|
|
4
|
+
|
|
5
|
+
## Design Principles
|
|
6
|
+
1. **Strictly read-only & metadata-only:** Never add write/mutation APIs or Parquet data-file scans to the core engine.
|
|
7
|
+
2. **Core engine stays MCP-independent:** All analysis logic lives in `src/icetrace/engine/` and must never import `mcp` or `typer`.
|
|
8
|
+
3. **Facts vs. Diagnoses:** Always separate deterministic `observed_facts` from rule-based `diagnoses` with explicit confidence levels.
|
|
9
|
+
4. **Zero-credential tests:** Every PR must be testable locally without AWS, GCP, or external catalog credentials.
|
|
10
|
+
|
|
11
|
+
## Local Development Setup
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git clone https://github.com/sanspareilsmyn/icetrace.git
|
|
15
|
+
cd icetrace
|
|
16
|
+
uv sync --python 3.12 --extra dev
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Running Checks
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Run full test suite (< 2s, zero cloud credentials)
|
|
23
|
+
uv run pytest -v
|
|
24
|
+
|
|
25
|
+
# Lint & typecheck
|
|
26
|
+
uv run ruff check src tests
|
|
27
|
+
uv run mypy src
|
|
28
|
+
|
|
29
|
+
# Try the built-in anomaly demo
|
|
30
|
+
uv run icetrace demo
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Commit Conventions
|
|
34
|
+
Use [Conventional Commits](https://www.conventionalcommits.org/): `feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
class Icetrace < Formula
|
|
2
|
+
include Language::Python::Virtualenv
|
|
3
|
+
|
|
4
|
+
desc "Scan-planning & metadata forensics engine for Apache Iceberg (EXPLAIN ANALYZE without Spark)"
|
|
5
|
+
homepage "https://github.com/sanspareilsmyn/icetrace"
|
|
6
|
+
url "https://github.com/sanspareilsmyn/icetrace/archive/refs/tags/v0.1.0.tar.gz"
|
|
7
|
+
# Update sha256 after publishing the v0.1.0 GitHub release tarball:
|
|
8
|
+
# curl -sL https://github.com/sanspareilsmyn/icetrace/archive/refs/tags/v0.1.0.tar.gz | shasum -a 256
|
|
9
|
+
sha256 "REPLACE_WITH_V0_1_0_TARBALL_SHA256"
|
|
10
|
+
license "Apache-2.0"
|
|
11
|
+
|
|
12
|
+
depends_on "python@3.12"
|
|
13
|
+
|
|
14
|
+
def install
|
|
15
|
+
virtualenv_create(libexec, "python3.12")
|
|
16
|
+
system libexec/"bin/pip", "install", "--no-cache-dir", buildpath
|
|
17
|
+
bin.install_symlink libexec/"bin/icetrace"
|
|
18
|
+
bin.install_symlink libexec/"bin/icetrace-mcp"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
test do
|
|
22
|
+
assert_match "icetrace 0.1.0", shell_output("#{bin}/icetrace version")
|
|
23
|
+
output = shell_output("#{bin}/icetrace demo --json")
|
|
24
|
+
assert_match "TRUNCATED_BOUNDS", output
|
|
25
|
+
assert_match "MISSING_METRICS_COL_LIMIT", output
|
|
26
|
+
end
|
|
27
|
+
end
|
icetrace-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based upon (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind) by name to, the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by the Licensor or its
|
|
58
|
+
representatives for the purpose of discussing and improving the Work,
|
|
59
|
+
but excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the Licensor or its representatives as
|
|
61
|
+
"Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated into the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against You or any other entity
|
|
84
|
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
85
|
+
the Work or a Contribution constitutes direct or indirect patent
|
|
86
|
+
infringement, then any patent licenses granted to You under this
|
|
87
|
+
License for that Work shall terminate as of the date such litigation
|
|
88
|
+
is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in Source or Object form, with or
|
|
92
|
+
without modifications, as long as you meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any other recipients to have any modified files
|
|
98
|
+
to carry prominent notices stating that You modified them; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright notices, retain all patent
|
|
102
|
+
notices, trademark notices, and attribution notices from the
|
|
103
|
+
Source form of the Work, excluding those notices that do not
|
|
104
|
+
pertain to any part of the Work; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "Notice" Notice file as part of its
|
|
107
|
+
Derivative Works, You must provide a written Notice file
|
|
108
|
+
containing a readable copy of the Work, if the Work includes a
|
|
109
|
+
"Notice" text file as part of its distribution, then any
|
|
110
|
+
Derivative Works that You distribute must include a readable
|
|
111
|
+
copy of the attribution notices contained within such NOTICE
|
|
112
|
+
file, excluding those notices that do not pertain to any part of
|
|
113
|
+
the Work, in at least one of the following places: within a
|
|
114
|
+
Notice text file distributed as part of the Work; within the
|
|
115
|
+
Source form of the Work; within the Documentation, if provided
|
|
116
|
+
along with the Work; or, within a display generated by the
|
|
117
|
+
Work, if elsewhere, wherever such third-party notices are
|
|
118
|
+
distributed. The contents of the NOTICE file are for
|
|
119
|
+
informational purposes only and do not modify the License. You
|
|
120
|
+
may add Your own copyright notices within Derivative Works
|
|
121
|
+
that You distribute, alongside or as part of the Work, provided
|
|
122
|
+
that such additional attribution notices cannot be construed
|
|
123
|
+
as part of the Work.
|
|
124
|
+
|
|
125
|
+
You may add Your own copyright notices within Derivative Works
|
|
126
|
+
that You distribute and may provide additional or different
|
|
127
|
+
license terms and conditions for use, reproduction, or distribution
|
|
128
|
+
of Your own Derivative Works, provided Your use, reproduction, or
|
|
129
|
+
distribution of the Work otherwise complies with the conditions stated
|
|
130
|
+
in this License.
|
|
131
|
+
|
|
132
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
133
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
134
|
+
by You shall voluntary be under the terms and conditions of this
|
|
135
|
+
License, without any additional terms or conditions. Notwithstanding
|
|
136
|
+
the above, nothing herein shall supersede or terminate the License
|
|
137
|
+
terms of any separate licensing agreements you may have with Licensor.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, or service marks of the Work, except as required
|
|
141
|
+
for reasonable and customary use in describing the License and
|
|
142
|
+
reproducing the content of the Work.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, including, without limitation,
|
|
149
|
+
any warranties or conditions of TITLE, NON-INFRINGEMENT,
|
|
150
|
+
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely
|
|
151
|
+
responsible for assessing the appropriateness of using or
|
|
152
|
+
redistributing the Work and assume any risks associated with Your
|
|
153
|
+
exercise of permissions granted by this License.
|
|
154
|
+
|
|
155
|
+
8. Limitation of Warranty. In no event and under no legal theory,
|
|
156
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
157
|
+
unless required by applicable law (such as deliberate and agreed
|
|
158
|
+
to in writing) or agreed to in writing, shall any Contributor be
|
|
159
|
+
liable to You for damages, including any direct, indirect, special,
|
|
160
|
+
incidental, or consequential damages of any character arising as a
|
|
161
|
+
result of this License or out of the use or inability to use the
|
|
162
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
163
|
+
loss of data, work stoppage, computer failure or malfunction, or any
|
|
164
|
+
commercial damages or losses), even if such Contributor has been
|
|
165
|
+
advised of the possibility of such damages.
|
|
166
|
+
|
|
167
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
168
|
+
the Work or Derivative Works thereof, You may provide support,
|
|
169
|
+
warranty, indemnity, or other liability obligations and/or rights
|
|
170
|
+
consistent with this License. However, in accepting such obligations,
|
|
171
|
+
You may only act on Your own behalf and on Your own responsibility,
|
|
172
|
+
and not on behalf of any Contributor, and only if You agree to
|
|
173
|
+
indemnify, defend, and hold each Contributor harmless for any
|
|
174
|
+
liability incurred by, or claims asserted against, such Contributor
|
|
175
|
+
otherwise arising from Your own actions.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2026 Sangmin Yoon
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
icetrace-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: icetrace
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Scan-planning & metadata forensics engine for Apache Iceberg — EXPLAIN ANALYZE for Iceberg metadata without Spark.
|
|
5
|
+
Project-URL: Homepage, https://github.com/sanspareilsmyn/icetrace
|
|
6
|
+
Project-URL: Repository, https://github.com/sanspareilsmyn/icetrace
|
|
7
|
+
Project-URL: Issues, https://github.com/sanspareilsmyn/icetrace/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/sanspareilsmyn/icetrace/blob/main/CHANGELOG.md
|
|
9
|
+
Author-email: Sangmin Yoon <sanspareilsmyn@users.noreply.github.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: apache-iceberg,data-engineering,forensics,iceberg,lakehouse,mcp,metadata,query-planning
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Database
|
|
21
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: mcp>=2.0.0
|
|
24
|
+
Requires-Dist: pydantic>=2.7.0
|
|
25
|
+
Requires-Dist: pyiceberg[sql-sqlite]>=0.9.0
|
|
26
|
+
Requires-Dist: rich>=13.7.0
|
|
27
|
+
Requires-Dist: sqlglot>=25.0.0
|
|
28
|
+
Requires-Dist: typer>=0.12.0
|
|
29
|
+
Provides-Extra: all
|
|
30
|
+
Requires-Dist: pyiceberg[gcsfs,glue,hive,s3fs,sql-postgres]>=0.9.0; extra == 'all'
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: mypy>=1.11.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pyarrow>=16.0.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest>=8.2.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: ruff>=0.6.0; extra == 'dev'
|
|
37
|
+
Provides-Extra: gcs
|
|
38
|
+
Requires-Dist: pyiceberg[gcsfs]>=0.9.0; extra == 'gcs'
|
|
39
|
+
Provides-Extra: glue
|
|
40
|
+
Requires-Dist: pyiceberg[glue,s3fs]>=0.9.0; extra == 'glue'
|
|
41
|
+
Provides-Extra: hive
|
|
42
|
+
Requires-Dist: pyiceberg[hive]>=0.9.0; extra == 'hive'
|
|
43
|
+
Provides-Extra: s3
|
|
44
|
+
Requires-Dist: pyiceberg[s3fs]>=0.9.0; extra == 's3'
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
|
|
47
|
+
# icetrace
|
|
48
|
+
|
|
49
|
+
**`EXPLAIN ANALYZE` for Apache Iceberg metadata — debug why your queries scan 100% of files without Spark, Trino, or Athena.**
|
|
50
|
+
|
|
51
|
+
[](LICENSE)
|
|
52
|
+
[](https://www.python.org/downloads/)
|
|
53
|
+
[](#agent-native-setup-cursor--claude-code)
|
|
54
|
+
|
|
55
|
+
`icetrace` is a **strictly read-only, metadata-only** scan-planning and pruning forensics engine for Apache Iceberg. Point it at any Iceberg table (AWS Glue, REST / Polaris / Lakekeeper / Nessie / S3 Tables, Hive, or SQL) from **Cursor**, **Claude Code**, or the CLI, and in seconds it simulates Iceberg's 4-stage pruning pipeline and proves **exactly why** files were not skipped:
|
|
56
|
+
|
|
57
|
+
- **32-column metrics cutoff (`MISSING_METRICS_COL_LIMIT`)** — Iceberg silently stops recording min/max bounds after column #32 by default.
|
|
58
|
+
- **16-char string truncation collisions (`TRUNCATED_BOUNDS`)** — default `truncate(16)` collapses prefixed IDs, tenant keys, or URIs across files, turning data skipping to 0%.
|
|
59
|
+
- **Destroyed clustering (`OVERLAPPING_RANGES`)** — computes exact $O(N \log N)$ domain-weighted **sweep-line interval overlap** (`0.00` = sorted, `1.00` = every file spans the full domain) to expose when binpack compaction or arrival-order writes broke pruning.
|
|
60
|
+
- **Zero-copy / writer stats omission (`MISSING_METRICS_WRITER`)** — detects files registered via `add_files` or custom writers with missing Parquet footer statistics.
|
|
61
|
+
- **Manifest interleaving & evolved partition specs** — catches Stage 1 manifest-list overlap, historical `spec_id` mismatches, and V2/V3 delete-file amplification.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Try It in 10 Seconds (Zero Credentials Required)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
uvx icetrace demo
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Creates a temporary local SQLite Iceberg table with 3 classic production pruning traps (`truncate(16)` prefix collision on `tenant_id`, 32-column metrics cutoff on col #35 `trace_key`, and unsorted `amount` vs sorted `event_id`) and runs `explain` + `audit` live:
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
╭───────────────────────────────────────────────────────────────────╮
|
|
75
|
+
│ icetrace explain demo.events │
|
|
76
|
+
│ Catalog: demo | Snapshot: 634953721215018604 | Sampled: False │
|
|
77
|
+
│ Predicate: tenant_id = 'org_prod_us_east_03_0042' │
|
|
78
|
+
╰───────────────────────────────────────────────────────────────────╯
|
|
79
|
+
Stage 1 (Manifest List): 8 evaluated -> 0 pruned -> 8 surviving (0.0%)
|
|
80
|
+
Stage 2 (Partitions): 8 evaluated -> 0 pruned -> 8 surviving (0.0%)
|
|
81
|
+
Stage 3 (Column Bounds): 8 evaluated -> 0 pruned -> 8 surviving (0.0%)
|
|
82
|
+
|
|
83
|
+
Survival Attribution: TRUNCATED_BOUNDS: 8
|
|
84
|
+
HIGH [TRUNCATED_BOUNDS]: 8/8 surviving files matched a truncated prefix of length 16
|
|
85
|
+
(metrics mode: truncate(16)) on column 'tenant_id'.
|
|
86
|
+
Fix: ALTER TABLE ... SET TBLPROPERTIES ('write.metadata.metrics.column.tenant_id' = 'full')
|
|
87
|
+
and run sort compaction on 'tenant_id'.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
Per-Column Pruning Readiness
|
|
92
|
+
# Column Mode Bounds Overlap Trunc% Grade Issues
|
|
93
|
+
1 event_id truncate(16) 100% 0.00 0% A ok
|
|
94
|
+
2 tenant_id truncate(16) 100% 1.00 100% F TRUNCATED_BOUNDS; OVERLAPPING_RANGES
|
|
95
|
+
3 amount truncate(16) 100% 0.98 0% F OVERLAPPING_RANGES (0.98)
|
|
96
|
+
35 trace_key none 0% - 0% F MISSING_METRICS_COL_LIMIT (35 > 32)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Why `icetrace`?
|
|
102
|
+
|
|
103
|
+
| Tool | Needs Cluster / Server? | 4-Stage Predicate Pruning Simulation | Per-File Root-Cause Attribution | Sweep-Line Bounds Overlap | Agent-Native MCP |
|
|
104
|
+
|---|:---:|:---:|:---:|:---:|:---:|
|
|
105
|
+
| **Spark `EXPLAIN` / `ScanReport`** | Yes (Spark JVM) | Post-execution counts only | No | No | No |
|
|
106
|
+
| **Nimtable / Amoro / Floe** | Yes (Docker/Postgres/JVM) | No | No | No | No |
|
|
107
|
+
| **`iceberg-meta` / `iceberg-doctor`** | No | No | No (static thresholds) | No | Basic (2 tools) |
|
|
108
|
+
| **Existing Iceberg MCP servers** | No | No (catalog listing / SQL) | No | No | Yes |
|
|
109
|
+
| **`icetrace`** | **No (zero-infra)** | **Yes (100% PyIceberg parity)** | **Yes (6 root causes)** | **Yes ($O(N \log N)$)** | **Yes (5 read-only tools + Skill)** |
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Installation
|
|
114
|
+
|
|
115
|
+
### 1. Zero-Install via `uvx` (Recommended for MCP)
|
|
116
|
+
```bash
|
|
117
|
+
uvx icetrace demo
|
|
118
|
+
uvx icetrace-mcp
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 2. Homebrew (macOS / Linux)
|
|
122
|
+
```bash
|
|
123
|
+
brew tap sanspareilsmyn/icetrace https://github.com/sanspareilsmyn/icetrace
|
|
124
|
+
brew install icetrace
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 3. `uv tool` / `pip`
|
|
128
|
+
```bash
|
|
129
|
+
# Core (REST, SQL/SQLite)
|
|
130
|
+
uv tool install icetrace
|
|
131
|
+
|
|
132
|
+
# With AWS Glue & S3 support
|
|
133
|
+
uv tool install "icetrace[glue]"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Agent-Native Setup (Cursor & Claude Code)
|
|
139
|
+
|
|
140
|
+
`icetrace` is designed to run directly inside your AI coding agent while your SQL queries, dbt models, Spark jobs, or table YAMLs are open.
|
|
141
|
+
|
|
142
|
+
### Cursor (`.cursor/mcp.json` or `~/.cursor/mcp.json`)
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"mcpServers": {
|
|
146
|
+
"icetrace": {
|
|
147
|
+
"command": "uvx",
|
|
148
|
+
"args": ["--from", "icetrace[glue]", "icetrace-mcp"],
|
|
149
|
+
"env": {
|
|
150
|
+
"AWS_PROFILE": "${env:AWS_PROFILE}",
|
|
151
|
+
"AWS_REGION": "us-east-1"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Claude Code
|
|
159
|
+
```bash
|
|
160
|
+
claude mcp add --transport stdio --scope user icetrace -- uvx --from "icetrace[glue]" icetrace-mcp
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Example Prompts
|
|
164
|
+
- *"Run `explain_scan` on `prod.events` for `WHERE event_ts >= '2026-11-20' AND tenant_id = 'org_prod_8491'`. Why did Athena scan 180 GB?"*
|
|
165
|
+
- *"Audit `prod.events` and tell me which columns have broken pruning bounds or high overlap."*
|
|
166
|
+
- *"Compare the last two snapshots of `prod.events` — did yesterday's compaction hurt clustering?"*
|
|
167
|
+
|
|
168
|
+
### Exposed MCP Tools (All `readOnlyHint: true`, `destructiveHint: false`)
|
|
169
|
+
1. `list_tables` — Discover namespaces and Iceberg tables.
|
|
170
|
+
2. `explain_scan` — 4-stage scan-planning simulator + per-file survival root-cause attribution.
|
|
171
|
+
3. `audit_pruning_health` — Predicate-free per-column bounds coverage, truncation collision, sweep-line overlap ratio, and layout health.
|
|
172
|
+
4. `diff_snapshots` — Snapshot-to-snapshot manifest growth, bounds coverage, clustering, and pruning regression diff.
|
|
173
|
+
5. `inspect_table_layout` — Zero-manifest-read inspection of `metadata.json` (format version, column ordinals, evolved partition specs, sort order, properties).
|
|
174
|
+
|
|
175
|
+
A companion Agent Skill is bundled in [`skills/icetrace/SKILL.md`](skills/icetrace/SKILL.md).
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## CLI Usage
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Simulate 4-stage pruning for a SQL WHERE clause
|
|
183
|
+
icetrace explain prod.events --where "event_ts >= '2026-11-20' AND tenant_id = 'org_prod_01'"
|
|
184
|
+
|
|
185
|
+
# Audit all columns for bounds coverage, truncation traps, and overlap
|
|
186
|
+
icetrace audit prod.events
|
|
187
|
+
|
|
188
|
+
# Diff current snapshot vs parent (with optional predicate regression check)
|
|
189
|
+
icetrace diff prod.events --where "tenant_id = 'org_prod_01'"
|
|
190
|
+
|
|
191
|
+
# Inspect metadata.json only (zero manifest reads)
|
|
192
|
+
icetrace inspect prod.events
|
|
193
|
+
|
|
194
|
+
# JSON output for scripting / CI
|
|
195
|
+
icetrace audit prod.events --json
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Catalog Configuration
|
|
199
|
+
`icetrace` reuses standard [`~/.pyiceberg.yaml`](https://py.iceberg.apache.org/configuration/) or environment variables:
|
|
200
|
+
- `ICETRACE_CATALOG_TYPE` (`glue`, `rest`, `sql`, `hive`)
|
|
201
|
+
- `ICETRACE_CATALOG_URI`, `ICETRACE_WAREHOUSE`, `ICETRACE_TOKEN`
|
|
202
|
+
- Standard AWS credentials (`AWS_PROFILE`, `AWS_REGION`, IAM role / SSO) for Glue & S3.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Architecture & Security Guarantees
|
|
207
|
+
|
|
208
|
+
```text
|
|
209
|
+
Cursor / Claude Code (MCP stdio) | CLI (icetrace)
|
|
210
|
+
v
|
|
211
|
+
Evidence & Diagnosis Layer (Facts != Inferences)
|
|
212
|
+
v
|
|
213
|
+
Core Forensics Engine (SQL AST -> 4-Stage Planner -> Sweep-Line Overlap -> Diff)
|
|
214
|
+
v
|
|
215
|
+
PyIceberg Catalog Adapter (Glue, REST, SQL, Hive) — Metadata Only
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
- **Strictly Read-Only:** `icetrace` never writes, compacts, expires, or mutates table metadata or data.
|
|
219
|
+
- **Metadata-Only:** Only reads `metadata.json`, manifest list Avro, and manifest Avro files — never downloads Parquet/ORC data files.
|
|
220
|
+
- **Bounded Cost:** Enforces `max_manifests` (default `200`) so huge tables never silently hang or trigger unbounded S3 GETs.
|
|
221
|
+
- **Zero Telemetry:** Your credentials and metadata never leave your machine.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Roadmap & Contributing
|
|
226
|
+
|
|
227
|
+
- See [ROADMAP.md](ROADMAP.md) for the 3-month release plan (v0.1 → v0.4) and 1–2 year vision.
|
|
228
|
+
- See [CHANGELOG.md](CHANGELOG.md) for release notes.
|
|
229
|
+
- See [CONTRIBUTING.md](CONTRIBUTING.md) to run the full test suite locally in `< 2s` with zero cloud credentials.
|
|
230
|
+
|
|
231
|
+
Licensed under the [Apache License 2.0](LICENSE).
|