Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ad82f63
feat(reporting): reconcile stable finding IDs across report formats
rng1995 Oct 30, 2026
7131ab7
Merge main into naren/port-stable-finding-ids
rng1995 Nov 2, 2026
6bd6dcc
fix(ci): refresh finding IDs even when no credential token was collected
rng1995 Nov 2, 2026
380bef2
fix(models): keep finding_id stable when a message repeats its location
rng1995 Nov 2, 2026
c3db20f
fix(reporting): count each location a folded PII finding lists
rng1995 Nov 2, 2026
39b3c78
fix(reporting): do not count workflow scope notes as warnings without…
rng1995 Nov 2, 2026
390980f
fix(reporting): merge HTML skill entries only within one finding_id
rng1995 Nov 2, 2026
0de9945
test(reporting): pin path separators, missing lines and severity esca…
rng1995 Nov 2, 2026
04454d1
docs: note that HTML summary.total_issues now counts unique findings
rng1995 Nov 2, 2026
139fd23
Merge main into naren/port-stable-finding-ids
rng1995 Nov 3, 2026
b8ef88e
fix(reporting): keep folder and plugin locations consistent in findin…
rng1995 Nov 3, 2026
9260978
refactor(reporting): drop the unused advisory_results list
rng1995 Nov 3, 2026
d7bd2b1
fix(reporting): prefix folded PII locations in merged results; trim o…
rng1995 Nov 3, 2026
b025f7e
Merge origin/naren/port-stable-finding-ids into naren/port-stable-fin…
rng1995 Nov 3, 2026
6c495f1
Merge main into naren/port-stable-finding-ids
rng1995 Nov 3, 2026
5c4d0c6
fix(ci): render the redacted HTML report from the refreshed JSON
rng1995 Nov 3, 2026
adad33d
fix(models): match a Windows message location against a posix file path
rng1995 Nov 3, 2026
ddc8b92
Merge main into naren/port-stable-finding-ids
rng1995 Nov 3, 2026
407455b
Merge origin/main into naren/port-stable-finding-ids
rng1995 Nov 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,30 @@ All notable changes to SkillEvaluator are documented in this file.
the selection as `case_selection`, and a run that skipped cases is reported
as publication-incomplete in JSON, HTML, and BENCHMARK.md.

- Every finding now has stable IDs for tracking across runs and validators.
`finding_id` (`SEF-…`) is derived from the finding's category, check,
message, and suggestion, so it survives line moves, whitespace or case
changes, and severity overrides. Location text a check copies into its
message is left out of it: the `in <file>:<line>` in a secret detection
message and the `— N occurrences (…)` list a PII scan message ends with.
A file name in a message, as script lint writes, stays part of the ID.
`occurrence_id` (`SEO-…`) adds the file, line, and line content. Identical findings in different files or skills
share one `finding_id`, so they count as one unique finding with one
occurrence per location. When CI redacts a detected credential from a
report, it recomputes the IDs from the redacted text, so no ID is derived
from a removed value. The JSON report and the HTML report's embedded data
add `finding_counts` (raw records, distinct occurrences, unique findings,
and duplicates removed), `finding_groups` (each unique finding with its
validators and every location, including each location a PII finding
lists for a repeated value), and `message_counts` (error and warning
strings with no finding behind them, such as failed gates and scanner or
execution errors, but not the workflow scope note for a stage that
configuration skips, plus informational messages other than the `[OK]` line
recorded for each passed check); each JSON result also carries its own
`finding_counts`. Markdown adds a Finding Reconciliation table, most severe
first, and per-finding IDs. `total_errors`, `total_warnings`, and
`severity_counts` are unchanged.

### Changed

- Hosted GitHub reports verify a separate GitHub-signed execution receipt.
Expand Down Expand Up @@ -171,6 +195,25 @@ All notable changes to SkillEvaluator are documented in this file.
environment, so each template compiles once per process instead of once per
report.

- The Markdown summary and the HTML report's summary now count findings the
same way: each unique finding once, at its highest severity, however many
lines, files, skills or validators report it. Markdown's Total Issues adds
distinct occurrences, raw records, and errors and warnings with no finding
behind them, such as failed gates and incomplete scans; its severity
breakdown counts unique findings. In HTML, the tier cards, the Tier 1
Findings and Blocking critical + high numbers, the verdict sentence, the
skill finding badges and the gate policy line count unique findings, and
the Findings number shows the same occurrence, raw-record and no-finding
counts beneath it when they differ from the unique count. Both formats used
to add up raw records, so a finding reported on several lines or by two
validators counted more than once. The HTML report's embedded and exported
data changes `summary.total_issues` the same way: it now counts unique
findings plus errors and warnings with no finding behind them, instead of
raw errors plus warnings; the raw finding count is in
`summary.raw_finding_occurrences` and `finding_counts.raw_occurrences`. The
JSON `skills[].issue_count`, contributor totals, `total_errors`,
`total_warnings` and `severity_counts` still count raw records.

### Documentation

- Give the performance dashboard its own sidebar guide, retain the previous
Expand Down
7 changes: 7 additions & 0 deletions ci/publish_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,13 @@ def read_artifact(payload: bytes) -> tuple[dict, dict[str, dict]]:
redactor = Redactor(tokens)
summary = redactor.object(summary)
reports = redactor.object(reports)
from skillevaluator.reporting.finding_summary import refresh_finding_identities

# IDs hashed from the unredacted text could confirm a guessed value.
# Refresh even without collected tokens: the redactor also masks
# database userinfo that no token names.
for report in reports.values():
refresh_finding_identities(report)
validate_summary(summary)
for row in summary["skills"]:
if row["overall_status"] != "error":
Expand Down
6 changes: 6 additions & 0 deletions ci/secret_redaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from pathlib import Path

from skillevaluator.reporting import MarkdownReporter, SARIFReporter
from skillevaluator.reporting.finding_summary import refresh_finding_identities
from skillevaluator.reporting.retained import retained_results
from skillevaluator.utils.secret_redaction import SENSITIVE_PII_CATEGORIES, Redactor, sensitive_values
from skillevaluator.utils.secure_fs import SecureRoot
Expand Down Expand Up @@ -148,6 +149,11 @@ def sanitized_outputs(raw: Path, tokens: set[str]) -> dict[str, bytes]:
text = content.decode("utf-8")
if name.endswith(".json"):
document = redactor.object(json.loads(text))
if isinstance(document, dict):
# IDs hashed from the unredacted text could confirm a guessed
# value. Refresh even without collected tokens: the redactor
# also masks database userinfo that no token names.
refresh_finding_identities(document)
text = json.dumps(document, ensure_ascii=True, allow_nan=False, indent=2)
else:
text = redactor.text(text)
Expand Down
43 changes: 41 additions & 2 deletions docs/ci-integration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,49 @@ When the exit code is not enough — dashboards, custom thresholds, badge genera
| `results[].publication_evidence` | object | Validated built-in Tier 1 or Tier 2 producer contract: schema version, producer, tier, and canonical check ID |
| `tier3.run_id` | string | Run-owned Tier 3 identity; duplicated in the Tier 3 summary for consistency checks |
| `severity_counts` | object | Totals for `critical`, `high`, `medium`, `low` |
| `total_errors`, `total_warnings` | number | Aggregate counts across all validators |
| `skills` | array | Per-skill `{ name, passed, issue_count }` |
| `total_errors`, `total_warnings` | number | Raw error and warning records across all validators; a finding that two validators report counts twice |
| `finding_counts` | object | Reconciled counts: `raw_occurrences`, `distinct_occurrences`, `unique_findings`, `duplicates_removed`, `occurrences_grouped`, `raw_by_severity`, `unique_by_severity` |
| `finding_groups` | array | One entry per unique finding: `finding_id`, highest `severity`, `message`, `validators`, and every location in `occurrences[]` with its `occurrence_id`, including each location a finding lists in `metadata.occurrences` when its check folds repeats of one value into it (the PII scan does) |
| `message_counts` | object | `independent_errors` and `independent_warnings`: error and warning strings with no finding behind them, such as `gate_failures` and scanner or execution errors (strings that mirror a finding, and the `Workflow scope:` note for a stage that configuration skips, are not counted); `informational`: informational messages, not counting the `[OK]` line recorded for each passed check |
| `results[].findings[].finding_id`, `results[].findings[].occurrence_id` | string | Stable finding and location identities (see below) |
| `skills` | array | Per-skill `{ name, passed, issue_count }`; `issue_count` counts raw finding records |
| `quality_summary` | array | Quality details with `overall_score` (0–100) and `grade` (A–F); a folder target reports the collection average plus a `skill_count` |

