Skip to content

fix(mobile-nitro): reject trailing path segments in issue deep links - #49693

Open
only21mil wants to merge 1 commit into
pingdotgg:mainfrom
only21mil:fix/mobile-nitro-issue-links-exact-segments
Open

only21mil wants to merge 1 commit into
pingdotgg:mainfrom
only21mil:fix/mobile-nitro-issue-links-exact-segments

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

When an issue deep link has extra trailing path segments (for example, t3code://issues/env/proj/github/acme%2Fapp/42/comments), parseAppLink silently discards them and returns an issue link instead of null because case "issues": slices segments.slice(1, 6) without checking segments.length === 6.

Change

Guard case "issues": in apps/mobile-nitro/src/navigation/appLinks.ts with if (segments.length !== 6) return null;, matching sibling exact-length routes. Add one invalid-path assertion for trailing issue segments to the existing test in apps/mobile-nitro/src/navigation/appLinks.test.ts.

Scope

Small bug fix for malformed issue deep-link parsing in apps/mobile-nitro; a narrow fix for an obvious parser omission needs no tracking issue.

Verification

Found by reading parseAppLink: its other fixed-length routes check the segment count and case "issues": did not.

Setup: Linux, Node 26.13.1, no UI change.

Steps: Run vp env exec --node 26.13.1 node --input-type=module -e 'import { parseAppLink } from "./apps/mobile-nitro/src/navigation/appLinks.ts"; console.log("trailing:", JSON.stringify(parseAppLink("t3code://issues/env/proj/github/acme%2Fapp/42/comments"))); console.log("valid:", JSON.stringify(parseAppLink("t3code://issues/env/proj/github/acme%2Fapp/42")));' → compare stdout on base and head.

Before (8ae23c521d83):

trailing: {"kind":"issue","environmentId":"env","projectId":"proj","tracker":"github","scope":"acme/app","issueKey":"42"}
valid: {"kind":"issue","environmentId":"env","projectId":"proj","tracker":"github","scope":"acme/app","issueKey":"42"}

After (b7487ecc0b83):

trailing: null
valid: {"kind":"issue","environmentId":"env","projectId":"proj","tracker":"github","scope":"acme/app","issueKey":"42"}

On b7487ecc0b83 (Node 26.13.1): vp test run apps/mobile-nitro/src/navigation/ passed (3 files, 25 tests); the new assertion uses the same URL that returns an issue link on 8ae23c521d83 above; vp run check:changed 8ae23c521d8361c60e419abf1737879ee4eef7ad passed (format, lint, knip, typecheck, appLinks.test.ts).

Links:

  • Base: 8ae23c521d83 · Candidate: b7487ecc0b83
  • apps/mobile-nitro/src/navigation/appLinks.ts, apps/mobile-nitro/src/navigation/appLinks.test.ts

Not shown:

  • Opening the link in the Nitro app on a simulator or device: not run. The output above calls parseAppLink directly in Node.
  • Repo-wide checks (left to CI).

Generated with Gemini 4 Neon in T3 Code Nightly

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Dec 6, 2026
expect(parseAppLink("t3nitro://unknown/env/run")).toBeNull();
expect(parseAppLink("t3nitro://workflows/env")).toBeNull();
expect(parseAppLink("t3nitro://pull-requests/env/proj/repo/abc")).toBeNull();
expect(parseAppLink("t3code://issues/env/proj/github/acme%2Fapp/42/comments")).toBeNull();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This checks a one-off guard for a malformed issue link; valid links are unaffected, so it doesn't meet the permanent-test bar. Could you remove this assertion and retain the repro as verification?

Suggested change
expect(parseAppLink("t3code://issues/env/proj/github/acme%2Fapp/42/comments")).toBeNull();

Posted via Macroscope — Test Signal

@macroscopeapp

macroscopeapp Bot commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at b7487ec

Macroscope's review found this PR approvable — Issue deep links with trailing path segments are now rejected instead of opening the issue identified by their prefix. Valid links remain unchanged, with effects limited to malformed-link navigation.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The issues route now rejects paths that do not contain exactly six segments. A test verifies that an issue-comments URL using the t3code scheme is rejected.

Changes: Issue Link Validation

Layer / File(s) Summary
Validate issue path segments
apps/mobile-nitro/src/navigation/appLinks.ts, apps/mobile-nitro/src/navigation/appLinks.test.ts
The issues route rejects paths whose segment count is not exactly six. A test checks rejection of an issue-comments URL.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to b7487

Issue deep links with extra trailing path segments are now rejected instead of being parsed as valid issue links. No merge-blocking risk is apparent.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(mobile-nitro): reject trailing path segments in issue deep links" states the main change. The diff adds an exact six-segment check to the issues route in appLinks.ts and a matching test…
Description check Passed The description follows the template. It covers Problem (trailing segments parsed as a valid issue link), Change (exact length guard in appLinks.ts plus one test assertion), Scope (small bug fix, no t…
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.
Full details: Title check

Explanation

The title "fix(mobile-nitro): reject trailing path segments in issue deep links" states the main change. The diff adds an exact six-segment check to the issues route in appLinks.ts and a matching test assertion, so the title is specific and on-topic. It is a conventional commit title in plain language and stays under the usual length.

Full details: Description check

Explanation

The description follows the template. It covers Problem (trailing segments parsed as a valid issue link), Change (exact length guard in appLinks.ts plus one test assertion), Scope (small bug fix, no tracking issue needed, with a reason), and Verification (before/after parseAppLink output, focused test run, and check:changed results, plus a note on what was not tested). The description does not include a model and harness line in the required form, but it does say 'Generated with Gemini 4 Neon in T3 Code Nightly', which covers the template's agent note. The Verification section is detailed and does not rely on 'tests pass' alone.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 797fc44 and b7487ec.

Files selected for processing: 2

  • apps/mobile-nitro/src/navigation/appLinks.test.ts
  • apps/mobile-nitro/src/navigation/appLinks.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant