Skip to content

Artifacts Lint: attribute Spectral findings per template and document the expected baseline - #685

Merged
rartych merged 2 commits into
camaraproject:mainfrom
hdamker:fix/artifacts-lint-annotation-surface
Aug 3, 2026
Merged

Artifacts Lint: attribute Spectral findings per template and document the expected baseline#685
rartych merged 2 commits into
camaraproject:mainfrom
hdamker:fix/artifacts-lint-annotation-surface

Conversation

@hdamker

@hdamker hdamker commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • bug

What this PR does / why we need it:

The Spectral step of the Artifacts Lint workflow (#673) linted all four templates in one invocation. Spectral loses the source file of most findings when several input documents share $ref targets (stoplightio/spectral#2640), so the step reported 9 problems in its summary, emitted 152 ::warning lines, and produced 10 annotations of which 3 pointed at . line 1 — while the two real findings in api-templates/sample-service.yaml had no annotation at all. Details and the reproduction in #684.

Spectral now runs once per template and the results are merged, which is what CAMARA Validation already does for the same reason. Six findings that the old view hid become visible, and the log, the annotations and the summary now describe one set of 15 findings instead of three different numbers:

  • .github/scripts/spectral_annotations.py merges the per-template JSON, deduplicates on (file, line, rule), emits the annotations, and prints a reconciliation table to the log and to the run summary.
  • The 10 findings that are the documented common-library baseline are collapsed into one notice annotation per source file, pointing at artifacts/linting_rules/README.md. The remaining 5 keep an individual annotation at their native severity.
  • The allowlist behind that split is read from validation/rules/spectral-rules.yaml in camaraproject/tooling (rule S-313 suppress_schema_paths) — added to the existing sparse-checkout rather than copied, so it cannot drift from what API repositories apply. Matching replicates the tooling semantics, including the dot-boundary prefix rule, so a newly added unconstrained string in a common schema still surfaces on its own.

Annotation budget, per step: 5 of 10 warning slots used, plus 2 notices — against 10 of 10 consumed by the baseline before this change, where a warning introduced by a pull request could go unannotated.

artifacts/linting_rules/README.md gains the expected-findings section from #676: all 15 findings with their rationale, keyed on schema path rather than line number so it does not go stale, and marked collapsed or individual so it can be checked against what the workflow actually annotates.

Which issue(s) this PR fixes:

Fixes #684
Fixes #676

Does this PR introduce a breaking change?

  • Yes
  • No

Special notes for reviewers:

Changelog input

 release-note
- Artifacts Lint: Spectral runs per template so findings keep their source file; annotations now cover the findings that need review, the documented baseline is collapsed into one notice per file, and the log and run summary report one reconciled count
- Documented the expected lint findings of the artifacts in artifacts/linting_rules/README.md

Additional documentation

docs
artifacts/linting_rules/README.md — new "Expected lint findings" section

hdamker added 2 commits July 29, 2026 21:12
Spectral loses the source file of most findings when several input
documents share $ref targets (stoplightio/spectral#2640), so one
invocation over all four templates reported 9 problems while emitting 152
unattributed warnings. Linting per template and merging the results
recovers all 15 real findings; the documented baseline is collapsed into
one notice per file so it no longer fills the annotation budget a pull
request needs.

@rartych rartych left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@PedroDiez PedroDiez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@bigludo7 bigludo7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@rartych
rartych merged commit 5f249e1 into camaraproject:main Aug 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants