Skip to content

fix: stabilize home-summary JSON key ordering - #6469

Open
luigia wants to merge 4 commits into
kunchenguid:mainfrom
luigia:home-summary-key-order
Open

luigia wants to merge 4 commits into
kunchenguid:mainfrom
luigia:home-summary-key-order

Conversation

@luigia

@luigia luigia commented Oct 3, 2026 •

Copy link
Copy Markdown

Intent

Whenever a bug is found, fix it automatically.
The bug: fm_hold_reason_decode_stream builds its JSON with JSON::PP without ->canonical, so the published home summary has random key order and byte comparisons of it are flaky.
It was found by the worker that delivered #6464 (home-summary refresh speedup, which avoids refolding status history during home-summary refresh) on 2026-10-03.

What Changed

  • Enable canonical JSON key ordering in fm_hold_reason_decode_stream so unchanged home summaries remain byte-identical.
  • Add a regression test comparing home-summary output across 16 Perl hash seeds while preserving landed completion data.
  • Update CI’s expected snapshot/fleet-view test count from 18 to 19.

Risk Assessment

✅ Low: Canonical encoding fixes randomized ordering at the shared decoder without changing JSON values; the behavioral regression and CI count update are narrowly scoped.

Testing

Targeted snapshot tests passed. Real isolated CLI publication reproduced two pre-fix byte orders and one stable post-fix output across 16 seeds, preserving completion and hold-reason semantics. Saved published JSON and transcripts; removed transient fixtures.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Repeatedly publish unchanged home state under different Perl hash seeds and receive identical bytes ✅ pass live Before/after publication transcript: pre-fix decoder produced two byte sequences; fixed publisher produced one across 16 seeds, with unchanged completion data.
Generate a home snapshot and receive exactly the bytes stored by the summary publisher ✅ pass live Publication transcript: --secondmate-home-summary under seed 99 exactly matched state/home-summary.json.
Read encoded Unicode hold reasons and malformed markers without losing or corrupting their content ✅ pass live Public backlog output and published summary: Unicode, punctuation, and newline decoding preserved; plain reasons, invalid base64, and invalid UTF-8 markers retained.
Evidence: Before/after publication transcript

Source: Before/after publication transcript

pre-fix decoder: PERL_HASH_SEED=1 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=cf9f6a085c99c459d76fe74b9cb42401d75c9844ac2185390bd179f62a173216
pre-fix decoder: PERL_HASH_SEED=2 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=cf9f6a085c99c459d76fe74b9cb42401d75c9844ac2185390bd179f62a173216
pre-fix decoder: PERL_HASH_SEED=3 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
pre-fix decoder: PERL_HASH_SEED=4 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=cf9f6a085c99c459d76fe74b9cb42401d75c9844ac2185390bd179f62a173216
pre-fix decoder: PERL_HASH_SEED=5 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
pre-fix decoder: PERL_HASH_SEED=6 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=cf9f6a085c99c459d76fe74b9cb42401d75c9844ac2185390bd179f62a173216
pre-fix decoder: PERL_HASH_SEED=7 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
pre-fix decoder: PERL_HASH_SEED=8 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=cf9f6a085c99c459d76fe74b9cb42401d75c9844ac2185390bd179f62a173216
pre-fix decoder: PERL_HASH_SEED=9 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
pre-fix decoder: PERL_HASH_SEED=10 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=cf9f6a085c99c459d76fe74b9cb42401d75c9844ac2185390bd179f62a173216
pre-fix decoder: PERL_HASH_SEED=11 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=cf9f6a085c99c459d76fe74b9cb42401d75c9844ac2185390bd179f62a173216
pre-fix decoder: PERL_HASH_SEED=12 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
pre-fix decoder: PERL_HASH_SEED=13 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
pre-fix decoder: PERL_HASH_SEED=14 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=cf9f6a085c99c459d76fe74b9cb42401d75c9844ac2185390bd179f62a173216
pre-fix decoder: PERL_HASH_SEED=15 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=cf9f6a085c99c459d76fe74b9cb42401d75c9844ac2185390bd179f62a173216
pre-fix decoder: PERL_HASH_SEED=16 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> .test-summary-live/baseline/bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=cf9f6a085c99c459d76fe74b9cb42401d75c9844ac2185390bd179f62a173216
pre-fix decoder: 2 distinct published byte sequences for unchanged state
fixed product: PERL_HASH_SEED=1 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=2 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=3 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=4 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=5 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=6 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=7 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=8 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=9 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=10 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=11 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=12 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=13 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=14 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=15 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: PERL_HASH_SEED=16 PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> bin/fm-home-summary-refresh.sh -> state/home-summary.json sha256=39a6ffd3e8bd58ec821912a21b795a4e65d5e43ee4a9988dd8849e56967b21dd
fixed product: 1 distinct published byte sequences for unchanged state
PERL_HASH_SEED=99 bin/fm-fleet-snapshot.sh --secondmate-home-summary: exact byte match with published ledger
bin/fm-fleet-snapshot.sh --json: decoded Unicode, parentheses, quotes, comma, and newline retained; plain and malformed markers unchanged

