hosted-write-eval-hints-budget-stress.test.mjs
38 lines 1.4 KB
Raw
sha256:4215cecbbabf5591b1ff69053cc938b4b6c800f0d487be40618c1d4254d8b67b security: npm audit fix pre-bridge 2026-09-05 Human 5 days ago
1 /**
2 * HOSTED-WRITE-EVAL hints budget — Tier 4 stress: repeated skip + budget races.
3 */
4 import { describe, it } from 'node:test';
5 import assert from 'node:assert/strict';
6 import { SCOOLING_REVIEW_TRAY_INTENT } from '../lib/hub-proposal-personal-self-apply.mjs';
7 import {
8 HOSTED_PROPOSAL_REVIEW_HINTS_INLINE_BUDGET_MS,
9 maybeScheduleHostedProposalReviewHints,
10 shouldSkipInlineReviewHintsOnCreate,
11 } from '../hub/gateway/proposal-review-hints-async.mjs';
12
13 describe('hosted review-hints budget (stress)', () => {
14 it('N self-apply skips stay cheap and consistent', async () => {
15 const N = 40;
16 const started = Date.now();
17 for (let i = 0; i < N; i++) {
18 assert.equal(
19 shouldSkipInlineReviewHintsOnCreate({ intent: SCOOLING_REVIEW_TRAY_INTENT }),
20 true,
21 );
22 await maybeScheduleHostedProposalReviewHints({
23 method: 'POST',
24 pathOnly: '/api/v1/proposals',
25 upstreamStatus: 200,
26 responseText: JSON.stringify({ proposal_id: `prop-stress-${i}` }),
27 canisterUrl: 'https://example.invalid',
28 effectiveUserId: `user-${i % 3}`,
29 actorUserId: `user-${i % 3}`,
30 vaultId: 'default',
31 hintsEnabled: true,
32 createBody: { intent: SCOOLING_REVIEW_TRAY_INTENT },
33 });
34 }
35 assert.ok(Date.now() - started < 1000);
36 assert.equal(HOSTED_PROPOSAL_REVIEW_HINTS_INLINE_BUDGET_MS, 2000);
37 });
38 });
File History 3 commits
sha256:4215cecbbabf5591b1ff69053cc938b4b6c800f0d487be40618c1d4254d8b67b security: npm audit fix pre-bridge 2026-09-05 Human 5 days ago
sha256:9eaa2a7ec9aaf5866cd03d0deadf843cca97778299d1857b5452f71d92a1880a feat(f24): flip DOCS_NOTION_HUB_KEY_AUTHORIZED=true (Tier 3) Human minor 18 days ago
sha256:e4c529f14a0bb908c1caaaeb3f95f3623a1a82e636e7e3722ca2cd3dc9821263 security: npm audit fix pre-bridge 2026-07-29 Human 42 days ago