mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-08-17 11:20:34 +00:00
docs(shim): annotate alignment shim as legacy pending AVM port; add strip receipt metadata
This commit is contained in:
parent
e19a6a56c7
commit
7f63d2280f
1 changed files with 41 additions and 14 deletions
|
|
@ -1,22 +1,27 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""RRC/PIST shape-alignment calibration pass.
|
"""RRC/PIST shape-alignment calibration pass.
|
||||||
|
|
||||||
Phase 2.2 bridge:
|
NOTE (ontology migration):
|
||||||
|
|
||||||
PIST exact/proxy label = structural/spectral morphology
|
This file is a **legacy shim**. It exists to keep historical alignment workflows
|
||||||
RRC shape label = semantic/domain routing class
|
running while the AVM rewrite is underway.
|
||||||
|
|
||||||
A mismatch is not automatically an error. For the current RRC equation corpus,
|
**Target architecture:** Lean-only AVM ISA + backend shims.
|
||||||
PIST often detects `LogogramProjection` because the input surface is an equation
|
- Lean defines all semantics.
|
||||||
name/logogram, while RRC supplies the semantic routing class such as
|
- Shims do JSON I/O only.
|
||||||
`CognitiveLoadField` or `SignalShapedRouteCompiler`.
|
|
||||||
|
|
||||||
This script annotates receipt-density records with a `shape_alignment` object and
|
This script still contains decision logic in Python (alignment classification +
|
||||||
turns known-compatible structural/semantic divergences into an explicit
|
warning rewrite). It therefore MUST be treated as a non-authoritative
|
||||||
`structural_semantic_label_divergence` warning instead of a raw
|
conversion surface.
|
||||||
`pist_shape_disagreement` warning.
|
|
||||||
|
|
||||||
It does not promote claims. Every record remains `promotion = not_promoted`.
|
Rules until ported:
|
||||||
|
- Records remain `promotion = not_promoted`.
|
||||||
|
- Output must carry an explicit `strip_receipt` section explaining:
|
||||||
|
- which decisions were made in shim space
|
||||||
|
- what must be ported to Lean/AVM
|
||||||
|
|
||||||
|
TODO(lean-port): Replace determine_alignment + rewrite_warnings + hashing payload
|
||||||
|
with Lean/AVM execution.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
@ -28,11 +33,13 @@ from collections import Counter
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
# Repo root (this file lives at 4-Infrastructure/shim/...)
|
# Repo root (this file lives at 4-Infrastructure/shim/...)
|
||||||
ROOT = Path(__file__).resolve().parents[3]
|
ROOT = Path(__file__).resolve().parents[3]
|
||||||
DEFAULT_IN = ROOT / "shared-data/rrc_receipt_density_backfill.json"
|
DEFAULT_IN = ROOT / "shared-data/rrc_receipt_density_backfill.json"
|
||||||
DEFAULT_OUT = ROOT / "shared-data/rrc_receipt_density_backfill.json"
|
DEFAULT_OUT = ROOT / "shared-data/rrc_receipt_density_backfill.json"
|
||||||
|
|
||||||
|
ONTOLOGY_VERSION = "shim-ontology-migration-v1"
|
||||||
|
|
||||||
RRC_SEMANTIC_SHAPES = {
|
RRC_SEMANTIC_SHAPES = {
|
||||||
"CognitiveLoadField",
|
"CognitiveLoadField",
|
||||||
"SignalShapedRouteCompiler",
|
"SignalShapedRouteCompiler",
|
||||||
|
|
@ -120,6 +127,7 @@ def update_hash(record: dict[str, Any]) -> str:
|
||||||
"warnings": record.get("warnings"),
|
"warnings": record.get("warnings"),
|
||||||
"promotion": "not_promoted",
|
"promotion": "not_promoted",
|
||||||
"source": record.get("source"),
|
"source": record.get("source"),
|
||||||
|
"ontology_version": ONTOLOGY_VERSION,
|
||||||
}
|
}
|
||||||
return stable_hash(payload)
|
return stable_hash(payload)
|
||||||
|
|
||||||
|
|
@ -157,12 +165,31 @@ def align_payload(payload: dict[str, Any]) -> tuple[dict[str, Any], Counter[str]
|
||||||
summary["warning_counts"] = dict(sorted(warning_counts.items()))
|
summary["warning_counts"] = dict(sorted(warning_counts.items()))
|
||||||
summary["raw_warning_counts"] = dict(sorted(raw_warning_counts.items()))
|
summary["raw_warning_counts"] = dict(sorted(raw_warning_counts.items()))
|
||||||
summary["promotion_policy"] = "no automatic promotion; shape alignment calibrates label spaces only"
|
summary["promotion_policy"] = "no automatic promotion; shape alignment calibrates label spaces only"
|
||||||
|
summary["ontology_version"] = ONTOLOGY_VERSION
|
||||||
|
summary["shim_role"] = "legacy_alignment_surface_pending_avm"
|
||||||
|
|
||||||
out = dict(payload)
|
out = dict(payload)
|
||||||
out["summary"] = summary
|
out["summary"] = summary
|
||||||
|
out["strip_receipt"] = {
|
||||||
|
"ontology_version": ONTOLOGY_VERSION,
|
||||||
|
"shim_role": "legacy_alignment_surface_pending_avm",
|
||||||
|
"computed_in_shim": [
|
||||||
|
"determine_alignment",
|
||||||
|
"rewrite_warnings",
|
||||||
|
"alignment_counts",
|
||||||
|
"warning_counts",
|
||||||
|
"receipt_hash recomputation",
|
||||||
|
],
|
||||||
|
"must_port_to_lean_avm": [
|
||||||
|
"determine_alignment",
|
||||||
|
"rewrite_warnings",
|
||||||
|
"update_hash canonical payload definition",
|
||||||
|
],
|
||||||
|
"float_policy": "no float used in this shim",
|
||||||
|
}
|
||||||
out["records"] = aligned_records
|
out["records"] = aligned_records
|
||||||
out["shape_alignment_claim_boundary"] = {
|
out["shape_alignment_claim_boundary"] = {
|
||||||
"means": "PIST structural morphology and RRC semantic routing labels have been calibrated",
|
"means": "PIST structural morphology and RRC semantic routing labels have been calibrated (legacy shim surface)",
|
||||||
"does_not_mean": "mathematical proof or claim promotion",
|
"does_not_mean": "mathematical proof or claim promotion",
|
||||||
"promotion_policy": "not_promoted for every record",
|
"promotion_policy": "not_promoted for every record",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue