Skip to content

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

Closed
jaso0n0818 wants to merge 1 commit into
JSONbored:mainfrom
jaso0n0818:feat/commit-lint-analyzer-2021
Closed

feat(enrichment): add conventional-commit subject linter analyzer#3343
jaso0n0818 wants to merge 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:18
@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

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - reject/close recommended

Review updated: 2026-07-05 04:21:49 UTC

11 files · 1 AI reviewer · 1 blocker · readiness 80/100 · CI pending · blocked

🛑 Suggested Action - Reject/Close

  • AI reviewers agree on a likely critical defect: review-enrichment/src/analyzers/commit-lint.ts:90 lowercases the captured type before checking ALLOWED_TYPES, so `FEAT: add thing` is treated as valid even though the analyzer claims to enforce the finite Conventional-Commits/commitlint preset type set
  • change it to a case-sensitive check (`if (!ALLOWED_TYPES.has(match[1]!)) return "bad-type"
  • `) or explicitly document and test that uppercase types are intentionally accepted. — Resolve the flagged defect, or override if the AI reviewers are mistaken, then re-run the gate.

Review summary
The change adds a bounded GitHub PR-commits analyzer and wires it through the REES registry, renderer, metadata, UI docs, and analyzer-name allowlist. The implementation follows the existing fetch/analyze/render split and the core path is bounded by commit count and finding count. I do see one correctness gap in the linter: it accepts uppercase commit types even though the documented allowed type set is the conventional lowercase preset.

Blockers

  • review-enrichment/src/analyzers/commit-lint.ts:90 lowercases the captured type before checking ALLOWED_TYPES, so `FEAT: add thing` is treated as valid even though the analyzer claims to enforce the finite Conventional-Commits/commitlint preset type set; change it to a case-sensitive check (`if (!ALLOWED_TYPES.has(match[1]!)) return "bad-type";`) or explicitly document and test that uppercase types are intentionally accepted.
Nits — 5 non-blocking
  • nit: review-enrichment/src/analyzers/commit-lint.ts:77 hard-codes `512 * 1024` inline while the rest of the analyzer names its other limits; extract a `MAX_RESPONSE_BYTES` constant so the descriptor/docs and fetch bound stay auditable.
  • nit: review-enrichment/src/analyzers/commit-lint.ts:117 hard-codes the rendered subject truncation length separately from the named analyzer limits; add a `MAX_REPORTED_SUBJECT_LEN` constant or include it in the descriptor limits if reviewers depend on that cap.
  • nit: review-enrichment/src/analyzers/commit-lint.ts:43 allows an empty scope like `feat(): summary`; if that is intentional, add a test, otherwise tighten the scope group to require at least one non-`)` character.
  • review-enrichment/src/analyzers/commit-lint.ts:90 should either preserve case-sensitive type validation or add explicit tests for uppercase accepted/rejected behavior so the house rule is unambiguous.
  • review-enrichment/test/commit-lint.test.ts should add a case for `FEAT: add thing` and, if kept, `feat(): add thing` to lock down the analyzer's actual contract.

Why this is blocked

  • review-enrichment/src/analyzers/commit-lint.ts:90 lowercases the captured type before checking ALLOWED_TYPES, so `FEAT: add thing` is treated as valid even though the analyzer claims to enforce the finite Conventional-Commits/commitlint preset type set; change it to a case-sensitive check (`if (!ALLOWED_TYPES.has(match[1]!)) return "bad-type";`) or explicitly document and test that uppercase types are intentionally accepted.
Signal Result Evidence
Code review ❌ 1 blocker 1 reviewer
Linked issue ✅ Linked #2021
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low 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 ❌ Blocking Repo-configured hard 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).
  • PR-specific overlap: none found.
Contributor next steps
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
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

@loopover-orb

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (AI reviewers agree on a likely critical defect: review-enrichment/src/analyzers/commit-lint.ts:90 lowercases the captured type before checking ALLOWED_TYPES, so `FEAT: add thing` is treated as valid even though the analyzer claims to enforce the finite Conventional-Commits/commitlint preset type set; change it to a case-sensitive check (`if (!ALLOWED_TYPES.has(match[1]!)) return "bad-type";`) or explicitly document and test that uppercase types are intentionally accepted.). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 5, 2026
@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 (9e87b4c) to head (e5fc023).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3343   +/-   ##
=======================================
  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.

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