Every finding carries two stable IDs. `finding_id` (`SEF-` plus 20 hex
characters) hashes the finding's category, check name, message, and suggestion,
ignoring case and extra whitespace. It does not change when the finding moves
Comment thread
rng1995 marked this conversation as resolved.
Resolved
to another line or file, or when a policy changes its severity, so you can
track a finding across runs. Location text that a check also writes into its
message is left out of the hash: the `in <file>:<line>` in a secret detection
message, and the `— N occurrences (…)` list that the PII scan appends when it
folds repeats of one value into one finding. Other message text stays part of
the ID; script lint names the script in its messages, so the same lint problem
in two scripts has two `finding_id` values. `occurrence_id` (`SEO-…`) adds the file path,
line number, and line content, so it identifies one location.
`finding_groups` groups findings by `finding_id` across validators, and each
result in `results[]` carries its own `finding_counts`. Identical findings in
different files or skills share one `finding_id`, so they count as one unique
finding with one occurrence per location. When the CI templates redact a
detected credential from a report, they recompute the IDs and groups from the
redacted text, so no ID is derived from a removed value; such a finding's IDs
differ from a local run's.

The Markdown summary and the HTML report count findings the same way: each
unique finding once, at its highest severity. Markdown's Total Issues also
shows distinct occurrences, raw records, and the `independent_errors` and
`independent_warnings`, so a run that fails a gate or leaves a scan
incomplete without any finding is not reported as zero issues. In HTML, the
tier cards, the Tier 1 Findings and Blocking critical + high numbers, the
verdict sentence, the skill finding badges and the gate policy line count
unique findings, and the Findings number shows the same breakdown beneath it
when it differs from the unique count. The HTML report's embedded data, which
Export JSON saves, counts `summary.total_issues` the same way: unique findings
plus `independent_errors` and `independent_warnings`, where it used to add up
raw errors and warnings. Its raw finding count is in
`summary.raw_finding_occurrences` and `finding_counts.raw_occurrences`.
`total_errors`, `total_warnings`, `severity_counts`, `skills[].issue_count` and
contributor totals still count raw records.

