fix(server): plan 3a review follow-ups — fail closed without an ORM at every choke point; seam and D5 ratchet tests; dead method and DDL copies removed

This commit is contained in:
jubnl
2026-09-22 16:54:45 +02:00
parent 6fafcd72f2
commit 761cd14b2b
37 changed files with 1020 additions and 204 deletions
@@ -64,13 +64,6 @@ describe('AddonsRepository', () => {
// repeat call from the identity map unless refresh: true is set —
// invisible to a write on the same id in the same request.
describe('sees a write on the same id in the same request (I1, identity-map regression)', () => {
it('ADDONSREPO-004: setEnabled then isEnabled reads the new value, not the stale one', async () => {
insertAddon({ id: 'budget', name: 'Budget', enabled: 0 });
expect(await addons.isEnabled('budget')).toBe(false); // populate the identity map
await addons.setEnabled('budget', true);
expect(await addons.isEnabled('budget')).toBe(true);
});
it('ADDONSREPO-005: a raw UPDATE on the same id then isEnabled reads the new value', async () => {
insertAddon({ id: 'budget', name: 'Budget', enabled: 0 });
expect(await addons.isEnabled('budget')).toBe(false); // populate the identity map
@@ -116,30 +109,4 @@ describe('AddonsRepository', () => {
});
});
});
describe('setEnabled', () => {
it('ADDONSREPO-010: stores the boolean as the legacy 0/1', async () => {
insertAddon({ id: 'budget', name: 'Budget', enabled: 0 });
await addons.setEnabled('budget', true);
expect(rawRow('budget')).toMatchObject({ enabled: 1 });
await addons.setEnabled('budget', false);
expect(rawRow('budget')).toMatchObject({ enabled: 0 });
});
it('ADDONSREPO-011: does not touch any other column', async () => {
insertAddon({ id: 'budget', name: 'Costs', description: 'Track spend', type: 'trip', icon: 'wallet', enabled: 0, sort_order: 5 });
await addons.setEnabled('budget', true);
expect(rawRow('budget')).toEqual({
id: 'budget',
name: 'Costs',
description: 'Track spend',
type: 'trip',
icon: 'wallet',
enabled: 1,
config: '{}',
sort_order: 5,
});
});
});
});