Actual published product output:
{
  "schema": "fm-secondmate-home-summary.v1",
  "hold_classifier_schema": "fm-captain-hold-buckets.v1",
  "contributions": {
    "known": 1,
    "checked": 0,
    "counts": {
      "captain": 0,
      "fleet": 1,
      "maintainer": 0,
      "nobody": 0
    },
    "unmeasured": 0,
    "complete": false,
    "proven_clear": false,
    "stale_verdicts": 0,
    "missing_verdicts": 0,
    "unreadable_records": 0,
    "valid_until": 900,
    "captain": [],
    "captain_omitted": 0
  },
  "generated": "2026-07-25T00:00:00Z",
  "generated_epoch": 1784937600,
  "home": "~/.no-mistakes/worktrees/3fecfed7f577/01M40X55R4W1PVBEV3HNFZBJ5B/.test-summary-live/home",
  "valid": true,
  "reason": null,
  "invalidity": {
    "kind": null,
    "ids": []
  },
  "state": "captain_decision",
  "active_children": [],
  "decisions_open": [
    {
      "id": "encoded-call",
      "key": "encoded-call",
      "verb": "captain-hold",
      "summary": "Choose route",
      "reason": "Choose (blue), \"green\" — café second line",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "source": "backlog"
    },
    {
      "id": "plain-call",
      "key": "plain-call",
      "verb": "captain-hold",
      "summary": "Plain route",
      "reason": "literal reason",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "source": "backlog"
    },
    {
      "id": "malformed-call",
      "key": "malformed-call",
      "verb": "captain-hold",
      "summary": "Malformed marker",
      "reason": "fm-hold-v1:%%%",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "source": "backlog"
    },
    {
      "id": "invalid-utf8-call",
      "key": "invalid-utf8-call",
      "verb": "captain-hold",
      "summary": "Invalid UTF-8 marker",
      "reason": "fm-hold-v1:/w==",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "source": "backlog"
    }
  ],
  "holds": [
    {
      "id": "encoded-call",
      "title": "Choose route",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "reason": "Choose (blue), \"green\" — café second line",
      "source": "backlog"
    },
    {
      "id": "plain-call",
      "title": "Plain route",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "reason": "literal reason",
      "source": "backlog"
    },
    {
      "id": "malformed-call",
      "title": "Malformed marker",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "reason": "fm-hold-v1:%%%",
      "source": "backlog"
    },
    {
      "id": "invalid-utf8-call",
      "title": "Invalid UTF-8 marker",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "reason": "fm-hold-v1:/w==",
      "source": "backlog"
    }
  ],
  "queued": [
    {
      "id": "encoded-call",
      "title": "Choose route",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "blocked_reason": null,
      "hold_reason": "Choose (blue), \"green\" — café second line",
      "hold_kind": "captain",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "captain_actionable": true,
      "repo": "alpha",
      "kind": "captain",
      "since": "2026-07-24"
    },
    {
      "id": "plain-call",
      "title": "Plain route",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "blocked_reason": null,
      "hold_reason": "literal reason",
      "hold_kind": "captain",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "captain_actionable": true,
      "repo": "alpha",
      "kind": "captain",
      "since": "2026-07-24"
    },
    {
      "id": "malformed-call",
      "title": "Malformed marker",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "blocked_reason": null,
      "hold_reason": "fm-hold-v1:%%%",
      "hold_kind": "captain",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "captain_actionable": true,
      "repo": "alpha",
      "kind": "captain",
      "since": "2026-07-24"
    },
    {
      "id": "invalid-utf8-call",
      "title": "Invalid UTF-8 marker",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "blocked_reason": null,
      "hold_reason": "fm-hold-v1:/w==",
      "hold_kind": "captain",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "captain_actionable": true,
      "repo": "alpha",
      "kind": "captain",
      "since": "2026-07-24"
    }
  ],
  "landed": [
    {
      "id": "shipped",
      "title": "Shipped",
      "kind": "ship",
      "hold_kind": null,
      "pr_url": "https://github.com/kunchenguid/firstmate/pull/9",
      "report_path": null,
      "local_note": null,
      "completion": {
        "date": "2026-07-06",
        "verb": "merged"
      }
    }
  ],
  "endpoints": [],
  "counts": {
    "active_children": 0,
    "decisions_open": 4,
    "holds": 4,
    "queued": 4,
    "landed": 1,
    "endpoints": 0
  },
  "omitted": []
}
Evidence: Actual published home summary

