Skip to content

fix(source-control): recognize encoded Gitea repository URLs - #18

Open
kalvenschraut wants to merge 1 commit into
gitea/tracking-filtersfrom
gitea/encoded-urls
Open

fix(source-control): recognize encoded Gitea repository URLs#18
kalvenschraut wants to merge 1 commit into
gitea/tracking-filtersfrom
gitea/encoded-urls

Conversation

@kalvenschraut

@kalvenschraut kalvenschraut commented Sep 5, 2026

Copy link
Copy Markdown
Member

Gitea pull request links containing Unicode repository names now resolve to the configured repository. The URL matcher compares the encoded repository path while preserving its origin and repository checks.

The focused Unicode URL regression, final integrated server typecheck, and targeted lint pass.

Final stack validation at 256fd6fe5: 228 focused tests passed, followed by 61 API/workflow cases and the final team-recovery regression; server typecheck and targeted lint passed. The live settle-on-merge E2E previously passed with fixture cleanup. Companion Gitea backend and focused integration tests passed, including native revert across all five merge styles.

Model: GPT-5.6 Luna and GPT-6 Astra. Harness: Codex.

Summary by CodeRabbit

  • Bug Fixes
    • Pull requests from repositories with special characters or non-ASCII characters in their owner or name are now recognized correctly.

@kalvenschraut

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 0c450855-aea9-4499-94d2-9d2538079aee

📥 Commits

Reviewing files that changed from the base of the PR and between eb6af25 and 00592fc.

📒 Files selected for processing (2)
  • apps/server/src/sourceControl/giteaRepository.test.ts
  • apps/server/src/sourceControl/giteaRepository.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The change updates Gitea pull-request URL matching to encode repository path segments. A test covers percent-encoded non-ASCII owner and repository names.

Changes

Gitea URL matching

Layer / File(s) Summary
Encoded repository path matching
apps/server/src/sourceControl/giteaRepository.ts, apps/server/src/sourceControl/giteaRepository.test.ts
The expected pull-request URL encodes each repository path segment. Tests verify matching for percent-encoded équipe/répo and pull request number 43.

Estimated code review effort: 2 (Simple) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 00592

Gitea pull-request URL matching now supports percent-encoded Unicode repository paths while retaining existing repository validation behavior. The targeted regression coverage supports merge readiness with no identified active risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. 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.
Description check ✅ Passed The description clearly explains the Gitea URL-matching change, the Unicode repository-name issue, the regression test, and validation results. It does not use the template headings or include the che…
Title check ✅ Passed The title clearly and concisely describes the main change: recognizing encoded Gitea repository URLs.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gitea/encoded-urls

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

@kalvenschraut
kalvenschraut marked this pull request as ready for review September 5, 2026 05:57
@kalvenschraut

Copy link
Copy Markdown
Member Author

@coderabbitai review

Please review this PR at its exact current head in stack pingdotgg#6. Verify correctness, regressions, security boundaries, and focused coverage against its current base, and report any actionable findings with file references.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== PR metadata =="
gh pr view 18 --repo RTVision/t3code --json number,state,isDraft,baseRefName,baseRefOid,headRefName,headRefOid,url

echo
echo "== Current HEAD and merge-base =="
git rev-parse HEAD
git merge-base "origin/$(gh pr view 18 --repo RTVision/t3code --json baseRefName --jq .baseRefName)" HEAD

echo
echo "== Diff against current merge-base =="
BASE="$(git merge-base "origin/$(gh pr view 18 --repo RTVision/t3code --json baseRefName --jq .baseRefName)" HEAD)"
git diff --no-ext-diff --unified=80 "$BASE"...HEAD -- \
  apps/server/src/sourceControl/giteaRepository.ts \
  apps/server/src/sourceControl/giteaRepository.test.ts

echo
echo "== Source outline =="
ast-grep outline apps/server/src/sourceControl/giteaRepository.ts --items all

echo
echo "== Test outline =="
ast-grep outline apps/server/src/sourceControl/giteaRepository.test.ts --items all

echo
echo "== Relevant source and test sections =="
rg -n -C 25 -e '\bgiteaPullRequestNumber\b' -e '\bencodeURIComponent\b' \
  apps/server/src/sourceControl/giteaRepository.ts \
  apps/server/src/sourceControl/giteaRepository.test.ts

echo
echo "== Call sites and comparable provider implementations =="
rg -n -C 8 -P '\bgiteaPullRequestNumber\s*\(' apps/server
rg -n -C 12 -P '\b(?:github|gitlab|gitea)PullRequestNumber\s*\(' apps/server/src/sourceControl

Length of output: 2107


🏁 Script executed:

#!/bin/bash
set -euo pipefail

