qbo_auth: после invalid_grant статус сохраняется (не откатывается), sync отвечает 409 reauth_needed; найдено ручным тестом M1
Some checks failed
ci / test (push) Successful in 39s
ci / deploy (push) Has been cancelled

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 10:16:11 +03:00
parent 6d6b8aa22d
commit 065eee0bad
5 changed files with 40 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
import { SPECS, type EntitySpec, type Row } from "./mirror.js";
import { QboApi } from "./api.js";
import { ReauthNeeded } from "./service.js";
import type { FetchFn } from "./oauth.js";
export interface Q {
@@ -179,6 +180,7 @@ export class QboSync {
} catch (e) {
const error = String((e as Error).message ?? e).slice(0, 500);
if (runId) await this.d.query("update qbo_sync_run set status = 'error', finished_at = now(), counts = $2, error = $3 where id = $1", [runId, JSON.stringify(counts), error]).catch(() => undefined);
if (e instanceof ReauthNeeded) throw e; // вызывающий (HTTP) отвечает 409 reauth_needed
return { runId, realmId, status: "error", counts, error, durationMs: Date.now() - started };
} finally {
this.running = false;