Skip to content

tooling: blocker-initiative tools -- baseline cache, history, provision, unmask, pr_check (#4270, 1 of 2) - #4596

Merged
squid-protocol merged 3 commits into
mainfrom
tooling/4270-blocker-tools
Oct 7, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
tooling/4270-blocker-tools

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Part of #4270 (blocker-initiative tooling, PR 1 of 2: items 1-4). Fixes #4598. Companion: #4595 (pr_check, one rosetta-audit run per push, nightly baseline) -- merge this one first (the nightly job calls survey --baseline).

What this fixes: every slice agent re-ran a 20-60 min before-survey on the same main SHA, rebuilt census clones and a private crucible clone by hand, kept scratch in /tmp, only learned what a whole-program refusal hid after fixing it, and had no history of the whole counts.

1. Baseline cache keyed by SHA

  • cics_census.py survey --baseline [--root DIR] [--sha SHA] [--no-fetch] [--force]: fetches origin/main (default) and surveys that commit with that commit's own translator -- git archive <sha> gitgalaxy tests/tools pyproject.toml into <root>/census-cache/<sha>/src -- into <root>/census-cache/<sha>/before-{b,nb-local,nb}, plus cics_programs.json (so later reads need no corpora), blockers.txt/json, and meta.json (written last: the cache is complete). A cached SHA is a no-op; an flock on <sha>.lock makes a second agent wait, then find the cache. A cache surveyed without the census refuses a census run (exit 2, --force to redo) instead of mixing.
  • Root: --root, else $GG_SCRATCH, else <worktrees dir>/_shared-scratch (worktrees dir = $GITGALAXY_WORKTREES, else the directory holding this worktree, else <main>/../gitgalaxy-worktrees). On this box: /srv/storage_16tb/projects/gitgalaxy-worktrees/_shared-scratch. Census clones: --census-corpora, $CICS_CENSUS_CORPORA, else the provisioned <root>/census.
  • blockers --baseline [--sha SHA] reads it; compare DIR --before-baseline --verb V takes the before rows from it, so an agent surveys only its own branch (survey --out DIR --label after).
  • Fix (found by the tooling: proof-level blocker ranking, spec status page, blocker-slice workflow (#4270) #4594 agent): --no-census still read $CICS_CENSUS_CORPORA in survey / usage / compare / blockers; now it reads no census root at all whatever the env holds, and --no-census with --census-corpora is an argument error (cics_census.py: --no-census still reads $CICS_CENSUS_CORPORA #4598; test_no_census_never_reads_the_census_root covers survey, usage and compare, plus test_no_census_ignores_the_census_env for the baseline). The nightly burned-only job depends on it.
  • survey --out now also writes <label>-runs.json (which corpora root each run read), which --unmask needs.

Real run (main 8dff2ec, 17 corpora; 125 CICS programs):

baseline 8dff2ec2e032 surveyed in 349s: .../_shared-scratch/census-cache/8dff2ec2e032cfde103a55c284c0f0734d7a2214
# blockers in baseline 8dff2ec2e032 (burned + local + census corpora): programs with an EXEC CICS command
translated whole: 76 / 125 (non-burned 14 / 31); refused whole (no statements translated): 12

second call: baseline 8dff2ec2e032 already surveyed (burned + local + census corpora, 2026-10-07T09:39:52Z): ... -- nothing to do (0.06 s).

blockers --baseline, top of the ranking:

 only gap (B/NB)  one away (B/NB)  touched  gap
     7 ( 0/ 7)      0 ( 0/ 0)        7  *refused: LayoutError: source defect: source text past column N (…) cuts a literal open: ...
     2 ( 2/ 0)      0 ( 0/ 0)        2  *missing copybook CMQGMOV
     1 ( 0/ 1)      0 ( 0/ 0)        1   EXEC CICS FORMATTIME RESP
     1 ( 0/ 1)      0 ( 0/ 0)        1  *missing copybook BAQRINFO
     1 ( 1/ 0)      1 ( 0/ 1)        2   EXEC CICS (no reason given)
     1 ( 1/ 0)      0 ( 0/ 0)        9   EXEC CICS RETURN IMMEDIATE
     1 ( 1/ 0)      0 ( 0/ 0)        3   EXEC CICS READ GTEQ

(76/125 vs #4592's 75/123: this baseline includes cics-java-jcics-samples, which #4592 left out; its EC01 is whole.) Gap keys now also blank backquoted source text (a cut literal's tail), so no source text reaches a key and the 7 NexusBank programs share one key.

2. History

docs/language_status/blockers_history.jsonl, one line per merged slice: PR, main SHA, date (UTC), whole / total, burned and non-burned, refused whole, top 5 gaps (counts), scope, note. history append --pr N [--note ...] [--sha] reads the cached baseline (refuses a duplicate PR+SHA); history show:

date           PR main SHA       whole  burned non-burned refused  top gap
2026-10-06  #4587 9fda76567    69/125   56/94     13/31        19  refused: LayoutError: national / DBCS text (…) is not modelled: the tr  (note)
2026-10-06  #4590 705dcc8c6    70/125   56/94     14/31        12  refused: ExprError: source defect: source text past column 72 (`…`) cu  (note)
2026-10-07  #4592 3b2480022    75/123   62/94     13/29         ?  -  (note)
2026-10-07  #4593 8dff2ec2e    76/125   62/94     14/31        12  refused: LayoutError: source defect: source text past column N (…) cut  (note)

The first three are seeded from the PR bodies. SHAs approximate (each note says so): #4587 was surveyed on its base b6c3e4e (recorded at its merge commit; tooling-only PR); #4590's line covers #4588 + #4590, measured on #4590's branch after merging main; #4592 was measured on its branch, without jcics-samples (123 programs), and reported neither refused-whole nor a ranking. #4593 is the first real entry (history append --pr 4593). Names and counts only.

3. equivalence_env.py --provision [--root DIR]

Idempotently: <root>/cics-crucible (a private clone checked out at tests/_cics_crucible_pin.py's PINNED_REF; refuses to move a clone with local changes), <root>/census/<repo> for only estate4_draw.INELIGIBLE_LIST minus the burned estates (shallow), and <root>/provision.json with each clone's SHA. Before cloning anything it compares the list against the names in estate4_candidates.json (only full_name is read) and refuses on any overlap. Progress on stderr, the --shell exports on stdout (eval "$(... --provision)"), now including CICS_CENSUS_CORPORA and GG_SCRATCH; --shell --root DIR exports an existing provision. Census dirs not on the list are reported, never touched.
--check: the shared checkout (beside the main checkout) off its pin is now a WARN with the provision hint (do not move it, other agents use it); any other off-pin checkout still FAILs.

$ eval "$(python tests/tools/equivalence_env.py --provision)"
cloning squid-protocol/cics-crucible -> .../_shared-scratch/cics-crucible
.../_shared-scratch/cics-crucible: checking out v0.5.0
cloning cicsdev/cics-async-api-credit-card-application-example -> .../_shared-scratch/census/cics-async-api-credit-card-application-example
... (10 census clones)
# provisioned .../_shared-scratch: cics-crucible v0.5.0 (9ee42d117111), 10 census clones (provision.json)

re-run: nothing cloned, 0.29 s.

4. blockers --unmask GAPKEY -- a what-if, not a translation

For a * row (a refusal that stops the whole program): re-translates only the programs that gap refuses, with that one refusal check off, reusing the baseline's generated estates (det_survey.py --program/--unmask/--estate-from), and reports the gaps hidden behind it and whether any program would become whole. Output is headed # WHAT-IF, NOT A TRANSLATION and rows carry "unmasked": CHECK.

  • The switch: det.source.survey_unmask(*checks), a context manager over a module-level frozenset, honoured only inside its with block. No env var or flag turns it on; the only caller is tests/tools/det_survey.py --unmask, and test_no_production_path_opens_the_what_if fails if any module under gitgalaxy/ (or another tool) calls it. Production behaviour is unchanged: the three pre-parse checks moved into source.refusal() in the same order.
  • Unmaskable checks (UNMASKABLE): cut-literal (the literal read with its text past column 72, as if the source were fixed), several-programs, unmodelled (national / DBCS, IDMS, DECIMAL-POINT IS COMMA, control characters), missing-copybook (expanded to nothing; not an ambiguous one). A gap with no switch says so and lists these.

Real run on the column-72 gap:

$ python tests/tools/cics_census.py blockers --baseline --unmask "source text past column"
# WHAT-IF, NOT A TRANSLATION -- refused: LayoutError: source defect: source text past column N (…) cuts a literal open: ...
# refusal check `cut-literal` switched off in survey mode only (det.source.survey_unmask; translator: this checkout 8dff2ec2e032)
programs it refuses whole: 7 (non-burned 7)
would translate whole with it lifted: 0 (non-burned 0); still refused by another check: 0

programs    B/NB  gap hidden behind it
       7   0/7    <name>: no such item
       6   0/6    EXEC CICS no generated screen for map <name>
       5   0/5    EXEC SQL: ROLLBACK: the generated repositories commit each statement
       4   0/4    MOVE an alphanumeric literal holds a character beyond the single-byte code page (…): ...
       1   0/1    EXEC CICS DUMP
       1   0/1    EXEC CICS no generated screen for map <name> MAP
       1   0/1    EXEC SQL: no generated Db2 repository method for the statement at line N
       1   0/1    GOTO GO TO ['…']
       1   0/1    STRING an alphanumeric literal holds a character beyond the single-byte code page (…): ...
       1   0/1    grammar: does not parse

per program (what-if):
  NB  nexusbank_v1.2_cobol           NACC         refused -> 85/112 holes=27
  NB  nexusbank_v1.2_cobol           NBON         refused -> 153/187 holes=34
  ... (7 programs, 44-153 statements translated each)

So the #1 * row (7, an upper bound) would make no program whole: each NexusBank program has 25-53 holes behind it, led by no such item (7) and missing generated screens (6). That is the "we only learned it after fixing" case answered before fixing.

Checks

  • New tests: test_cics_census_baseline.py (7: cache once per SHA + no-op + scope mismatch, failed survey leaves no cache, blockers/compare from the baseline, history append/show/duplicate, the committed history well-formed, gap -> check mapping, the labelled what-if with only the refused programs re-translated), test_det_unmask.py (6, importorskip tree_sitter_language_pack where the parsers run: off by default and only in the block, restored on raise, unknown check refused, the cut-literal what-if reaches both parsers, missing copybook expands to nothing, no production caller), test_equivalence_env.py (+5: provision at the pin with SHAs + idempotent + stray dirs, candidate refusal before any clone, census list = ineligible minus burned and disjoint from candidates, shared off-pin WARN vs private FAIL, scratch root order).
  • test_det_source_4462.py, test_det_translate.py, the census / env tests: 369 passed, 1 skipped (JDK 17 cell).
  • ruff 0.16.0 (pr_gates --only lint) and mypy clean on the touched tools (det_survey.py's 3 mypy errors are pre-existing lines); pr_gates --only audits secrets pass.
  • pr_gates.py --ratchets: port-surface, estate, fact-crosscheck, completeness, ground-truth PASS; ports SKIP (no shared cics-crucible checkout at the default path during the run). Re-run with CICS_CRUCIBLE_PATH=<the provisioned clone at v0.5.0>: ports FAIL on all 25 equivalence cases -- identically on an origin/main worktree (tooling: blocker-initiative tools -- pr_check, one rosetta-audit run, nightly baseline (#4270, 2 of 2) #4595's branch): aws-mainframe-modernization-carddemo is not fetched at its pinned ref -- the box's shared mainframe corpora are off their pins, not this change (I did not re-fetch the user's corpora). A skip is not a pass.
  • Full pr_gates.py: lint, audits, secrets, xray, gauntlet, golden PASS; suite 15150 passed, 1 failed -- test_source_reads flagged a lossy errors="replace" read in my new test, fixed (re-run passes).

🤖 Generated with Claude Code

https://claude.ai/code/session_011wnQoeeAZP4npeyGnDviK6

- cics_census survey --baseline: one survey per main SHA with that commit's
  own translator, cached at <root>/census-cache/<sha>/ (a no-op once cached,
  locked); blockers --baseline and compare --before-baseline read it.
- cics_census history append/show: docs/language_status/blockers_history.jsonl,
  seeded with #4587 / #4590 / #4592 (approximate SHAs, noted) and #4593.
- equivalence_env --provision: private cics-crucible at the pin + census
  clones (INELIGIBLE_LIST minus burned; estate4 candidate names refused),
  provision.json with SHAs, the exports; --check WARNs on an off-pin shared
  checkout.
- blockers --unmask GAPKEY: what-if re-translation of the programs one
  whole-program refusal stops, with that check off via det.source.survey_unmask
  (survey-only; det_survey.py is its only caller).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011wnQoeeAZP4npeyGnDviK6
@squid-protocol squid-protocol added enhancement New feature, sensor, or structural signature testing Unit, integration, and E2E pipeline verification labels Oct 7, 2026
def test_restored_when_the_block_raises():
with pytest.raises(RuntimeError), SRC.survey_unmask("unmodelled"):
raise RuntimeError("boom")
assert not SRC.unmasked("unmodelled")
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol marked this pull request as ready for review October 7, 2026 10:42
@squid-protocol
squid-protocol merged commit ee28e75 into main Oct 7, 2026
37 checks passed
@squid-protocol
squid-protocol deleted the tooling/4270-blocker-tools branch October 7, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, sensor, or structural signature testing Unit, integration, and E2E pipeline verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cics_census.py: --no-census still reads $CICS_CENSUS_CORPORA

2 participants