Source: Actual published home summary

{
  "schema": "fm-secondmate-home-summary.v1",
  "hold_classifier_schema": "fm-captain-hold-buckets.v1",
  "contributions": {
    "known": 1,
    "checked": 0,
    "counts": {
      "captain": 0,
      "fleet": 1,
      "maintainer": 0,
      "nobody": 0
    },
    "unmeasured": 0,
    "complete": false,
    "proven_clear": false,
    "stale_verdicts": 0,
    "missing_verdicts": 0,
    "unreadable_records": 0,
    "valid_until": 900,
    "captain": [],
    "captain_omitted": 0
  },
  "generated": "2026-07-25T00:00:00Z",
  "generated_epoch": 1784937600,
  "home": "~/.no-mistakes/worktrees/3fecfed7f577/01M40X55R4W1PVBEV3HNFZBJ5B/.test-summary-live/home",
  "valid": true,
  "reason": null,
  "invalidity": {
    "kind": null,
    "ids": []
  },
  "state": "captain_decision",
  "active_children": [],
  "decisions_open": [
    {
      "id": "encoded-call",
      "key": "encoded-call",
      "verb": "captain-hold",
      "summary": "Choose route",
      "reason": "Choose (blue), \"green\" — café second line",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "source": "backlog"
    },
    {
      "id": "plain-call",
      "key": "plain-call",
      "verb": "captain-hold",
      "summary": "Plain route",
      "reason": "literal reason",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "source": "backlog"
    },
    {
      "id": "malformed-call",
      "key": "malformed-call",
      "verb": "captain-hold",
      "summary": "Malformed marker",
      "reason": "fm-hold-v1:%%%",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "source": "backlog"
    },
    {
      "id": "invalid-utf8-call",
      "key": "invalid-utf8-call",
      "verb": "captain-hold",
      "summary": "Invalid UTF-8 marker",
      "reason": "fm-hold-v1:/w==",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "source": "backlog"
    }
  ],
  "holds": [
    {
      "id": "encoded-call",
      "title": "Choose route",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "reason": "Choose (blue), \"green\" — café second line",
      "source": "backlog"
    },
    {
      "id": "plain-call",
      "title": "Plain route",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "reason": "literal reason",
      "source": "backlog"
    },
    {
      "id": "malformed-call",
      "title": "Malformed marker",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "reason": "fm-hold-v1:%%%",
      "source": "backlog"
    },
    {
      "id": "invalid-utf8-call",
      "title": "Invalid UTF-8 marker",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "reason": "fm-hold-v1:/w==",
      "source": "backlog"
    }
  ],
  "queued": [
    {
      "id": "encoded-call",
      "title": "Choose route",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "blocked_reason": null,
      "hold_reason": "Choose (blue), \"green\" — café second line",
      "hold_kind": "captain",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "captain_actionable": true,
      "repo": "alpha",
      "kind": "captain",
      "since": "2026-07-24"
    },
    {
      "id": "plain-call",
      "title": "Plain route",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "blocked_reason": null,
      "hold_reason": "literal reason",
      "hold_kind": "captain",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "captain_actionable": true,
      "repo": "alpha",
      "kind": "captain",
      "since": "2026-07-24"
    },
    {
      "id": "malformed-call",
      "title": "Malformed marker",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "blocked_reason": null,
      "hold_reason": "fm-hold-v1:%%%",
      "hold_kind": "captain",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "captain_actionable": true,
      "repo": "alpha",
      "kind": "captain",
      "since": "2026-07-24"
    },
    {
      "id": "invalid-utf8-call",
      "title": "Invalid UTF-8 marker",
      "blocked_by": null,
      "blocked_by_ids": [],
      "unresolved_blocker_ids": [],
      "blocked_reason": null,
      "hold_reason": "fm-hold-v1:/w==",
      "hold_kind": "captain",
      "hold_until": null,
      "hold_bucket": "live",
      "hold_age_days": 1,
      "captain_actionable": true,
      "repo": "alpha",
      "kind": "captain",
      "since": "2026-07-24"
    }
  ],
  "landed": [
    {
      "id": "shipped",
      "title": "Shipped",
      "kind": "ship",
      "hold_kind": null,
      "pr_url": "https://github.com/kunchenguid/firstmate/pull/9",
      "report_path": null,
      "local_note": null,
      "completion": {
        "date": "2026-07-06",
        "verb": "merged"
      }
    }
  ],
  "endpoints": [],
  "counts": {
    "active_children": 0,
    "decisions_open": 4,
    "holds": 4,
    "queued": 4,
    "landed": 1,
    "endpoints": 0
  },
  "omitted": []
}
Evidence: Public backlog output with decoded and malformed reasons

