feat: support extra health state mechanics
Validate and deploy production / validate (push) Successful in 21s
Validate and deploy staging / validate (push) Successful in 23s
Validate and deploy production / deploy (push) Successful in 44s
Validate and deploy staging / deploy (push) Successful in 30s

This commit is contained in:
jb
2026-07-31 23:55:49 -04:00
parent 9ac2fe47cf
commit 1998e87309
16 changed files with 575 additions and 47 deletions
+23 -1
View File
@@ -149,7 +149,7 @@ describe('conditional mechanic persistence adapter', () => {
)).toThrow(/inconsistent delivery_duration_seconds metadata/);
});
it('round-trips continuous delivery through normalized rows', async () => {
it('round-trips continuous delivery and direct event predicates through normalized rows', async () => {
const database = await connect(':memory:');
await database.exec(`CREATE TABLE conditional_effect_rules (
id TEXT PRIMARY KEY, source_type TEXT, source_id TEXT, configured INTEGER,
@@ -276,6 +276,19 @@ describe('conditional mechanic persistence adapter', () => {
}
}
}]
}, {
key: 'extra-health-state',
label: 'Extra Health state',
event: 'extra_health_changed',
if: {
kind: 'compare',
left: { source: 'event', path: 'values.hasExtraHealth' },
operator: 'eq',
right: true
},
reducer: { kind: 'none' },
mutations: [],
outcomes: []
}]
});
@@ -358,5 +371,14 @@ describe('conditional mechanic persistence adapter', () => {
II: { value: 336 }
}
});
expect(loaded?.clauses[1]).toMatchObject({
event: 'extra_health_changed',
if: {
kind: 'compare',
left: { source: 'event', path: 'values.hasExtraHealth' },
operator: 'eq',
right: true
}
});
});
});