feat(rust): the leases and their option sources (phase 12, protocol 8)
Four leases on core.lease: rust.decay.scale, rust.population, rust.spawn.scalar and rust.group.permission. Every lease is targeted and the target names the server (D73). Also the three target option sources plus rust.options.servers, with no budgets (D79). Held for up to seven days (D77). A key that is already held reads as its baseline. Drift is an answer, not a failure. inForce reads the plugin's holds and never compares values. Lease calls get a 4.5s timeout so that two of them fit in core.lease's 10s budget, and a timed-out apply is followed by a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -139,15 +139,38 @@ test('nothing is registered that has nothing behind it yet', () => {
|
||||
// that has something real to put in it, and this assertion is what that phase
|
||||
// deletes. Phase 9 deleted the Team provider's line; phase 10 the four
|
||||
// engagement lines, and the announce leg and post hook it deliberately did
|
||||
// NOT register (D62) moved into the assertions below.
|
||||
// NOT register (D62) moved into the assertions below. Phase 12 deleted the
|
||||
// leases and option sources, and kept budgets here on purpose (D79): a lease
|
||||
// spends none, and a dimension nothing spends is a dial that does nothing.
|
||||
assert.deepStrictEqual(api.record.legs, [])
|
||||
assert.strictEqual(api.record.hooks.post, undefined)
|
||||
assert.strictEqual(api.record.eventBudgets, null)
|
||||
assert.strictEqual(api.record.eventOptionSources, null)
|
||||
assert.strictEqual(api.record.eventLeases, null)
|
||||
assert.strictEqual(api.record.eventActions, null)
|
||||
})
|
||||
|
||||
test('the leases and their option sources are registered, every source a lease reads (phase 12)', () => {
|
||||
const { api } = register()
|
||||
|
||||
const leases = api.record.eventLeases
|
||||
const sources = api.record.eventOptionSources
|
||||
assert.deepStrictEqual(
|
||||
leases.map((l) => l.id).sort(),
|
||||
['rust.decay.scale', 'rust.group.permission', 'rust.population', 'rust.spawn.scalar'],
|
||||
)
|
||||
|
||||
// D78: exactly the sources the leases' targets name — none without a reader.
|
||||
const read = new Set(leases.map((l) => l.target.source))
|
||||
assert.deepStrictEqual([...read].sort(), sources.map((s) => s.id).sort())
|
||||
|
||||
for (const l of leases) {
|
||||
// D73: every lease is targeted, because the target is what names the server.
|
||||
assert.ok(l.target && l.target.label && l.target.example, `${l.id} has no target`)
|
||||
for (const fn of ['read', 'apply', 'restore', 'inForce']) {
|
||||
assert.strictEqual(typeof l[fn], 'function', `${l.id} has no ${fn}()`)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
test('the engagement set is registered as one decision (phase 10, R7)', () => {
|
||||
const { api } = register()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user