Skip to content

detector: slicer keyword buckets (dockerfile RUN, css keyframes) reach the duplicate/orphan checks as if they were functions #2728

Closed

Description

@squid-protocol

Found by the #2669 F.4 census. The #2547 shape again, this time in the duplicate check.

_is_synthetic_satellite_name (detector.py L830) recognises <KEYWORD>_Statement plus a short literal list. Mode D/E buckets that are bare keywords are not matched, so they enter both the duplicate and the orphan check as ordinary functions:

dockerfile/b.dockerfile  ['RUN','RUN','RUN','RUN','RUN']
dockerfile/a.dockerfile  ['RUN','RUN','HEALTHCHECK']
css/a.css                ['keyframes','keyframes','keyframes']
yaml/a.yaml              ['run','run','run',...]

Consequences measured on the corpus:

  • state_slop_duplicates = 1 for dockerfile — four RUN slices with materially identical bodies are recorded as copy-pasted logic. It is the only nonzero duplicate cell in 46 languages, and it is a phantom.
  • keyframes (9 chars, 3 occurrences) suppresses css's orphan count by the token test; run (3 chars) fails len > 3 in yaml. Neither is a real identifier either way.

Fix shape

#2691 already stamps func["is_synthetic_slice"] on every function at the one place they all pass through. Read that flag in the duplicate/orphan guard instead of re-deriving synthetic-ness from the name in a second place:

if func_name and not func["is_synthetic_slice"] and not _is_synthetic_satellite_name(func_name):

That requires _UNCOUNTABLE_SLICE_NAMES to grow the igniter-keyword buckets the slicer actually emits (RUN, CMD, HEALTHCHECK, keyframes, media, supports, container, run) — worth generating from the slicer's own igniter table rather than hand-listing, so the two cannot drift. Note the existing comment at L811 on why the broad helper is wrong for the population count: Main collides with a real function name. That argument does not apply to a generated igniter list.

Part of #2669 (F.4); sibling of #2727.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-engine

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions