feat(github-app): first-time-contributor-aware gating - #631
Conversation
Add firstTimeContributorGrace repo setting that downgrades block gates to advisory for newcomers while keeping full blocking for repeat offenders. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 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. |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Co-authored-by: Cursor <cursoragent@cursor.com>
ghost
left a comment
There was a problem hiding this comment.
Gittensory review · advisory — a maintainer merges
0 actionable · 6 nitpick(s) · 19 file(s) · two independent AI reviewers
Suggested action: 🔍 Manual review. The changed route's preview could not be captured — review the rendered page manually before merging.
📋 Walkthrough
Adds a firstTimeContributorGrace boolean flag to repository settings, updates DB schema and OpenAPI, implements logic to downgrade gate modes for first‑time contributors, and updates all related tests and defaults.
Changes
| File | Summary |
|---|---|
apps/gittensory-ui/public/openapi.json |
Adds firstTimeContributorGrace boolean property to RepositorySettings schema and required list. |
migrations/0026_first_time_contributor_grace.sql |
Adds first_time_contributor_grace integer column with default 0 to repository_settings table. |
src/api/routes.ts |
Extends repository settings validation schema and handling to include firstTimeContributorGrace. |
src/db/repositories.ts |
Updates default values, query mapping, and upsert logic for the new flag. |
src/db/schema.ts |
Adds firstTimeContributorGrace column definition with boolean mode. |
src/openapi/schemas.ts |
Adds firstTimeContributorGrace to the Zod schema for RepositorySettings. |
src/queue/processors.ts |
Introduces resolveGateCheckPolicy to apply grace logic and uses it when the flag is enabled. |
src/rules/gate-grace.ts |
New module implementing grace eligibility checks and policy transformation. |
src/types.ts |
Adds firstTimeContributorGrace boolean to RepositorySettings type. |
test/unit/gate-grace.test.ts |
Adds comprehensive unit tests for the new grace rule logic. |
test/unit/policy-sanitizer.test.ts |
Updates test fixtures to include the new flag. |
test/unit/queue.test.ts |
Adds test verifying grace behavior for a newcomer PR. |
test/unit/registration-readiness.test.ts |
Updates settings fixture with the new flag. |
test/unit/repo-policy-readiness.test.ts |
Updates settings fixture with the new flag. |
test/unit/self-dogfood-registration-pack.test.ts |
Updates settings fixture with the new flag. |
test/unit/settings-preview.test.ts |
Updates settings fixture with the new flag. |
test/unit/signals-coverage.test.ts |
Updates repository settings fixture with the new flag. |
test/unit/signals-v2.test.ts |
Updates repository settings fixture with the new flag. |
test/unit/signals.test.ts |
Updates repository settings fixtures with the new flag. |
🔍 Reviewer notes
Reviewer A · gpt-oss-120b — recommends ✅ merge
This PR introduces a first‑time‑contributor grace setting, adds the corresponding DB column and API schema, implements gate‑check policy logic, and provides comprehensive tests. The changes are well‑scoped, type‑safe, and do not affect public privacy constraints.
Suggestions
- Confirm that
buildContributorProfile,buildRoleContext, andbuildContributorOutcomeHistoryare imported insrc/queue/processors.ts(they were likely already present). - Add a brief comment in the migration file documenting the purpose of the new column.
- Consider adding a test for the
resolveGateCheckPolicyhelper to ensure it returns the base policy when the grace flag is disabled.
Worth double-checking
- The migration must be applied before the new code runs; ensure deployment order respects this.
- Verify that the SQLite integer‑boolean mapping aligns with the TypeScript
booleantype (0/1 ↔ false/true).
Reviewer B · nemotron-3-120b-a12b — recommends ✅ merge
This PR adds first-time contributor aware gating functionality. When enabled, it downgrades blocking gate modes (linked issue, duplicate PR, quality gate) to advisory for qualifying newcomers. Changes include database schema updates, API schema extensions, backend logic modifications, and comprehensive tests. The implementation follows existing patterns, respects the public/private boundary (no forbidden terms introduced), and includes adequate test coverage.
Suggestions
- Consider adding a comment in src/rules/gate-grace.ts explaining why the maintainer lane is excluded from grace (though the test already covers this).
- In test/unit/gate-grace.test.ts, the test case for 'low-history contributors with multiple open attempts' could use a clarifying comment about why mixed open/closed scenarios are handled as they are.
- Ensure the migration note in the PR description mentions that this is a non-breaking additive change (though the SQL is straightforward).
Worth double-checking
- Verify that the additional computations in resolveGateCheckPolicy (building contributor profile, role context, outcome history) don't introduce noticeable latency in gate evaluation during high load.
- Double-check that the downgrade logic in applyFirstTimeContributorGrace correctly handles undefined gate modes (though current usage shows they're always set).
- Confirm that the OpenAPI schema update in public/openapi.json doesn't inadvertently expose internal-only fields (it doesn't, as it's just a boolean flag).
Warning
Could not capture a preview of the changed route(s) — review the rendered page manually before merging.
🤖 Automated advisory review · a maintainer makes the final call.
JSONbored
left a comment
There was a problem hiding this comment.
Thanks for this — but it needs a rethink rather than a rebase, since it predates #644 and conflicts with the model we settled on.
- It softens the wrong population. The grace path targets non-confirmed newcomers — but #644 already forces the gate to neutral for every non-confirmed author. So downgrading their
block→advisoryis a no-op for them; the only authors it can affect are confirmed contributors with no merges yet (opposite of intent). - It drops
confirmedContributorfrom thegateCheckPolicycall — if force-merged, that regresses #644. - Non-deterministic. Eligibility keys off thin repo-local cache (
repoStats: [], no official snapshot), so it default-grants on a newcomer's first webhook and is trivially gamed.
If we want a contributor on-ramp, let's design it on top of confirmedContributor, keyed on official gittensor merge history, layered after the contributor check. Suggest closing and reopening with that approach — your commits/credit carry over.


Summary
firstTimeContributorGracesetting (default off) with migration0026_first_time_contributor_grace.sql.src/rules/gate-grace.tsto detect repeat closed-unmerged authors and downgrade configured block gates to advisory for eligible newcomers.RoleContextand outcome history into gate evaluation viaresolveGateCheckPolicyin the queue processor.Closes #552
Test plan
npm run validate(typecheck + test:coverage at 97%+ branch coverage)test/unit/gate-grace.test.ts)test/unit/queue.test.ts)Made with Cursor