Skip to content

[Bug]: Suppression scanners miss time-prefixed case comments #1656

Description

@ben-ranford

Summary

The suppression scanners do not preserve command position after the shell time prefix. A following case command is not recognized, so its pattern closer can be mistaken for the command-substitution closer and a genuine adjacent suppression comment is missed.

Review evidence: #1650 (comment).

Reproduction steps

Run this source in zsh, then feed full contents and a changed-line patch for line2 into tracker scanPatch. Supply valid tracking metadata on the marker when checking record output.

v=$(time case x in
x)#nolint
printf hi;; esac)
printf %s "$v"

Expected behavior

The shell prints hi. The case-pattern comment on line2 requires metadata and a record from all three scanners.

Actual behavior

The tracker returns0records. Finishing time clears commandStart, so case remains ordinary command text and its pattern closer incorrectly ends the expansion. The review identifies the same state transition in the local and workflow AWK scanners; verify all-three parity during the fix.

Logs and output

zsh parse exit: 0
zsh execution exit: 0
zsh stdout: hi
tracker expected records: 1
tracker actual records: 0

Proposed scope and acceptance criteria

Targetv1.9.0, medium dialect grammar work. The preceding PR1650 compound-prefix design explicitly excluded time from its nine-token contract. Adding the bare token alone would leave option, command-position and dialect questions unresolved.

  • Define supported shells and time option behavior, including whether -p and dialect-specific options are accepted.
  • Recognize only eligible reserved-word positions; preserve quoted/escaped time, ordinary arguments and external-command uses as data where required by the selected shell grammar.
  • Detect real case-pattern comments after supported time prefixes within substitutions, groups and operator-separated command positions.
  • Preserve literal suffixes after completed substitutions and carry state across lines and full-file hunk seeding.
  • Keep tracker, local checker and trusted workflow verifier consistent; preserve source content, metadata and fingerprints.
  • Add bounded shell/version oracles and failing-before/passing-after regression cases for positive and negative controls.
  • Do not implicitly include coproc; it needs a separate scope decision.

Version / commit

Reviewed3650a227b39e13eb76f3fd3051d2e7829fb077c7; reproduced5971cbacb5818e9163c355e81175b14bf2149721.

Environment

macOS with bundled Bash/sh and zsh, Node.js. The exact snippets below parse and print hi in zsh; bundled older Bash/sh reject these unparenthesized case-in-substitution forms. Do not generalize this evidence to all shell versions. Tracker scanPatch uses a read-only mocked full-file API with a changed-line patch; no external issue writes occur in the reproduction.

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtarget-series:1.9.xRelease series targeting label

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions