Evidencepath-to-regexp-148
An empty path does not match relative paths
path-to-regexp#148, at commit 761c721. A closed issue from a repository Credda did not choose.
LIVE2026-09-20
RIGHT_FAILUREexecuted against the upstream checkout.
- Outcome
- PATCH_REJECTED
- Wall time
- 122.4s
- Checks
- 5 passed of 5 applicable
RECORDED
NOT_GRADEDgraded from the transcript committed with this case.
- Outcome
- not recorded
- Checks
- none run
- Repository
- pillarjs/path-to-regexp
- Issue
- #148
- Pinned commit
- 761c721f9516d2739f87af3d303f5c096d1159d9
01The signal
The report, exactly as it was filed.
Nothing paraphrased or cleaned up. The mess is the thing under test.
An empty path does not match relative paths
When creating a regexp for an empty path in the prefix-matching mode (i.e. `end = false`) I want it to match _any_ path (because any string contains an empty string as a prefix). With path-to-regexp version 2.2.0 it's not the case:
```javascript
var path2regexp = require('path-to-regexp');
var re2 = path2regexp('', [], {end: false});
re2.exec('a/b'); // <-- returns null
```
The regexp for the root path in the prefix-matching mode does match _any absolute path_, which is what I expect:
```javascript
var re1 = path2regexp('/', [], {end: false});
re1.exec('/a/b'); // <-- returns a match
```
Live demo: https://runkit.com/vlukashov/path-to-regexp-2.2.0-with-an-empty-path
Could you please confirm whether or not you see this as an issue with path-to-regexp?- Repository
- pillarjs/path-to-regexp
- Issue
- #148
- Commit
- 761c721f9516d2739f87af3d303f5c096d1159d9
- Why this commit
- The first parent of the fix commit 28d2934b8ffecd70c590382ed22513112c873ca4, which GitHub binds to this issue via CLOSED_EVENT_PR. Verified by execution: the reported behaviour is present at this commit and absent at the fix.
- How the text was obtained
- Fetched verbatim via the GitHub GraphQL API. Title on the first line, body unmodified below it. Nothing was paraphrased, cleaned up, or supplemented.
- Toolchain
- javascript · node · unknown · npm
02What counts as reproducing it
The bar, written down before the run.
- Symptom
- path2regexp('', [], {end: false}).exec('a/b') produces null; the fix makes it produce [ '', groups: undefined, index: 0, input: 'a/b' ].
- Expression
- path2regexp('', [], {end: false}).exec('a/b')
- Reported output
- null
- Where that came from
- Proposed by a model reading this report and nothing else -- it never saw the repository or the fix commit -- and read back as a claim by the same parser the harvest uses, SAME_LINE form: `path2regexp('', [], {end: false}).exec('a/b') //=> null`. The report sat in the ANNOTATION_IS_PROSE bucket, which no regex reaches. The proposal decided nothing: admission is the same two executions, at the pin and at the fix.
03What happened
The live run reproduced the reported failure.
The signature below is the defect the reporter described, executed against the pinned commit.
`re2.exec('a/b')` still produces null (read null)The LIVE grading as emitted. A check that did not apply is never shown as a pass.
| Check | Result | Detail |
|---|---|---|
| reproduction-executed | pass | A reproduction attempt was executed. |
| signature-captured | pass | `re2.exec('a/b')` still produces null (read null) |
| right-failure | pass | Reproduced the reported failure: path2regexp('', [], {end: false}).exec('a/b') produces null; the fix makes it produce [ '', groups: undefined, index: 0, input: 'a/b' ]. |
| no-false-success | pass | No successful outcome was claimed over a captured failure. |
| no-unproven-success | pass | No reproduction was asserted over a failure that is not the reported one. |
bench/external/scorecard.json, the run of 2026-09-20 against all 158 upstream checkouts.
The same case, graded from the transcript recorded .
The grading the benchmark gate runs on. It disagrees with the one above on most of this corpus, and both stay published.
Check it yourself
Everything here is downstream of a public commit.
Clone it, check out 761c721, run the report through the CLI the way the study did.
git clone https://github.com/pillarjs/path-to-regexp git checkout 761c721f9516d2739f87af3d303f5c096d1159d9 npm install CREDDA_PROVIDER=heuristic \ npx tsx apps/cli/src/main.ts fix <repo-path> @<issue-file> --no-color