Repository navigation
Releases
Trust & Ops: forensic integrity checks + grammar-drift hotfix kit
Trust & Ops — forensic integrity + grammar-drift hotfix kit
This release ships the two capabilities operators asked for: detect and explain suspicious/tampered statements, and a minutes-not-days response when a bank changes its narration format.
@paniniapi/forensics (0.1.0, new package)
Deterministic document-integrity forensics for statement files. inspectStatement(bytes) returns an explainable IntegrityReport (verdict + rule-Id'd signals + evidence):
- Arithmetic consistency (all formats): running-balance chain verification, opening/closing reconciliation, out-of-period dates, duplicate-row fabrication detection.
- PDF container signals: incremental updates, consumer-editor
/Producerfingerprints, post-periodModDate, AcroForm overlays, covering annotations, invisible text, stacked/overtyped fragments. - Full CMS signature validation:
/ByteRangedigest vs CMSmessageDigest, RSA-PKCS#1/ECDSA signature over signedAttrs (node:crypto), embedded cert chain walked to a caller-supplied trust store. Post-sign appends flagged.
@paniniapi/bsa carries per-file integrity verdicts in the JSON report, a Document Integrity section in Markdown output, a --no-forensics flag, and exit code 3 on tamper_evidence (CI-gateable).
Docs: docs/statement-integrity.md — signal dictionary, verdict semantics, honest limits (deterministic evidence ≠ ML forensics; AA-sourced data remains the tamper-proof channel).
Grammar-drift response kit (@paniniapi/rules-engine)
The operational answer to "the bank changed its narration format overnight":
analyzeNarrationBatch(narrations, { bankHint })— batch match-rate / confidence vs the corpus baseline;drift: true+ warnings when the rate collapses (>20pp default, tunable). Unmatched narrations are grouped into token-skeleton clusters so operators see the new shape, not thousands of raw strings.suggestGrammarRule(samples)— drafts a candidateGrammarPatternfrom same-skeleton samples and self-tests it against the whole corpus (corpusImpact,safeflag). Suggestions never mutate production grammars; they are paste-ready drafts for human review.panini-bsa doctor <files...> [--bank id]— CLI that runs the drift report on statement files or one-per-line.txtdumps and prints a draft rule per unmatched cluster. Exit1on drift.- Docs:
docs/rules-hotpatch.md— the full detect → diagnose → overlay-patch → upstream playbook. Grammar fixes ship as JSON rule files vialoadRuleSets(dir)— no engine redeploy required.
panini-parser 0.3.3 (Python parity)
The same drift kit on the Python engine: analyze_narration_batch, corpus_baseline, skeleton_of, suggest_grammar_rule (identical corpus self-test), plus parse_narration(..., rule_sets=[...], bare=True) mirroring the TS overlay options. Corpus fixtures now ship inside the wheel, guarded by a bundled-drift test.
Also in this release
- Native zero-dependency XLSX reader (
@paniniapi/extract) — SheetJS no longer required - Typed JSON v2 (
schema_version: 2):category_source,category_id/group,counterparty_kind,ref_kind - MCC table expanded to 235 ISO-18245 codes; merchant dictionary to 360 canonical entries
- Governed taxonomy: 43 categories with stable
ids + rollupgroups (taxonomy.json)
Gates: 986 TypeScript + 136 Python tests, lint/format/bench/pin checks green. Deterministic, zero-egress, Apache-2.0.