Bug: Incorrect port range in comment vs actual code
Description
In packages/core/src/utils/port-allocation.ts, the inline comment inside calculatePortOffset states:
// 100-999 range: Offset starts at 100 to avoid default port 3000, results in ports 3100-3999
return (hash.readUInt16BE(0) % 900) + 100;
However, the actual basePort used in getPort() is 3090, not 3000:
const basePort = 3090;
// ...
const port = basePort + offset; // 3090 + 100..999 => 3190..4089
So the real port range allocated for worktrees is 3190–4089, not the 3100–3999 stated in the comment.
The JSDoc above the function already has the correct range:
* @returns Offset in range 100-999 (ports 3190-4089 when added to base 3090)
But the inline comment directly contradicts this, making it confusing for contributors.
Steps to reproduce
- Open
packages/core/src/utils/port-allocation.ts
- Read the inline comment in
calculatePortOffset
- Compare with
basePort = 3090 and the JSDoc — the inline comment says 3100–3999 but the JSDoc says 3190–4089
Expected behaviour
The inline comment should match the correct JSDoc annotation and actual arithmetic:
// 100-999 range; produces ports 3190-4089 when added to basePort (3090)
Fix
Update the misleading inline comment to accurately describe the resulting port range.
Bug: Incorrect port range in comment vs actual code
Description
In
packages/core/src/utils/port-allocation.ts, the inline comment insidecalculatePortOffsetstates:However, the actual
basePortused ingetPort()is 3090, not 3000:So the real port range allocated for worktrees is 3190–4089, not the 3100–3999 stated in the comment.
The JSDoc above the function already has the correct range:
But the inline comment directly contradicts this, making it confusing for contributors.
Steps to reproduce
packages/core/src/utils/port-allocation.tscalculatePortOffsetbasePort = 3090and the JSDoc — the inline comment says 3100–3999 but the JSDoc says 3190–4089Expected behaviour
The inline comment should match the correct JSDoc annotation and actual arithmetic:
// 100-999 range; produces ports 3190-4089 when added to basePort (3090)Fix
Update the misleading inline comment to accurately describe the resulting port range.