Skip to main content

Module drift

Module drift 

Source
Expand description

coinset.org API drift detection.

coinset.org publishes no OpenAPI schema, so the only way to notice a breaking API change is to watch it. This module reduces a live JSON response to its shape — the set of keys and the JSON type of each value, with all concrete values discarded — and diffs that shape against a committed baseline snapshot.

Values are dropped on purpose: a block’s difficulty or a mempool’s size changes every block, but its shape (the key difficulty holding an integer) is the actual contract chia-query depends on. Drift in the shape — a renamed key, a removed field, a type flip — is what breaks a consumer, and is what this detects.

Functions§

diff_shapes
Compare a current shape against the baseline shape and return one human-readable line per drift found. An empty vec means the shapes match.
shape_of
Reduce a JSON value to its type-shape: objects keep their keys (each mapped to the shape of its value), arrays collapse to a single-element shape, and every scalar becomes a type tag ("string", "integer", "number", "boolean", "null").