windowcross 0.1.2__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.
@@ -0,0 +1,48 @@
1
+ # Scope evidence
2
+
3
+ Pages fetched and read on November 14, 2026. These sources motivate the narrow
4
+ contract; they do not endorse this tool or prove its implementation correct.
5
+
6
+ ## Existing fold and horizon tools
7
+
8
+ - scikit-learn, official TimeSeriesSplit API:
9
+ https://scikit-learn.org/stable/modules/generated/sklearn.model%5Fselection.TimeSeriesSplit.html
10
+ defines `gap` as "Number of samples to exclude from the end of each train set
11
+ before the test set." The documentation also says samples must be equally
12
+ spaced for comparable metrics across folds. A sample-count gap is not a
13
+ supplied variable label-horizon audit.
14
+ - purged-cross-validation, official splitter documentation:
15
+ https://eslazarev.github.io/purged-cross-validation/api/splitters/
16
+ documents prediction and evaluation times, half-open label horizons, purging
17
+ and embargoes. It already provides richer split construction. This project
18
+ does not claim to invent overlap-based contamination checks or replace it.
19
+
20
+ ## Interval and boundary behavior
21
+
22
+ - bedtools, official intersect documentation:
23
+ https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html
24
+ documents its sorted sweep workflow. Sorted interval sweeping is established
25
+ prior work, not a new algorithm introduced here.
26
+ - pandas, official Interval.overlaps reference:
27
+ https://pandas.pydata.org/docs/reference/api/pandas.Interval.overlaps.html
28
+ says intervals that "only have an open endpoint in common do not overlap."
29
+ This audit uses positive half-open windows only; it rejects empty windows.
30
+
31
+ ## Important differences between workflows
32
+
33
+ - python.financial concept explainer:
34
+ https://python.financial/concepts/purged-cross-validation/
35
+ describes financial cross-validation with overlapping label horizons, including
36
+ a closed-boundary convention. Secondary explanation, not a universal boundary
37
+ definition or proof that purging eliminates every form of leakage.
38
+ - 3Jane implementation discussion:
39
+ https://3jane.com/blog/financial-cross-validation/
40
+ discusses an asymmetric workflow filtering test observations by prior training
41
+ label ends. Practitioner discussion, not an equivalent symmetric audit.
42
+
43
+ These conventions differ. The tool checks exactly the caller-supplied
44
+ same-entity, different-split positive half-open intervals and nothing more.
45
+ There is no inference that independent entities, feature availability,
46
+ statistical independence, model evaluation quality or all data leakage were
47
+ checked. No uniqueness, speed superiority, real-world adoption or registry
48
+ availability claim is made.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anish Pentyala
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.
@@ -0,0 +1,4 @@
1
+ include LICENSE README.md EVIDENCE.md VALIDATION.md
2
+ recursive-include examples *.csv
3
+ recursive-include tests *.py
4
+ recursive-include proof *.py
@@ -0,0 +1,230 @@
1
+ Metadata-Version: 2.4
2
+ Name: windowcross
3
+ Version: 0.1.2
4
+ Summary: Offline exact cross-partition time-window overlap audit
5
+ Author: Anish Pentyala
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/anishpentyala/windowcross
8
+ Project-URL: Repository, https://github.com/anishpentyala/windowcross
9
+ Project-URL: Issues, https://github.com/anishpentyala/windowcross/issues
10
+ Keywords: time-series,data-leakage,csv,data-validation
11
+ Requires-Python: >=3.9
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Dynamic: license-file
15
+
16
+ # windowcross
17
+
18
+ [![Tests](https://github.com/anishpentyala/windowcross/actions/workflows/tests.yml/badge.svg)](https://github.com/anishpentyala/windowcross/actions)
19
+
20
+ Audit whether explicitly assigned time windows overlap across dataset partitions.
21
+
22
+ ## Quickstart
23
+
24
+ ```sh
25
+ python -m pip install "git+https://github.com/anishpentyala/windowcross.git"
26
+ cat > windows.csv <<'CSV'
27
+ id,entity,split,start_at,end_at
28
+ a,x,train,2026-01-01T00:00:00Z,2026-01-03T00:00:00Z
29
+ b,x,test,2026-01-02T00:00:00Z,2026-01-04T00:00:00Z
30
+ c,x,test,2026-01-04T00:00:00Z,2026-01-05T00:00:00Z
31
+ CSV
32
+ windowcross windows.csv --examples 1
33
+ ```
34
+
35
+ This exits 1: one cross-split pair overlaps, affecting two records. The intervals
36
+ for `b` and `c` only touch and do not overlap. Comparisons require the same exact
37
+ entity and different splits. This audits declared windows, not every kind of
38
+ training leakage or statistical independence.
39
+
40
+ A PyPI release is being prepared. Until its package page is linked here, use the
41
+ source-install command above.
42
+
43
+ A label might depend on an outcome observed after its prediction time. Two rows
44
+ assigned to different splits can therefore use overlapping outcome windows even
45
+ if their prediction times are ordered. `windowcross` checks the declared windows
46
+ without creating or changing the split.
47
+
48
+ It reads one local CSV, validates the entire input, and reports exact pair and
49
+ affected-record counts. It uses Python's standard library and makes no network
50
+ calls. This is source-only software, not a hosted service or registry release.
51
+
52
+ ## Run from source
53
+
54
+ Python 3.9 or newer:
55
+
56
+ ```sh
57
+ python -m pip install .
58
+ windowcross examples/crossing.csv
59
+ windowcross examples/crossing.csv --examples 5
60
+ ```
61
+
62
+ Or, without installing:
63
+
64
+ ```sh
65
+ PYTHONPATH=src python -m windowcross examples/crossing.csv
66
+ ```
67
+
68
+ Exit statuses: `0` means no crossing under this policy, `1` means at least one
69
+ crossing, and `2` means invalid input/options or an incomplete audit. Invalid
70
+ input does not emit partial report JSON. Do not treat missing output, an error,
71
+ or an unrecognized status as a pass. Output delivery can itself fail, so consumers
72
+ must also successfully parse a complete report. The CLI checks complete writes and
73
+ flushes before reporting an audit status. Failed report, help or diagnostic
74
+ delivery exits 2, including closed streams and full output devices. Some bytes
75
+ may already have reached the destination before a later delivery error; a
76
+ partial report is never a usable audit. Embedded callers can use `main(argv)`;
77
+ the `cli(argv)` process wrapper also handles final flushes and may disable a
78
+ failed standard stream to avoid another flush during interpreter shutdown.
79
+
80
+ ## Input and exact scope
81
+
82
+ ```csv
83
+ id,entity,split,start_at,end_at
84
+ p1,account-7,train,2026-01-01T00:00:00Z,2026-01-03T00:00:00Z
85
+ p2,account-7,test,2026-01-02T00:00:00Z,2026-01-04T00:00:00Z
86
+ p3,account-7,test,2026-01-04T00:00:00Z,2026-01-05T00:00:00Z
87
+ ```
88
+
89
+ The first two rows overlap for one day. The second and third only touch; they do
90
+ not overlap. Rows in the same split are not violations even when they overlap.
91
+
92
+ - Header names and order must match exactly. No extra columns.
93
+ - IDs must be globally unique. Entity and split comparisons use exact strings,
94
+ with no numeric conversion, case folding, trimming or Unicode normalization.
95
+ A leading/trailing space is significant; whitespace-only fields are invalid.
96
+ - Each interval is positive and half-open: `[start_at, end_at)`. Empty and reversed
97
+ intervals are errors. Equal end/start boundaries do not overlap.
98
+ - Compare only rows with the **same entity and different splits**, symmetrically.
99
+ The entity is a caller-declared comparison scope. If every row should be
100
+ compared, use one constant entity. Different entities are never compared;
101
+ this is not evidence they are independent.
102
+ - Timestamps require `YYYY-MM-DDTHH:MM:SS`, optional 1-6 fractional digits, and
103
+ `Z` or a numeric `+HH:MM`/`-HH:MM` offset. They are converted to integer UTC
104
+ microseconds, never floats. Numeric offsets denote a known fixed offset
105
+ (`-00:00` is treated as zero), not a timezone or unknown-local-offset marker.
106
+ Leap seconds, more than six fractional digits, missing offsets, invalid dates,
107
+ and instants outside Python's UTC year 1-9999 range are rejected.
108
+ - UTF-8 CSV only, with an optional UTF-8 BOM. Quoted commas, newlines and Unicode
109
+ identifiers are allowed. NUL is rejected. At least one data row is required.
110
+ Blank records are errors, not ignored rows.
111
+
112
+ ## Report and evidence
113
+
114
+ ```python
115
+ from windowcross import audit, Limits, AuditError
116
+
117
+ try:
118
+ report = audit("examples/crossing.csv", examples=2,
119
+ limits=Limits(max_records=100_000))
120
+ except AuditError:
121
+ raise # Not a clean audit.
122
+ print(report["counts"]["cross_split_pairs"])
123
+ ```
124
+
125
+ Schema version 1 includes:
126
+
127
+ - `passed`: true only when cross-split pair count is zero.
128
+ - `counts`: records, distinct entities, overlapping cross-split pairs, distinct
129
+ affected records and affected entities. A record with many partners counts
130
+ once as affected. Pair counts are unordered, not doubled.
131
+ - `splits`: total and affected records for every split, including clean ones.
132
+ - `split_pairs`: nonzero pair counts, ordered by lexical split names.
133
+ - `input`: SHA-256 and byte length of the exact bytes read, including BOM and
134
+ newline choices. This receipt identifies input bytes, not their truth or source.
135
+ - `settings`: effective limits and requested evidence cap.
136
+ - `examples` and `examples_omitted`: bounded witnesses and exact remaining pair
137
+ count. Default cap is zero. Counts are still complete when evidence is capped.
138
+
139
+ Evidence ordering is deterministic, not a ranking of severity. Rows are scanned
140
+ by `(entity, UTC start, UTC end, id)`. For each current row, prior active split
141
+ names are visited lexically; records in that split retain their scan/insertion
142
+ order. The first requested pairs in that order are emitted. `earlier`/`later`
143
+ refer to this scan order, including tie-breaking, not strict time inequality.
144
+ Evidence has entity, both IDs, split names, UTC start/end microseconds, and exact
145
+ overlap duration. Reordering input rows preserves all report contents except the
146
+ byte receipt. For timestamps before 1970, epoch microseconds are negative.
147
+
148
+ **Privacy:** the default omits record IDs, entity values and timestamps from the
149
+ report. Split names, sizes, overlap counts and a hash remain visible. This is not
150
+ an anonymization promise. `--examples` explicitly includes potentially sensitive
151
+ record-level evidence. Error messages avoid echoing field contents or the path;
152
+ the invoked shell command and filesystem can still expose the path. Keep reports
153
+ and source manifests in an appropriate location.
154
+
155
+ ## Limits and cost
156
+
157
+ Defaults: 16 MiB input bytes, 100,000 records, 1,024 characters per field and 100
158
+ distinct splits. Set `--max-bytes`, `--max-records`, `--max-field-chars`, and
159
+ `--max-splits` to positive integers. `--examples` accepts 0 through 1000. The API
160
+ uses the same `Limits` defaults and rejects booleans for integer settings.
161
+
162
+ The file is read up to the byte cap plus one, decoded and fully parsed, then
163
+ sorted in memory. This is **not streaming**, and these acceptance caps are **not
164
+ hard RAM or runtime bounds**. Python's CSV parser field limit can also reject a
165
+ large field, even if the configured field cap would allow it; the audit fails
166
+ rather than modifying the process-wide CSV limit.
167
+
168
+ For N rows, S splits, and E emitted examples, sorting plus the sweep costs
169
+ `O(N log N + N S log S + E)` worst case. The S term matters when increasing
170
+ `max_splits`. Sorting active split labels is included in that bound. Expired splits are removed
171
+ from that index as soon as their live count reaches zero, then reinserted if
172
+ they return. Each row scans only currently live split labels rather than every
173
+ split previously seen for the entity. This can save work on sparse histories
174
+ with many split labels, but does not improve the dense worst-case bound.
175
+ Deleting and reinserting labels adds work, so it is not a universal speedup. Memory is
176
+ `O(input bytes + N + S² + E)`, including the per-split-pair report. Counts are
177
+ Python integers. Split multiplicities and an end heap avoid materializing all
178
+ crossing pairs. Per-record active start/end witness maps are omitted when
179
+ `examples=0`, and dropped once the evidence cap is filled. Unfilled evidence
180
+ requests retain those maps. The end heap, parsed rows and pending affected-record
181
+ IDs still take memory; this is not a hard RAM guarantee or a claim of lower
182
+ whole-process peak memory. Every newly affected prior record is cleared from a pending map
183
+ at most once; dense overlap still produces exact affected counts. This does not
184
+ make large inputs or large split counts cheap.
185
+
186
+ ## What a pass does not mean
187
+
188
+ This is not a leakage certificate, statistical independence test, or validation
189
+ of a model's evaluation procedure. It does not infer label horizons, build or
190
+ purge folds, add embargoes or gaps, choose entity scope, inspect feature
191
+ availability, find duplicate content, or check dependencies between different
192
+ entities. A contaminated manifest can omit the relevant windows or assign
193
+ misleading scopes and still pass. Select boundaries and scopes from the actual
194
+ meaning of the data before using this check.
195
+
196
+ ## Related work and boundaries
197
+
198
+ This is a narrow audit format, not a claim of a new interval algorithm or better
199
+ cross-validation method. Existing tools cover broader or different workflows:
200
+
201
+ - [scikit-learn TimeSeriesSplit](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.TimeSeriesSplit.html)
202
+ creates time-ordered folds and offers a sample-count `gap`; its documentation
203
+ discusses equally spaced samples for comparable fold metrics.
204
+ - [purged-cross-validation](https://eslazarev.github.io/purged-cross-validation/api/splitters/)
205
+ already offers label-horizon-aware splitters, purging and embargoes. If you need
206
+ fold construction, inspect it rather than treating this audit as a substitute.
207
+ - [bedtools intersect](https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html)
208
+ already uses a sorted sweep for interval intersection in genomic workflows.
209
+ - [pandas Interval.overlaps](https://pandas.pydata.org/docs/reference/api/pandas.Interval.overlaps.html)
210
+ documents open/closed boundary behavior. This tool fixes one convention and
211
+ rejects empty windows rather than offering all closure types.
212
+
213
+ Boundary conventions and purge direction differ across published workflows.
214
+ This tool's symmetric positive half-open policy must not be assumed equivalent
215
+ to them. See [EVIDENCE.md](EVIDENCE.md) for the checked sources and limits.
216
+
217
+ ## Development
218
+
219
+ ```sh
220
+ PYTHONPATH=src python -m unittest discover -s tests -v
221
+ ruff check src tests proof
222
+ ruff format --check src tests proof
223
+ python -m build
224
+ ```
225
+
226
+ The suite compares complete reports against a separate pair-enumerating oracle,
227
+ including deterministic witness order, dense counts, invalid inputs, UTC bounds,
228
+ privacy defaults and CLI exit behavior. See [VALIDATION.md](VALIDATION.md) for
229
+ what has actually been run. No dependency, registry or Marketplace publication
230
+ is implied by this repository.
@@ -0,0 +1,215 @@
1
+ # windowcross
2
+
3
+ [![Tests](https://github.com/anishpentyala/windowcross/actions/workflows/tests.yml/badge.svg)](https://github.com/anishpentyala/windowcross/actions)
4
+
5
+ Audit whether explicitly assigned time windows overlap across dataset partitions.
6
+
7
+ ## Quickstart
8
+
9
+ ```sh
10
+ python -m pip install "git+https://github.com/anishpentyala/windowcross.git"
11
+ cat > windows.csv <<'CSV'
12
+ id,entity,split,start_at,end_at
13
+ a,x,train,2026-01-01T00:00:00Z,2026-01-03T00:00:00Z
14
+ b,x,test,2026-01-02T00:00:00Z,2026-01-04T00:00:00Z
15
+ c,x,test,2026-01-04T00:00:00Z,2026-01-05T00:00:00Z
16
+ CSV
17
+ windowcross windows.csv --examples 1
18
+ ```
19
+
20
+ This exits 1: one cross-split pair overlaps, affecting two records. The intervals
21
+ for `b` and `c` only touch and do not overlap. Comparisons require the same exact
22
+ entity and different splits. This audits declared windows, not every kind of
23
+ training leakage or statistical independence.
24
+
25
+ A PyPI release is being prepared. Until its package page is linked here, use the
26
+ source-install command above.
27
+
28
+ A label might depend on an outcome observed after its prediction time. Two rows
29
+ assigned to different splits can therefore use overlapping outcome windows even
30
+ if their prediction times are ordered. `windowcross` checks the declared windows
31
+ without creating or changing the split.
32
+
33
+ It reads one local CSV, validates the entire input, and reports exact pair and
34
+ affected-record counts. It uses Python's standard library and makes no network
35
+ calls. This is source-only software, not a hosted service or registry release.
36
+
37
+ ## Run from source
38
+
39
+ Python 3.9 or newer:
40
+
41
+ ```sh
42
+ python -m pip install .
43
+ windowcross examples/crossing.csv
44
+ windowcross examples/crossing.csv --examples 5
45
+ ```
46
+
47
+ Or, without installing:
48
+
49
+ ```sh
50
+ PYTHONPATH=src python -m windowcross examples/crossing.csv
51
+ ```
52
+
53
+ Exit statuses: `0` means no crossing under this policy, `1` means at least one
54
+ crossing, and `2` means invalid input/options or an incomplete audit. Invalid
55
+ input does not emit partial report JSON. Do not treat missing output, an error,
56
+ or an unrecognized status as a pass. Output delivery can itself fail, so consumers
57
+ must also successfully parse a complete report. The CLI checks complete writes and
58
+ flushes before reporting an audit status. Failed report, help or diagnostic
59
+ delivery exits 2, including closed streams and full output devices. Some bytes
60
+ may already have reached the destination before a later delivery error; a
61
+ partial report is never a usable audit. Embedded callers can use `main(argv)`;
62
+ the `cli(argv)` process wrapper also handles final flushes and may disable a
63
+ failed standard stream to avoid another flush during interpreter shutdown.
64
+
65
+ ## Input and exact scope
66
+
67
+ ```csv
68
+ id,entity,split,start_at,end_at
69
+ p1,account-7,train,2026-01-01T00:00:00Z,2026-01-03T00:00:00Z
70
+ p2,account-7,test,2026-01-02T00:00:00Z,2026-01-04T00:00:00Z
71
+ p3,account-7,test,2026-01-04T00:00:00Z,2026-01-05T00:00:00Z
72
+ ```
73
+
74
+ The first two rows overlap for one day. The second and third only touch; they do
75
+ not overlap. Rows in the same split are not violations even when they overlap.
76
+
77
+ - Header names and order must match exactly. No extra columns.
78
+ - IDs must be globally unique. Entity and split comparisons use exact strings,
79
+ with no numeric conversion, case folding, trimming or Unicode normalization.
80
+ A leading/trailing space is significant; whitespace-only fields are invalid.
81
+ - Each interval is positive and half-open: `[start_at, end_at)`. Empty and reversed
82
+ intervals are errors. Equal end/start boundaries do not overlap.
83
+ - Compare only rows with the **same entity and different splits**, symmetrically.
84
+ The entity is a caller-declared comparison scope. If every row should be
85
+ compared, use one constant entity. Different entities are never compared;
86
+ this is not evidence they are independent.
87
+ - Timestamps require `YYYY-MM-DDTHH:MM:SS`, optional 1-6 fractional digits, and
88
+ `Z` or a numeric `+HH:MM`/`-HH:MM` offset. They are converted to integer UTC
89
+ microseconds, never floats. Numeric offsets denote a known fixed offset
90
+ (`-00:00` is treated as zero), not a timezone or unknown-local-offset marker.
91
+ Leap seconds, more than six fractional digits, missing offsets, invalid dates,
92
+ and instants outside Python's UTC year 1-9999 range are rejected.
93
+ - UTF-8 CSV only, with an optional UTF-8 BOM. Quoted commas, newlines and Unicode
94
+ identifiers are allowed. NUL is rejected. At least one data row is required.
95
+ Blank records are errors, not ignored rows.
96
+
97
+ ## Report and evidence
98
+
99
+ ```python
100
+ from windowcross import audit, Limits, AuditError
101
+
102
+ try:
103
+ report = audit("examples/crossing.csv", examples=2,
104
+ limits=Limits(max_records=100_000))
105
+ except AuditError:
106
+ raise # Not a clean audit.
107
+ print(report["counts"]["cross_split_pairs"])
108
+ ```
109
+
110
+ Schema version 1 includes:
111
+
112
+ - `passed`: true only when cross-split pair count is zero.
113
+ - `counts`: records, distinct entities, overlapping cross-split pairs, distinct
114
+ affected records and affected entities. A record with many partners counts
115
+ once as affected. Pair counts are unordered, not doubled.
116
+ - `splits`: total and affected records for every split, including clean ones.
117
+ - `split_pairs`: nonzero pair counts, ordered by lexical split names.
118
+ - `input`: SHA-256 and byte length of the exact bytes read, including BOM and
119
+ newline choices. This receipt identifies input bytes, not their truth or source.
120
+ - `settings`: effective limits and requested evidence cap.
121
+ - `examples` and `examples_omitted`: bounded witnesses and exact remaining pair
122
+ count. Default cap is zero. Counts are still complete when evidence is capped.
123
+
124
+ Evidence ordering is deterministic, not a ranking of severity. Rows are scanned
125
+ by `(entity, UTC start, UTC end, id)`. For each current row, prior active split
126
+ names are visited lexically; records in that split retain their scan/insertion
127
+ order. The first requested pairs in that order are emitted. `earlier`/`later`
128
+ refer to this scan order, including tie-breaking, not strict time inequality.
129
+ Evidence has entity, both IDs, split names, UTC start/end microseconds, and exact
130
+ overlap duration. Reordering input rows preserves all report contents except the
131
+ byte receipt. For timestamps before 1970, epoch microseconds are negative.
132
+
133
+ **Privacy:** the default omits record IDs, entity values and timestamps from the
134
+ report. Split names, sizes, overlap counts and a hash remain visible. This is not
135
+ an anonymization promise. `--examples` explicitly includes potentially sensitive
136
+ record-level evidence. Error messages avoid echoing field contents or the path;
137
+ the invoked shell command and filesystem can still expose the path. Keep reports
138
+ and source manifests in an appropriate location.
139
+
140
+ ## Limits and cost
141
+
142
+ Defaults: 16 MiB input bytes, 100,000 records, 1,024 characters per field and 100
143
+ distinct splits. Set `--max-bytes`, `--max-records`, `--max-field-chars`, and
144
+ `--max-splits` to positive integers. `--examples` accepts 0 through 1000. The API
145
+ uses the same `Limits` defaults and rejects booleans for integer settings.
146
+
147
+ The file is read up to the byte cap plus one, decoded and fully parsed, then
148
+ sorted in memory. This is **not streaming**, and these acceptance caps are **not
149
+ hard RAM or runtime bounds**. Python's CSV parser field limit can also reject a
150
+ large field, even if the configured field cap would allow it; the audit fails
151
+ rather than modifying the process-wide CSV limit.
152
+
153
+ For N rows, S splits, and E emitted examples, sorting plus the sweep costs
154
+ `O(N log N + N S log S + E)` worst case. The S term matters when increasing
155
+ `max_splits`. Sorting active split labels is included in that bound. Expired splits are removed
156
+ from that index as soon as their live count reaches zero, then reinserted if
157
+ they return. Each row scans only currently live split labels rather than every
158
+ split previously seen for the entity. This can save work on sparse histories
159
+ with many split labels, but does not improve the dense worst-case bound.
160
+ Deleting and reinserting labels adds work, so it is not a universal speedup. Memory is
161
+ `O(input bytes + N + S² + E)`, including the per-split-pair report. Counts are
162
+ Python integers. Split multiplicities and an end heap avoid materializing all
163
+ crossing pairs. Per-record active start/end witness maps are omitted when
164
+ `examples=0`, and dropped once the evidence cap is filled. Unfilled evidence
165
+ requests retain those maps. The end heap, parsed rows and pending affected-record
166
+ IDs still take memory; this is not a hard RAM guarantee or a claim of lower
167
+ whole-process peak memory. Every newly affected prior record is cleared from a pending map
168
+ at most once; dense overlap still produces exact affected counts. This does not
169
+ make large inputs or large split counts cheap.
170
+
171
+ ## What a pass does not mean
172
+
173
+ This is not a leakage certificate, statistical independence test, or validation
174
+ of a model's evaluation procedure. It does not infer label horizons, build or
175
+ purge folds, add embargoes or gaps, choose entity scope, inspect feature
176
+ availability, find duplicate content, or check dependencies between different
177
+ entities. A contaminated manifest can omit the relevant windows or assign
178
+ misleading scopes and still pass. Select boundaries and scopes from the actual
179
+ meaning of the data before using this check.
180
+
181
+ ## Related work and boundaries
182
+
183
+ This is a narrow audit format, not a claim of a new interval algorithm or better
184
+ cross-validation method. Existing tools cover broader or different workflows:
185
+
186
+ - [scikit-learn TimeSeriesSplit](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.TimeSeriesSplit.html)
187
+ creates time-ordered folds and offers a sample-count `gap`; its documentation
188
+ discusses equally spaced samples for comparable fold metrics.
189
+ - [purged-cross-validation](https://eslazarev.github.io/purged-cross-validation/api/splitters/)
190
+ already offers label-horizon-aware splitters, purging and embargoes. If you need
191
+ fold construction, inspect it rather than treating this audit as a substitute.
192
+ - [bedtools intersect](https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html)
193
+ already uses a sorted sweep for interval intersection in genomic workflows.
194
+ - [pandas Interval.overlaps](https://pandas.pydata.org/docs/reference/api/pandas.Interval.overlaps.html)
195
+ documents open/closed boundary behavior. This tool fixes one convention and
196
+ rejects empty windows rather than offering all closure types.
197
+
198
+ Boundary conventions and purge direction differ across published workflows.
199
+ This tool's symmetric positive half-open policy must not be assumed equivalent
200
+ to them. See [EVIDENCE.md](EVIDENCE.md) for the checked sources and limits.
201
+
202
+ ## Development
203
+
204
+ ```sh
205
+ PYTHONPATH=src python -m unittest discover -s tests -v
206
+ ruff check src tests proof
207
+ ruff format --check src tests proof
208
+ python -m build
209
+ ```
210
+
211
+ The suite compares complete reports against a separate pair-enumerating oracle,
212
+ including deterministic witness order, dense counts, invalid inputs, UTC bounds,
213
+ privacy defaults and CLI exit behavior. See [VALIDATION.md](VALIDATION.md) for
214
+ what has actually been run. No dependency, registry or Marketplace publication
215
+ is implied by this repository.
@@ -0,0 +1,135 @@
1
+ # Validation record
2
+
3
+ Local developer checks on November 14, 2026, before public submission:
4
+
5
+ - 25 unittest methods passed on CPython 3.9.25, 3.10.12, 3.11.17, 3.13.17,
6
+ 3.14.9 and 3.15.1 on Linux. This is not every platform or interpreter.
7
+ - A pair-enumerating oracle compared complete reports, including bounded witness
8
+ order, for 400 seeded random manifests at four evidence caps (0, 1, 7, 1000).
9
+ Input receipts were separately calculated from raw bytes. The oracle uses
10
+ production timestamp conversion only to render integer dates in these small
11
+ generated cases; separate timestamp tests cover rejection, offsets and bounds.
12
+ - Dense fixture: 10,000 rows, two balanced splits, 25,000,000 exact crossing
13
+ pairs, 10,000 affected records and two emitted examples. No portable speed
14
+ or memory claim follows from this fixture.
15
+ - Ruff 0.17.5 check and format verification passed over source, tests and proof.
16
+ - Wheel and sdist built locally. Neutral directories using installed wheels on
17
+ Python 3.9 and 3.14 passed all 25 methods, including module subprocess tests.
18
+ - `proof/mutations.py` reran the same-target intact suite (25 methods passing),
19
+ then a deliberate bad assertion (one failure, zero errors), followed by eight
20
+ isolated code faults. Actual assertion failures, zero test errors: closed
21
+ boundary 530; same-split counting 1451; lost pair multiplicity 1283; lost prior
22
+ affected records 1486; lost current affected record 1486; expired pending
23
+ records retained 438; empty windows accepted 1; entity scoping removed 1543.
24
+ Counts include generated subtest failures, not independent test methods.
25
+ The script requires assertion failures and rejects error-only results.
26
+ - An initial I/O-error test incorrectly mocked its own fixture write as well as
27
+ the read under test. It was fixed to invoke the audited read directly. It is
28
+ not counted as product failure evidence.
29
+
30
+ No independent review, hosted CI, public merge, downstream adoption, Windows or
31
+ macOS result is implied by these developer checks. Publication and final-state
32
+ checks are separate from this local record.
33
+
34
+ ## Fractional timestamp consistency correction
35
+
36
+ Independent review identified that Python 3.9/3.10's `datetime.fromisoformat`
37
+ accepts only three or six fractional digits, unlike newer interpreters. The
38
+ original grammar promised one through six, so valid short fractions failed
39
+ closed on older supported interpreters. This was an input-acceptance contract
40
+ bug, not an incorrect overlap count.
41
+
42
+ The fix right-pads a regex-validated fractional component to six digits before
43
+ conversion, with no floating-point conversion or rounding. A regression method
44
+ covers all six lengths, Z/positive/negative-zero offsets, negative epoch times
45
+ and CSV-to-report acceptance. The original implementation with this method
46
+ failed on Python 3.10.12 with four errors: inspected tracebacks show valid
47
+ fraction strings rejected by `instant`, not fixture or import failures. This
48
+ expected API-error baseline is separate from the assertion-only mutation gate.
49
+ After the fix all 26 methods passed on the six interpreters listed above; the
50
+ same eight mutation checks and deliberate bad assertion retained the recorded
51
+ assertion-failure counts with zero errors. A current wheel/sdist rebuild and
52
+ neutral installed-wheel 3.9/3.14 run also passed all 26 methods.
53
+
54
+ ## Counts-only active-state change (0.1.1)
55
+
56
+ Developer checks on November 14, 2026:
57
+
58
+ - All original 26 methods remain unchanged; three new methods check that default
59
+ counts-only mode writes no active witness tuples, a filled cap stops retaining
60
+ metadata, and an unfilled cap keeps the witness path. All 29 methods passed
61
+ on the six Linux CPython versions listed above and neutral installed wheels
62
+ on 3.9/3.14. Ruff check/format, wheel and sdist builds passed.
63
+ - The same 29-method target on the unchanged 0.1.0 core has two assertion
64
+ failures and zero errors: 100 witness writes instead of zero at cap 0, and
65
+ 100 instead of one at cap 1. These are operation/storage regression checks,
66
+ not a claim that the previous output counts were incorrect.
67
+ - 3,000 complete 0.1.0/candidate report comparisons over 600 additional seeded
68
+ manifests and caps 0/1/2/7/1000 matched exactly. The existing independent
69
+ pair-enumerating report oracle remains active in the suite.
70
+ - Same-target intact 29 methods pass. A deliberate bad assertion has one failure
71
+ and zero errors. Eleven isolated faults are caught with assertion failures,
72
+ zero errors: enable default witness storage 1; keep metadata after full cap 1;
73
+ retain expired active count 1341; closed boundaries 530; same-split counting
74
+ 1454; lost pair multiplicity 1285; lost prior affected count 1486; lost current
75
+ affected count 1486; expired pending records retained 438; empty windows
76
+ accepted 1; lost entity scope 1543. Counts include generated subtests.
77
+ - A local direct retained-state probe at the last insertion of a dense 100,000
78
+ row fixture saw 100,000 active witness entries in 0.1.0 and zero in the
79
+ candidate at caps 0, 1 and 1000 (the latter two already full). Both reported
80
+ 2,500,000,000 pairs. Local shallow witness-container/tuple sizes were
81
+ 10,843,312 bytes versus zero, excluding shared keys, heap, parsed input,
82
+ pending IDs, counters and other process memory. This is not a hard memory cap.
83
+ - Whole-process peak RSS in local three-process 100,000-row runs was effectively
84
+ unchanged (about 85 MiB) across dense, disjoint and same-split fixtures. Dense
85
+ sweep runs were a little faster; unfilled-cap disjoint runs were slower.
86
+ Neither memory nor speed superiority across workloads is claimed.
87
+
88
+ This section is local developer evidence, not new independent review, hosted
89
+ current-head CI, downstream use or a cross-platform guarantee.
90
+
91
+ ## 0.1.2 active split index
92
+
93
+ 2026-11-14 local Linux validation, not hosted CI or Windows/macOS evidence.
94
+ The previous 29-method test file is byte-unchanged. Four new methods give
95
+ 33 passing on actual CPython 3.9.25, 3.10.12, 3.11.17, 3.13.17, 3.14.9 and
96
+ 3.15.1. New tests inspect the actual active Counter keys passed to sorting,
97
+ including full expiry, partial expiry with a split still live, split reappearance,
98
+ equal start/end multiplicity and exact witness order. They exclude the separate
99
+ final split-total sort from that observation.
100
+
101
+ The same four methods against the original 0.1.1 core produce three assertion
102
+ failures and zero test errors; the dense multiplicity control passes. They show
103
+ expired zero-count labels still being scanned, not incorrect old report counts.
104
+ A separate seeded reference run compares 3,200 complete old/new reports from
105
+ 800 random manifests at caps 0/1/3/1000, with zero differences. The existing suite
106
+ also checks reports against its literal pair-enumerating reference.
107
+
108
+ The intact suite passes all 33 methods. A deliberately wrong expected assertion
109
+ causes one assertion failure. Five production mutations fail by assertions with
110
+ zero test errors: leaving zero-count labels (3), changing half-open expiry (531),
111
+ dropping pair multiplicity (1,286), replacing rather than incrementing active
112
+ counts (1,329), and dropping prior affected counts (1,488). Counts include failing
113
+ subtests. Restoring the code and expected assertion restores all 33 methods.
114
+
115
+ Independent review separately ran Python 3.10 all 33 methods, the original
116
+ 29-method baseline, the three new-test baseline failures plus dense control,
117
+ 6,000 full-report equalities (1,200 manifests at five caps), 300 manifests at
118
+ three row shuffles, mutation checks, a neutral installed-wheel 33-method run,
119
+ lint and build. These checks are scoped evidence, not an exhaustive proof.
120
+
121
+ Ruff 0.17.5 checks and format checks cover `src`, `tests` and `proof` (six files).
122
+ No claim that all README fenced snippets were independently linted. Wheel and
123
+ sdist build, all packaged source bytes match the candidate, and neutral installed
124
+ wheel tests pass all 33 methods on Python 3.9 and 3.14.
125
+
126
+ A local CPython 3.14.9 fresh-process median of three runs on 50,000 rows measured
127
+ 100-split disjoint histories at 0.436586 -> 0.244393 seconds without examples,
128
+ and 0.441355 -> 0.244937 with one example. Dense 100-split histories were slightly
129
+ slower (2.124706 -> 2.141069 seconds without examples), as were two-split disjoint
130
+ histories (0.230618 -> 0.236219). Peak RSS was essentially unchanged. Independent
131
+ fresh-process probes also found sparse-history savings, dense timing near neutral,
132
+ and about 3% slower two-split churn. These are local synthetic measurements, not
133
+ a portable speed or memory guarantee. Delete/reinsert work can cost more than
134
+ scanning a short split list. The dense worst-case bound and retained input, heap,
135
+ pending affected-record and optional witness data do not change.
@@ -0,0 +1,3 @@
1
+ id,entity,split,start_at,end_at
2
+ p1,account-7,train,2026-01-01T00:00:00Z,2026-01-03T00:00:00Z
3
+ p2,account-7,test,2026-01-03T00:00:00Z,2026-01-04T00:00:00Z
@@ -0,0 +1,4 @@
1
+ id,entity,split,start_at,end_at
2
+ p1,account-7,train,2026-01-01T00:00:00Z,2026-01-03T00:00:00Z
3
+ p2,account-7,test,2026-01-02T00:00:00Z,2026-01-04T00:00:00Z
4
+ p3,account-7,test,2026-01-04T00:00:00Z,2026-01-05T00:00:00Z