Skip to content

refactor(mqlaunch): make mq-ui.sh the single print_header authority (Step 11a)#48

Merged
MCamner merged 3 commits into
mainfrom
refactor/print-header-authority
Jul 5, 2026
Merged

refactor(mqlaunch): make mq-ui.sh the single print_header authority (Step 11a)#48
MCamner merged 3 commits into
mainfrom
refactor/print-header-authority

Conversation

@MCamner

@MCamner MCamner commented Jul 5, 2026

Copy link
Copy Markdown
Owner

What

Resolve the print_header duplication the git de-layer surfaced (#45). The launcher redefined print_header after sourcing mq-ui.sh, shadowing the library's version.

The two were not cosmetic variants: the launcher override re-forked the dashboard script uncached on every screen, bypassing the dashboard cache model (TTL + mq_dashboard_cache_invalidate) that the rest of the runtime — the git/release flows, the cache smoke test — already relied on. The override was the anomaly that ignored its own caching infrastructure.

  • Remove the launcher override → mq-ui.sh is the sole print_header owner.
  • Opt the main loop into the dashboard-v7.1 header via a non-exported MQ_USE_DASHBOARD_HEADER=1 (non-exported so it drives this launcher's print_header without forcing the dashboard header onto child subprocesses, which set the flag themselves).
  • Delete the now-dead DASHBOARD_V71 variable (only the removed override used it).

Launcher: 1348 → 1347 lines (the override's logic collapses into the single-line opt-in).

Behavior change (deliberate — chosen with the maintainer)

The main-loop header now renders through mq-ui's cached dashboard path instead of an uncached per-screen fork:

  • Freshness bounded by MQ_DASHBOARD_CACHE_TTL (default 5s), invalidated by open_git_menu / open_release_menu so a commit/stash/tag refreshes immediately.
  • Removes a hidden fork in render behavior; aligns the main loop with the cache + invalidation model the runtime already used; avoids a dashboard re-fork per screen.
  • Escape hatch: MQ_DASHBOARD_CACHE_TTL=0 restores uncached, per-screen rendering for investigation.

Verification

  • Confirmed the dashboard header still renders in the main loop under launcher conditions; the cached path populates and reuses within TTL (no fork per screen).
  • Full selftest suite green — including the dashboard-header-cache contract (rapid renders reuse cache; invalidation forces refresh; TTL=0 disables) and headless smoke.
  • AUTHORITY_MAP updated: mq-ui.sh marked sole print_header owner.

Completes the print_header thread flagged in #45/#47. Part of the v2.0.0 runtime-authority track.

🤖 Generated with Claude Code

MCamner and others added 3 commits July 5, 2026 21:51
…Step 11a)

The launcher redefined print_header after sourcing mq-ui.sh, shadowing the
library's version. The two were not cosmetic variants: the launcher override
re-forked the dashboard script uncached on every screen, bypassing the dashboard
cache model (TTL + mq_dashboard_cache_invalidate) that the rest of the runtime —
including the git/release flows and the cache smoke test — already relied on.

Remove the launcher override so mq-ui.sh owns print_header outright, and opt the
main loop into the dashboard-v7.1 header via a non-exported MQ_USE_DASHBOARD_HEADER=1
(non-exported so it drives this launcher's own print_header without forcing the
dashboard header onto child subprocesses, which set the flag themselves). The
dead DASHBOARD_V71 variable — used only by the removed override — is deleted.

Behavior change (deliberate, chosen with the user): the main-loop header now
renders through the cached dashboard path instead of an uncached per-screen
fork. Freshness is bounded by MQ_DASHBOARD_CACHE_TTL (default 5s) and invalidated
by open_git_menu / open_release_menu, so a commit/stash/tag still refreshes
immediately. Escape hatch for investigation: MQ_DASHBOARD_CACHE_TTL=0 restores
uncached per-screen rendering.

Verified: the dashboard header still renders in the main loop (cached path
confirmed populating and reusing within TTL); full selftest suite green,
including the dashboard-header-cache contract and headless smoke.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@MCamner MCamner merged commit 0851e47 into main Jul 5, 2026
3 checks passed
@MCamner MCamner deleted the refactor/print-header-authority branch July 5, 2026 18:54
@MCamner

MCamner commented Jul 5, 2026

Copy link
Copy Markdown
Owner Author

Decision note (of record)

This change intentionally unifies print_header behavior around the mq-ui.sh implementation.

Before this change, the launcher-level print_header override did more than change presentation. It re-ran the dashboard script uncached on every screen, which bypassed the existing dashboard cache model. In contrast, mq-ui.sh renders the cached dashboard when MQ_USE_DASHBOARD_HEADER=1, with a 5-second TTL and explicit invalidation hooks already used by the git/release flows.

That made the launcher override a behavioral anomaly: the repo had cache infrastructure, invalidation calls, and cache smoke coverage, but the main loop was still using an uncached path.

This PR standardizes the main-loop header on the cached mq-ui.sh path. The intended result is one header contract, one freshness model, and one cache/invalidation mechanism across the runtime.

Behavior change

  • main-loop header rendering now uses the cached dashboard path by default
  • header freshness may be up to 5 seconds old unless the cache is explicitly invalidated
  • existing invalidation hooks (open_git_menu / open_release_menu) now apply consistently to the main-loop header

Why this is the preferred behavior

  • removes a hidden fork in render behavior
  • aligns runtime behavior with the repo's existing cache design
  • makes cache invalidation meaningful and consistent
  • reduces repeated dashboard re-forks on every screen render

This is a deliberate behavior decision, not a cosmetic cleanup.

Risk

  • any workflow that implicitly depended on per-screen uncached freshness will now see cached header behavior instead

Escape hatch (correction to the original draft)

MQ_DASHBOARD_CACHE_TTL=0 is a pre-existing, permanent cache bypass (already covered by tests/dashboard-header-cache-smoke.sh), not a temporary mitigation added by this PR. It remains available indefinitely as the uncached / force-fresh switch for investigation or debugging.

Follow-up

  • validate the cached path in normal use
  • no escape hatch removal is needed — MQ_DASHBOARD_CACHE_TTL=0 stays as the permanent uncached switch

🤖 Recorded via Claude Code

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