Record Class FileRecord

java.lang.Object
java.lang.Record
com.tnsai.quality.security.harness.FileRecord
Record Components:
path - relative to the project root
contentHash - SHA-256 of file bytes; bumping invalidates cached findings + agent runs
candidateMatchers - ids of the matchers that fired during scan
findings - all findings, deduplicated by ReviewFinding.id()
runs - history of ReviewAgentSpi invocations on this file
metadata - free-form key/values

public record FileRecord(Path path, String contentHash, Set<String> candidateMatchers, List<ReviewFinding> findings, List<AgentRun> runs, Map<String,String> metadata) extends Record
Per-file canonical state in the code-review pipeline (TNS-291).

Owns three things:

  1. Identity — relative path + content hash. Two records for the same path with different content hashes are different entries; the state store keeps the latest.
  2. Candidate matchers — ids of the MatcherSpis that fired during scan; tells the process stage which agent prompts to use.
  3. Aggregated findings + agent-run history — what the pipeline has discovered + how it discovered it.
Since:
0.10.0 (TNS-291)
  • Constructor Details

    • FileRecord

      public FileRecord(Path path, String contentHash, Set<String> candidateMatchers, List<ReviewFinding> findings, List<AgentRun> runs, Map<String,String> metadata)
      Creates an instance of a FileRecord record class.
      Parameters:
      path - the value for the path record component
      contentHash - the value for the contentHash record component
      candidateMatchers - the value for the candidateMatchers record component
      findings - the value for the findings record component
      runs - the value for the runs record component
      metadata - the value for the metadata record component
  • Method Details

    • scanned

      public static FileRecord scanned(Path path, String contentHash, Set<String> matchers)
      Empty record for a file that has been scanned but not yet processed. The scan stage emits this shape; subsequent stages append to it.
    • withFinding

      public FileRecord withFinding(ReviewFinding finding)
      Add a finding; returns a new record (records are immutable).
    • withRun

      public FileRecord withRun(AgentRun run)
      Append an agent run to history.
    • 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.
    • path

      public Path path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • contentHash

      public String contentHash()
      Returns the value of the contentHash record component.
      Returns:
      the value of the contentHash record component
    • candidateMatchers

      public Set<String> candidateMatchers()
      Returns the value of the candidateMatchers record component.
      Returns:
      the value of the candidateMatchers record component
    • findings

      public List<ReviewFinding> findings()
      Returns the value of the findings record component.
      Returns:
      the value of the findings record component
    • runs

      public List<AgentRun> runs()
      Returns the value of the runs record component.
      Returns:
      the value of the runs record component
    • metadata

      public Map<String,String> metadata()
      Returns the value of the metadata record component.
      Returns:
      the value of the metadata record component