Repository navigation
feat(mcp): the maintenance tools, the counts the pass drops, and the run record - #1226
Conversation
MaintenanceService::clear_old_events answers EventPurgeCounts; the guard's arm answers three zeros without calling the store. The MaintenanceTasks future carries the counts, MaintenanceRunner passes them through, and PassOutcome gains counts: Option<EventPurgeCounts> — None on the error, panic and timeout arms, because zeros there would be a fake.
MaintenanceRun holds ranAt and the three purge counts; record_maintenance_run replaces the previous value and answers the record it stored, latest_maintenance_run reads it, and the field sits on AdminRuntime beside the heartbeats and the probe ring. WorkerHeartbeat and the status document are untouched.
maintenance_run is a write row that runs the purge step through MaintenanceService in the answering process and records it; maintenance_last_run is a read row that answers {run} from AdminState. The crate takes nostream-services as a real dependency, McpError gains a transparent Services variant, the surface is fourteen names (nine reads, five writes), and the absent-name example moves to no_such_tool.
…pipe
Over a config with limits.event.retention.maxDays: 7, maintenance_run answers the store's Phase-1 message while maintenance_last_run answers {run: null}: a failed run records nothing. Both tools/list counts move to 14.
ADR 0019 carries the six decisions; ADR 0014's audit table gains both actions and its scope sentence now points at the TOOLS table; ADRs 0017 and 0018 gain the forward line naming 0019.
…tion The --help lists and CONFIGURATION.md's read and write rows name maintenance_run and maintenance_last_run, and the write row reads five.
🦋 Changeset detectedLatest commit: 2a11611 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
[Medium impact] The changes affect MCP maintenance calls and the shared maintenance-pass count contract. The PR appears safe to merge, with a non-blocking test gap around the named deletion counts. Findings
|
| assert_eq!(result.is_error, Some(false), "{}", text(&result)); | ||
| assert_eq!( | ||
| payload(&result), | ||
| run(NOW_RAN_AT, [1, 1, 1]), |
There was a problem hiding this comment.
The new MCP tests always give deleted and expired equal counts. Swapping those fields in record_maintenance_run would leave every new case green while showing operators the wrong breakdown. Seed different numbers of deleted and expired events, then check both tools’ named fields.
Slice 5 of #1183:
maintenance_runandmaintenance_last_run, the retention purge's counts through the seam, and a last-run record.The API change the family carried.
MaintenanceService::clear_old_eventsanswersEventPurgeCountsinstead of(), theMaintenanceTaskstrait's future carries them,MaintenanceRunnerpasses them through, andPassOutcomegainscounts: Option<EventPurgeCounts>—Noneon a failed, panicked or timed-out purge, never zeros.crates/nostream-storageis untouched: both backends already answered the counts, and noEventRepositoryimplementor moves. The counts are handed on as one named value (record_maintenance_run(counts: EventPurgeCounts)), so a transposeddeleted/expiredpair is a call the compiler refuses.The door.
maintenance_run(write scope) runs the purge step throughMaintenanceService— the function the worker'sMaintenanceTasksarm delegates to, since aMaintenanceRunnerneeds the outbox dispatcher, payments service and relay key source the stdio mode does not compose — and records the run.maintenance_last_run(read scope) answers{"run": null}before any run in this process and{"run": {ranAt, deleted, expired, retained}}after one. The record is process memory inAdminState: replace, never sum.The limit, stated not hidden. The stdio door is its own process, so the record is this process's own. Run beside a daemon,
{"run": null}means "this process has not run one" and the daemon's passes are invisible — a known blind spot, and the tool's description says so. ADR 0019's Consequences names the durable cross-process record as that decision's successor, and prices it: an amendment to ADR 0016's five-key document plus a writer at the loop, which already holds the counts and discards them (MaintenanceTasks→run_pass'sPassOutcomeatworkers/maintenance.rs:178).Record. ADR 0019 (six decisions, each with its cost), ADR 0014/0017/0018 amended, the absent-name example retired to
no_such_tool(no#1183name is absent now),CONFIGURATION.md,--helpandMCP_INSTRUCTIONSat fourteen tools / nine reads / five writes, one empty changeset.Measured. mcp 101 over 9 targets (96/8 at base); services
maintenance7 (6);mcp_stdio20 (19); workspace 1 808 passed / 0 failed over 105 targets (1 801/0 over 104);fmt, both clippy passes and--releaseclean;tools/listsnapshot rendered from the live server and compared.Sixteen criteria a wrong implementation could have satisfied were rewritten before the build (the two-pass cap), and the two findings that mattered were both introduced by a fix: a positional-count swap all five new cases stayed green through, and a cost paragraph whose premise a neighbouring ADR refuted. Rounds: 1 full (five lenses), 2 and 3 confirmation, two reworks, approver APPROVE at
2a116117.Rust only: no version bump.
Closes #Nis inert on this repository's integration branch; #1183 is closed by hand with the merge sha.