REPO="RTVision/t3code"
BASE_SHA="d41838efd1fe8341cc3a8a9216e6f14ab150f6dd"
HEAD_SHA="010e69b9c7cf866baae51f2255090eb559a61060"

echo "== PR changed files and patches from GitHub =="
gh api --paginate "repos/$REPO/pulls/18/files?per_page=100" \
  --jq '.[] | {filename, status, additions, deletions, patch}'

for path in \
  apps/server/src/sourceControl/giteaRepository.ts \
  apps/server/src/sourceControl/giteaRepository.test.ts
do
  echo
  echo "== $path at current head =="
  cat -n "$path"

  echo
  echo "== $path at PR base =="
  gh api \
    -H 'Accept: application/vnd.github.raw+json' \
    "repos/$REPO/contents/$path?ref=$BASE_SHA" | cat -n
done

echo
echo "== Source-control directory map =="
ast-grep outline apps/server/src/sourceControl --items all --type function,class,interface,type

echo
echo "== URL parsing and encoding references in source-control code =="
rg -n -C 10 -P '\b(?:new URL|URL\(|encodeURIComponent|decodeURIComponent|pullRequestNumber)\b' \
  apps/server/src/sourceControl

echo
echo "== Gitea tests: URL and error cases =="
rg -n -C 12 -P '(?:pull request|pullRequest|giteaPullRequestNumber|https?://|encodeURIComponent)' \
  apps/server/src/sourceControl/giteaRepository.test.ts

Length of output: 16360


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== giteaPullRequestNumber call sites =="
rg -n -C 15 -P '\bgiteaPullRequestNumber\s*\(' apps/server

echo
echo "== Gitea repository parsing and integration call sites =="
rg -n -C 12 -P '\b(?:parseGiteaRepository|giteaRepositoryFromRemote|giteaRepositoryPath)\s*\(' \
  apps/server

echo
echo "== Source-control file map =="
fd -t f . apps/server/src/sourceControl | sort

echo
echo "== Comparable pull-request URL matching implementations =="
rg -n -C 20 -P 'function\s+\w*PullRequestNumber\b|export\s+function\s+\w*PullRequestNumber\b' \
  apps/server/src/sourceControl

echo
echo "== Test configuration references =="
rg -n -C 5 -P '(?:`@effect/vitest`|vitest|giteaRepository\.test)' \
  package.json apps package.json 2>/dev/null || true

echo
echo "== WHATWG URL pathname checks =="
node --input-type=module <<'NODE'
const base = "https://forge.example.test/gitea";
for (const reference of [
  `${base}/%C3%A9quipe/r%C3%A9po/pulls/43/files`,
  `${base}/%c3%a9quipe/r%c3%a9po/pulls/43`,
  `${base}/%C3%A9quipe/r%C3%A9po/pulls/43`,
  `${base}/%C3%A9quipe/r%C3%A9po/pulls/43%2Fother`,
]) {
  const url = new URL(reference);
  console.log(JSON.stringify({ reference, pathname: url.pathname, origin: url.origin }));
}
console.log(
  JSON.stringify({
    encodedRepository: "équipe/répo".split("/").map(encodeURIComponent).join("/"),
  }),
);
NODE

Length of output: 201917


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Exact checked-out head =="
git rev-parse HEAD
gh pr view 18 --repo RTVision/t3code --json headRefOid,baseRefOid --jq '{headRefOid, baseRefOid}'

echo
echo "== Production imports of the Gitea repository helper module =="
rg -n -C 8 -g '*.ts' -g '!*.test.ts' \
  'from ["'\''][^"'\'']*giteaRepository(?:\.ts)?["'\'']' \
  apps/server

echo
echo "== Production calls to giteaPullRequestNumber =="
rg -n -C 12 -g '*.ts' -g '!*.test.ts' \
  '\bgiteaPullRequestNumber\s*\(' \
  apps/server || true

echo
echo "== All direct calls, limited to the helper test and source-control module =="
rg -n -C 8 -g '*.ts' \
  '\bgiteaPullRequestNumber\s*\(' \
  apps/server/src/sourceControl

echo
echo "== Repository validation boundary in Gitea integration code =="
rg -n -C 12 -g '*.ts' -g '!*.test.ts' \
  '\bparseGiteaRepository\s*\(|\bgiteaRepositoryFromRemote\s*\(' \
  apps/server/src

Length of output: 37937


@kalvenschraut Reviewed PR #18 at head 010e69b9c7cf866baae51f2255090eb559a61060 against base d41838efd1fe8341cc3a8a9216e6f14ab150f6dd.

No actionable findings.

The change encodes each validated repository path segment before comparison with URL.pathname. The existing exact-origin check and repository-specific /pulls/ boundary remain in place. The added test covers the intended percent-encoded Unicode owner and repository path.

I did not execute repository tests because the review sandbox does not permit execution of repository files.

You are interacting with an AI system.

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