The sub-bullet of #454 at the end of « Vérifications dues à la release
suivante » gets one more sentence, same split window and same test profile:
a split changed then deleted, from the Transactions page and from the
Adjustments page, without « database is locked », the transaction back
whole in its category. The unit tests mock the database and the SQLite
replay runs the SQL with python3: neither runs these two writes through
withTransaction in the Tauri runtime. Procedure in the body of PR #516.
Resolves#513
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/architecture.md: the row of transactionService.ts adds that a split is
saved or deleted in one transaction, on the pattern of
updateTransactionCategory, the parent of a saved split read before any
write, and notified after the COMMIT only.
ADR 0022: the row of transactionService.ts lists saveSplitAdjustment and
deleteSplitAdjustment among the writes that notify, after the COMMIT of
their transaction, with the lock released, and never after a ROLLBACK (the
ADR's rule for a new write of a table COUNTERS_SQL reads).
CHANGELOG.md and CHANGELOG.fr.md: one Fixed / Corrigé entry under
[Unreleased], after the entry of #454.
Resolves#513
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
saveSplitAdjustment and deleteSplitAdjustment sent their statements one by
one through getDb(), outside any SQL transaction: an error in the middle
left a half-written split that the reports add up as it is (entries without
their offset line, children without the parent's split flag), and a parent
that could not be found threw after its children were already deleted.
Both now run in withTransaction, through a private *InTransaction function
that issues BEGIN, the statements on the transaction's handle, then COMMIT,
and ROLLBACK then rethrow on any error (the pattern of
applyKeywordInTransaction and updateTransactionCategoryInTransaction). The
save reads the parent first, so a missing parent throws before any write.
The statements and their values are those of main, in the same order once
the parent read is moved before the DELETE: same entries, same offset line
(the parent's description and category, -offsetTotal), same split flag.
Both notify the data-change channel once withTransaction returns, after the
COMMIT and with the DB lock released, never after a ROLLBACK (ADR 0022: a
split writes rows of transactions, which the getting-started counters read).
Tests: the same statements and values as before (green on the base too),
the BEGIN/read/writes/COMMIT order and one notification after the lock is
released, a missing parent (BEGIN, read, ROLLBACK, nothing written), a
failure of each write (ROLLBACK right after it, error rethrown, no
notification), and every statement through the transaction's handle, none
through getDb(). The callers (useTransactions, AdjustmentsPage) are
unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>