fix(gitlab): guide users when the project path has a stray slash - #91354
Merged
Conversation
A project entered with a leading, trailing, or doubled slash passed the format check, URL-encoded into a nonsense path, and 404'd into the "not found or not accessible with this token" message. That points the user at their token when the real problem is the project format. Widen the pre-request format guard to require a numeric id or a group/project path with non-empty segments, so these inputs get the existing format guidance instead. Generated-By: PostHog Desktop Task-Id: 5f41ec65-11ea-47ff-b3f7-908ef5bd6af2
|
😎 Merged successfully - details. |
Contributor
|
Hey @Gilbert09! 👋 It looks like your git author email on this PR isn't your
You can fix it for this repo with: git config user.email "you@posthog.com"Or set it globally with |
Contributor
🤖 CI report
|
There was a problem hiding this comment.
Trivial, well-tested validation fix by an author on the owning team with strong familiarity; no risky territory touched.
- Author wrote 100% of the modified lines and has 2 merged PRs in these paths (familiarity STRONG).
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 10L, 1F substantive, 13L/2F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1a-trivial (13L, 2F, single-area, fix) |
| stamphog 2.0.0b4 | .stamphog/policy.yml @ 3714228 · reviewed head 3714228 |
Contributor
|
/trunk merge |
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.
Problem
A user setting up a GitLab source who enters the project with a stray slash (a leading
/myproject, a trailingmygroup/, or a doubledmygroup//myproject) is told the project is "not found or not accessible with this token". That blames their token, but the real problem is the project format, so they retry with a new token and fail again.The pre-request format guard already catches pasted URLs and bare group names, but a value with a slash slipped through, URL-encoded into a nonsense path, and 404'd into that misleading message.
Changes
How did you test this code?
Added three cases (leading, trailing, doubled slash) to the existing
test_malformed_project_gets_format_guidanceparametrization. They catch the regression where a slash-bearing but malformed project path reaches the API and surfaces the token error; no existing case exercised a value that contains a slash yet is still malformed.Ran the GitLab suite's format cases locally: 7 passed.
Automatic notifications
Docs update
None.
🤖 Agent context
Autonomy: Fully autonomous
Triage of data-warehouse source-creation failures surfaced this misclassified error. Authored by an agent (Claude) via the PostHog Desktop task runner. Skills invoked: /writing-user-facing-copy, /writing-tests, /writing-pr-descriptions.
The fix reuses the existing format-guidance string rather than adding a new message, so the same problem reads the same way across the malformed-input cases.
Created with PostHog Desktop