Source: Public backlog output with decoded and malformed reasons

{
  "path": "~/.no-mistakes/worktrees/3fecfed7f577/01M40X55R4W1PVBEV3HNFZBJ5B/.test-summary-live/home/data/backlog.md",
  "present": true,
  "records": [
    {
      "blocked_by": null,
      "blocked_by_ids": [],
      "blocked_reason": null,
      "body_excerpt": null,
      "body_lines": [],
      "captain_actionable": true,
      "checked": false,
      "completion": {
        "date": null,
        "verb": null
      },
      "current_role": "queued",
      "done": null,
      "hold_age_days": 1,
      "hold_bucket": "live",
      "hold_kind": "captain",
      "hold_reason": "Choose (blue), \"green\" — café\nsecond line",
      "hold_set": null,
      "hold_until": null,
      "id": "encoded-call",
      "kind": "captain",
      "links": [],
      "local_note": null,
      "merged": null,
      "order": 1,
      "pr_url": null,
      "priority": null,
      "raw": "- [ ] encoded-call - Choose route (repo: alpha) (kind: captain) (since 2026-07-24) (hold: fm-hold-v1:Q2hvb3NlIChibHVlKSwgImdyZWVuIiDigJQgY2Fmw6kKc2Vjb25kIGxpbmU=) (hold-kind: captain)",
      "repo": "alpha",
      "report_path": null,
      "reported": null,
      "requires_child_metadata": false,
      "since": "2026-07-24",
      "state": "queued",
      "structured": true,
      "title": "Choose route",
      "unresolved_blocker_ids": []
    },
    {
      "blocked_by": null,
      "blocked_by_ids": [],
      "blocked_reason": null,
      "body_excerpt": null,
      "body_lines": [],
      "captain_actionable": true,
      "checked": false,
      "completion": {
        "date": null,
        "verb": null
      },
      "current_role": "queued",
      "done": null,
      "hold_age_days": 1,
      "hold_bucket": "live",
      "hold_kind": "captain",
      "hold_reason": "literal reason",
      "hold_set": null,
      "hold_until": null,
      "id": "plain-call",
      "kind": "captain",
      "links": [],
      "local_note": null,
      "merged": null,
      "order": 2,
      "pr_url": null,
      "priority": null,
      "raw": "- [ ] plain-call - Plain route (repo: alpha) (kind: captain) (since 2026-07-24) (hold: literal reason) (hold-kind: captain)",
      "repo": "alpha",
      "report_path": null,
      "reported": null,
      "requires_child_metadata": false,
      "since": "2026-07-24",
      "state": "queued",
      "structured": true,
      "title": "Plain route",
      "unresolved_blocker_ids": []
    },
    {
      "blocked_by": null,
      "blocked_by_ids": [],
      "blocked_reason": null,
      "body_excerpt": null,
      "body_lines": [],
      "captain_actionable": true,
      "checked": false,
      "completion": {
        "date": null,
        "verb": null
      },
      "current_role": "queued",
      "done": null,
      "hold_age_days": 1,
      "hold_bucket": "live",
      "hold_kind": "captain",
      "hold_reason": "fm-hold-v1:%%%",
      "hold_set": null,
      "hold_until": null,
      "id": "malformed-call",
      "kind": "captain",
      "links": [],
      "local_note": null,
      "merged": null,
      "order": 3,
      "pr_url": null,
      "priority": null,
      "raw": "- [ ] malformed-call - Malformed marker (repo: alpha) (kind: captain) (since 2026-07-24) (hold: fm-hold-v1:%%%) (hold-kind: captain)",
      "repo": "alpha",
      "report_path": null,
      "reported": null,
      "requires_child_metadata": false,
      "since": "2026-07-24",
      "state": "queued",
      "structured": true,
      "title": "Malformed marker",
      "unresolved_blocker_ids": []
    },
    {
      "blocked_by": null,
      "blocked_by_ids": [],
      "blocked_reason": null,
      "body_excerpt": null,
      "body_lines": [],
      "captain_actionable": true,
      "checked": false,
      "completion": {
        "date": null,
        "verb": null
      },
      "current_role": "queued",
      "done": null,
      "hold_age_days": 1,
      "hold_bucket": "live",
      "hold_kind": "captain",
      "hold_reason": "fm-hold-v1:/w==",
      "hold_set": null,
      "hold_until": null,
      "id": "invalid-utf8-call",
      "kind": "captain",
      "links": [],
      "local_note": null,
      "merged": null,
      "order": 4,
      "pr_url": null,
      "priority": null,
      "raw": "- [ ] invalid-utf8-call - Invalid UTF-8 marker (repo: alpha) (kind: captain) (since 2026-07-24) (hold: fm-hold-v1:/w==) (hold-kind: captain)",
      "repo": "alpha",
      "report_path": null,
      "reported": null,
      "requires_child_metadata": false,
      "since": "2026-07-24",
      "state": "queued",
      "structured": true,
      "title": "Invalid UTF-8 marker",
      "unresolved_blocker_ids": []
    },
    {
      "blocked_by": null,
      "blocked_by_ids": [],
      "blocked_reason": null,
      "body_excerpt": null,
      "body_lines": [],
      "captain_actionable": false,
      "checked": true,
      "completion": {
        "date": "2026-07-06",
        "verb": "merged"
      },
      "current_role": "done",
      "done": null,
      "hold_age_days": null,
      "hold_bucket": null,
      "hold_kind": null,
      "hold_reason": null,
      "hold_set": null,
      "hold_until": null,
      "id": "shipped",
      "kind": "ship",
      "links": [
        "https://github.com/kunchenguid/firstmate/pull/9"
      ],
      "local_note": null,
      "merged": "2026-07-06",
      "order": 5,
      "pr_url": "https://github.com/kunchenguid/firstmate/pull/9",
      "priority": null,
      "raw": "- [x] shipped - Shipped https://github.com/kunchenguid/firstmate/pull/9 (repo: alpha) (kind: ship) (merged 2026-07-06)",
      "repo": "alpha",
      "report_path": null,
      "reported": null,
      "requires_child_metadata": false,
      "since": null,
      "state": "done",
      "structured": true,
      "title": "Shipped",
      "unresolved_blocker_ids": []
    }
  ]
}
Evidence: Reproducible isolated CLI driver

