Repository navigation
test(git): e2e coverage for the Git integration, plus fixes it found - #636
Merged
Merged
Conversation
…inks - Implemented e2e tests for Git settings in projects, covering scenarios for linking and managing repositories. - Created tests for task details to verify linked pull requests and branches, including various states and actions. - Added tests for the Git task links API to ensure proper permissions and error handling for linking tasks to repositories. - Introduced security tests for Git webhook intake to validate endpoint behavior and error responses. - Enhanced IAM validation to include git_identity resources and updated related tests. - Improved error handling in the Git workflow repository for project settings. - Updated service logic to ensure tasks from different projects are not accessible. - Added validation for webhook keys to ensure only plausible keys are accepted. - Refactored Git handler tests to cover scenarios for unknown webhook endpoints.
Contributor
There was a problem hiding this comment.
ℹ️ No critical issues — minor suggestions inline.
Reviewed changes
This PR adds the Git end-to-end suite plus several production hardening fixes; the Go tests for the touched packages pass and PR CI is green.
- Git e2e coverage — 14 feature/spec pairs cover admin identities/setup, IAM gates and role templates/editor, project settings/automation, the agent Git tab/API, task Git detail/links, and webhook intake.
- IAM resource root —
git_identityis accepted by policy validation, so workspace Git-identity roles no longer fail withROLE_POLICY_INVALID. - Settings 404 — a foreign-key violation on project-settings upsert maps to
ErrNotFoundinstead of a 500. - Webhook key guard — implausible endpoint keys are rejected before the database lookup in both the check and handle paths.
- Task project scoping —
ListTaskGitreturnsErrNotFoundfor a task in another project. - Unlink route fix — the handler moves into the
/{repositoryId}subrouter, restoring a route that the later mount was shadowing.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed the delta since pullfrog's prior review (e4b7301): six test/feature files tightened in response to the earlier inline findings, with no production code touched.
- Role-template scenario corrected — the wrong "project resource is refused with 422" claim is replaced by an "accepted but grants nothing" scenario, and the spec now creates the role and asserts 403 on the workspace identity routes.
- Settings feature line removed — the self-contradictory "a partial update keeps the fields it does not mention" step is gone.
- Sidebar absence assertion anchored — the admin Git page test now opens a collapsed sidebar and waits for a visible entry the user holds before asserting the Git link is absent.
- Remove-identity confirm waits for the dialog — the non-waiting
isVisible()probe is replaced by a dialog-scoped click onRemove identity. - Git task-detail absence and unlink assertions strengthened — the "nothing shown" test waits for the repositories response and the Properties panel first, and both unlink tests assert the resulting empty state.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
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
End-to-end coverage for the Git integration (permissions, project settings, tasks, agents, setup), plus three backend bugs those tests found and a missing policy resource root. The e2e stack has no Git provider plugin, so specs that need one stub the provider endpoints in the browser with
page.route; permissions, projects, tasks and agents are always real.Bugs found by the new tests (fixed here)
git_identitywas not a known policy resource rootgit.identities:managecould not be created (ROLE_POLICY_INVALID, "unknown root")iam/validate.go) + testDELETE /projects/{id}/git/repositories/{repositoryId}was unreachable/{repositoryId}sub-router replaced the Delete registered on the same pattern: every unlink answered a plain router 404, skipping the permission gaterouter.go)GET /projects/{id}/tasks/{taskId}/gitanswered 200 for another project's taskListTaskGitchecksTaskInProjectand returns not foundPUT /projects/{id}/git/settingsfor a project that does not exist answered 500GIT_NOT_FOUND(404)\x00in a text parameter[A-Za-z0-9_-], empty or > 128 chars) are a 404 before the database is touchedNew e2e specs (
apps/e2e, each with a.featurefile)API / permissions
iam/git-permissions: who may read, write, link, approve and merge; workspace identity routes; public webhook.iam/git-ops-gates: one test per operation route (26 routes): open only to the one action it declares (git:read,git:write,git:approve,git:merge,git:*), 403 to everyone else, 401 anonymous; deny wins over a wildcard; id validation.iam/git-role-templates: built-in Editor / Viewer / Admin Git actions, custom roles holding each action, workspace action on its own resource only, Editor works end to end.projects/git-settings-api: defaults, round trip, replace-on-save semantics, every minimum-permission level, validation, default-responder rules, isolation between projects.projects/git-task-links: task Git routes and their permission combinations (tasks:*+git:*), unknown repository, cross-project task.projects/git-agent-api: trigger defaults and explicit choices, unknown kind, identity routes' permissions, no-provider answer (503GIT_PROVIDER_UNAVAILABLE).security/git-webhook: unknown keys, methods, odd keys, no session needed,/_gitnot callable from a browser.UI
admin/git-identities,admin/git-setup: admin Git page states, setup dialog payload, remove confirmation, callback page (invalid state, single completion call with raw params, other-origin return URL ignored, next step, access grant).projects/git-settings,projects/git-automation: link form visibility by permission, link errors explained, unlink confirmation, automation saved to the real settings (responder, minimum access, pause), reader view.projects/git-task-detail: PR state and CI badges, branches, link / unlink, rejected link, read-only view.projects/git-agent-tab: shared vs own identity, create / install / remove, trigger groups and switches, reader view.iam/git-role-editor: the four project Git switches and the workspace one store the right actions; stored Git roles reopen in Simple.Shared helpers are in
tests/helpers/git.ts;tests/helpers/e2e-api.tsgainsgit_identity/*in the workspace resources.Go unit tests
validate_test.go(resource root),service_test.go(webhook keys, endpoint check, offered identity, cached-credential audit),ops_test.go(foreign task),git_handler_test.go(unknown endpoint refused before the body is read).Testing
docker compose -f deploy/docker-compose.e2e.yml up -d --build --wait, thencd apps/e2e && E2E_WORKERS=2 npx playwright test --project=chromium tests/{iam,projects,admin,security}/git-*.spec.ts: 162 passed.mobile-chrome(the task page hides the author and CI label on narrow screens, so those are asserted as present rather than visible).go test ./internal/service/git/... ./internal/transport/http/... ./internal/platform/authz/...pass.Notes
git.identities:*.🤖 Generated with Claude Code