Skip to content

feat(enrichment): add conventional-commit subject linter analyzer#3346

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
jaso0n0818:feat/commit-lint-analyzer-2021
Jul 5, 2026
Merged

feat(enrichment): add conventional-commit subject linter analyzer#3346
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
jaso0n0818:feat/commit-lint-analyzer-2021

Conversation

@jaso0n0818

Copy link
Copy Markdown
Contributor

Closes #2021

What

A new github-light REES analyzer, commitLint, that lints a PR's commit subjects against the Conventional Commits spec and flags each non-conforming subject — a wrong/absent type, a missing type: structure, an over-long subject, or an empty subject. A house-rule the gate cares about, surfaced early to the reviewer.

Detection

  • Reads the PR's commit subjects from the structured GitHub PR-commits API (one bounded page, commit.message only) through the shared bounded-fetch layer, following commit-hygiene.ts / commit-signature.ts exactly. Each subject is linted independently — no cross-commit or cross-line state, and the subject strings arrive from the API already clean (no diff/comment/string parsing).
  • lintSubject reason precedence: empty (blank subject) → too-long (> 72 chars) → missing-colon (not type(scope)?!?: summary) → bad-type (type not in the Conventional-Commits/commitlint preset set: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert). A parenthesized scope and the ! breaking-change marker are both optional per the spec.
  • The finding carries a short SHA prefix, the (truncated) subject, and the reason — never author/email. Findings capped (maxFindings: 25).
  • Fail-safe: no token, a bad repo slug, or any fetch error yields no finding rather than an error.

Registration

Registered as a github-light descriptor (category quality, requires ["github-token"]) with an inline render(), following the commitHygiene descriptor shape. All wiring updated: types.ts (CommitLintFinding + commitLint? key), render.ts, analyzer-registry.test.ts, root src/review/enrichment-analyzer-names.ts (canonical REES_ANALYZER_NAMES), root test/unit/enrichment-wire.test.ts, and the generated analyzer-metadata.json / rees-analyzers.ts / .env.example via node scripts/generate-analyzer-metadata.mjs.

Tests

review-enrichment/test/commit-lint.test.ts (8 tests) covers: a conforming subject (with/without scope and breaking marker) passing, each non-conforming reason, the empty/too-long precedence, analyzeCommitSubjects reporting only non-conforming subjects with a short sha + truncated subject, subject-line-only linting (body ignored), the maxFindings cap + no-sha skip, the end-to-end fetch path, and the fail-safe paths (no token, bad slug, fetch error). Analyzer metadata is regenerated and committed.

@jaso0n0818
jaso0n0818 requested a review from JSONbored as a code owner July 5, 2026 04:27
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 5, 2026
@loopover-orb

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-05 04:32:53 UTC

11 files · 1 AI reviewer · no blockers · readiness 62/100 · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
The change adds a new `commitLint` github-light analyzer, wires it through the registry/render/type/name metadata paths, and includes focused unit coverage for subject parsing, finding caps, and basic fail-safe behavior. The core source-path is coherent: it reads GitHub PR commit subjects from structured API data, lints each subject independently, caps findings, and registers the analyzer consistently with the generated metadata. I do not see a reachable correctness break in the provided diff, but there is one fail-safe edge worth tightening because the tests only cover HTTP failure responses, not thrown fetch/analysis errors.

Nits — 5 non-blocking
  • nit: review-enrichment/src/analyzers/commit-lint.ts:125 documents that “any fetch error” yields no finding, but the test at review-enrichment/test/commit-lint.test.ts:88 only covers an HTTP 500 response; add a thrown-fetch or rejected `analysis.fetchJson` case so the fail-safe contract is proven against the real failure mode.
  • nit: review-enrichment/src/analyzers/commit-lint.ts:118 uses an inline `120` truncation limit while the other analyzer bounds are named constants; name it, e.g. `MAX_RENDERED_SUBJECT_LEN`, to keep the limit self-documenting.
  • In review-enrichment/test/commit-lint.test.ts, add a case like `const err = async () => { throw new Error("network down"); }; assert.deepEqual(await scanCommitLint(req(), err), []);` and change `scanCommitLint` to catch around `fetchPrCommits` if the shared fetch helper does not already normalize thrown errors.
  • In review-enrichment/src/analyzers/commit-lint.ts, replace `subject.trim().slice(0, 120)` with a named constant so future render-limit changes do not require hunting for a bare literal.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2021
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 444 registered-repo PR(s), 267 merged, 7 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jaso0n0818; Gittensor profile; 444 PR(s), 7 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: jaso0n0818
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 444 PR(s), 7 issue(s).
  • Related work: Titles/paths share 5 meaningful terms. (issue #1477, issue #1514)
  • Related work: Titles/paths share 5 meaningful terms. (issue #1514, issue #2025)
  • Related work: Titles/paths share 7 meaningful terms. (issue #2033, issue #2017)
  • Additional title-only matches omitted; title-only overlap does not block.
Contributor next steps
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
  • Check active issues and PRs before submitting.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.88%. Comparing base (38a1bac) to head (c0e2c82).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3346   +/-   ##
=======================================
  Coverage   93.88%   93.88%           
=======================================
  Files         280      280           
  Lines       30552    30552           
  Branches    11130    11130           
=======================================
  Hits        28684    28684           
  Misses       1211     1211           
  Partials      657      657           
Files with missing lines Coverage Δ
src/review/enrichment-analyzer-names.ts 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot 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.

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 28349b5 into JSONbored:main Jul 5, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(enrichment): commit-message conventional-commit lint analyzer

1 participant