Skip to content

fix(bin): let fm-secondmate-report.sh carry a decision key - #6

Merged
matthewstrud merged 6 commits into
mainfrom
fm/fm-report-key
Sep 18, 2026
Merged

matthewstrud merged 6 commits into
mainfrom
fm/fm-report-key

Conversation

@matthewstrud

Copy link
Copy Markdown
Owner

Secondmates raising a decision through bin/fm-secondmate-report.sh could not have it closed: the helper always wrote [corr=] in the leading bracket and appended (via-helper) at the tail, so any key a caller tried to embed landed at the note tail where neither _fm_key_before_colon nor _fm_key_at_note_head reads it, the decision folded under default, and fm-send --resolve-key refused.

This change adds a --key option that places [key=] at the note head — the only bracket position the fold reads — while the corr token stays in the leading bracket so the pending-reply contract still correlates. Keyless calls are byte-identical to the historical shape. The helper also rejects keys in the reserved pending-reply- namespace and the literal default key, reading those prefixes from fm-classify-lib.sh FM_CLASSIFY_RESERVED_KEY_PREFIXES_DEFAULT so the guard cannot silently drift.

Three pipeline-fix commits from the aborted validation run are preserved: dash-leading key rejection, --key=value support, and doc accuracy.

Proof: a needs-decision via the helper with --key appears in OPEN DECISIONS under its key, fm-send --resolve-key closes it, and the drain no longer lists it. A keyless call writes byte-identical output to the historical format.

matt added 5 commits September 18, 2026 16:55
The helper always wrote [corr=<id>] in the leading bracket, which
bin/fm-classify-lib.sh reads as [key=...]. A decision opened through
the helper therefore folded under the default key, and
fm-send.sh --resolve-key refused with "no open decision or blocker
with that key" even though the key was present later on the line.

Add a --key <key> option: when given, the status line carries
[key=<key>] in the leading bracket position, with the corr token
retained unbracketed so fm_pending_reply_extract_corr and the
pending-reply contract still correlate the reply. A call with no key
writes the historical [corr=<id>] bracket shape byte-for-byte.

Update the helper header/usage, fm-brief.sh charter text,
fm-classify-lib.sh comment, and add tests across three suites.
The --key option now refuses keys in the reserved pending-reply- namespace
(read from FM_CLASSIFY_RESERVED_KEY_PREFIXES_DEFAULT in bin/fm-classify-lib.sh)
and the literal default key, so a key the helper accepts is always one the
fold can open and fm-send.sh --resolve-key can close. Reads the prefix list
from its one owner to avoid drift.

Add tests for both rejected forms.
Copilot AI lite review requested due to automatic review settings September 18, 2026 16:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The helper accepts overlong keys that fm-send --resolve-key cannot close, and custom reserved-prefix errors identify the wrong owner.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Captain, this PR adds keyed decision reporting for secondmates while preserving correlation tokens and keyless output compatibility.

Changes:

  • Adds --key and --key=<key> support with validation.
  • Updates secondmate instructions and tests for keyed reports.
  • Adds coverage for resolving keyed decisions and reserved keys.
File summaries
File Description
bin/fm-secondmate-report.sh Implements keyed report formatting and validation.
bin/fm-brief.sh Documents the keyed helper contract.
tests/fm-classify-corr-token.test.sh Tests parsing, placement, compatibility, and validation.
tests/fm-pending-reply.test.sh Tests parent-channel correlation and resolution.
tests/fm-send-resolve-key.test.sh Tests end-to-end keyed resolution.
Review details
  • Files reviewed: 4/6 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@matthewstrud
matthewstrud merged commit f81376e into main Sep 18, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants