feat(events): an expired ledger status and ctx.events.expired (MODULE_API 1.11.0)
A game that ends a resource at its own deadline — a Rust zone erased when its
time is up — could reach core only through ctx.events.reconcile(), which files
it `orphaned`: amber, "it vanished", and still claimable for a revert. The new
call files it as the plan working (Rust PLAN_FIXES F14, D170, D183):
- event_run_resources.status gains `expired`, terminal like `reverted`: the
sweep never takes it back, live_marker releases the target, and it joins
neither HELD nor UNRESOLVED. The ENUM ALTER re-runs as a no-op on every boot
(checked on MariaDB 11.8 with the stored generated column depending on it).
- ctx.events.expired({ kind, ref }) marks the calling module's own pending,
confirmed or orphaned rows for that target expired and logs
`resource.expired`; a revert in flight is left to finish. The owner is bound
by the loader, like reconcile. A finished run whose last unresolved row this
was goes to cleanup `complete`, even from `incomplete`.
- The run console shows it green, "ended by the game on time".
Additions only, so minor. Module-uo (coreApi ^1.10.0) calls none of it and
reads no ledger status; the contract test now asserts the range still holds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -38,6 +38,7 @@ const { test, beforeEach, after } = require('node:test')
|
||||
const assert = require('node:assert/strict')
|
||||
|
||||
const express = require('express')
|
||||
const semver = require('../src/modules/semver')
|
||||
|
||||
const db = require('../src/utils/db')
|
||||
const registries = require('../src/modules/registries')
|
||||
@@ -99,13 +100,19 @@ beforeEach(() => {
|
||||
|
||||
// ── The seam is open ───────────────────────────────────────────────────────
|
||||
|
||||
test('the version a module declares against is 1.10.0', () => {
|
||||
test('the version a module declares against satisfies ^1.10.0', () => {
|
||||
// Not decoration. `coreApi: "^1.10.0"` on every module below is what makes
|
||||
// these tests fail loudly rather than quietly if the bump is ever reverted —
|
||||
// the loader would refuse the manifest and every assertion would become "the
|
||||
// module did not register", which is the same failure the seam closing would
|
||||
// produce. Asserting the number here says which of the two it was.
|
||||
assert.equal(MODULE_API_VERSION, '1.10.0')
|
||||
// produce. Asserting the range here says which of the two it was.
|
||||
//
|
||||
// A range, not the number, since 1.11.0 (`ctx.events.expired`, Rust
|
||||
// PLAN_FIXES D183): an additive bump must keep every module written against
|
||||
// 1.10.0 loading — Module-uo declares exactly `^1.10.0` — and this is the
|
||||
// assertion that says it does. The number itself is pinned in version.js.
|
||||
assert.ok(semver.satisfies(MODULE_API_VERSION, '^1.10.0'), MODULE_API_VERSION)
|
||||
assert.equal(MODULE_API_VERSION, '1.11.0')
|
||||
})
|
||||
|
||||
test('a module registers actions, budgets, leases and option sources', () => {
|
||||
|
||||
Reference in New Issue
Block a user