fix(investments): align roles and date contracts
Backend security / security (push) Successful in 9s
Backend verify / verify (push) Successful in 10m23s
Backend security / security (pull_request) Successful in 8s
Backend verify / verify (pull_request) Successful in 10m39s
Conventional commits / commits (pull_request) Successful in 29s

Identify income dependencies by role and document screen-specific dates.
Convert inclusive calendar days into half-open source ranges while
preserving operation timestamps and existing stored coverage.
This commit is contained in:
2026-09-27 11:38:13 +03:00
parent e4232138d0
commit 516e43203e
18 changed files with 500 additions and 74 deletions
+51
View File
@@ -122,6 +122,25 @@ describe('screen sync HTTP and SQLite', () => {
from: '2026-02-31',
to: '2026-03-01',
},
...(['income', 'events'] as const).flatMap((screen) => [
{ screen, accountId: 'all', from: '2025-02-29', to: '2025-03-01' },
{ screen, accountId: 'all', from: '2024-03-01', to: '2024-02-29' },
{
screen,
accountId: 'all',
from: '2024-02-29T00:00:00Z',
to: '2024-02-29',
},
{
screen,
accountId: 'all',
from: '2024-02-29',
to: '2024-02-29T23:59:59Z',
},
]),
{ screen: 'income', accountId: 'all', from: '2024-02-29' },
{ screen: 'income', accountId: 'all', to: '2024-02-29' },
{ screen: 'events', accountId: 'all', to: '2000-01-01' },
{
screen: 'stock',
instrumentUid: '00000000-0000-4000-8000-000000000001',
@@ -145,6 +164,38 @@ describe('screen sync HTTP and SQLite', () => {
expect(await prisma.tbankSyncWork.count()).toBe(0);
expect(upstream.getOpenAccounts).not.toHaveBeenCalled();
});
it.each([
{
screen: 'income',
accountId: 'all',
from: '2024-02-29',
to: '2024-02-29',
},
{
screen: 'events',
accountId: 'all',
from: '2096-02-29',
to: '2096-02-29',
},
{ screen: 'events', accountId: 'all', from: '2096-02-29' },
{ screen: 'events', accountId: 'all', to: '2096-02-29' },
{
screen: 'operations',
accountId: 'all',
from: '2024-02-29T00:00:00Z',
to: '2024-03-01T00:00:00Z',
},
])(
'preserves valid calendar/instant scope in accepted and status responses: %j',
async (scope) => {
const response = await post(scope).expect(202);
const accepted = response.body as { id: string; scope: object };
expect(accepted.scope).toEqual(scope);
const result = await settled(accepted.id);
expect(result.scope).toEqual(scope);
expect(result.state).toBe('succeeded');
},
);
it('keeps failed work terminal, cancels abandoned work without restart, and hides old connection handles', async () => {
upstream.getOpenAccounts.mockRejectedValue(
new Error('upstream details never exposed'),