feat(config): add review.labeling_rules deterministic label suggestions (#2045) - #3534
Conversation
…ns (JSONbored#2045) A maintainer can declare deterministic `{label, when}` rules that SUGGEST a non-scoring label when a PR's changed paths / title / description match. Surfaced as advisory suggestions; auto-applied only when the repo's autoLabelEnabled is set. Empty (default) ⇒ no suggestion (byte-identical). Part of JSONbored#1959. - focus-manifest.ts: LabelingRule type + labelingRules on FocusManifestReviewConfig; parseReviewLabelingRules (mirrors parseReviewPreMergeChecks) — public-safe labels, refuses the reserved `gittensor:` namespace, requires >=1 when-criterion, caps at MAX_PATH_INSTRUCTIONS, warn+drop invalid; reviewConfigToJson round-trip (omitted when empty ⇒ byte-identical) + present + EMPTY literals. - src/review/labeling-rules.ts: pure, deterministic resolveLabelingRules(rules, facts, autoLabelEnabled) → { suggest, apply } — mirrors the pure resolvePrTypeLabel decider (no IO; the GitHub apply stays a separate processor concern). - .gittensory.yml.example: documented review.labeling_rules. - Tests: every parse branch (reserved/invalid/no-criterion/cap/non-list), round-trip (full / path-only / title-only / absent-omitted), and resolve (each when-criterion, AND semantics, autoLabel on/off, dedup+order). Scope: the deterministic config + pure resolver + tests + doc. Wiring the resolver into the live label-apply path in queue/processors.ts is a follow-up, mirroring how resolvePrTypeLabel is a pure decider separate from its processor application.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-05 16:12:32 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 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.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3534 +/- ##
==========================================
+ Coverage 93.09% 93.10% +0.01%
==========================================
Files 301 302 +1
Lines 31450 31496 +46
Branches 11483 11502 +19
==========================================
+ Hits 29279 29325 +46
Misses 1517 1517
Partials 654 654
🚀 New features to boost your workflow:
|
Closes #2045 (part of #1959).
Adds
review.labeling_rules— deterministic{label, when}rules that suggest a non-scoring label when a PR's changed paths / title / description match. Suggestions are advisory; they're auto-applied only when the repo'sautoLabelEnabledis set. Empty/unset ⇒ no suggestion (byte-identical to today).What's here
focus-manifest.tsLabelingRuletype ({ label, whenPaths, titleContains, descriptionContains }) +labelingRulesonFocusManifestReviewConfig.parseReviewLabelingRules— mirrorsparseReviewPreMergeChecks: public-safe labels, refuses the reservedgittensor:namespace (scoring/type labels), requires ≥1whencriterion, caps atMAX_PATH_INSTRUCTIONS, warn+drops invalid entries.reviewConfigToJsonround-trip (omitted when empty ⇒ byte-identical) +present+ theEMPTYliterals.src/review/labeling-rules.ts— pure, deterministicresolveLabelingRules(rules, facts, autoLabelEnabled) → { suggest, apply }. A rule fires when all its set criteria match (path glob viamatchesManifestPath, case-insensitive title/description contains). Mirrors the pureresolvePrTypeLabeldecider — no IO..gittensory.yml.example— documentedreview.labeling_rules.Scope note
This PR delivers the deterministic config + pure resolver + tests + doc. Wiring the resolver into the live label-apply path in
queue/processors.tsis a natural follow-up — deliberately kept separate, mirroring howresolvePrTypeLabelis a pure decider distinct from its processor application, so this PR stays pure and side-effect-free.Validation
Typecheck clean. Focused suites green (labeling-rules, focus-manifest, signals-coverage, and the example-file validation):
Tests cover every parse branch (reserved/invalid/missing-label/no-criterion/cap/non-list), round-trip (full / path-only / title-only / absent-omitted), and resolve (each
whencriterion, AND semantics, autoLabel on/off, dedup + order).