Skip to content

fix: make remote repository entry reliable#1936

Merged
carlosflorencio merged 6 commits into
mainfrom
feature/paste-remote-repos-a2l
Jul 25, 2026
Merged

fix: make remote repository entry reliable#1936
carlosflorencio merged 6 commits into
mainfrom
feature/paste-remote-repos-a2l

Conversation

@carlosflorencio

@carlosflorencio carlosflorencio commented Jul 24, 2026

Copy link
Copy Markdown
Member

Remote repository URLs resolved while users were still editing them and hid provider failures, making task creation unreliable in credential-free preview environments. Require explicit submission, expose retryable errors, and preserve anonymous access to public GitHub and GitLab resources.

Important Changes

  • Keep pasted or typed URLs editable until Enter and show a visible submission hint.
  • Preserve failed remote rows and retry branch plus PR/issue metadata resolution explicitly.
  • Fall back to fixed-host anonymous provider reads only when no integration is configured; authenticated failures remain authoritative.
  • Document which public remote operations work without credentials.

Validation

  • make fmt
  • make typecheck
  • make test
  • make lint
  • cd apps/web && pnpm e2e --project=mobile-chrome e2e/tests/task/mobile-create-task-remote-repo.spec.ts
  • Focused GitHub/GitLab provider tests, task-dialog tests, and a security boundary audit

Possible Improvements

Low risk: anonymous provider APIs remain rate-limited, so transient upstream failures still depend on the new Retry flow.

Checklist

  • I have performed a self-review of my code.
  • I have manually tested my changes and they work as expected.
  • My changes have tests that cover the new functionality and edge cases.
  • If my change touches UI files (apps/web/), I have added or updated Playwright e2e tests in apps/web/e2e/ and verified them with make test-e2e.
  • I checked whether this affects public docs in docs/public/** and updated them or noted why no docs change is needed.

Review in cubic

Screenshots

Desktop — URL staged until Enter

Desktop Remote repository selector with a public URL staged and the Enter hint visible

Mobile — retryable resolution error

Mobile Remote repository row with a provider error and touch-sized Retry control

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds credential-free public GitHub and GitLab resolution, makes remote URL submission Enter-driven, preserves per-URL failures with retry support, and expands backend, frontend, mobile, and documentation coverage.

Changes

Remote repository resolution

Layer / File(s) Summary
Public provider resolution
apps/backend/internal/github/..., apps/backend/internal/gitlab/..., apps/web/lib/api/domains/gitlab-api.ts
GitHub PR/issue requests and public GitLab branch discovery use anonymous requests under restricted conditions, preserve upstream errors, and omit empty GitLab tokens.
Per-URL resolution state and retry
apps/web/hooks/domains/github/..., apps/web/components/task-create-dialog-remote-repo-chips.tsx
Branch and PR-info hooks expose retained errors per URL and require explicit clearing before retrying failed requests.
Explicit URL entry and row retry
apps/web/components/task-create-dialog-remote-repo-chip*, apps/web/components/task-create-dialog-remote-repo-chips*
Remote URLs remain editable until plain Enter, URL hints are shown, and committed rows expose retryable resolution errors while preserving their URL.
Mobile interaction validation
apps/web/e2e/tests/task/mobile-create-task-remote-repo.spec.ts
Mobile tests check deferred resolution, retry behavior, viewport containment, and horizontal overflow.
Behavior plans and specifications
docs/plans/remote-repository-entry-reliability/*, docs/public/tasks-and-workflows.md, docs/specs/...
Plans and specifications document public provider access, explicit submission, error preservation, retry behavior, and acceptance coverage.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant RemoteRepoChip
  participant ResolutionHooks
  participant ProviderAPI
  User->>RemoteRepoChip: enter remote URL
  RemoteRepoChip->>ResolutionHooks: submit trimmed URL on Enter
  ResolutionHooks->>ProviderAPI: resolve branches and metadata
  ProviderAPI-->>ResolutionHooks: success or error
  ResolutionHooks-->>RemoteRepoChip: row data and per-URL error
  User->>RemoteRepoChip: click Retry
  RemoteRepoChip->>ResolutionHooks: clear and re-ensure URL
Loading

Possibly related PRs

  • kdlbs/kandev#1116: Extends the Remote-mode GitHub URL resolution flow and uses the same metadata, branch hooks, and task-create UI.

Suggested reviewers: jcfs

Poem

I’m a rabbit with URLs tucked tight,
Press Enter to send them just right.
If branches go astray,
Retry saves the day,
While public APIs hop into sight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 17.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately summarizes the main change: making remote repository entry reliable.
Description check ✅ Passed The description covers the required summary, important changes, validation, possible improvements, and checklist, with no critical sections missing.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/paste-remote-repos-a2l

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@claude

claude Bot commented Jul 24, 2026

Copy link
Copy Markdown

Claude finished @carlosflorencio's task in 0s —— View job


I'll analyze this and get back to you.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b50f2c903

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/backend/internal/gitlab/controller_watches.go
Comment thread apps/web/components/task-create-dialog-remote-repo-chip.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
apps/backend/internal/github/service_test.go (1)

136-148: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Register test-server cleanup with t.Cleanup.

  • apps/backend/internal/github/service_test.go#L136-L148: replace defer srv.Close() with t.Cleanup(srv.Close) immediately after server creation.
  • apps/backend/internal/github/service_test.go#L196-L204: replace defer srv.Close() with t.Cleanup(srv.Close) immediately after server creation.

As per coding guidelines, register t.Cleanup immediately after creating resources requiring teardown, before any fatal assertion can exit the test.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/backend/internal/github/service_test.go` around lines 136 - 148, Replace
the deferred server teardown in TestGetPRAndIssue_FallBackWithoutClient at
apps/backend/internal/github/service_test.go:136-148 with immediate t.Cleanup
registration after creating the test server. Apply the same change to the server
setup at apps/backend/internal/github/service_test.go:196-204, ensuring cleanup
is registered before any assertions or fatal exits.

Source: Coding guidelines

docs/specs/gitlab-integration/spec.md (1)

172-175: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Document the expected_host parameter for anonymous branch fallback.

GET /projects/branches accepts ?workspace_id=...&project=...&expected_host=...; when the workspace is unconfigured, the server only falls back to https://gitlab.com after normalizing and checking expected_host, so the spec should document the required host-bearing parameter instead of leaving it as a bare project path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/specs/gitlab-integration/spec.md` around lines 172 - 175, Update the GET
/projects/branches specification to document the expected_host query parameter
and its required GitLab host value for anonymous fallback. Describe that the
server normalizes and validates expected_host before allowing the explicitly
named public project path when the workspace is unconfigured.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@docs/plans/remote-repository-entry-reliability/task-01-public-provider-resolution.md`:
- Around line 4-8: Keep the done status and completion evidence consistent by
updating
docs/plans/remote-repository-entry-reliability/task-01-public-provider-resolution.md
lines 4-8 with exact backend test results, changed entry points, risks, and
uncertainties; update
docs/plans/remote-repository-entry-reliability/task-03-resolution-errors-and-retry.md
lines 4-8 with the changed state contract and exact frontend test results; and
update docs/plans/remote-repository-entry-reliability/task-04-mobile-e2e.md
lines 4-8 with the exact E2E result plus any screenshots or failure artifacts.

In `@docs/public/tasks-and-workflows.md`:
- Line 58: Update the “Remote” entry in the tasks-and-workflows documentation to
explicitly identify anonymous public GitHub pull request/issue reads and GitLab
branch reads as credential-free. Clarify that credentials remain required for
private resources and authenticated browsing or write operations, while
preserving the existing URL and branch-selection details.

---

Nitpick comments:
In `@apps/backend/internal/github/service_test.go`:
- Around line 136-148: Replace the deferred server teardown in
TestGetPRAndIssue_FallBackWithoutClient at
apps/backend/internal/github/service_test.go:136-148 with immediate t.Cleanup
registration after creating the test server. Apply the same change to the server
setup at apps/backend/internal/github/service_test.go:196-204, ensuring cleanup
is registered before any assertions or fatal exits.

In `@docs/specs/gitlab-integration/spec.md`:
- Around line 172-175: Update the GET /projects/branches specification to
document the expected_host query parameter and its required GitLab host value
for anonymous fallback. Describe that the server normalizes and validates
expected_host before allowing the explicitly named public project path when the
workspace is unconfigured.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 83eeccd0-ae5b-4a6c-8693-eccffecf7e99

📥 Commits

Reviewing files that changed from the base of the PR and between 767cc89 and 2b50f2c.

📒 Files selected for processing (30)
  • apps/backend/internal/github/controller_test.go
  • apps/backend/internal/github/service_pr.go
  • apps/backend/internal/github/service_reviews.go
  • apps/backend/internal/github/service_test.go
  • apps/backend/internal/gitlab/controller_test.go
  • apps/backend/internal/gitlab/controller_watches.go
  • apps/backend/internal/gitlab/pat_client.go
  • apps/backend/internal/gitlab/pat_client_test.go
  • apps/web/components/task-create-dialog-form-body.test.tsx
  • apps/web/components/task-create-dialog-remote-repo-chip-url.test.tsx
  • apps/web/components/task-create-dialog-remote-repo-chip.test.tsx
  • apps/web/components/task-create-dialog-remote-repo-chip.tsx
  • apps/web/components/task-create-dialog-remote-repo-chips.test.tsx
  • apps/web/components/task-create-dialog-remote-repo-chips.tsx
  • apps/web/components/task-create-dialog-repo-chips.test.tsx
  • apps/web/components/task-create-dialog-submit.test.tsx
  • apps/web/components/task-create-dialog.test.tsx
  • apps/web/e2e/tests/task/mobile-create-task-remote-repo.spec.ts
  • apps/web/hooks/domains/github/use-branches-by-url.test.ts
  • apps/web/hooks/domains/github/use-branches-by-url.ts
  • apps/web/hooks/domains/github/use-pr-info-by-url.test.ts
  • apps/web/hooks/domains/github/use-pr-info-by-url.ts
  • docs/plans/remote-repository-entry-reliability/plan.md
  • docs/plans/remote-repository-entry-reliability/task-01-public-provider-resolution.md
  • docs/plans/remote-repository-entry-reliability/task-02-explicit-url-entry.md
  • docs/plans/remote-repository-entry-reliability/task-03-resolution-errors-and-retry.md
  • docs/plans/remote-repository-entry-reliability/task-04-mobile-e2e.md
  • docs/public/tasks-and-workflows.md
  • docs/specs/gitlab-integration/spec.md
  • docs/specs/tasks/multi-branch/spec.md

Comment thread docs/public/tasks-and-workflows.md Outdated
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Cloudflare Pages docs preview

Open the docs preview

Built from docs commit 012f317.

Stable PR alias: https://docs-pr-1936.landing-87j.pages.dev/docs

@carlosflorencio

Copy link
Copy Markdown
Member Author

Addressed all four inline findings in 81bbe78:

  • forwarded the parsed GitLab origin as expected_host;
  • showed the Enter hint for supported GitHub, GitLab, and Azure SCP remotes;
  • recorded completion evidence in the implementation task files;
  • clarified anonymous public reads versus credential-required operations.

The docstring-coverage warning is non-blocking and does not match this repository's enforced
TypeScript/documentation conventions. The changed-scope typecheck, web tests, docs validation,
Prettier, and ESLint checks pass, so no docstring-only churn was added.

@claude

claude Bot commented Jul 24, 2026

Copy link
Copy Markdown

Claude finished @carlosflorencio's task in 0s —— View job


I'll analyze this and get back to you.

@claude

claude Bot commented Jul 25, 2026

Copy link
Copy Markdown

Claude finished @carlosflorencio's task in 0s —— View job


I'll analyze this and get back to you.

@carlosflorencio
carlosflorencio merged commit 3c09b15 into main Jul 25, 2026
59 checks passed
@carlosflorencio
carlosflorencio deleted the feature/paste-remote-repos-a2l branch July 25, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant