Skip to content

feat(tier1): attach SkillSpector reference-gap reasons to AE1 findings and summarize affected artifacts - #460

Merged
rng1995 merged 20 commits into
naren/port-tier1-skillspector-unmodeled-hook-criticalfrom
naren/port-tier1-skillspector-ae1-diagnostics
Nov 12, 2026
Merged

rng1995 merged 20 commits into
naren/port-tier1-skillspector-unmodeled-hook-criticalfrom
naren/port-tier1-skillspector-ae1-diagnostics

Conversation

@rng1995

@rng1995 rng1995 commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #459; merge that first.

The branch includes that base branch at 89ac385, which contains public main at 7ae25d2, by merge commits.

SkillSpector reports a High Incomplete referenced artifact analysis (AE1) finding at each line that names a file it did not completely inspect. From v2.12.0 the issue's evidence names the file, its disposition and the reasons the analysis stopped. main drops that evidence: the finding's suggestion is only Referenced artifact was not completely inspected plus SkillSpector's remedy, and its metadata keeps only skillspector_confidence. With SkillSpector before v2.12.0, which leaves pattern empty, the finding is titled Unknown (AE1) and tells the user to make the file available, although SkillSpector read part of it.

  • New src/skillevaluator/skillspector_references.py:
    • issue_diagnostics projects an AE1 issue's evidence into finding metadata: skillspector_evidence (target_path, target_disposition, up to 16 reasons with reason_code, phase, message, analyzers, lines and known limits, and reasons_truncated) and skillspector_occurrences (up to 128 reference lines, with skillspector_occurrences_truncated). Text with control characters is dropped, text is redacted with utils.redaction.redact_sensitive_text, and a path is kept only when it stays inside the scan (report_path, a lexical check, because the file may be missing). Limits are range-checked before any float check, so an integer too large for a float is dropped.
    • ReportNormalizer keeps, for one report, the redacted form of each distinct text and the in-scan form of each distinct path, and resolves the scan root at most once. A report whose many AE1 findings repeat the same lines and reasons is not redacted again for each one.
    • Before v2.12.0 the target comes from the finding text, such as scripts/helper.pl (partial), only when the issue's own location is inside the scan, and the reasons come from the ledger rows for that file. index_legacy_reference_reasons reads the ledger once per report. Without a matching row the finding keeps SkillSpector's suggestion and gets no evidence metadata; its name is still the rule's.
    • reference_suggestion names the file, its disposition and each reason, with reasons that differ only in the analyzer, the run time or the time budget joined into one. It leaves out the run time and the time budget (observed_seconds, limit_seconds) that SkillSpector records with a runtime_limit reason. SkillSpector sets limit_seconds to the part of the scan's time budget left when a step began, such as each file YARA did not reach or the dependency analysis of a lockfile, so both values differ from run to run. The suggestion is part of finding_id, which must stay the same across runs; the metadata keeps both values. SkillSpector's remedy is kept unless it is missing or the generic pre-v2.12.0 text; then a parse limit, a read error or any other reason gets its own remedy, and a truncated reason list never gets a specific one.
    • reference_summary, combine_reference_summaries, reference_summary_record and reference_summary_message count the files and distinct reference lines, total them over a folder, keep only the three count fields, and format the one line. The line says each finding names the artifact and any reasons SkillSpector gave, because a finding counts even when SkillSpector gave no reason.
  • src/skillevaluator/validators/security.py:
    • _convert_skillspector_issue names an AE1 with an empty or non-text pattern Incomplete referenced artifact analysis (AE1), adds the metadata above and uses the new suggestion when there is evidence. Other rules keep Unknown (...) and their metadata.
    • _process_skillspector_cli_result builds one ReportNormalizer and passes it, the report's analysis_completeness and the ledger index to each issue, then _record_skillspector_reference_summary sets skillspector_reference_summary (affected_artifacts, reference_occurrences, reference_occurrences_truncated). _run_skillspector records it again after merging the --llm stage, so a line reported by both stages counts once. _validate_with_applicability totals the counts of a folder's skills, as it does for skillspector_applicability.
    • The counts are not added to the result's messages. Reporters list a passing result's messages as passed checks, and a policy override or --verify-llm can pass a complete scan with AE1 findings.
  • src/skillevaluator/reporting/retained.py: retained_results copies skillspector_reference_summary through reference_summary_record, so the HTML and Markdown reports that CI renders again from the JSON report keep the count line of a failed result, and a malformed record is dropped.
  • src/skillevaluator/models/result.py: merge_with_prefix puts the skill's [name] prefix on skillspector_occurrences[].file, as it already does for occurrences, so a folder's JSON names the skill of each reference line. target_path stays relative to that skill.
  • Reporters show the line only for a failed result: reporting/cli.py prints it after the status line, console_ui.summarize_tier1 adds a references row, markdown.py adds a list item, and html.py adds a Jinja filter that report.html.j2 uses for a line above the Tier 1 results. cli.py, markdown.py and html.py import the formatter inside the method that uses it. json_reporter.py exports skillspector_reference_summary for every result, passed or failed, through reference_summary_record.
  • Docs: a paragraph on these findings and counts in docs/tier1-validation.mdx and a sentence in its Troubleshooting entry for valid helper scripts. CHANGELOG: an entry under Unreleased > Added. Both say that with SkillSpector before v2.12.0 the check name changes, so a severity_overrides entry keyed on SECURITY.Unknown (AE1) must use SECURITY.Incomplete referenced artifact analysis (AE1), and the SARIF rule ID changes with it. Both say the suggestion leaves out the run time and the time budget (observed_seconds, limit_seconds), and the CHANGELOG says each AE1 finding_id changes once because the suggestion text is new.

Why

Each AE1 finding names the line that references the file and SkillSpector's generic remedy, but not why the analysis stopped. Users had to match it by hand against the INCOMPLETE error, which lists at most three ledger rows.

  • skillevaluator security-scan with SkillSpector v2.13.3 on PATH, on a skill whose Perl helper prints a string of 2,000 words (SkillSpector records static_parse_limit):
    • main and the base branch: Fix: Referenced artifact was not completely inspected Review the reported expression and analyzer's parsing limitation; ...
    • This branch: Fix: Referenced artifact scripts/helper.pl was not completely inspected (partial). static_parse_limit (static_patterns_tool_misuse): A security-relevant expression exceeded a bounded static parser's span limit. Review the reported expression ..., and the line skillspector could not completely inspect 1 referenced artifact(s) across 2 reference occurrence(s); each AE1 finding names the artifact and any reasons SkillSpector gave in the terminal, Markdown and HTML reports. The JSON report records the counts and the evidence. The result is still failed, with the same INCOMPLETE error.
  • SkillSpector v2.13.4 reports the same evidence for that skill, with a reworded reason message.
  • The captured v2.11.2 report of a skill that names scripts/helper.pl twice: on main the findings are Unknown (AE1) with Make the referenced artifact locally available and fully analyzable, or remove the reference. Here they are named, give static_parse_limit (static_patterns_tool_misuse) from the ledger row, and suggest checking the installed SkillSpector release.

Kept from public

Tests

  • New fixtures: real offline SkillSpector --no-llm reports with skill.source set to /fixture/<name>: v2.11.2 for a skill that names a Perl helper twice, v2.12.0 for a skill that names three helpers, and v2.13.3 for the 2,000-word Perl helper.
  • New tests/validators/test_skillspector_reference_diagnostics.py (77 tests): the three captured reports (names, suggestions, metadata and counts, with the 13 analyzers of one reason joined), with no count message in result.messages; the scan stays INCOMPLETE and failed; the --llm stage counts each reference once; rule naming for empty, blank and non-text patterns, and other rules unchanged; bounds and sanitization of reasons, limits and occurrences, including limits beyond the count or float range, and a scan whose limit is 10**400 still returns its result; two runtime_limit reasons that differ only in observed_seconds and limit_seconds (a fixed limit, a lockfile's budget left, and a YARA budget left with a run time of 0) give the same suggestion and finding_id, the metadata keeps both values, a size limit beside them stays in the suggestion, and such reasons are described once; redaction; one report of 50 AE1 findings with 128 absolute reference lines and 16 reasons each redacts each distinct text once and resolves the scan root once; a finding with no reasons is counted and the line claims none; paths outside the scan, absolute paths under and outside the scan root, and unknown dispositions; ledger reasons only for an in-scope target and source, read-error remedies, unreadable structured targets, and one ledger pass for 100 repeated findings; truncated reasons never claim one remedy and keep SkillSpector's.
  • New tests/reporting/test_skillspector_reference_summary.py (24 tests): the line appears once in the CLI, compact terminal, Markdown and HTML reports of a failed skill and folder, and JSON exports the counts; the result that retained_results rebuilds from the JSON report keeps the counts, and its Markdown report and the render_retained_report HTML show the line once, while four malformed records are dropped there; two copies of one reference line whose reasons differ only in the run time and the time budget are one unique finding in the JSON finding_groups; in a folder each exported reference line carries its skill's prefix; a cut occurrence list reads at least 256; a passing result shows no line, including a complete scan whose AE1 findings apply_policy lowers, where JSON still has the counts; for a report before v2.12.0 an override of SECURITY.Incomplete referenced artifact analysis (AE1) passes the check and one of SECURITY.Unknown (AE1) does not; malformed counts are neither shown nor exported; the export keeps only the count fields; folder totals skip malformed children.
  • New tests/validators/test_skillspector_ae1_contract.py (3 tests, integration marker, skipped unless skillspector.graph v2.13.1 or later is importable): an inert Perl help string, system("rm -rf /") and the 2,000-word string. The default run deselects them, and with -m integration they are skipped here because the test environment has no SkillSpector. The same three cases, run through skillspector.graph v2.13.3 and _process_skillspector_cli_result in a script, give the expected results.
  • Fail-before: on the base branch at 89ac385 both new test modules fail at import (2 collection errors). With only skillspector_references.py added to the base branch's src/ and a no-op _record_skillspector_reference_summary, they give 61 failed and 40 passed. Of the 40, 11 call the new module's helpers directly; the other 29 pin what stays the same: an AE1 with an out-of-scope, unreadable or unknown-disposition target gets no evidence, malformed counts show nothing, other rules and a given AE1 pattern keep their names, and two copies of a line that differ only in the run time and the time budget stay one unique finding, as on main. On the branch before the time-budget fix (8bef506), 6 of the 101 fail: the three run-time and time-budget cases, the size-limit test, the described-once test and the unique-finding test. On the branch before the run-time and retained-report fixes (1153394), 8 fail: those 6, the limits assertion of the sanitization test and the retained report test; the four malformed retained records were already dropped there.
  • This branch's three new modules: 101 passed, 3 deselected (the integration cases; with -m integration, 3 skipped).
  • The base branch's test modules on this branch (tests/validators/test_skillspector_hook_surface.py, test_security.py, test_skillspector_scope.py, test_base.py, tests/test_commands.py, tests/golden/; -n 4): 2067 passed, 1 skipped.
  • The modules for the files that both this branch and the merge of the base branch changed, the tests fix(ci): apply reviewed baselines and preserve scan completeness evidence #453 and fix(reporting): let default Tier 3 runs with a baseline pass publication #332 added, and the CHANGELOG and docs readers (tests/reporting, tests/validators, which holds every test_security* module and this branch's two validator modules, tests/models/test_result.py, tests/golden, tests/test_commands.py, tests/ci/test_prepare_security_baselines.py, test_run_tier1.py, test_evaluate_workflow.py, test_gitlab_template.py, tests/test_ci_workflows.py, tests/test_oss_packaging.py, tests/test_ci_change_classifier.py; -n 4): 7292 passed, 2 skipped, 5 failed. The 5 are the tests/ci/test_prepare_security_baselines.py cases that start python -I (below).
  • Full suite (-n 6): 27950 passed, 35 skipped, 10 failed. The 10 fail the same way on main 7ae25d2. Five are the tests/ci/test_prepare_security_baselines.py cases from fix(ci): apply reviewed baselines and preserve scan completeness evidence #453 that run ci/prepare_security_baselines.py with python -I: here that imports the installed SkillEvaluator, which has no skillevaluator.utils.structured_data. Three are tests/ci/test_all_tier_preflight.py::test_actual_workflow_bootstrap_ignores_consumer_pythonpath and the two cases of tests/ci/test_feedback.py::test_isolated_feedback_launcher_uses_trusted_siblings_from_any_consumer_directory. They start python -I, which ignores PYTHONPATH, so here they cannot import the checkout's ci package. The other two are sidecar cases in tests/test_harbor_secure_docker_environment.py, which here stop with Docker Compose interpolation variable ... requires protected execution state (HELPER_IMAGE, CUSTOM_HOST_IP).
  • ruff check (0.15.20) is clean on the changed Python files. ruff format --check passes on every changed file except security.py, where it reports the same 27 hunks as the base branch at 89ac385 (main 7ae25d2 reports 28), none in this PR's lines. scripts/check_oss_boundary.py passed.

🤖 Generated with Claude Code

rng1995 and others added 19 commits November 9, 2026 12:43
… not inspected

SkillSpector reports a High AE1 (incomplete referenced artifact analysis)
finding at each line that names a file it did not completely inspect. The
finding said only "Referenced artifact was not completely inspected", so the
reason had to be matched by hand against the incomplete-analysis error. With
SkillSpector before v2.12.0 it was titled "Unknown (AE1)" and suggested
making the file available although SkillSpector had read part of it.

The new skillspector_references module projects the finding's evidence:
the target, its disposition and up to 16 reasons, read from the ledger rows
of earlier releases, with bounded, redacted text and paths kept only inside
the scan. The suggestion names the file and each reason, and the result
counts the files and reference lines in skillspector_reference_summary and
one message, also across the --llm stage and a folder of skills. Severities,
completeness and gates are unchanged.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…led Tier 1 reports

When the security check fails, the full and compact terminal output, the
Markdown report and the HTML report add one line that counts the files
SkillSpector did not completely inspect and the lines that name them. The
JSON report records the counts in skillspector_reference_summary, with only
its three count fields.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ings

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A reason's limit that is an integer beyond the float range raised
OverflowError in math.isfinite, so the scan returned no result. Check
the type and range first and call math.isfinite only for floats, so such
a limit is left out like any other out-of-range value.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The count of incompletely inspected referenced artifacts was also added
to the result's messages. A policy that lowers the AE1 findings, or
--verify-llm, can pass a complete scan, and reporters list a passing
result's messages as passed checks, so the Markdown, HTML and terminal
reports showed the count as a success. Every reporter already renders
the line from the skillspector_reference_summary metadata, and only for
a failed result, so the message is dropped. JSON still records the
counts for every result.

Also pin that a severity override for a SkillSpector report before
v2.12.0 matches the rule's name, not "Unknown (AE1)".

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eport

Every reference line and reason of every AE1 finding went through
redaction, and every absolute path resolved the scan root again. A
report with thousands of AE1 findings that repeat the same lines took
seconds instead of a fraction of one.

ReportNormalizer keeps, for one report, the redacted form of each
distinct text and the in-scan form of each distinct path, and resolves
the scan root at most once. _process_skillspector_cli_result builds one
and passes it to the ledger index and to every issue it converts.
report_path keeps its behavior for a single path.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… results

merge_with_prefix put the skill's [name] prefix on each finding's path
and on the PII scan's metadata occurrences, but not on the
skillspector_occurrences of an AE1 finding. In a folder report a JSON
reader could not tell which skill a listed reference line was in
without the finding's own path. Prefix those lines the same way; the
referenced file's target_path stays relative to the named skill.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… gave

The count line ended "each AE1 finding names the artifact and why its
analysis stopped", but a finding counts whenever SkillSpector names its
file, even with an empty reason list and no ledger row for the file.
Say instead that each finding names the artifact and any reasons
SkillSpector gave.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…kdown use it

The module-level imports in reporting/cli.py and reporting/markdown.py
sat in the same import slot that several open pull requests also add
to, so each of those merges would conflict on one line. Import
reference_summary_message inside the method that uses it, as html.py
already does.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With SkillSpector before v2.12.0 the AE1 check name changes from
"Unknown (AE1)" to "Incomplete referenced artifact analysis (AE1)", so
a severity_overrides entry keyed on the old name no longer matches and
the SARIF rule ID changes. Say so in the CHANGELOG and the Tier 1 docs,
and soften "gates are unchanged" to the one case where a gate can
change. Also say that JSON records the counts for every result, while
the other reports show them only for a failed one.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…environment

Two sibling port branches add a filter after skip_reason, where this
branch also added one, so each merge conflicted on one line. Register
skillspector_reference_summary before the other filters instead.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A finding's suggestion is part of its finding_id, which the docs say stays
the same across runs. The AE1 suggestion listed every limit of a reason,
including observed_seconds, the wall-clock time SkillSpector records with a
runtime_limit reason. Each run of a scan that hit the runtime budget gave
the finding a new finding_id, and with --llm the two stages' copies of one
reference line counted as two unique findings when the second stage was
incomplete.

The suggestion now leaves out observed_seconds; the finding's metadata still
records it. Reasons that differ only in the run time are described once.
The CHANGELOG notes that AE1 finding_id values change once because the
suggestion text is new.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ined JSON

CI renders its HTML and Markdown reports again from the JSON report through
retained_results, which rebuilds each result's metadata from named fields.
skillspector_reference_summary was not one of them, so a failed Tier 1
result lost the count line in every report that CI published, although the
docs and the CHANGELOG say the Markdown and HTML reports show it.

retained_results now copies the record through reference_summary_record,
so only valid counts are kept and a malformed record is dropped. The hunk
sits after the scanners block, apart from the lines that open PRs #333 and
#349 change in this function.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…into naren/port-tier1-skillspector-ae1-diagnostics

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ostics

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
SkillSpector sets a runtime_limit reason's limit_seconds to the part of
the scan's time budget left when the step began: for each file that
YARA did not reach and for the dependency analysis of a lockfile. The
value differs from run to run like observed_seconds, so an AE1 finding
with such a reason got a new finding_id on every run.

Leave every *_seconds limit out of the suggestion and its grouping key.
The finding's metadata keeps both values.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… them

The sentence on the AE1 counts followed the paragraph on reference and
target roots, so "the same way" read as the target-root rule. It now
sits in the paragraph on the applicability counters.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…into naren/port-tier1-skillspector-ae1-diagnostics

The base branch now contains public main d717f22.

Conflicted: CHANGELOG.md only. Under Unreleased > Added, main's entry
on repository CI onboarding (#443) and this branch's AE1 entry were both
appended after the OpenClaw entry. Both are kept, main's first and this
branch's AE1 entry after it. Released sections match main.

Merged without conflict although both sides changed them:
docs/tier1-validation.mdx, src/skillevaluator/reporting/cli.py,
reporting/html.py, reporting/markdown.py and
reporting/templates/report.html.j2. This branch's additions there are
unchanged on top of main's reporting changes.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n/port-tier1-skillspector-ae1-diagnostics

The base branch now contains public main 7ae25d2, with #453 (reviewed baselines
and the SkillSpector 2.13.3 missing-reference caveat), #332 and #448.

Conflicted, each only in the import block:
- src/skillevaluator/validators/security.py: main's import of
  reference_caveat_metadata and this branch's import of the AE1 helpers
  from skillspector_references are both kept, in sorted order.
- src/skillevaluator/reporting/json_reporter.py and
  reporting/retained.py: main's import of
  sanitize_reference_caveat_metadata and this branch's import of
  reference_summary_record (and REFERENCE_SUMMARY_KEY) are both kept.

The code below the imports merged without conflict. main's export and
retained-report check of skillspector_reference_caveats and this
branch's skillspector_reference_summary lines are both kept, a few
blocks apart in each file. The caveat finding has no AE1 evidence, so
the AE1 counts do not include it.

Merged without conflict although both sides changed them: CHANGELOG.md
(main's #453 and #332 entries under Unreleased > Fixed, this branch's
AE1 entry under Added, where it was) and docs/tier1-validation.mdx.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the full production diff, AE1 evidence/path normalization and bounds, legacy-ledger indexing, stable finding identities, stage/folder aggregation, retained JSON reconstruction and all report consumers. No additional actionable findings. Merged the updated #459 base without conflicts, carrying the #457 wildcard coverage fix and repaired docs link. All109 selected AE1 diagnostics/reporting/wildcard tests pass under locked dependencies; full src/tests Ruff lint passes. Pinned Fern5.121 check passes with0errors and1existing configuration warning. Opt-in live SkillSpector integration contracts were not run. Signed-off integration pushed normally; remains stacked on #459 and open/unmerged.

@rng1995
rng1995 merged commit dc65c95 into naren/port-tier1-skillspector-unmodeled-hook-critical Nov 12, 2026
25 checks passed
@rng1995
rng1995 deleted the naren/port-tier1-skillspector-ae1-diagnostics branch November 12, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant