v0.2.23
sdivi-rust v0.2.23 — Three new pattern categories and callee-text classification
This release lands the M29–M33 milestone batch, which extends the pattern
measurement surface from five categories to eight and promotes classification
from node-kind-only to node-kind + callee-text. The headline additions are the
data_access, logging, and class_hierarchy categories, a new
classify_hint API that inspects the source text of a call to decide its
category, and the native-pipeline switchover that puts classify_hint behind
Pipeline::snapshot.
snapshot_version stays at "1.0". The category set, the pattern_metrics
field shapes, and the DivergenceSummary structure are all unchanged. What
changes is the per-category instance distribution on the next snapshot after
upgrade — see "Impact on existing baselines" below.
Highlights
- M29 —
data_accesscategory.call_expression(TS/JS/Go) andcall
(Python) nodes are now bucketed underdata_access. TS/JS/Go already
collected these asPatternHints; Python's adapter gains"call"in its
PATTERN_KINDSso every Python call now emits a hint. - M30 —
loggingcategory (catalog-only at introduction). Added to the
contract so foreign extractors can emitcategory: "logging"and round-trip
throughcompute_pattern_metrics/compute_delta.category_for_node_kind
deliberately never returns it — the relevant node kinds overlap with
data_accessandresource_management, and only the callee name
distinguishes them. - M31 —
class_hierarchycategory. A node-kind-routed category covering
class_declaration/class_definition/abstract_class_declaration/
interface_declaration/impl_itemacross TypeScript, JavaScript, Python,
Rust, and Java. Go is skipped — it has no class/interface AST shape — so the
category exists in the catalog but produces zero Go hits. - M32 —
classify_hint(hint, language) -> Vec<&'static str>. The
callee-text-aware classifier. Per-language regex tables ondata_access,
logging, andasync_patterns(matches_callee) plus an inverted
resource_management::excludes_calleefor Rust macro disambiguation. Exposed
throughsdivi-coreand the@geoffgodwin/sdivi-wasmWASM surface alongside
a new WASM-safePatternHintInput { node_kind, text }struct. The native
pipeline is intentionally left oncategory_for_node_kindin M32 so this
milestone ships pure-additive (no snapshot diff). - M33 — native pipeline switchover.
crates/sdivi-patterns/src/catalog.rs
now classifies hints viaclassify_hint.loggingbecomes natively
populated,data_accessnarrows to actual data-access callees, TS/JS Promise
chains (.then()/.catch()/.finally()) route toasync_patterns, and Rust
tracing::*!/log::*!/println!-family macros land inlogginginstead of
resource_management. The multi-category return is honoured (a hint can land
in more than one bucket); v0's per-language regex tables are disjoint so in
practice each hint lands in at most one.
list_categories() now returns 8 entries:
async_patterns, class_hierarchy, data_access, error_handling,
logging, resource_management, state_management, type_assertions.
Impact on existing baselines
The category contract is unchanged, but the per-category instance counts and
entropy values shift on the first snapshot taken after upgrade:
data_accessshrinks — only callees matching the per-language regex
remain; structurally homogeneous non-data calls are dropped.loggingbecomes non-zero on languages with a logging regex table
(was catalog-only since M30).async_patternsgrows on TS/JS — Promise chains are now counted.resource_managementshrinks on Rust — logging macros leave the bucket.
Threshold gates (sdivi check) tuned against pre-M33 baseline numbers may trip
on the next snapshot. The escape hatch is unchanged: set
[thresholds.overrides.<category>] with an expires date inside your migration
window to defer recalibration until you have retuned. The M20 cross-architecture
threshold epsilon is far smaller than these instance-count shifts and will not
absorb them. A side-by-side pre/post worked example is in MIGRATION_NOTES.md.
What did not change
snapshot_versionis still"1.0". ThePatternCatalogJSON shape,
pattern_metricsfield names, andDivergenceSummarystructure are
unchanged.- No new
.sdivi/config.tomlkeys.[thresholds.overrides.<new-category>]
blocks are legal under the existing category-agnostic override loader and the
existingexpires-required rule. - Public API is additive:
classify_hint,PatternHintInput, the per-category
matches_callee/excludes_calleehelpers, and the three new category names.
category_for_node_kindis unchanged and preserved for callers that have a
node kind but no source text. - Foreign extractors that emit
PatternInstanceInputdirectly are unaffected —
their inputs determine their outputs. - WASM dependency invariant (Rule 21) holds:
regexis the only new entry in
thesdivi-corewasm32 dependency tree; notree-sitter/walkdir/ignore/
rayon/tempfile. - Snapshot atomic-write, retention, exit-code, and determinism contracts
unchanged. Same repo state + same seed still produces bit-identical output
(a different bit-identical output than pre-M33).
Install
# crates.io
cargo install sdivi-cli
# pre-built binary (Linux x86_64 example)
curl -Lo sdivi https://github.com/GeoffGodwin/sdivi-rust/releases/download/v0.2.23/sdivi-x86_64-unknown-linux-gnu
chmod +x sdivi && mv sdivi ~/.local/bin/
# WASM / npm
npm install @geoffgodwin/sdivi-wasm@0.2.23Documentation
- Pattern category contract: https://github.com/GeoffGodwin/sdivi-rust/blob/main/docs/pattern-categories.md
- Migration notes: https://github.com/GeoffGodwin/sdivi-rust/blob/main/MIGRATION_NOTES.md
- CHANGELOG: https://github.com/GeoffGodwin/sdivi-rust/blob/main/CHANGELOG.md
Released under Apache 2.0.