fix(server): use account identity for duplicate-session idle policy (… - #120
Conversation
|
Te aviso que esta quedo en conflicto con Hoy entraron cuatro merges que tocan esa zona: #109 (los seed que faltaban, La issue #16 sigue asignada a vos y la PR queda abierta. Cuando rebasees contra Dos cosas que cambiaron y te conviene saber: El CI ahora sirve. Las corridas de los PRs de fork quedan esperando aprobacion. Nadie las estaba aprobando, por eso tu PR nunca mostro resultado. Ya lo estoy destrabando a mano; avisa cuando rebasees y la apruebo. |
| "clean": "rm -rf dist", | ||
| "build": "pnpm run clean && tsc && node scripts/copy-assets.cjs", | ||
| "dev": "NODE_ENV=development tsx watch src/server.ts", | ||
| "test": "tsx --test tests/**/*.test.ts", |
There was a problem hiding this comment.
⚠️ Bug: New npm scripts reference missing files
Both new scripts point at paths that don't exist in the repo: test:client-activity runs src/scripts/testClientActivityPolicy.ts (not present in server/src/scripts/) and test runs tsx --test tests/**/*.test.ts (no server/tests/ directory exists). pnpm test and pnpm test:client-activity will fail immediately, and any CI wired to test will break. Add the missing test file/directory in this PR, or remove the script entries until the tests land.
Was this helpful? React with 👍 / 👎
| "clean": "rm -rf dist", | ||
| "build": "pnpm run clean && tsc && node scripts/copy-assets.cjs", | ||
| "dev": "NODE_ENV=development tsx watch src/server.ts", | ||
| "test": "tsx --test tests/**/*.test.ts", |
There was a problem hiding this comment.
💡 Quality: Test glob may not expand without shell globstar
tsx --test tests/**/*.test.ts relies on ** recursive globbing, which requires shell globstar (bash) or is passed literally to tsx depending on the runner. If the pattern isn't expanded, the test command silently matches nothing or errors. Prefer letting the test runner do the matching (e.g. tsx/node's own glob support) or a portable pattern to avoid environment-dependent behavior.
Was this helpful? React with 👍 / 👎
Code Review 🚫 Blocked 0 resolved / 4 findingsFixes duplicate-session idle policy to use account identity instead of IP-based grouping with added unit tests, but the PR is blocked by four issues: missing test files referenced in npm scripts ( 🚨 Bug: Imported ./gracefulShutdown module is missing from this branch📄 server/src/server.ts:7 📄 server/src/server.ts:211-225 server.ts adds
|
| Auto-apply | Compact |
|
|
Important
Your trial ends in 4 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more.
Was this helpful? React with 👍 / 👎 | Gitar
|
Rebase/sync contra `main` já está aplicado no head atual `548c73b`, e
as duas verificações desse commit concluíram com sucesso: **CI ✅** e
**Secret Scan ✅**.
Também conferi os quatro pontos do review contra o head/base atuais:
- `server/src/gracefulShutdown.ts` existe no head atual;
- `RuntimeClient.close` já aceita `code?` e `reason?`;
- `test` e `test:client-activity` já existem iguais no `main` e não
foram introduzidos pela #120;
- o único script novo desta PR é `test:connection-policy`, e o arquivo
correspondente está incluído.
Então o review parece ter usado estado anterior/parcial da branch. A
PR está mergeable e com CI verde; fica pronta para nova revisão/merge.
…On Fri, 28 Aug 2026 01:53:44 -0700, "gitar-bot[bot]" ***@***.***> wrote:
gitar-bot[bot] left a comment [(Bitcoindefi/OpenAO#120)](#120 (comment))
Reviewing your code
Code Review 🚫 Blocked 0 resolved / 4 findings
Fixes duplicate-session idle policy to use account identity instead of IP-based grouping with added unit tests, but the PR is blocked by four issues: missing test files referenced in npm scripts (testClientActivityPolicy.ts and tests/ directory), a shell-dependent glob pattern in the test script, a missing gracefulShutdown.ts module imported by server.ts that causes startup failure, and a type mismatch on RuntimeClient.close() that doesn't accept the arguments being passed. These must be resolved before merge.
🚨 Bug: Imported ./gracefulShutdown module is missing from this branch
📄 [server/src/server.ts:7](https://github.com/Bitcoindefi/OpenAO/pull/120/files#diff-4398e3b2ab3e7e7e70a93409fa893abf68608d45a5ad1ac7faaf888dac77005dR7) 📄 [server/src/server.ts:211-225](https://github.com/Bitcoindefi/OpenAO/pull/120/files#diff-4398e3b2ab3e7e7e70a93409fa893abf68608d45a5ad1ac7faaf888dac77005dR211-R225)
server.ts adds import { createGracefulShutdown } from "./gracefulShutdown" and calls it at module load, but no gracefulShutdown.ts/.js exists in this branch (git ls-tree HEAD server/src shows nothing; the commit [8b28af6](8b28af6) that added it lives only on origin/main and is not an ancestor of this PR). As written the branch fails to compile/resolve the module and the server crashes on startup. Either add gracefulShutdown.ts to this branch or properly merge the main commit that introduces it before merging.
|
|
Mergeado. Verificado en local con los comandos del CI, no sólo mirando el verde: Lo que me convenció del enfoque es esta línea de // Never fall back to public IP when the authenticated account identity is absent.
if (!accountId) {
continue;
}Ahí está el bug entero. Dos personas atrás del mismo CGNAT son dos cuentas distintas, así que dejan de penalizarse entre sí; una persona con dos sesiones de la misma cuenta se sigue penalizando, que es lo que la política quería decir desde el principio. Y sacarlo a su propio módulo lo vuelve testeable sin levantar el servidor. Gracias por el rebase y por dejar escrito en el comentario qué commit y qué checks, que ahorra tener que ir a buscarlo. |
Fixes #16
Summary by Gitar
connectionPolicy.tstestConnectionPolicy.tscovering CGNAT and missing account scenariosThis will update automatically on new commits.