refactor!: simplify runtime coordination #7
Backend verify / commits (pull_request) Successful in 29s
Backend verify / security (pull_request) Successful in 8s
Backend verify / verify (pull_request) Failing after 9m36s

Keep financial ownership, atomic publication and refresh CAS.
Failed refresh leaves cookies untouched; logout still clears them.

Remove full-history candle prefetch and special metadata retries.
Use native Pino request context instead of parallel middleware.

BREAKING CHANGE: remove investment stateVersion, queued sync state,
and tbank-sync status progress/resources. Consumers must observe
resources through sync=observe with the updated frontend contract.
This commit is contained in:
2026-10-03 11:38:08 +03:00
parent 0f27da9fd1
commit d698ed9425
48 changed files with 185 additions and 925 deletions
+6 -10
View File
@@ -103,10 +103,11 @@ describe('screen sync HTTP and SQLite', () => {
release([]);
const done = await settled(ids[0]);
expect(done.state).toBe('succeeded');
expect(done.resources[0]).toMatchObject({
resourceKey: 'accounts',
availability: 'complete',
});
const accounts = await request(app.getHttpServer())
.get('/api/v1/brokerage-accounts?sync=observe')
.set('Authorization', auth())
.expect(200);
expect(accounts.body).toMatchObject({ data: [], meta: { availability: 'complete' } });
expect(JSON.stringify(done)).not.toMatch(
/revision|attemptId|encryptedToken|synthetic/,
);
@@ -297,20 +298,17 @@ describe('screen sync HTTP and SQLite', () => {
.set('Authorization', auth())
.expect(200);
const first = before.body as {
meta: { dataRevision: string; stateVersion: string };
meta: { dataRevision: string };
};
const last = after.body as {
data: { items: unknown[] };
meta: {
dataRevision: string;
stateVersion: string;
sync: { id: string };
};
};
expect(last.data.items).toEqual([]);
expect(last.meta.dataRevision).toBe(first.meta.dataRevision);
expect(last.meta.stateVersion).not.toBe(first.meta.stateVersion);
expect(done.resources[0].stateVersion).toBe(last.meta.stateVersion);
await status(last.meta.sync.id).expect(200);
expect(upstream.getOperationsByCursor).toHaveBeenCalledTimes(1);
});
@@ -389,7 +387,6 @@ describe('screen sync HTTP and SQLite', () => {
try {
expect((await status(second).expect(200)).body).toMatchObject({
state: 'running',
progress: { completed: 1, total: 2, discovering: false },
});
await status(second, 'other').expect(404);
} finally {
@@ -401,7 +398,6 @@ describe('screen sync HTTP and SQLite', () => {
expect(await settled(second)).toMatchObject({
state: outcome,
errorCode: outcome === 'failed' ? 'TBANK_UNAVAILABLE' : null,
progress: { completed: 2, total: 2, discovering: false },
});
await prisma.tbankConnection.delete({ where: { userId: 'owner' } });
await status(second).expect(404);