Skip to content

fix(homeassistant): recover missing K1 SE layer totals - #761

Closed
alex-mextner wants to merge 1 commit into
mainfrom
fix/ha-printer-layer-metadata-20261117
Closed

alex-mextner wants to merge 1 commit into
mainfrom
fix/ha-printer-layer-metadata-20261117

Conversation

@alex-mextner

@alex-mextner alex-mextner commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Problem

K1 SE firmware can report zero total layers while a real print is already advancing through layers. Moonraker has the correct layer count for the same G-code, so the dashboard currently shows a misleading zero despite available metadata.

Task: UB-216.

Changes

  • Add a GET-only Moonraker metadata fallback, keeping positive live firmware counts first.
  • Bind cached values to the exact filename and raw status revision. Late or skipped requests preserve the cache without publishing an older job's count; a completion event fetches a newer job skipped during a running request.
  • Bound opportunistic retries to three attempts at least 30 seconds apart, driven by existing status/progress events. Pause/resume and reconnect conservatively refetch. Missing or ambiguous counts remain unknown, including while idle.
  • Add 19 regressions rendering the actual YAML variables/actions, include the test in YAML-change gate selection, and declare Jinja2 in the dev/test dependencies and lockfile.

Verification

  • 19 focused template tests passed; touched Python ruff/mypy, strict package yamllint, and normal Rig staged lint passed.
  • The installed Home Assistant full async template schema and real single-mode Script/state event bus passed offline fake-GET lifecycle checks for different-file rollover, same-file new job, and startup without the raw entity. No printer or production API was contacted by those tests.
  • Native review recorded three passed iterations across correctness, consistency and quality; two fresh final-diff passes reported zero findings. Normal quorum and diff-identity checks passed with three verified iterations and no exclusions.
  • Normal commit hooks passed on this exact head. Full repository gates run in this PR's real CI.

Deployment scope

The exact final change was deployed at 22:30 UTC on 2026-11-17. All three affected source/runtime YAML slices match byte for byte, preserving the older runtime checkout outside this change. A native full configuration check passed; template-only reload and independent live API readback confirmed total_layers=104, metadata=104, attempts=1 and matching filename/revision. Preimage, patch and receipt are retained for rollback. No Home Assistant restart or printer control commands were used.

This PR covers layer-count metadata. The separate custom-card rendering errors shown on the user's iPhone are outside this diff and are not claimed fixed here.

Use filename- and status-revision-bound Moonraker metadata when stock
firmware reports no total. Keep bounded event-driven retries and discard
obsolete requests without losing a newer pending job. Add actual-template
regressions and declare their test dependencies.

Task: UB-216
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
alex-mextner added a commit that referenced this pull request Nov 18, 2026
* fix(ha): recover printer cards and current-file layer counts (UB-217)

Register loading shells after Home Assistant initializes its element registry,
then load the pinned camera, inspector and sharing implementations with bounded
recovery. Preserve their configuration, state updates, events and lifecycle.

Use current-file Moonraker metadata when K1 SE firmware reports no total layer
count, with filename and status-revision guards against stale replies.

Add focused regressions and a Chromium/WebKit recovery fixture using the real
Home Assistant frontend components. Extract existing HA vision helpers to keep
the required whole-file complexity gate clean (Refs #707). Release 0.81.1.

Primary task: UB-217
Related task: UB-216
Supersedes the source repair in PR #761 after this combined change is merged.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(ci): pin printer-card browsers to Ubuntu 24.04 (UB-217)

The ubuntu-latest runner moved to Ubuntu 26.04, which the pinned Playwright
1.56.1 runtime does not support. Use its supported Ubuntu 24.04 runner for
the printer-card browser job while preserving the locked dependencies,
the browser cases, and all runtime assets.

Refs UB-217

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(ci): use pinned Playwright image for printer card checks

Avoid repeated APT setup timeouts by using the official Playwright image
with matching browser binaries and dependencies. Set up Python explicitly
for the existing fixture builder and retain Node 22, both browser cases,
artifacts and the existing 15-minute budget.

Refs UB-217

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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