Source: Reproducible isolated CLI driver

#!/usr/bin/env python3
"""Drive the real summary publisher in a disposable worktree-local home, no stubs."""
import hashlib
import json
import os
from pathlib import Path
import shutil
import subprocess

root = Path.cwd()
evidence = Path('~/.no-mistakes/evidence/01M40X55R4W1PVBEV3HNFZBJ5B')
scratch = root / '.test-summary-live'
home = scratch / 'home'
for name in ('state', 'data', 'config', 'projects'):
    (home / name).mkdir(parents=True, exist_ok=True)
env = dict(os.environ)
for key in ('FM_ROOT_OVERRIDE', 'FM_STATE_OVERRIDE', 'FM_DATA_OVERRIDE', 'FM_CONFIG_OVERRIDE', 'FM_PROJECTS_OVERRIDE', 'FM_GATE_REFUSE_BYPASS', 'FM_TEST_SEAM'):
    env.pop(key, None)
env.update(FM_HOME=str(home), FM_ROOT_OVERRIDE=str(root), TMPDIR=str(scratch / 'tmp'), FM_SNAPSHOT_NOW='2026-07-25T00:00:00Z', PERL_PERTURB_KEYS='2')
reason = 'Choose (blue), "green" — café\nsecond line'
encoded = subprocess.check_output(['/bin/bash', '-c', '. bin/fm-hold-reason-lib.sh; fm_hold_reason_encode "$1"', 'encode', reason], env=env, text=True)
(home / 'data' / 'backlog.md').write_text(f'''## In flight

## Queued
- [ ] encoded-call - Choose route (repo: alpha) (kind: captain) (since 2026-07-24) (hold: {encoded}) (hold-kind: captain)
- [ ] plain-call - Plain route (repo: alpha) (kind: captain) (since 2026-07-24) (hold: literal reason) (hold-kind: captain)
- [ ] malformed-call - Malformed marker (repo: alpha) (kind: captain) (since 2026-07-24) (hold: fm-hold-v1:%%%) (hold-kind: captain)
- [ ] invalid-utf8-call - Invalid UTF-8 marker (repo: alpha) (kind: captain) (since 2026-07-24) (hold: fm-hold-v1:/w==) (hold-kind: captain)

## Done
- [x] shipped - Shipped https://github.com/kunchenguid/firstmate/pull/9 (repo: alpha) (kind: ship) (merged 2026-07-06)
''')

