Skip to content

readiness scanner: gitgalaxy assess -- offline, read-only, no source text in the report (Part of #4726) - #5234

Merged
squid-protocol merged 3 commits into
mainfrom
churn/4726-20261016T0833Z
Oct 16, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
churn/4726-20261016T0833Z

Conversation

@squid-protocol

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

Copy link
Copy Markdown
Owner

Part of #4726.

What

gitgalaxy assess ESTATE [--options FILE] [--redact [--redact-key-file F]] [--out FILE] scans a COBOL / CICS estate on
the customer's machine. It runs offline and only reads the estate. It writes a JSON report that holds counts, feature names,
program names (or their redacted labels) and statuses, and never source text. Customer doc: docs/assess.md.

Design

  • Entry point. A new gitgalaxy console script (gitgalaxy/cli.py) with one subcommand, assess
    (gitgalaxy/tools/readiness/assess.py). Without the console script, python -m gitgalaxy.cli assess ... does the same.
    --jcl is refused by name: reading options from JCL is a follow-up.
  • Package boundary. The estate inventory's scan core used to live under tests/tools, which a pip install does not
    ship. It moves into the package as gitgalaxy/tools/readiness/:
    • inventory.py is feature_inventory.scan_estate and its helpers, plus det_survey.copy_dirs. scan_estate gains
      two parameters: a scan hook (assess passes its guarded scan) and estate_opt.
    • era_tags.py is moved with git mv.
    • tests/tools/feature_inventory.py and tests/tools/era_tags.py become re-export shims that keep their CLIs.
    • feature_inventory.py --all-burned --check passes: all six committed fixtures are byte-identical after the move.
    • Dependencies: pip install gitgalaxy[translator] (the det parser). No Docker, Db2 or JDK.
  • What the output holds (gitgalaxy-assess/1):
    • totals: programs, parsed, unparsed, refused by family, assembler members.
    • eras: era counts and tell counts.
    • features: per category, each feature with its count and the programs that use it.
    • other: per category, features outside its vocabulary, as counts only.
    • copybook_gaps: missing copybooks and the programs that need them.
    • programs: name, kind, status, reason, era tags (tell, era, count; no line numbers).
    • tool_version and redacted. No date, host or absolute path.
  • How "no source text" is enforced.
    1. schema.project is the only function that builds a report. A feature name is printed only if it is in a closed
      vocabulary:

      • the CICS command spec's words;
      • IBM COBOL statement verbs and the parser's own kinds;
      • IBM intrinsic functions;
      • SQL forms, data types, semantic compile options, refusal families and era tells.

      Anything else is counted under other. An unparsed reason is the exception's class name, missing copybook or
      unreadable, never its message.

    2. schema.validate re-checks the finished report. If it fails, nothing is written and the command exits 3.

    3. Tests (below) hold the report against each burned estate's real source.

  • Redaction. --redact turns program paths into P- labels and copybook names into C- labels, each 12 hex
    digits of an HMAC-SHA256. Without a key file the key is random, so the labels can't be linked across runs.
    --redact-key-file gives the same labels every run. Counts don't change.
  • Offline. offline.install() refuses connect / connect_ex / sendto / sendmsg on any non-AF_UNIX socket, and
    refuses create_connection and the DNS calls. It is installed in the assess process and, through a -c bootstrap, in
    the galaxyscope child before any of the engine's code runs. Forked workers inherit it.
  • Read only. The scan DB and the BMS copybooks go to a private temporary directory. galaxyscope runs
    --db-only --no-dependency-cache with git history off. --out inside the estate is refused.
  • Readiness report. Wiring it to the readiness report (Readiness scanner: readiness report — programs translatable whole today, and ranked 'rules to learn' #4725) waits on readiness scanner: per-estate readiness report -- ladder counts, ranked rules to land, era mix (Part of #4725) #5228. This PR does not touch its files.

Class: every way estate text can leave the site through the report

member before this PR test
unparsed reason (exception text) free text class name / missing copybook / unreadable test_an_unparsed_reason_prints_its_class_never_its_message
feature keys taken from source words raw vocabulary; off-vocabulary keys go to other as counts test_projection_holds_its_schema[*6], test_carddemo_sequence_numbers_never_reach_the_report
era tell line numbers first_line dropped validate
program paths raw name, or label under --redact test_redaction[*6]
copybook / dataset names raw name, or label under --redact test_redaction[*6], planted
network — guard in the command and the scan child test_the_guard_*, test_the_scan_child_runs_under_the_guard
writes into the estate — tempdir; --out refused inside; tree snapshot equal test_the_estate_is_read_only, test_out_inside_the_estate_is_refused

A real leak this caught: CardDemo's committed raw inventory has sequence-area numbers as CICS command words
(02750012 029200, ASKTIME 03430012, READ 03700306). These come from the census fallback of CODATE01 / COACCT01,
whose MQ copybooks are missing. The report counts them under other (7 command keys, 54 option keys) and prints none.

Evidence

tests/cobol_mainframe/test_assess.py: 30 passed and 5 skipped with plain pytest from /tmp. The skips are the
nightly per-estate runs; all 35 passed with them enabled locally.

  • Every burned estate (6), fast, from the committed inventories:
    • the plain and redacted reports pass validate;
    • with the corpora on disk, no string literal (6+ chars), comment or code line (24+ chars), sequence-area value, or
      data / paragraph name of that estate appears in the report;
    • redaction: no program path, file name, stem or copybook name appears; labels are stable under one key and change
      with another; every count matches the plain report.
  • The check is not vacuous: the raw CardDemo inventory, written as it stands, fails it.
  • Planted estate through the real command: a marker sits in a comment, a literal, a data name, a paragraph name,
    the sequence area, a non-function FUNCTION word, SQL names and a non-COBOL file. It never appears, plain or
    redacted. The estate snapshot (sizes, mtimes, hashes, directories) is unchanged.
  • The real command on each burned estate: zECS on every run, the other five nightly (each 2-10 s). Exit 0, the estate
    unchanged, no source text, and the report equal to project(committed inventory).
  • Existing tests: test_feature_inventory, test_era_tags, test_support_matrix,
    test_det_cics_macro_refusal_5121: 146 passed, 1 nightly skip. feature_inventory.py --all-burned --check exits 0.
  • Gates (through heavy-run.sh, JDK 17): pr_gates --fast passed 6/6 (lint, audits, secrets, xray, gen-docs, gauntlet). pr_gates --ratchets: 8 passed, 0 failed, 0 skipped.
  • No golden-master drift: no parsing code changed.

Follow-ups (named, not in this PR)

Cross-repo

None.

🤖 Generated with Claude Code

squid-protocol and others added 2 commits October 16, 2026 04:50
…e text in its report (Part of #4726)

The feature inventory's scan core and the era tagger move into the package (gitgalaxy/tools/readiness/,
tests/tools keep shims and their CLIs; fixtures byte-identical). schema.project is the only path to a report
(closed vocabularies, names or keyed-hash labels, class-name reasons); offline.install guards the network in
the command and its galaxyscope child; the estate is only read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 16, 2026
@squid-protocol squid-protocol removed the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 16, 2026
…gitgalaxy/tools/readiness (Part of #4726)

schema.py reads the CICS command spec as its vocabulary: listed in test_cics_spec IMPORTERS. The readiness
package reads the scanned estate, so test_source_reads' rule 2 now covers it; the --options file goes
through read_source like estate_options.load_estate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 16, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 16, 2026 09:05
@squid-protocol
squid-protocol enabled auto-merge (squash) October 16, 2026 09:06
Comment on lines +14 to +21
from gitgalaxy.tools.readiness.inventory import ( # noqa: E402, F401
census_lines,
extract_sql_forms,
fallback_parse,
inventory_template,
process_program,
scan_estate,
)
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants