Skip to content

Deepen cryptotrace 4x: edge/error tests, 20 demos, value-coercion hardening#6

Open
cognis-digital wants to merge 1 commit into
mainfrom
feature/depth-4x-hardening-tests-demos
Open

Deepen cryptotrace 4x: edge/error tests, 20 demos, value-coercion hardening#6
cognis-digital wants to merge 1 commit into
mainfrom
feature/depth-4x-hardening-tests-demos

Conversation

@cognis-digital

Copy link
Copy Markdown
Owner

Summary

Deepens the repo ~4x with real work across tests, demos, and hardening — public API unchanged.

Tests: 73 → 290

New edge-case and error-path coverage across five files:

  • test_edge_parsing.py — empty/garbage/JSONL/scalar inputs, field aliases (from/to/vin/vout/hash), explorer-object coercion, and the new value-coercion (negative/NaN/inf/string/null).
  • test_edge_analysis.py — clustering corners (common-input, duplicate inputs, self-loops, change-address ambiguity, sort/ids/tx-count), sanctions inheritance + risk cap, hop-distance BFS bounds, taint haircut dilution and [0,1] invariants, peel-chain min-length/cycle/reuse.
  • test_edge_sarif_cli.py — SARIF rule dedupe/index/levels/fingerprints/empty-run, and CLI exit codes + error paths (missing files → 2, bad --min-taint → 2, flagged → 1).
  • test_edge_model_feeds.pyTransaction/Finding/Cluster/TraceResult serialization, SDN-table integrity, all bundled fixtures parse+analyze, feeds-parser corners.
  • test_edge_render_connect.py / test_edge_severity_sdn.py — table rendering, connect/emit mapping, determinism/no-mutation, severity-grading boundaries, per-entity SDN coverage.

python -m pytest -q290 passed.

Demos: 5 → 20

15 new runnable scenarios (each exits 0, offline, PYTHONUTF8=1-safe): SARIF pipeline, offline feed enrichment, taint dilution, destination screening, false-positive audit, multi-source attribution, cluster risk scoring, JSONL + explorer ingest, malformed-input resilience, negative-export hardening, triple export, peel-chain forensics, single-address check, connect/emit. Adds 5 new fixtures (+ SCENARIO.md), updates run_all.py and docs/DEMOS.md.

Bug fixes / hardening (API stable)

  • Negative / non-finite value bug: parse_txs and propagate_taint silently turned a negative or NaN/inf value field into a neutral 1.0 weight, understating dirty-value totals. Now normalised to a finite, non-negative magnitude via _coerce_value; propagate_taint guards direct-API callers too.
  • analyze() validation: rejects out-of-range taint_threshold with a clear ValueError, clamps negative max_hops to 0; CLI surfaces these as exit-code-2 errors.

Ops

  • Migrate .github/labeler.yml v4 → v5 schema (also committed to main so the label check is green), add a demos label.
  • Re-ignore demos/**/__pycache__ that the !demos/** negation was re-including.
  • Version 3.0.0 → 3.1.0.

…labeler v5

Tests: 73 -> 290 (edge cases + error paths for parsing, clustering,
common-input, change-address, peel chains, taint propagation, hop analysis,
sanctions inheritance, SARIF export, CLI exit codes, connect emit).

Demos: 5 -> 20 runnable scenarios (SARIF pipeline, offline feed enrichment,
taint dilution, destination screening, false-positive audit, multi-source
attribution, cluster risk scoring, JSONL + explorer ingest, malformed-input
resilience, negative-export hardening, triple export, peel-chain forensics,
single-address check, connect/emit) + 5 new fixtures + SCENARIO.md docs.

Bug fixes / hardening (public API stable):
- parse_txs + propagate_taint: a negative or non-finite (NaN/inf) value
  field silently became a neutral 1.0 weight, understating dirty-value
  totals. Now normalised to a finite, non-negative magnitude via
  _coerce_value; propagate_taint guards direct-API callers too.
- analyze(): validates taint_threshold in [0,1] (clear ValueError) and
  clamps negative max_hops to 0; CLI surfaces these as exit-code-2 errors.

Ops: migrate .github/labeler.yml v4 -> v5 (changed-files/any-glob-to-any-file);
re-ignore demos/**/__pycache__ that the !demos/** negation was re-including;
bump version 3.0.0 -> 3.1.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant