Repository navigation
Commit 141056b
test(runtime): judge each share-link password pair once in the messages-audience file (#25426)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDWJsBGQpadCH8JR2xZQ5re)_
Part of #23181 (slice 7). The card stays open for later slices.
Clause-②: no
## What changes
One test file:
`packages/runtime/src/domains/share-links-messages-audience.test.ts`.
Its `beforeAll` wraps the `ShareLinkService` instance's own password
verifier in a memo keyed by the `(password, hash)` pair. This is the
same memo `share-links-refusal-order.test.ts` beside it got in PR
#24704. The first request that presents a pair is judged by the
production verifier (scrypt at the account parameters). Every later
request with that pair gets the same verdict back.
What stays the same:
- every request is still made, on both mounts and both routes, so every
answer is still a real request's answer;
- every row, case and assertion: 85 tests before, 85 after;
- the service is still built with both password members at their
defaults, as production builds it;
- if `verifyPassword` stops being the member name, `beforeAll` throws
instead of quietly going back to paying for every call.
## Measured (local, shared box, `origin/main` `830a63a680` vs this head
`6e979387cc`)
Each run is `pnpm --filter @objectstack/runtime exec vitest run
--maxWorkers=2 src/domains/share-links-messages-audience.test.ts` under
`os-verify-lock`. The box is shared, so the ratios are the reading to
trust, not the absolute numbers.
| | run 1 | run 2 | run 3 |
|:--|--:|--:|--:|
| per-file duration before (json reporter, the unit CI's module line
reports) | 3695 ms | 3816 ms | 3580 ms |
| per-file duration after | 891 ms | 928 ms | 864 ms |
| vitest `Duration` before (wall incl. ~15 s import) | 19.30 s | 18.93 s
| 18.89 s |
| vitest `Duration` after | 16.80 s | 17.98 s | 17.79 s |
- scrypt derivations, counted with a measurement-only preload that wraps
`node:crypto.scrypt` (not part of this PR): **32 before** (30 verifier
calls + 2 password mints), **6 after** (4 distinct pairs + 2 mints), the
same in all three after-runs. Before, the derivations added up to 3817
ms, which is about the whole per-file duration.
- Per-file ratio after/before: about 0.24. Applied to the card's CI
reading (13.51 s, run `39298888283`), that projects to about 3.3 s,
under the 10 s line. The next refresh's list is the real check.
- The rest of the wall is module import (~15 s), and it is the same
before and after. The per-file reading the card grades does not count
import time.
## Tests and gates (at `6e979387cc`)
- `pnpm --filter @objectstack/runtime test`: Test Files 438 passed
(438), Tests 7022 passed / 19 skipped; lock VERDICT command-exit 0.
- `pnpm --filter @objectstack/runtime typecheck`: lock VERDICT
command-exit 0, test layer included (`check:test-typecheck: OK`).
- `pnpm lint`: exit 0.
- `dispatch-gates --commands` derived 54 commands. 53 exited 0. `pnpm
check:dual-build-cjs-loads` exited 3, PREREQUISITE NOT MET (it needs
every package's `dist/`, and this worktree built only the runtime
closure), so it is NOT MEASURED here. CI's Lint & Repo Gates runs it.
`--ran`: 54 accounted, 53 run, 1 NOT-MEASURED, 0 UNRUN.
## Changeset
`skip-changeset`: the only change is a `*.test.ts` file.
`@objectstack/runtime` ships `files: [dist, README.md, CHANGELOG.md]`,
and Build Core checks that no compiled test file ends up in any dist.
## Acceptance notes
- The dispatch suggested importing PR #24704's memo instead of copying
it. That memo is written inline in the sibling file's `beforeAll` and is
not exported, so it can only be imported after being moved into a shared
testkit. Doing that touches the sibling file and adds a new file, which
is outside this slice's one-file surface. So the same 13 lines are
copied here, and the comment names the sibling. Moving both copies into
a `share-link-verifier-memo.testkit.ts` would be a small follow-up for
whoever owns this lane.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01CxBKycaiUpA1yGx1XyoGqX
---
_Generated by [Claude
Code](https://claude.ai/code/session_01CxBKycaiUpA1yGx1XyoGqX)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4374f3c commit 141056b
1 file changed
Lines changed: 30 additions & 0 deletions
File tree
- packages/runtime/src/domains
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
214 | 244 | | |
215 | 245 | | |
216 | 246 | | |
| |||
0 commit comments