Skip to content

Detection hardening: EQU-only .asm copybooks misclassify as assembly (hlasm discriminator gap) #3110

Closed

Description

@squid-protocol

Found by a real-repo plausibility audit of a galaxyscope scan of IBM's zopeneditor-sample (COBOL/PL-I/JCL/HLASM/REXX mainframe sample corpus), run against engine main just after REXX #2504 merged (PR #3107).

What the scan shows

ASMCOPY/REGISTRS.asm is a 19-line HLASM register-equate copybook — R0 EQU 0 through R15 EQU 15, name field in column 1, no colon after the name. It classifies as x86/ARM assembly, decided at Tier 1.5 by the "Ecosystem Consensus Lock (75% Local Dominance)".

The neighbours show the discriminator working everywhere except this shape:

file content outcome
ASM/ASAM1.asm carries CSECT/USING/AMODE correctly resolves hlasm at Tier 2 via the #2503 internal_discriminator
ASM/[email protected] 6,432-line RACF exit excluded by the lexical-monotony guard
ASMCOPY/REGISTRS.asm EQU-only equate copybook misclassified assembly

The gap is specifically EQU-only members: they carry none of the discriminator's tokens (CSECT/DSECT/RSECT/AMODE/RMODE/USING/LTORG/MEND/DFHEIENT/DFHEIRET), so Tier 2 never fires and gravity decides.

The design tension (to adjudicate here, not pre-decided)

The obvious widening is the name-field EQU shape ^name[ \t]+EQU[ \t] — HLASM equates have no colon after the name. But MASM also writes colon-less NAME EQU value, so a naive single-line EQU alternative could flip real x86 MASM equate files to hlasm. Candidate mitigations for the implementer to weigh:

  1. Register-equate idiom specifically: ^R[0-9]{1,2}[ \t]+EQU[ \t]+[0-9]{1,2}\b, requiring multiple hits — the single most common HLASM copybook shape.
  2. N distinct EQU lines plus absence of x86 markers (.model, section, %macro, mov/rax).
  3. Leave Tier 2 alone and teach the gravity path that a mainframe-sibling folder (.cbl/.jcl/.pli neighbours — this repo has all of them) outweighs same-extension neighbours.

Impact

Cosmetic-to-minor today — EQU copybooks carry near-zero signal mass — but it is a wrong-language identity on a canonical IBM sample, and hlasm's per-language rules never run on the file.

Cross-references: #2503 (built the internal_discriminator this widens), #2504 / PR #3107 (the batch/.cmd sibling of this mechanism), closed epic #2516.

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-engineenhancementlegacy-modernization

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions