Skip to content

AP-1522 Align SonarJava agent-facing documentation - #6595

Draft
erwan-leforestier-sonarsource wants to merge 7 commits into
masterfrom
ap/AP-1522
Draft

erwan-leforestier-sonarsource wants to merge 7 commits into
masterfrom
ap/AP-1522

Conversation

@erwan-leforestier-sonarsource

@erwan-leforestier-sonarsource erwan-leforestier-sonarsource commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Part of https://sonarsource.atlassian.net/browse/AP-1522

  • Align SonarJava agent-facing documentation.

Summary by Gitar

  • Agent documentation restructure:
    • Replaced the monolithic AGENTS.md and CUSTOM_RULES_101.md with topic guides under docs/systems/ and docs/custom-rules/
    • Added .agents, .claude, .cursor skill adapters and .gitar/rules files pointing to canonical sources
  • Documentation tooling:
    • Added .github/scripts/check_docs.py and docs_commands.py with a docs.yml workflow to validate links, frontmatter and Maven/mise commands
  • Build tasks:
    • Added mise.toml and scripts/mise/ helpers and updated README.md to link the new guides
  • Javadoc links:
    • Linked public API Javadoc in CheckVerifier, IssuableSubscriptionVisitor and related classes to the new docs

This will update automatically on new commits.

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

AP-1522

Comment thread .agents/skills/new-rule/SKILL.md Resolved
@datadog-sonarsource

datadog-sonarsource Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Pipelines

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 2b3f620 | Docs | Give us feedback!

@erwan-leforestier-sonarsource

Copy link
Copy Markdown
Contributor Author

Regarding the workflow and license findings in #6595 (comment):

  • Fixed the documentation runner and package registry settings in 7716093. The job uses sonar-xs-public, config-npm@v2, and the shared documentation action with config-pip@v2. Package installation now uses Repox.
  • The LGPL license expectation does not match this repository. Before this PR, both LICENSE.txt and the root POM already declared SSALv1 at f56e378. This PR does not change the license. The new license guide describes those existing files.
  • Restored the rule delivery requirements in f8cf028; see the reply on the original review thread.

Local validation: nine tests pass, the full documentation check passes, and Markdown lint reports no errors. CI is running on 7716093.

Comment thread .github/actions/check-docs/action.yml Resolved
Comment thread .github/actions/check-docs/action.yml Resolved
@erwan-leforestier-sonarsource

Copy link
Copy Markdown
Contributor Author

Regarding #6595 (comment):

  • Fixed the documentation job setup in 2b3f620. It now uses sonar-xs. It supplies the workflow run number to the registry actions through their supported BUILD_NUMBER input environment. This job publishes no artifacts and no longer needs to allocate a repository build number. Repository contents permission remains read-only.
  • Fixed both new review suggestions in 86e9cc3 and 18a15a8. The original threads contain the validation results.
  • The release-trigger report is incorrect for the current head. .github/workflows/release.yml has only workflow_dispatch under on. Its release: key defines a job, not an event trigger. No release change is needed.

The new CI run is checking 2b3f620.

@gitar-bot

gitar-bot Bot commented Nov 30, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk 3 closed / 3 findings

The new pull-request workflow grants id-token write, expanding CI credential authority; an altered step could request OIDC tokens and potentially access federated resources.

Aligns SonarJava agent-facing documentation with repo conventions, covering the new-rule skill, documentation CI services, and documentation tool coverage. Resolved the rule-delivery drift in the new-rule skill, the documentation structure check no longer masked by checker unit test failures, and the coverage gate now counting only documentation tools instead of the test module. No open issues remain.

✅ 3 closed
✅ Quality: new-rule skill drops the repo's documented rule-delivery conventions

📄 .agents/skills/new-rule/SKILL.md:8-13 📄 docs/systems/ruling-tests.md:18 📄 docs/systems/verification.md:30-32
The rewritten .agents/skills/new-rule/SKILL.md cuts the 292-line workflow down to four generic steps. The repository's new-rule delivery conventions don't survive the rewrite, and none of them moved to the new docs/systems/* pages. I grepped every .md/.mdc file for one commit, Implement rule S, rebase, Update ruling expectations, babysit and SONARJAVA- and got no matches.

The conventions that are gone:

  • one commit per workflow step, with single-line messages that contain no rule id, no "java" and no Jira key
  • the PR title format SONARJAVA-XXXX Implement rule SXXXX - <title>
  • the shared Jira prefix for the implementation and RSPEC PRs
  • folding the bot-created ruling-expectations PR into one Update ruling expectations commit, the one exception to rebase-only
  • the rule to rebase and never merge

The file is declared the single source of truth, and .cursor/rules/rules-implementation.mdc and .claude/skills/new-rule/SKILL.md both point to it. Agents following it will now produce PRs and histories that break the team's process. The fix is to restore a short delivery section in the skill, or move these rules to a doc it links to, such as docs/systems/verification.md or docs/systems/ruling-tests.md.

✅ Edge Case: Failing checker unit tests now stop the documentation structure check

📄 .github/actions/check-docs/action.yml:16-26 📄 .github/workflows/docs.yml:20-24
Before this change, docs.yml had separate steps, and check_docs.py still ran with if: !cancelled() && steps.dependencies.outcome == 'success' when the unit tests failed. The composite action now runs unittest, check_docs.py and the coverage report in one bash script, and that shell exits on the first error. So if a checker unit test fails, the repository's documentation is never checked, and broken links or structure issues in the same PR stay hidden until the next run. To keep the old behaviour, split the action into separate steps and guard the doc check with if: ${{ !cancelled() }}, or let the tests fail without stopping the script (for example || status=1) and exit with that status at the end.

✅ Quality: Coverage gate counts the test module, inflating the 90% threshold

📄 .github/actions/check-docs/action.yml:23-26
coverage run --source=.github/scripts measures every Python file in that directory, including test_check_docs.py. unittest discover imports and runs that file, so nearly all of its lines count as covered. The test file then pushes up the total checked by coverage report --fail-under=90, and the tools check_docs.py and docs_commands.py can be under 90% while the gate still passes. The same inflated numbers are also uploaded to Sonar through the XML report. To fix this, add --omit='.github/scripts/test_*.py' to both coverage run calls, or to coverage report and coverage xml.

Verification Rules 4/4 met Knowledge 🔎 3 PRs 1 inspected

Functional validation No results

Rules 4 passed 7 not applicable

✅ Approved GitHub Actions runners
✅ Internal artifact registries
✅ Release secrets usage
✅ Repository license compliance

Knowledge 🔎 3 informed a finding

🔎 New-rule delivery: one commit per step, TP above 90%, single Jira ticket informed a finding, resolved -> new-rule skill drops the repo's documented rule-delivery conventions
🔎 Ruling PR merge is folded into one commit informed a finding, resolved -> new-rule skill drops the repo's documented rule-delivery conventions
🔎 Shared Jira prefix for implementation and RSpec PRs informed a finding, resolved -> new-rule skill drops the repo's documented rule-delivery conventions

Broader impact PRs 1 inspected
Cross-PR 1 PR inspected 0 open impacts

PR 6598: AP-1542 Correct SonarJava contributor guidance Inspected

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqube-next

Copy link
Copy Markdown
Contributor

This branch has not been deployed

No deployments
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