feat(commands): add the maintainer-only @gittensory generate-tests command - #4211
Conversation
…mmand Adds the on-demand `@gittensory generate-tests` command: classify -> authorize (maintainer-only, ["maintainer"] alone -- the first command in the catalog narrower than every existing default) -> resolve the e2eTests feature gate -> generate a Playwright test via the #4191 LLM core -> render and post it as a dedicated reply comment, mirroring maybeProcessExplainCommand's shape. Deliberately does NOT splice generated content into the automated review's sticky unified comment: unlike fix-handoff (which derives its blocks for free from data the regular review pass already computed), this is an explicit, cost-bearing, maintainer-triggered action, so it gets its own on-demand reply comment, the same precedent already set by explain/configuration. The existing maintainer_command_requires_maintainer guard in the shared authorization framework already denies a PR's own author when they don't independently hold the maintainer role -- no bespoke pr_author check needed, closing the exact loophole a click-to-generate button would otherwise open for a contributor on their own PR. Keeps the engine package's own duplicated command-authorization.ts copy in sync (a genuinely separate file the standalone package imports, not a re-export shim), which a config-templates-style regression test enforces. Closes #4193, #4194, #4195.
|
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 | ed5beac | Commit Preview URL Branch Preview URL |
Jul 08 2026, 12:57 PM |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (95.83%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #4211 +/- ##
=======================================
Coverage 93.75% 93.76%
=======================================
Files 389 390 +1
Lines 36499 36547 +48
Branches 13376 13389 +13
=======================================
+ Hits 34221 34267 +46
- Misses 1621 1623 +2
Partials 657 657
🚀 New features to boost your workflow:
|
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - fixes requiredReview updated: 2026-07-08 13:32:42 UTC
🛑 Suggested Action - Manual Review
Nits — 1 non-blocking
Why this is blocked
CI checks failing
Linked issue satisfactionNot yet addressed Review context
Contributor next steps
Signal definitions
Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. 🟩 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.
|
…erate-tests CI's codecov/patch flagged 2 missing lines in the previous commit that a local unsharded coverage run (on a newer local Node than CI's pinned .nvmrc version) didn't surface. Adds the two branches most likely responsible: the manifest?.review optional-chain when no manifest is published at all (falls back to the GITTENSORY_REVIEW_REPOS allowlist default, same precedent as resolveConvergedFeature's own allowlist test), and payload.comment?.body when the webhook payload carries no comment object.
Summary
@gittensory generate-testscommand — the maintainer-only, on-demand trigger for AI-generated E2E test coverage (Epic: AI-generated E2E test coverage for pull requests #4189 epic): classify → authorize → resolve thee2eTestsgate → generate via feat(review): LLM core to turn a PR diff into Playwright E2E test source #4191's LLM core → render → post as a dedicated reply comment.fix-handoff(splice a block into the automated review's sticky unified comment viaunified-comment-bridge.ts's collapsible chain). Implementation surfaced why that's the wrong model — fix-handoff derives its content for free from data the regular synchronous review pass already computed; E2E test generation needs a new, async, cost-bearing LLM call, which can only make sense as an explicit, on-demand action, not something spliced into every automated review pass.explain/configurationalready establish the right precedent: post the on-demand result as its own reply comment, not an edit to the main sticky comment. This PR follows that precedent instead, closing feat(review): render + comment-assembly for generated E2E test blocks #4193 and feat(review): dispatch wiring for e2eTests in queue/processors.ts #4194 as part of the same, more coherent PR rather than shipping now-inapplicable "splice into unified comment" plumbing.["maintainer"]alone — every other command (review,pause,resume,resolve,configuration,explain) allows at least["maintainer", "collaborator"]. This closes the specific loophole a click-to-generate button must not open: a repo could grant a contributor/miner collaborator-level push access, and that tier must never be able to generate tests for their own scored PR.src/settings/command-authorization.ts'smaintainer_command_requires_maintainerguard) already handles this generically for any command whose allowed roles are maintainer/collaborator-only; no bespokepr_authorcheck was needed.command-authorization.ts(a genuinely separate filepackages/gittensory-engine/src/settings/command-authorization.tsimports, not a re-export shim) in sync — a dedicated regression test (test/unit/command-authorization-engine.test.ts, pre-existing) andfocus-manifest.test.ts's parity assertion both caught the drift when I first forgot this, confirming the safety net works.apps/gittensory-ui/src/lib/command-reference.ts(the auto-generated command reference — now 8 action commands, was 7) and fixed the two hardcoded "7 action commands" counts intest/unit/gen-command-reference-script.test.tsthat the regression run caught.Closes #4193, #4194, #4195.
Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coverage(unsharded, full repo) — 100% branch coverage on every new/changed line, confirmed via the rawcoverage/lcov.infodata for the new handler (maybeProcessGenerateTestsCommand/postGenerateTestsNotEnabledComment/recordGenerateTestsSkipinprocessors.ts), the new render file (e2e-test-gen-render.ts, 4/4 lines + 4/4 branches), andcommand-authorization.ts(77/77 lines, 85/85 branches). All 12,160 existing tests still pass (2 pre-existing PG-gated skips).npm run test:workersnpm run build:mcp/npm run test:mcp-packnpm run build:miner(part oftest:ci) /npm run test:miner-packnpm run rees:testnpm run ui:openapi:check/npm run ui:openapi:settings-paritynpm run ui:lint/npm run ui:typecheck/npm run ui:test/npm run ui:buildnpm run ui:version-auditnpm run docs:drift-check/npm run manifest:drift-check/npm run command-reference:checknpm run db:migrations:check/npm run db:schema-drift:check/npm run selfhost:env-reference:check/npm run selfhost:validate-observability/npm run cf-typegen:checknpm audit --audit-level=moderatetest/unit/queue.test.tscovering: authorized-maintainer success (free path), collaborator-tier denial, the PR-author-self-denial loophole check, feature-disabled note, malformed-output note, missing-cached-PR skip, non-command decline, bot-author classify-failure skip, BYOK success (with both the "no provider pin" and "provider pin matches" branches), and the no-provider-configured degrade path — plus 4 unit tests for the render function's own branches.Safety
sanitizePublicComment, wrapped in a try/catch (it throws rather than strips on a forbidden term) that degrades to a safe withheld-content note rather than crashing the handler or leaking raw generated text.command-reference.ts.UI Evidencesection — N/A, no hand-authored UI change (generated reference doc only).CHANGELOG.mditself is untouched.Notes
features.e2eTestsmust be explicitly enabled per-repo (feat(review): register e2eTests as the sixth converged-feature key #4190), and even then only an actual repo maintainer can invoke the command — no auto-trigger yet (that's feat(review): auto-trigger E2E test generation on the manifest_missing_tests signal #4196, separate and still pending).