def run(command, seed):
    local = dict(env, PERL_HASH_SEED=str(seed))
    result = subprocess.run(command, env=local, capture_output=True, check=True)
    if result.stderr:
        raise AssertionError(result.stderr.decode())
    return result.stdout

baseline = scratch / 'baseline'
shutil.copytree(root / 'bin', baseline / 'bin', dirs_exist_ok=True)
old = subprocess.check_output(['git', 'show', '1f3e769616fdf9f31f85f4c3e6a9f71606634238:bin/fm-hold-reason-lib.sh'])
(baseline / 'bin' / 'fm-hold-reason-lib.sh').write_bytes(old)
log = []
outputs = {}
for label, publisher in [('pre-fix decoder', baseline / 'bin' / 'fm-home-summary-refresh.sh'), ('fixed product', root / 'bin' / 'fm-home-summary-refresh.sh')]:
    emitted = []
    for seed in range(1, 17):
        run([str(publisher)], seed)
        data = (home / 'state' / 'home-summary.json').read_bytes()
        summary = json.loads(data)
        assert summary['valid'] is True and summary['state'] == 'captain_decision'
        assert summary['landed'][0]['completion'] == {'date': '2026-07-06', 'verb': 'merged'}
        queued = {row['id']: row['hold_reason'] for row in summary['queued']}
        assert queued == {'encoded-call': 'Choose (blue), "green" — café second line', 'plain-call': 'literal reason', 'malformed-call': 'fm-hold-v1:%%%', 'invalid-utf8-call': 'fm-hold-v1:/w=='}
        assert summary['counts']['decisions_open'] == 4 and summary['counts']['landed'] == 1
        emitted.append(data)
        log.append(f'{label}: PERL_HASH_SEED={seed} PERL_PERTURB_KEYS=2 FM_HOME=<isolated home> {publisher.relative_to(root)} -> state/home-summary.json sha256={hashlib.sha256(data).hexdigest()}')
    outputs[label] = emitted
    log.append(f'{label}: {len(set(emitted))} distinct published byte sequences for unchanged state')
assert len(set(outputs['pre-fix decoder'])) > 1, 'baseline did not reproduce the bug'
assert len(set(outputs['fixed product'])) == 1, 'fixed publisher changed bytes'
assert all(json.loads(data) == json.loads(outputs['fixed product'][0]) for data in outputs['pre-fix decoder']), 'semantic data changed across decoder versions'
snapshot = run([str(root / 'bin' / 'fm-fleet-snapshot.sh'), '--secondmate-home-summary'], 99)
assert snapshot == outputs['fixed product'][0], 'publisher does not preserve snapshot bytes'
log.append('PERL_HASH_SEED=99 bin/fm-fleet-snapshot.sh --secondmate-home-summary: exact byte match with published ledger')
# Inspect the full public snapshot too: unlike the home projection, it preserves newlines.
full = json.loads(run([str(root / 'bin' / 'fm-fleet-snapshot.sh'), '--json'], 99))
reasons = {row['id']: row['hold_reason'] for row in full['backlog']['records'] if row.get('hold_reason') is not None}
assert reasons['encoded-call'] == reason
assert reasons['malformed-call'] == 'fm-hold-v1:%%%'
assert reasons['invalid-utf8-call'] == 'fm-hold-v1:/w=='
assert reasons['plain-call'] == 'literal reason'
log.append('bin/fm-fleet-snapshot.sh --json: decoded Unicode, parentheses, quotes, comma, and newline retained; plain and malformed markers unchanged')
(evidence / 'published-home-summary.json').write_bytes(outputs['fixed product'][0])
(evidence / 'snapshot-backlog.json').write_text(json.dumps(full['backlog'], ensure_ascii=False, indent=2) + '\n')
(evidence / 'publication-transcript.txt').write_text('\n'.join(log) + '\n\nActual published product output:\n' + outputs['fixed product'][0].decode())
print('\n'.join(log))

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Repeatedly publish unchanged home state under different Perl hash seeds and receive identical bytes ✅ pass live Before/after publication transcript: pre-fix decoder produced two byte sequences; fixed publisher produced one across 16 seeds, with unchanged completion data.
Generate a home snapshot and receive exactly the bytes stored by the summary publisher ✅ pass live Publication transcript: --secondmate-home-summary under seed 99 exactly matched state/home-summary.json.
Read encoded Unicode hold reasons and malformed markers without losing or corrupting their content ✅ pass live Public backlog output and published summary: Unicode, punctuation, and newline decoding preserved; plain reasons, invalid base64, and invalid UTF-8 markers retained.
  • env -u FM_ROOT_OVERRIDE -u FM_STATE_OVERRIDE -u FM_DATA_OVERRIDE -u FM_CONFIG_OVERRIDE -u FM_PROJECTS_OVERRIDE TMPDIR="$PWD/.test-summary-live/tmp" /bin/bash tests/fm-fleet-snapshot-view.test.sh
  • python3 ~/.no-mistakes/evidence/01M40X55R4W1PVBEV3HNFZBJ5B/drive-summary.py: real summary publication across 16 Perl hash seeds, before and after the decoder fix; exact snapshot/publication comparison; Unicode and malformed-reason checks.
  • rm -rf .test-summary-live; git status --short: removed disposable test homes and baseline copy; worktree clean.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Stabilizes JSON output ordering in home-summary snapshots.

The PR appears safe to merge; no new actionable issue was established.

Reviews (2) · Last reviewed commit: "test: compare raw home-summary bytes and..."

Comment thread tests/fm-fleet-snapshot-view.test.sh Resolved
Comment thread tests/fm-fleet-snapshot-view.test.sh Resolved
luigia added 4 commits October 3, 2026 08:52
fm_hold_reason_decode_stream re-encoded the json snapshot through JSON::PP
without ->canonical, so Perl's per-process hash randomization reordered
object keys and the published home summary changed bytes between runs with
identical state (for example landed[].completion flipped between date,verb
and verb,date).
…in CI

The key-order regression compared jq-normalized JSON, which re-serializes
the summary instead of checking the published bytes; compare the raw
fm-fleet-snapshot output directly (generated_epoch is already pinned by
FM_SNAPSHOT_NOW). The macOS stock-Bash CI job counts snapshot/fleet-view
passes exactly, so raise it from 18 to 19 for the new test.
@luigia
luigia force-pushed the home-summary-key-order branch from e2b43b9 to 7396388 Compare October 3, 2026 13:01
@luigia luigia changed the title fix: stabilize home-summary JSON key order fix: stabilize home-summary JSON key ordering Oct 3, 2026
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.

1 participant