Record Class ScanRun

java.lang.Object
java.lang.Record
org.egothor.methodatlas.ScanRun
Record Components:
runId - short hex correlation id, non-empty
startedAt - wall-clock time the run was started
toolVersion - implementation version or "dev"
configFingerprint - SHA-256 hex digest of the canonical configuration text; never null, never empty

public record ScanRun(String runId, Instant startedAt, String toolVersion, String configFingerprint) extends Record
Immutable record identifying one CLI invocation of MethodAtlas.

Created once at the top of MethodAtlasApp.run(String[], java.io.PrintWriter) and propagated through ScanRunContext so that every log record emitted during the run can carry the correlation id. This makes it possible to trace a single audit-trail artefact, a single SARIF file, or a single CI log slice back to the exact run that produced it.

Fields

  • runId — a short hex-encoded random id (16 hex characters); intentionally not a full UUID because the id appears in log lines and CSV preamble where 36-character UUIDs are noisy.
  • startedAt — wall-clock timestamp at run construction.
  • toolVersion — implementation version reported by the methodatlas JAR manifest; falls back to "dev" for developer builds.
  • configFingerprint — SHA-256 of a stable textual rendering of the parsed CliConfig. Lets two runs of the same configuration be correlated across time and machine boundaries.
Since:
1.0.0
  • Constructor Details

    • ScanRun

      public ScanRun(String runId, Instant startedAt, String toolVersion, String configFingerprint)
      Compact constructor enforcing the documented invariants on the component values.
  • Method Details

    • create

      public static ScanRun create(String toolVersion, String configText)
      Creates a new ScanRun with a freshly generated correlation id and the current wall-clock timestamp.

      The configFingerprint is the SHA-256 of configText, a stable textual rendering of the parsed CLI configuration. Two runs with byte-identical configuration produce the same fingerprint, letting operators correlate scans without sharing the full config.

      Parameters:
      toolVersion - implementation version, or "dev" for builds without a manifest version
      configText - canonical textual rendering of the parsed CliConfig; must not be null
      Returns:
      a fresh scan-run identifier
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • runId

      public String runId()
      Returns the value of the runId record component.
      Returns:
      the value of the runId record component
    • startedAt

      public Instant startedAt()
      Returns the value of the startedAt record component.
      Returns:
      the value of the startedAt record component
    • toolVersion

      public String toolVersion()
      Returns the value of the toolVersion record component.
      Returns:
      the value of the toolVersion record component
    • configFingerprint

      public String configFingerprint()
      Returns the value of the configFingerprint record component.
      Returns:
      the value of the configFingerprint record component