You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dd2e306
Browse filesBrowse the repository at this point in the historyBrowse files
refactor: architectural and cleanliness pass across the extension
Behavioral fixes (all fail-loud):
- content_hash is now actually verified at load, closing the gap the
receipts removal left: inline student blobs in predict0_registry_lookup
(new return code 2 -> PREDICT_ERR_MODEL_HASH at every caller), URI
weights in the onnx session builder (once per cache miss)
- distill train_query now enforces the same single-statement + read-only
contract as every other inner query (shared predict0_prepare_ro)
- predict_register rejects runtime 'tree' (a URI tree row could never be
served; students come from distill_predict/distill_forecast)
- distill_forecast unknown option keys and student+train_query misuse
already rejected; predict() runtime misuse reclassified from
MODEL_NOT_FOUND to RUNTIME_UNAVAILABLE, teacher prepare failure to
SCHEMA
- predict_version() lists the bundled model ids instead of "models":[]
Duplication removed:
- conformal_quantile: one sort+rank implementation for served intervals
and backtest coverage (they must agree)
- coerce_ts: one epoch/ISO coercion for collect_series and the aggregate
step (these rules drifted once already)
- parse_name_list: one parser for group_cols and candidates
- register_student, fcst_teacher_flush (was the 50-line FLUSH_SERIES
macro with an embedded goto), predict0_json_str_array (was json_arr +
parse_str_array), predict0_prepare_ro (pr_prepare now delegates)
- PREDICT_MAX_FEAT: one feature cap (was TAB_MAX_FEAT, TREE_MAX_FEAT,
and two literal 64s in the onnx backend)
Dead code and scars deleted:
- receipts-era result hashers (hash_null/int/real/text/row_end, hash_sep,
PREDICT_RS), predict0_ulid_new, dead params vars, doubled rc check,
4-for-3 struct initializers (both bopts sites)
- predict-receipts.c renamed predict-registry.c (Makefile, amalgamate.py,
ci.yml fuzz list, ARCHITECTURE.md)
- unprefixed cross-TU student runtime functions (tree_free, mlp_forward,
fcst_serialize, ...) prefixed predict0_ -- they were link-time
collision bait in the amalgamation/static builds
Tests and soaks:
- both soak drivers now fail the run on unexpected statement results
(they printed and discarded); that surfaced two dead expectations: a
stale bare-candidates error (valid since auto became the default) and
soak_onnx's two-head block never serving (hour-40 timestamps poisoned
the series as non_numeric) -- reseeded with valid datetimes, so the
reconstruction path now actually runs under ASan
- soak_onnx ported off the removed query-form TVF and de-receipted
- corrupt-blob soak/test rows now carry correct content hashes so they
reach the deserializers they exist to exercise; tamper coverage added
separately (PREDICT_ERR_MODEL_HASH)
- test_receipts.py -> test_registry.py, test_collect_errors.py ->
test_backtest_errors.py, aggregate-driven selection tests split into
test_model_selection.py; shared forecast_doc/anomaly_doc helpers in
conftest; wave() deduped into synthetic.py
Docs and build:
- ARCHITECTURE/SECURITY/RELEASING de-receipted and re-grounded (two
calling conventions, the real four-workflow release pipeline)
- ~30 stale RFC section references corrected across C, tests, and docs
- ci fuzz job now runs `make fuzz` (adds UBSan) instead of a hand-copied
file list; fuzz-build links -lm -lpthread -ldl for Linux
- .PHONY completed; bindings-dev target refreshes the gitignored dev
dylibs; test.sql -> examples/smoke.sql; fuzz seed doc1 regenerated
Verified: plain 185 passed, onnx 220 passed, ASan+UBSan core and onnx
soaks clean, amalgamation-check clean, website builds.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: ARCHITECTURE.md
+40-27Lines changed: 40 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,25 +17,37 @@ Source layout:
17
17
|`sqlite-predict.c`| entry point, function registration, shared helpers (timestamp parse/format, ULID, options parsing, normal-quantile) |
18
18
|`predict-forecast.c`| the `forecast()` and `detect_anomalies()` aggregates, `backtest()`, the expansion TVFs, the statistical models, the native forecast-student serving path, and the shared `collect_series()` helper |
19
19
|`predict-tabular.c`|`predict()` vtab, the in-context k-NN model, and dispatch to a runtime backend for registered models |
20
-
|`predict-receipts.c`| the model registry (`_predict_models`) and content hashing |
20
+
|`predict-registry.c`| the model registry (`_predict_models`) and content hashing |
21
21
|`predict-onnx.c`| ONNX runtime backend (opt-in build only); the only file that links onnxruntime |
22
22
|`predict-student.c`| the native student **serving** runtime: blob (de)serialization and tree / forest / MLP inference (`predict0_tree_run`). The serve side of the train/serve boundary |
23
-
|`predict-student.h`| the shared student-model **format**: the tree/forest/MLP structs and the runtime entry points both sides agree on (RFC §4.1.6) |
23
+
|`predict-student.h`| the shared student-model **format**: the tree/forest/MLP structs and the runtime entry points both sides agree on (RFC §4.1.3) |
24
24
|`predict-distill.c`| the **training** side: the CART / gradient-boosting / MLP trainers, the `distill_predict()` vtab, and the `distill_forecast()` vtab that fits the forecast student. Builds student blobs that `predict-student.c` serves |
`--allow-dirty` is needed because `csrc/` is generated (git-ignored); it is
47
-
still included in the published crate via `Cargo.toml`'s `include`.
48
-
49
-
### npm — `sqlite-predict` (unscoped)
50
-
51
-
1.`npm login` as the org account.
52
-
2. Publish the main package to claim the name:
53
-
54
-
```sh
55
-
cd bindings/node && npm publish --access public
56
-
```
31
+
That is the whole procedure. Registry versions (PyPI, crates.io, npm)
32
+
are immutable: if a publish job fails partway, fix the cause and cut a
33
+
fresh version rather than re-tagging.
57
34
58
-
NOTE: this **claims the name but is not yet functional.** The package resolves
59
-
its binary from per-platform packages (`sqlite-predict-<platform>`) that must
60
-
be built and published by CI (not wired yet — see "Open follow-ups"). Claim
61
-
now; make it functional before you announce npm.
35
+
## What the tag triggers
62
36
63
-
### GitHub Releases — no account
37
+
All four workflows in `.github/workflows/` fire on every `v*` tag push:
64
38
65
-
Nothing to claim; the repo owns it. See Part 2.
39
+
| Workflow | Publishes | Credentials |
40
+
| --- | --- | --- |
41
+
|`release.yml`| GitHub Release: prebuilt loadables for Linux, macOS, and Windows, the single-file amalgamation (`sqlite-predict.c`), and `SHA256SUMS`, with generated release notes | built-in `GITHUB_TOKEN`|
42
+
|`wheels.yml`| Python wheels (manylinux and macOS, compiler-free `pip install sqlite-predict`) plus the sdist, to PyPI | trusted publishing (OIDC), no stored token |
43
+
|`npm.yml`| the per-platform binary packages (`sqlite-predict-darwin-arm64`, `sqlite-predict-darwin-x64`, `sqlite-predict-linux-x64`, `sqlite-predict-linux-arm64`, `sqlite-predict-windows-x64`), then the main `sqlite-predict` package with `optionalDependencies` pinned to the same version |`NPM_TOKEN` repo secret |
44
+
|`crate.yml`| the `sqlite-predict` crate to crates.io (the crate's `build.rs` compiles the bundled amalgamation on the user's machine) |`CARGO_REGISTRY_TOKEN` repo secret |
66
45
67
-
---
46
+
`npm.yml` and `crate.yml` also support `workflow_dispatch` with an
47
+
explicit version input, for re-running a single registry publish
48
+
without a new tag.
68
49
69
-
## Part 2 — Cut a release
50
+
## One-time setup (already done, recorded for repo moves)
70
51
71
-
Tagging drives everything else automatically (built-in `GITHUB_TOKEN`, no
72
-
external secrets for the binaries):
52
+
-**PyPI trusted publisher** on the `sqlite-predict` project: owner
0 commit comments