Plugin: handover step + auto-seed prior notes into next session (hc-dy9)

Add a final "Notes for next time" step so the tech finishing today can flag
pending issues, watch-fors, and outstanding client decisions for whoever
picks up the next healthcheck on the same site.

On ATT_HC_Session::start() for a given site_key, the server's step history
for the handover step is queried (limit 1, excluding the just-created
session). If a prior session left handover notes, they're written into
the new session's "Before You Start" notes prefixed with the prior
session's date ("From previous session (YYYY-MM-DD):") so the carry-over
is obvious. The tech can edit/clear them as normal step notes from there.

- includes/steps/125-handover.php — new step (id=handover) using the
  standard notes field. No server schema or API change; it's just another
  step row in step_updates, surfaced like any other.
- ATT_HC_Session::seed_before_notes_from_prior_handover() — best-effort,
  silent degrade on API failure. The session is already registered on
  the server before this runs, so a failed seed never blocks start.
- No seed on resume() — resuming an existing session would clobber
  whatever the tech had already typed.

Verified end-to-end against the live MySQL server: handover-test-XXXX
flow shows carry-over with date prefix; no-handover-XXXX flow confirms
no false-positive seed for a fresh site_key. Test rows purged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-30 10:17:44 +01:00
parent 3c64dd8125
commit 1a9e5ac0fd
3 changed files with 59 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
<?php
if (!defined('ABSPATH')) exit;
/**
* Last step. Anything written in this step's notes is carried into the
* "Before You Start" notes of the NEXT session for the same site_key, so
* the next engagement starts with the prior tech's flags already visible.
*
* The carry-over happens in ATT_HC_Session::start() — see seed_before_notes_from_prior_handover().
*/
return new class extends ATT_HC_Step {
public function id(): string { return 'handover'; }
public function title(): string { return 'Notes for next time'; }
public function blurb(): string {
return 'Anything to flag for whoever picks this up at the next healthcheck — pending issues, things that nearly broke, gotchas, client decisions still outstanding. Whatever you write here will be pre-filled into the "Before You Start" step of the next session for this site, so it gets read.';
}
public function sub_items(): array {
return [
'Pending issues that didn\'t need fixing today but might next time',
'Decisions you\'re waiting on from the client',
'Things that nearly went wrong and what to watch for',
'Workarounds in place that should eventually be properly fixed',
];
}
};