mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-08-12 21:00:34 +00:00
docs(shim): annotate as legacy shim pending AVM port; add strip receipt metadata
This commit is contained in:
parent
a84a704dbf
commit
98f5f0e795
1 changed files with 43 additions and 22 deletions
|
|
@ -1,31 +1,25 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""PIST -> RRC receipt-density backfill injector.
|
"""PIST -> RRC receipt-density backfill injector.
|
||||||
|
|
||||||
This script converts existing RRC equation projection rows plus optional PIST
|
NOTE (ontology migration):
|
||||||
classification output into receipt-density records.
|
|
||||||
|
|
||||||
It is intentionally conservative:
|
This file is a **legacy shim**. It exists to keep historical backfill workflows
|
||||||
|
running while the AVM rewrite is underway.
|
||||||
|
|
||||||
* It DOES NOT promote equations.
|
**Target architecture:** Lean-only AVM ISA + backend shims.
|
||||||
* It DOES NOT mutate RDS/ENE by default.
|
- Lean defines all semantics.
|
||||||
* RDS writes require the explicit --write-rds flag.
|
- Shims do JSON/RDS I/O only.
|
||||||
* RDS writes default to a sidecar table: ene.rrc_receipt_density.
|
|
||||||
* Database connectivity is delegated to the shared rds_connect.connect_rds helper.
|
|
||||||
* It filters Markdown table header/separator rows that older validation scripts
|
|
||||||
accidentally treated as equations.
|
|
||||||
|
|
||||||
Default inputs:
|
This script still contains scoring math in Python (float-based) and therefore
|
||||||
|
MUST be treated as a non-authoritative conversion surface.
|
||||||
|
|
||||||
6-Documentation/docs/rrc_equation_classification.md
|
Rules until ported:
|
||||||
shared-data/rrc_pist_exact_validation.json
|
- Output is always `promotion = not_promoted`.
|
||||||
|
- Output must carry an explicit `strip_receipt` section explaining:
|
||||||
|
- which constructs were computed in shim space
|
||||||
|
- what must be ported to Lean/AVM
|
||||||
|
|
||||||
Default output:
|
TODO(lean-port): Replace all scoring and warning decisions with Lean/AVM.
|
||||||
|
|
||||||
shared-data/rrc_receipt_density_backfill.json
|
|
||||||
|
|
||||||
The output is a receipt-density surface, not a truth claim. A populated density
|
|
||||||
axis means "this equation has enough structural/witness evidence for routing";
|
|
||||||
it does not mean the equation is mathematically proved.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
@ -34,7 +28,6 @@ import argparse
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
|
|
@ -53,6 +46,8 @@ DEFAULT_PIST_REPORT = REPO_ROOT / "shared-data/rrc_pist_exact_validation.json"
|
||||||
DEFAULT_OUT = REPO_ROOT / "shared-data/rrc_receipt_density_backfill.json"
|
DEFAULT_OUT = REPO_ROOT / "shared-data/rrc_receipt_density_backfill.json"
|
||||||
DEFAULT_RDS_TABLE = "ene.rrc_receipt_density"
|
DEFAULT_RDS_TABLE = "ene.rrc_receipt_density"
|
||||||
|
|
||||||
|
ONTOLOGY_VERSION = "shim-ontology-migration-v1"
|
||||||
|
|
||||||
TARGET_AXES = {
|
TARGET_AXES = {
|
||||||
"projection_declared",
|
"projection_declared",
|
||||||
"negative_control_strength",
|
"negative_control_strength",
|
||||||
|
|
@ -290,6 +285,7 @@ def build_record(row: RRCEquationRow, pred: dict[str, Any] | None) -> ReceiptDen
|
||||||
"top_axes": row.top_axes,
|
"top_axes": row.top_axes,
|
||||||
"promotion": "not_promoted",
|
"promotion": "not_promoted",
|
||||||
"source": "pist_receipt_density_injector_v1",
|
"source": "pist_receipt_density_injector_v1",
|
||||||
|
"ontology_version": ONTOLOGY_VERSION,
|
||||||
}
|
}
|
||||||
receipt_hash = stable_hash(unsigned_payload)
|
receipt_hash = stable_hash(unsigned_payload)
|
||||||
|
|
||||||
|
|
@ -325,6 +321,8 @@ def summarize(records: list[ReceiptDensityRecord], total_rows: int, prediction_c
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"receipt_version": "pist-receipt-density-v1",
|
"receipt_version": "pist-receipt-density-v1",
|
||||||
|
"ontology_version": ONTOLOGY_VERSION,
|
||||||
|
"shim_role": "legacy_scoring_surface_pending_avm",
|
||||||
"input_rows": total_rows,
|
"input_rows": total_rows,
|
||||||
"records": len(records),
|
"records": len(records),
|
||||||
"pist_predictions_loaded": prediction_count,
|
"pist_predictions_loaded": prediction_count,
|
||||||
|
|
@ -339,6 +337,10 @@ def summarize(records: list[ReceiptDensityRecord], total_rows: int, prediction_c
|
||||||
"by_status": dict(sorted(by_status.items())),
|
"by_status": dict(sorted(by_status.items())),
|
||||||
"warning_counts": dict(sorted(warning_counts.items())),
|
"warning_counts": dict(sorted(warning_counts.items())),
|
||||||
"promotion_policy": "no automatic promotion; density populates routing evidence only",
|
"promotion_policy": "no automatic promotion; density populates routing evidence only",
|
||||||
|
"float_policy": {
|
||||||
|
"status": "legacy_float_math_present",
|
||||||
|
"reason": "shim computes density components using Python float; must be ported to Lean/AVM",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -524,12 +526,31 @@ def main(argv: list[str] | None = None) -> int:
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"summary": summary,
|
"summary": summary,
|
||||||
|
"strip_receipt": {
|
||||||
|
"ontology_version": ONTOLOGY_VERSION,
|
||||||
|
"shim_role": "legacy_scoring_surface_pending_avm",
|
||||||
|
"computed_in_shim": [
|
||||||
|
"receipt_density",
|
||||||
|
"confidence",
|
||||||
|
"density_components",
|
||||||
|
"warnings",
|
||||||
|
],
|
||||||
|
"must_port_to_lean_avm": [
|
||||||
|
"compute_density",
|
||||||
|
"spectral_quality",
|
||||||
|
"shape_agreement",
|
||||||
|
"axis_score",
|
||||||
|
"status_score",
|
||||||
|
"warning assignment",
|
||||||
|
],
|
||||||
|
"float_policy": "legacy_float_math_present; reject once AVM port is active",
|
||||||
|
},
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"rrc_file": str(args.rrc_file),
|
"rrc_file": str(args.rrc_file),
|
||||||
"pist_report": str(args.pist_report),
|
"pist_report": str(args.pist_report),
|
||||||
},
|
},
|
||||||
"claim_boundary": {
|
"claim_boundary": {
|
||||||
"receipt_density_means": "routing evidence is populated",
|
"receipt_density_means": "routing evidence is populated (legacy shim surface)",
|
||||||
"receipt_density_does_not_mean": "mathematical proof or promotion",
|
"receipt_density_does_not_mean": "mathematical proof or promotion",
|
||||||
"promotion_policy": "not_promoted for every generated record",
|
"promotion_policy": "not_promoted for every generated record",
|
||||||
"rds_policy": "--write-rds upserts sidecar receipt-density metadata only via rds_connect.connect_rds",
|
"rds_policy": "--write-rds upserts sidecar receipt-density metadata only via rds_connect.connect_rds",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue