[rush-serve-plugin] The auto-picked port never reaches the port parameter: `_value` is ignored since ts-command-line uses `#value`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- nodejs, typescript
- Área
- build-system, tooling
Línea de trabajo
Empieza en rush-plugins/rush-serve-plugin/src/phasedCommandHandler.ts alrededor de la línea 241, donde el puerto elegido automáticamente se escribe en portParameter._value, y en libraries/ts-command-line/src/parameters/CommandLineIntegerParameter.ts para ver que el valor se guarda en #value y solo se asigna mediante _setValue(). Se considera terminado cuando una ejecución del handler con el puerto 0 deja portParameter.value igual al puerto activo, con una prueba unitaria que lo cubra. Confirma la corrección con las pruebas existentes del serve-plugin antes de proponer una alternativa pública al setter interno.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
When rush start (or another watch-mode phased command with portParameterLongName) runs without an explicit port, @rushstack/rush-serve-plugin listens on an OS-assigned port and then tries to publish it through the command-line parameter, so that other plugins (and the operations that receive the parameter) see the real port. It does so by writing portParameter._value. Since @rushstack/ts-command-line switched parameters to native private fields (#5943), CommandLineIntegerParameter stores its value in #value, so the assignment only adds an unused property. portParameter.value stays undefined, and nothing downstream sees the port.
Versions
@microsoft/rush/@rushstack/rush-serve-plugin5.181.0@rushstack/ts-command-line5.3.17 (any version that includes #5943)- Node.js 22
Repro
- Configure
rush-serve-pluginwithportParameterLongName: "--port", and define--portas anintegerparameter of thestartcommand, associated with a phase. - Add a second plugin that taps
createOperationsAsyncafter the serve plugin (any stage above -1) and logscontext.customParameters.get('--port').value. - Run
rush startwithout--port.
Expected
The serve plugin logs Content is being served from: https://localhost:<port>/, and the second plugin logs the same <port>.
Actual
The second plugin logs undefined. An explicit --port 4321 works, because then the value comes from the parser.
Code pointer (main)
rush-plugins/rush-serve-plugin/src/phasedCommandHandler.ts, line 241:(portParameter as unknown as { _value?: string })._value = `${activePort}`;libraries/ts-command-line/src/parameters/CommandLineIntegerParameter.ts: the value lives in#valueand is written only by_setValue().
Suggested fix
Set the value through the parameter's setter (it also stores a number, as the integer parameter expects, instead of a string):
(portParameter as unknown as { _setValue(data: unknown): void })._setValue(activePort);
Since _setValue is @internal, a public way for a plugin to override a parsed parameter value (or a session-level API that publishes the serve plugin's active port) would avoid the cast. A unit test that runs the handler with port 0 and checks portParameter.value would catch a regression.
Filed with help from GitHub Copilot (AI); reviewed by the reporter.
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.5k
- Forks
- 710
- Merge medio
- 1 d 13 h
- PR fusionados (30 d)
- 45
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/rushstack
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[rush] Upgrade the pnpm-sync-lib dependency to 0.3.5.Posiblemente ocupada @martinnaj la tomó hace 15 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
microsoft/rushstack#5971 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
microsoft/rushstack#5902 · 1 reacción ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/rushstack
Issues similares
-
fix(frontend): correct VITE_IS_DEVELPOMENT typo in shared/app.ts and align dev environment flagsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
vicharanashala/ajrasakha#1439 ·
Los mantenedores suelen responder en 1 día
-
Add: TV5Monde AsieAbiertoapproved check:passed streams:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
codex-team/editor.js#3037 ·
-
complexity: trivial good first issue impact: low
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
ueberdosis/tiptap#8522 ·
Los mantenedores suelen responder en 1 día
-
Bump anybuf version to ^1.0.0Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
wormhole-foundation/wormhole#5062 ·
Los mantenedores suelen responder en 1 día