research(rectification): angle-timing A1 — real vs shuffled and age-preserving jittered dates, 0/9 tests significant (BUG-1141)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017eEAG8HD3mm8gsKXgk8uU8
This commit is contained in:
Jesse_Chen
2026-10-01 10:55:46 +08:00
co-authored by Claude Opus 5.5
parent f507570448
commit 915c3e829d
6 changed files with 11010 additions and 0 deletions
+24
View File
@@ -251,3 +251,27 @@ def stable_json(payload: Any) -> str:
def sha256_of(path: Path) -> str:
return hashlib.sha256(path.read_bytes()).hexdigest()
def jittered_events(case: dict[str, Any], rng: Random) -> list[dict[str, Any]]:
"""Second null: each event moved 1-3 years earlier or later (same precision, month/day kept),
which keeps the age structure of real biographies; clamped to after birth and before the cutoff."""
birth = birth_local(case).date()
out = []
for raw in case["events"]:
text = str(raw.get("date") or "")
p = str(raw.get("precision") or "")
try:
year = int(text[:4])
except ValueError:
out.append(dict(raw)); continue
shift = rng.choice((-1, 1)) * rng.randint(1, 3)
new_year = min(max(year + shift, birth.year + 1), EVENT_CUTOFF.year - 1)
if p == "day" and len(text) >= 10:
m, d = int(text[5:7]), int(text[8:10]); d = min(d, calendar.monthrange(new_year, m)[1]); new = f"{new_year:04d}-{m:02d}-{d:02d}"
elif p == "month" and len(text) >= 7:
new = f"{new_year:04d}-{text[5:7]}"
else:
new = f"{new_year:04d}"
out.append({**raw, "date": new})
return out