Class ScanStage

java.lang.Object
com.tnsai.quality.security.harness.ScanStage
All Implemented Interfaces:
PipelineStage

public final class ScanStage extends Object implements PipelineStage
The scan stage (TNS-291). Walks the project root, runs every registered MatcherSpi against every (filtered) file, and persists a FileRecord for each file where at least one matcher fired.

Idempotent: re-running on an unchanged tree skips files whose stored contentHash still matches the on-disk file. The stored record's candidate-matchers set may grow if a new matcher has been added since the last run, but the agent runs / findings already on the record are preserved.

File walk respects two config knobs (read from PipelineContext.config()):

  • "scan.includeGlobs" — comma-separated list of glob patterns; defaults to common source extensions across the supported languages.
  • "scan.excludeGlobs" — comma-separated list of glob patterns to skip; defaults to common build / vendor directories.
Since:
0.10.0 (TNS-291)
  • Field Details

    • DEFAULT_INCLUDES

      public static final List<String> DEFAULT_INCLUDES
      Built-in default include globs.
    • DEFAULT_EXCLUDES

      public static final List<String> DEFAULT_EXCLUDES
      Built-in default exclude globs.
  • Constructor Details

    • ScanStage

      public ScanStage()
  • Method Details

    • id

      public String id()
      Description copied from interface: PipelineStage
      Stable id, e.g. "scan", "process".
      Specified by:
      id in interface PipelineStage
    • execute

      public StageResult execute(PipelineContext ctx)
      Description copied from interface: PipelineStage
      Execute the stage. Reads from / writes to ctx.stateStore().

      Stages SHOULD respect Thread.interrupted() — long-running stages (process, revalidate) check periodically so the pipeline can be cancelled cleanly.

      Specified by:
      execute in interface PipelineStage