reflake 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.
Files changed (42) hide show
  1. reflake-0.1.0/.gitignore +164 -0
  2. reflake-0.1.0/CHANGELOG.md +117 -0
  3. reflake-0.1.0/LICENSE +661 -0
  4. reflake-0.1.0/NOTICE +10 -0
  5. reflake-0.1.0/PKG-INFO +1067 -0
  6. reflake-0.1.0/README.md +374 -0
  7. reflake-0.1.0/pyproject.toml +71 -0
  8. reflake-0.1.0/src/reflake/__init__.py +165 -0
  9. reflake-0.1.0/src/reflake/cli.py +1417 -0
  10. reflake-0.1.0/src/reflake/core/__init__.py +181 -0
  11. reflake-0.1.0/src/reflake/core/client_state.py +157 -0
  12. reflake-0.1.0/src/reflake/core/config.py +105 -0
  13. reflake-0.1.0/src/reflake/core/domain/__init__.py +56 -0
  14. reflake-0.1.0/src/reflake/core/domain/errors.py +79 -0
  15. reflake-0.1.0/src/reflake/core/domain/models.py +154 -0
  16. reflake-0.1.0/src/reflake/core/hashing.py +23 -0
  17. reflake-0.1.0/src/reflake/core/layout.py +71 -0
  18. reflake-0.1.0/src/reflake/core/manifest.py +459 -0
  19. reflake-0.1.0/src/reflake/core/objects/__init__.py +65 -0
  20. reflake-0.1.0/src/reflake/core/objects/backends.py +123 -0
  21. reflake-0.1.0/src/reflake/core/objects/base.py +113 -0
  22. reflake-0.1.0/src/reflake/core/objects/derived.py +72 -0
  23. reflake-0.1.0/src/reflake/core/objects/footer.py +523 -0
  24. reflake-0.1.0/src/reflake/core/objects/local.py +253 -0
  25. reflake-0.1.0/src/reflake/core/objects/query.py +287 -0
  26. reflake-0.1.0/src/reflake/core/objects/s3.py +464 -0
  27. reflake-0.1.0/src/reflake/core/objects/source.py +248 -0
  28. reflake-0.1.0/src/reflake/core/objects/transfer.py +174 -0
  29. reflake-0.1.0/src/reflake/core/objects/tree.py +239 -0
  30. reflake-0.1.0/src/reflake/core/query/__init__.py +38 -0
  31. reflake-0.1.0/src/reflake/core/query/catalog.py +97 -0
  32. reflake-0.1.0/src/reflake/core/query/pruning.py +240 -0
  33. reflake-0.1.0/src/reflake/core/repository.py +961 -0
  34. reflake-0.1.0/src/reflake/core/repository_ops.py +500 -0
  35. reflake-0.1.0/src/reflake/core/repository_support.py +144 -0
  36. reflake-0.1.0/src/reflake/core/repository_sync.py +503 -0
  37. reflake-0.1.0/src/reflake/core/services/__init__.py +24 -0
  38. reflake-0.1.0/src/reflake/core/services/entries.py +219 -0
  39. reflake-0.1.0/src/reflake/core/services/refs.py +273 -0
  40. reflake-0.1.0/src/reflake/core/services/staging.py +276 -0
  41. reflake-0.1.0/src/reflake/core/services/tree.py +867 -0
  42. reflake-0.1.0/src/reflake/core/vfs/__init__.py +273 -0
@@ -0,0 +1,164 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ .DS_Store
6
+ ._*
7
+ __MACOSX/
8
+
9
+ # C extensions
10
+ *.so
11
+
12
+ # Distribution / packaging
13
+ .Python
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ eggs/
19
+ .eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ wheels/
26
+ share/python-wheels/
27
+ *.egg-info/
28
+ .installed.cfg
29
+ *.egg
30
+ MANIFEST
31
+
32
+ # PyInstaller
33
+ # Usually these files are written by a python script from a template
34
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
35
+ *.manifest
36
+ *.spec
37
+
38
+ # Installer logs
39
+ pip-log.txt
40
+ pip-delete-this-directory.txt
41
+
42
+ # Unit test / coverage reports
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ *.py,cover
53
+ .hypothesis/
54
+ .pytest_cache/
55
+ cover/
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+ local_settings.py
64
+ db.sqlite3
65
+ db.sqlite3-journal
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ .pybuilder/
79
+ target/
80
+
81
+ # Jupyter Notebook
82
+ .ipynb_checkpoints
83
+
84
+ # IPython
85
+ profile_default/
86
+ ipython_config.py
87
+
88
+ # pyenv
89
+ # For a library or package, you might want to ignore these files since the code is
90
+ # intended to run in multiple environments; otherwise, check them in:
91
+ # .python-version
92
+
93
+ # pipenv
94
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
96
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
97
+ # install all needed dependencies.
98
+ #Pipfile.lock
99
+
100
+ # poetry
101
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
102
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
103
+ # commonly ignored for libraries.
104
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
105
+ #poetry.lock
106
+
107
+ # pdm
108
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
109
+ #pdm.lock
110
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
111
+ # in version control.
112
+ # https://pdm.fming.dev/#use-with-ide
113
+ .pdm.toml
114
+
115
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
116
+ __pypackages__/
117
+
118
+ # Celery stuff
119
+ celerybeat-schedule
120
+ celerybeat.pid
121
+
122
+ # SageMath parsed files
123
+ *.sage.py
124
+
125
+ # Environments
126
+ .env
127
+ .venv
128
+ env/
129
+ venv/
130
+ ENV/
131
+ env.bak/
132
+ venv.bak/
133
+
134
+ # Spyder project settings
135
+ .spyderproject
136
+ .spyproject
137
+
138
+ # Rope project settings
139
+ .ropeproject
140
+
141
+ # mkdocs documentation
142
+ /site
143
+
144
+ # mypy
145
+ .mypy_cache/
146
+ .dmypy.json
147
+ dmypy.json
148
+
149
+ # Pyre type checker
150
+ .pyre/
151
+ .pyrefly_cache/
152
+
153
+ # pytype static type analyzer
154
+ .pytype/
155
+
156
+ # Cython debug symbols
157
+ cython_debug/
158
+
159
+ # PyCharm
160
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
161
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
162
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
163
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
164
+ #.idea/
@@ -0,0 +1,117 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on Keep a Changelog, and Reflake currently tracks changes before its first public alpha release.
6
+
7
+ ## Unreleased
8
+
9
+ ## [0.1.0] - 2026-08-16
10
+
11
+ ### Added
12
+
13
+ - **Footer-stats pruning engine (rev. 3, docs/architecture.md §4)**: `reflake query
14
+ prune <ref> <path> --where "col >= x"` selects the parquet row groups that may
15
+ match an AND-composed predicate (`= != < <= > >= IS NULL IS NOT NULL`) using only
16
+ the compact `footers/<hash>` stats objects — no data bytes are read. Exposed as
17
+ `parse_where_clause` / `prune_row_groups` / `plan_pruned_scan` in
18
+ `core/query/pruning.py`; unknown columns and type mismatches keep row groups
19
+ conservatively.
20
+ - **Store unification (rev. 3, §12)**: `core/repository_store/` and `core/storage/`
21
+ are merged into `core/objects/` — one `ObjectStore` protocol
22
+ (`objects/base.py`), two adapters (`LocalObjectStore`, `S3ObjectStore`), plus
23
+ `backends.py` (storage/transfer protocols), `source.py` (source-URI access,
24
+ `S3StorageBackend`), and `transfer.py` (boto3/s5cmd blob transfer).
25
+ - **Parquet footer capture (P1)**: with `config set parquet_footer true`, parquet
26
+ files get a compact footer-stats object (schema hash + per-row-group column
27
+ min/max/nulls, hand-decoded from the thrift-compact `FileMetaData`) stored
28
+ under `footers/<hash>` and referenced from new `bp`/`mp` tree entries —
29
+ enabling row-group pruning without reading object bytes. Unchanged files are
30
+ backfilled on the next commit; `verify`-style re-scan can backfill later.
31
+ - `reflake cat <ref> <path>` prints a file's bytes from a ref; `list`, `cat`,
32
+ `diff`, `log`, and `query` work on virtual refs (S3 URIs) without a local
33
+ worktree.
34
+ - Streaming S3 import with metadata identity mode and repeatable path filters.
35
+ - Staged add support for arbitrary local files, directories, S3 objects, and S3 prefixes.
36
+ - Real S3 integration coverage for remote repository flows.
37
+ - AGPL-3.0-or-later licensing, attribution notice, and funding metadata for the first public release.
38
+ - **Tree-based object model (v2, P0 of `docs/architecture.md`)**: commits now
39
+ build Merkle tree DAGs (`trees/`) instead of full JSONL manifests. Exact
40
+ lookups descend the path chain through a client-side content-addressed
41
+ tree cache (0–1 GETs warm); prefix/bulk listings stream from pruned
42
+ subtree walks (O(matches + depth)); the `.idx` sidecar and embedded
43
+ `commit.manifest_index` are gone.
44
+ - Derived manifests: a tree can be flattened to a JSONL manifest with block
45
+ offsets, cached per-client keyed by the root-tree hash, for
46
+ latency-critical point lookups (`export_derived_manifest`,
47
+ `lookup_derived_entry`).
48
+ - Directory fanout is bounded (10k entries); oversized directories split
49
+ into name-range shard subtrees, keeping tree depth ≤ ~4–5 at 100M entries.
50
+ - `commit --staged` re-applies the staged overlay onto a new parent and
51
+ retries the CAS when a peer advanced the branch (P0 conflict-retry
52
+ contract, `docs/architecture.md` §6).
53
+
54
+ ### Changed
55
+
56
+ - **3-way metadata merge (P3, §9)**: diverged branches merge instead of
57
+ erroring — `merge` computes the merge base (LCA), streams base/ours/theirs
58
+ trees with standard merge rules (auto-keep identical additions, take the
59
+ changed side, drop double-removals), and creates a merge commit with two
60
+ parents when histories diverge; conflicting paths raise
61
+ `MergeConflictError` with the offending paths.
62
+ - `reflake reflog` (P3): every successful ref update is recorded per-branch in
63
+ client state (old → new commit, operation, timestamp); `reflake catalog`
64
+ lists branches with their heads and messages.
65
+ - **Plan-then-batch sync (P2, §7)**: `push`/`pull`/`fetch` now compute the exact
66
+ missing-object set (commits, trees, footers, blobs) as a transfer plan and
67
+ execute it in one batch through the s5cmd backend (manifest file) or
68
+ per-object through boto3, with an optional progress callback. Parquet
69
+ footer stats objects now sync too.
70
+ - **Adapter error translation (P2, §8)**: the S3 adapters raise domain errors
71
+ (`ObjectMissingError`, `PreconditionFailedError`, `StorageUnavailableError`,
72
+ all `ReflakeError` subclasses) instead of raw botocore exceptions; the CLI no
73
+ longer special-cases `BotoCoreError`/`ClientError`.
74
+ - `reflake gc` (P2, §11): audit-only by default — computes the reachable set
75
+ from all refs (commit DAG → trees → blobs/footers) and reports orphans;
76
+ `--prune` deletes them.
77
+ - `filesystem.py` moved to the `core/vfs/` package; `index.py` moved to the
78
+ `core/query/` package (DuckDB catalog now carries a `footer` column); the
79
+ CLI subcommand `index build` is now `query build`.
80
+ - `CommitObject` is now `{id, message, tree, parents: [...], created_at,
81
+ branch, generation}`; the `manifest`/`parent`/`manifest_index` fields are
82
+ gone. `SnapshotWriter` is replaced by `TreeWriter`
83
+ (`services/tree.py`).
84
+ - Stores are `ObjectStore + RefStore + TreeQuerier`; S3 branch-lock
85
+ machinery (locks, `lock list`, `lock cleanup`) is removed — version-token
86
+ CAS is the only safety primitive.
87
+ - Full commits preserve parent-only entries and staged additions (v1 merge
88
+ semantics); deletions require explicit staging, as before.
89
+ - Commit creation is faster than v1 in metadata mode (no per-file entry
90
+ objects; ~48k files/sec on the 200k-file meta benchmark).
91
+ - CLI examples and tests now prefer `--repo` repository selection semantics.
92
+ - Client-local state writes now use atomic replace semantics for HEAD and staging payloads.
93
+ - Manifest index prefix iteration now streams rows instead of materializing full result sets.
94
+ - Manifest exact-path and prefix lookups now fall back to a full manifest scan when no index is available, so legacy or index-less repositories remain fully readable.
95
+ - `status(ref=...)` working-tree comparison now honors the requested branch instead of always comparing against the currently checked-out branch.
96
+ - The `RepositoryStore` contract is now split into focused `ObjectStore`, `RefStore`, `ManifestIndexStore`, and `ManifestQuerier` protocols, with `RepositoryStore` kept as the composed facade for compatibility.
97
+ - Manifest index lookups are deduplicated into a single shared implementation (`repository_store/manifest_query.py`) used by both local and S3 stores.
98
+ - Commit creation no longer relies on `_last_manifest_index` instance state; the manifest index is threaded explicitly through manifest writing and commit creation.
99
+ - S3 blob writes via streams (`push`/`pull`/`fetch`) now honor the configured blob transfer backend, so `s5cmd` accelerates sync transfers.
100
+ - The in-process commit cache is now bounded (LRU-style) instead of growing without limit.
101
+ - `ReflakeRepository` is now a facade over four focused collaborator services (`RefManager`, `SnapshotWriter`, `StagingArea`, `EntryFactory` in `core/services/`); the god-object class was split from ~1650 to ~790 lines and `repository_ops.py` no longer reaches into repository internals.
102
+
103
+ ### Removed
104
+
105
+ - Removed `manifest_index.py`, `manifest_query.py`, `.idx` sidecars, the embedded manifest index, and the index/fallback decision tree.
106
+ - Removed the `reflake import` command; S3 ingress is now staged via `reflake add ... s3://... [--identity meta --as ...]` followed by `reflake commit --staged`.
107
+ - Removed `--identity` from `reflake commit`; the commit identity mode is now configured with `reflake config set identity meta`, or set per stage with `reflake add --identity ...`.
108
+ - Removed the direct-commit `-m/--message` flag from `reflake rm` and `reflake mv`; metadata-only mutations are staged and committed with `reflake commit --staged`.
109
+ - Removed `--ref` from `reflake verify` and `reflake index build`; both now target the current branch.
110
+ - Removed `reflake index query` and `reflake index drop`; `reflake index build` remains and the produced DuckDB database can be queried with the DuckDB CLI.
111
+
112
+ ### Fixed
113
+
114
+ - Manifest parsing now validates entry shape, digests, and metadata-only invariants with line-aware errors.
115
+ - Commit creation is back to near-pre-refactor throughput: the commit hot loop now streams serialized manifest lines from the worktree instead of constructing and validating a `ManifestEntry` object per file (~2× faster for metadata-only commits; validated again on read).
116
+ - CLI commands now return clean `... error:` messages for common validation, filesystem, and object-storage failures instead of raw tracebacks.
117
+ - Corrupt S3-hosted manifest lines now surface actionable validation errors.