`overall_status` and `overall_passed` describe the configured command gate. They
can be green when an advisory tier did not run, so do not use them as a
publication signal. Require `publication_status == "pass"` (or
Expand Down
16 changes: 12 additions & 4 deletions docs/reports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,18 @@ the evidence below it:
repeat a finding are folded away.
- **Run details.** Scope, the target path, provenance and the gate policy.

A finding is one problem a check reports at one location, with a severity. A
finding in a failed check blocks the verdict; a finding in a passed check is
advisory. A quality score below the configured minimum fails the Quality score
check, so it also blocks the verdict.
A finding is one problem a check reports, with a severity. The same problem
reported on several lines, or in several files or skills, counts once at its
highest severity; each location is an occurrence, including each line a
PII finding lists when one value repeats. When the unique, occurrence and
raw record counts differ, or when some errors or warnings have no finding
behind them, the findings number shows the occurrences, the raw records and
those errors and warnings beneath it, in the same words as the Markdown
report's Total Issues. The workflow scope note for a stage that configuration
skips, such as LLM checks under `--no-llm`, is not counted as a warning there. A finding in a failed check blocks the
verdict; a finding in a passed check is advisory. A quality score below the
configured minimum fails the Quality score check, so it also blocks the
verdict.

The HTML report, the CI index and the Pages history use the same verdict
words: **Passed**, **Changes required**, **Incomplete**, **Skipped** and
Expand Down
74 changes: 74 additions & 0 deletions src/skillevaluator/models/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from __future__ import annotations

import hashlib
from dataclasses import dataclass, field
from enum import StrEnum

Expand Down Expand Up @@ -129,6 +130,77 @@ def tag(self) -> str:
return f"[{self.category}-{self.severity.value.upper()}]"
return f"[{self.category}-{str(self.severity).upper()}]"

@staticmethod
def _normalize_identity_text(value: object) -> str:
"""Normalize human text without coupling identity to formatting."""
return " ".join(("" if value is None else str(value)).casefold().split())

def _identity_message(self) -> str:
"""Return the message without location text the finding records elsewhere.

Secret detection writes the finding's own ``in <file>:<line>`` into
its message, and the PII scan appends ``— N occurrences (...)`` when
it folds repeats of one value into a finding whose ``metadata``
lists them. Leaving that text out keeps ``finding_id`` stable when
lines move. Other text, such as a file name a check puts in its
message, stays part of the identity.
"""
message = "" if self.message is None else str(self.message)
if self.file_path is not None and self.line_number is not None:
message = message.replace(f" in {self.file_path}:{self.line_number}", "", 1)
occurrences = self.metadata.get("occurrences") if isinstance(self.metadata, dict) else None
if isinstance(occurrences, list) and len(occurrences) > 1:
marker = f" \u2014 {len(occurrences)} occurrences ("
index = message.rfind(marker)
if index >= 0 and message.endswith(")"):
message = message[:index]
return message

@property
def finding_id(self) -> str:
"""Return a deterministic semantic identity independent of location.

File and line belong to an occurrence. Excluding them, and any copy
of them in the message (see ``_identity_message``), lets reporters
group the same check across paths and validators while retaining every
concrete occurrence in the reconciliation contract. Severity is also
excluded, so a policy override or verifier downgrade keeps the ID.
"""
identity = "\x1f".join(
(
self._normalize_identity_text(self.category),
self._normalize_identity_text(self.check_name),
self._normalize_identity_text(self._identity_message()),
self._normalize_identity_text(self.suggestion),
)
)
digest = hashlib.sha256(identity.encode("utf-8"), usedforsecurity=False).hexdigest()[:20]
return f"SEF-{digest}"

def location_occurrence_id(self, file_path: object, line_number: object, line_content: object = None) -> str:
"""Return the occurrence ID this finding has at another location.

A check that folds repeats into one finding, such as the PII scan,
lists the other locations in ``metadata["occurrences"]``; reporters
give each of them an ID this way. At the finding's own location and
line content it equals ``occurrence_id``.
"""
identity = "\x1f".join(
(
self.finding_id,
("" if file_path is None else str(file_path)).replace("\\", "/"),
str(line_number) if line_number is not None else "",
self._normalize_identity_text(line_content),
)
)
digest = hashlib.sha256(identity.encode("utf-8"), usedforsecurity=False).hexdigest()[:20]
return f"SEO-{digest}"

@property
def occurrence_id(self) -> str:
"""Return a deterministic identity for this concrete location."""
return self.location_occurrence_id(self.file_path, self.line_number, self.line_content)

@property
def location(self) -> str:
"""Return formatted location like 'file.py:42'."""
Expand All @@ -145,6 +217,8 @@ def to_dict(self) -> dict:
"""Convert to dictionary for JSON serialization."""
severity_value = self.severity.value if isinstance(self.severity, Severity) else str(self.severity).lower()
return {
"finding_id": self.finding_id,
"occurrence_id": self.occurrence_id,
"category": self.category,
"severity": severity_value,
"check_name": self.check_name,
Expand Down
Loading
Loading