chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged: - Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances) - country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk after the per-subpath dynamic-import approach silently failed in webpack) - Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index, redirects (ocr to ai, reports to dashboard, invitations to users), docs/admin-ia-proposal.md - Per-template email tester (registry + endpoint + UI on Email admin page) - Cancel-document mode picker (delete-from-Documenso vs keep-for-audit) - Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers - Customize-widgets per-region sortables at xl+ (charts/rails/feed); single flat sortable below xl when the layout stacks; per-viewport saved orders - Audit doc updates capturing each shipped item - Lint fixes: react-compiler immutability in DonutChart (reduce instead of let-reassign), set-state-in-effect disables in CountryFlag and UploadForSigning preview-bytes effect, unused 'confirm' destructures in interest contract + reservation tabs, unescaped apostrophe in test-template card copy
This commit is contained in:
@@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('Concurrent operation safety', () => {
|
||||
it('concurrent interest score calculations should not interfere', async () => {
|
||||
// Scoring is a pure read + compute operation — no shared mutable state.
|
||||
// Scoring is a pure read + compute operation - no shared mutable state.
|
||||
// Simulates 10 parallel calculations to verify isolation.
|
||||
const promises = Array.from({ length: 10 }, (_, i) =>
|
||||
Promise.resolve({ interestId: `interest-${i}`, score: Math.random() * 100 }),
|
||||
@@ -25,9 +25,7 @@ describe('Concurrent operation safety', () => {
|
||||
payload: { clientId: `client-${i}` },
|
||||
}));
|
||||
|
||||
const results = await Promise.allSettled(
|
||||
events.map((e) => Promise.resolve(e)),
|
||||
);
|
||||
const results = await Promise.allSettled(events.map((e) => Promise.resolve(e)));
|
||||
|
||||
expect(results).toHaveLength(10);
|
||||
expect(results.every((r) => r.status === 'fulfilled')).toBe(true);
|
||||
@@ -39,9 +37,7 @@ describe('Concurrent operation safety', () => {
|
||||
const readKpis = (portId: string) =>
|
||||
Promise.resolve({ portId, totalClients: 120, activeInterests: 34 });
|
||||
|
||||
const results = await Promise.all(
|
||||
Array.from({ length: 5 }, () => readKpis('port-abc')),
|
||||
);
|
||||
const results = await Promise.all(Array.from({ length: 5 }, () => readKpis('port-abc')));
|
||||
|
||||
results.forEach((r) => {
|
||||
expect(r).toHaveProperty('portId', 'port-abc');
|
||||
@@ -74,9 +70,7 @@ describe('Concurrent operation safety', () => {
|
||||
const writeAuditEntry = (index: number) =>
|
||||
Promise.resolve({ id: `audit-${Date.now()}-${index}`, index });
|
||||
|
||||
const entries = await Promise.all(
|
||||
Array.from({ length: 20 }, (_, i) => writeAuditEntry(i)),
|
||||
);
|
||||
const entries = await Promise.all(Array.from({ length: 20 }, (_, i) => writeAuditEntry(i)));
|
||||
|
||||
const ids = entries.map((e) => e.id);
|
||||
const uniqueIds = new Set(ids);
|
||||
@@ -101,16 +95,14 @@ describe('Concurrent operation safety', () => {
|
||||
const fulfilled = results.filter((r) => r.status === 'fulfilled');
|
||||
const rejected = results.filter((r) => r.status === 'rejected');
|
||||
|
||||
// Indices 0, 3, 6, 9 fail — 4 rejections, 6 successes.
|
||||
// Indices 0, 3, 6, 9 fail - 4 rejections, 6 successes.
|
||||
expect(fulfilled).toHaveLength(6);
|
||||
expect(rejected).toHaveLength(4);
|
||||
});
|
||||
|
||||
it('high-concurrency burst (50 simultaneous requests) all settle', async () => {
|
||||
// Smoke-tests that the Promise machinery handles a realistic burst.
|
||||
const burst = Array.from({ length: 50 }, (_, i) =>
|
||||
Promise.resolve({ requestId: i }),
|
||||
);
|
||||
const burst = Array.from({ length: 50 }, (_, i) => Promise.resolve({ requestId: i }));
|
||||
|
||||
const results = await Promise.allSettled(burst);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user