feat(gate): add selfAuthoredLinkedIssueGateMode with config-as-code parity#1198
Merged
Merged
Conversation
…arity Exposes the self_authored_linked_issue signal as an opt-in per-repo gate field. When set to `block`, a PR that links an issue the contributor themselves opened becomes a hard gate blocker rather than an advisory warning. Defaults to `advisory` — the finding surfaces in the panel without ever closing a PR unless the maintainer opts in. Implementation: - DB migration 0055: adds `self_authored_linked_issue_gate_mode TEXT` to `repository_settings` (DEFAULT 'advisory') - Drizzle schema + RepositorySettings type updated - `buildPullRequestAdvisory`: adds `linkedIssueAuthorLogins` context param; raises `self_authored_linked_issue` when the PR author matches any linked issue author (case-insensitive, fail-open on unknown) - `isConfiguredGateBlocker`: routes `self_authored_linked_issue` through the new `selfAuthoredLinkedIssueGateMode` policy field - `gateCheckPolicy`: threads `selfAuthoredLinkedIssueGateMode` from resolved settings into the gate policy - `resolveLinkedIssueAuthorLogins`: fetches issue author logins from the local DB (fail-safe: errors return null, never block the advisory) - Both `buildPullRequestAdvisory` call sites in processors.ts now pass `linkedIssueAuthorLogins` resolved from the DB - config-as-code parity: `focus-manifest.ts` reads/writes/resolves the field from `.gittensory.yml` gate.selfAuthoredLinkedIssue - `settings-preview.ts`: exposes the field in the settings preview - `predicted-gate.ts`: includes the field in the gate prediction input - OpenAPI regenerated; snapshot tests updated Tests: 14 unit tests in rules.test.ts cover the detection logic and all gate-mode branches; 4 tests in gate-check-policy.test.ts cover resolveLinkedIssueAuthorLogins (happy path, missing issue, DB error).
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 99a914e | Commit Preview URL Branch Preview URL |
Jun 24 2026, 08:48 AM |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1198 +/- ##
==========================================
- Coverage 94.80% 94.78% -0.02%
==========================================
Files 157 157
Lines 19100 19115 +15
Branches 6915 6924 +9
==========================================
+ Hits 18107 18119 +12
Misses 399 399
- Partials 594 597 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Closed
12 tasks
This was referenced Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exposes the
self_authored_linked_issuesignal as an opt-in per-repo gate field. When set toblock, a PR that links an issue the contributor themselves opened becomes a hard gate blocker. Defaults toadvisory— the finding surfaces in the check panel without blocking unless the maintainer explicitly opts in.The issue-authorship detection is fail-open: when the linked issue's author is unknown (not yet in the local DB, or DB hiccup), the finding is never raised — no false positives.
Changes:
migrations/0055:self_authored_linked_issue_gate_mode TEXT NOT NULL DEFAULT 'advisory'onrepository_settingssrc/db/schema.ts: Drizzle column addedsrc/types.ts:selfAuthoredLinkedIssueGateMode: GateRuleModeonRepositorySettings;linkedIssueAuthorLoginsonbuildPullRequestAdvisorycontextsrc/rules/advisory.ts:addPullRequestFindingsdetects self-authored issues fromlinkedIssueAuthorLogins(case-insensitive, fail-open on null);isConfiguredGateBlockerroutesself_authored_linked_issuethrough the new modesrc/queue/processors.ts:gateCheckPolicypassesselfAuthoredLinkedIssueGateModeinto the policy; addsresolveLinkedIssueAuthorLoginshelper that fetches issue author logins from the DB (fail-safe, errors → null); bothbuildPullRequestAdvisorycall sites now passlinkedIssueAuthorLoginssrc/rules/predicted-gate.ts: includesselfAuthoredLinkedIssueGateModein gate predictionsrc/signals/focus-manifest.ts: reads and resolvesgate.selfAuthoredLinkedIssuefrom.gittensory.yml(6 spots: type, empty constant, parse, hasAny, serialize, resolveEffectiveSettings);settings.selfAuthoredLinkedIssueGateModeoverlaysrc/signals/settings-preview.ts: exposes the field in the settings previewsrc/openapi/schemas.ts: schema updated;openapi.jsonregeneratedrules.test.ts(detection + all gate-mode branches); 4 ingate-check-policy.test.ts(resolveLinkedIssueAuthorLogins— happy path, missing issue, DB error, empty array)Scope
src/)apps/gittensory-ui/)Validation
npm run test:ci— fully green (typecheck, coverage, workers, mcp, openapi:check, ui)resolveLinkedIssueAuthorLoginscovering happy path + null + DB error + empty??/ternary/&&in new code coverednpm run ui:openapiregenerated and committedgit diff --checkcleanSafety
site/,CNAME, or**/lovable/**CHANGELOG.mdeditsadvisory— no change to existing gate behavior until maintainer opts inAdvances #1198