Skip to content

package: link transport for niimbot autodetect probe#1

Open
mannes wants to merge 6 commits into
mainfrom
feat/transport-link-for-autodetect
Open

package: link transport for niimbot autodetect probe#1
mannes wants to merge 6 commits into
mainfrom
feat/transport-link-for-autodetect

Conversation

@mannes
Copy link
Copy Markdown
Contributor

@mannes mannes commented May 21, 2026

Switches the harness pnpm.overrides for @thermal-label/transport from ^0.6.0link:../transport.

The linked niimbot-web now calls WebBluetoothTransport.requestAny and fromDevice for the autodetect probe — both added in thermal-label/transport#1 and not yet in published 0.6.0. Without the link override, the harness bundle calls methods that don't exist at runtime.

Mirrors the existing labelwriter-core / labelwriter-web 0.6.3-debug.0 prerelease pin pattern.

Must swap back to a published version (≥ 0.6.1 once that ships) before any harness release build, alongside the labelwriter pin removal. The org's release-build gate already enforces "no prereleases / no links in published harness bundles".

Bench-verified on B1, B2 Pro, and D110_M (separate report).

🤖 Generated with Claude Code

mannes and others added 6 commits May 20, 2026 00:25
Re-adds the harness-niimbot app to the workspace after the Wave 4 0.6.0
release cut. Niimbot remains unpublished (0.1.0 in sibling repo), so it
needs link-overrides to ../niimbot/packages/{core,web} in the harness
root — the only sibling-linked driver in the harness today.

Changes:
- pnpm-workspace.yaml: drop the !apps/harness-niimbot exclusion.
- eslint.config.js: drop the apps/harness-niimbot/** ignore block.
- package.json: add niimbot-core/web link overrides.
- apps/harness-niimbot/package.json: bump niimbot-core/web spec from
  ^0.0.0 → ^0.1.0 to match the sibling versions.
- apps/harness-niimbot/src/adapter.ts: drop stale 'reporter' from
  buildReport destructure (BuildReportInput no longer carries it) and
  drop the unnecessary device type assertion / unused param.

Typecheck, lint, and test pass across all five harness apps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The picker promoted any driver with mediaDetection+match to
'auto-locked' — rendering a yellow banner with 'The printer refuses
to print on anything else.' That's only true for brother-ql with
media detection on; niimbot's RFID is a hint (the chassis prints
whatever you ask), letratag's advertising is hint-only too.

Adds opt-in MediaPickerConfig.detectionEnforced flag. brother-ql
sets it (canonical enforced case); niimbot + letratag don't.
Without it the picker uses 'auto-suggest' — softer 'Detected: X —
confirm or pick a different entry' copy, no yellow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Before: in auto-suggest mode the picker mounted, no detection yet, so
it auto-picked defaultMediaId as the catalogue fallback. When RFID
then arrived, the picker bailed because modelValue !== null —
treating the auto-picked default as if the operator had chosen it.
Net effect: 'Detected: X' banner shown, but the catalogue list stayed
on the default, not on the detected media.

Treat 'modelValue still equals defaultMediaId' as 'operator hasn't
picked yet' and let detected claim it. Explicit operator picks
(modelValue.id !== defaultMediaId) are still respected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors the LW 5xx NFC-unknown flow for niimbot. When the chassis
reports an RFID payload whose barcode is not in
niimbot-core/data/media.json5, the harness now:

1. Drops into 'detected-unrecognized' mode (geometry-edit panel
   instead of catalogue lock-in).
2. Operator confirms physical dimensions; customMedia.build
   synthesises a printable NiimbotMedia for the job.
3. Submit section renders a second CTA — a prefilled GitHub issue
   at the niimbot repo with the full rfid payload + operator
   dimensions, ready for the maintainer to append to media.json5.

Changes:
* apps/harness-niimbot/src/adapter.ts
  - Add mediaPicker.customMedia.build = buildCustomNiimbotMedia
    (mirrors apps/harness-labelwriter/src/adapter.ts §200's
    buildCustomLabelMedia). Synthesises a NiimbotMedia with the
    operator dimensions, an unknown-<barcode> sentinel id, empty
    targetModels/barcodes/skus, and labelTypeId: 1 (matches
    niimbot-core resolveLabelType's fallback). The print path
    consults widthMm/heightMm/type only; targetModels is the
    catalogue-filter axis and bypassed for the synthetic media.
  - Update the in-progress niimbotExtras rfid type cast to the
    current shape (source / uuid / barcode / serialNumber /
    allPaper / usedPaper / labelType / capacity / rawHex) — the
    earlier draft used the pre-rename usedLengthMm / totalLengthMm
    fields.

* packages/harness-shell/src/sections/MediaSection.vue
  - Extend rawDetectedMedia so it falls back to status.rfid when
    detectedMedia is undefined and rfid.barcode is set: synthesises
    a minimal MediaDescriptor (id=rfid-<barcode>, name=<barcode>,
    type derived from rfid.labelType — 3 ⇒ continuous, anything
    else ⇒ die-cut). widthMm intentionally left undefined; the
    picker's geometry-edit panel reads it as 'not set' and renders
    blank inputs for the operator.
  - Fold the rfid payload into the existing 'Submit it for the
    library' link body so the geometry-bearing route + the
    SubmitSection CTA carry identical context.
  - dimsOf now tolerates a missing widthMm (renders '?' mm) so the
    rfid-fallback shape (no width) doesn't render 'NaN × NaN mm'.

* packages/harness-shell/src/sections/SubmitSection.vue
  - Add the second CTA next to the main Submit button — fires iff
    status.detectedMedia === undefined && status.rfid.barcode is
    set. Renders 'Catalogue this RFID barcode →' linking to a
    prefilled issue at adapter.targetRepo, body assembled via
    buildRfidCatalogueIssue.

* packages/harness-shell/src/submit/submit.ts
  - Add RfidBlock type + renderRfidBlock helper (used by both
    MediaSection.vue's existing detected-unknown link and the new
    SubmitSection CTA — single pretty-printer, single shape).
  - Add buildRfidCatalogueIssue: builds title
    'media(<driver>): catalogue new barcode <X> (<W>×<H>)' and a
    body that combines operator-confirmed dimensions with the full
    rfid block, ready to paste into media.json5.

* packages/harness-shell/src/sections/__tests__/MediaSection.test.ts
  - Add three cases for the rfid-fallback path: detection-mode
    resolution, the issue body carrying every populated rfid field,
    and the auto-suggest degrade when rfid has no barcode.

* packages/harness-shell/src/__tests__/SubmitSection.rfid.test.ts
  - New test file covering the SubmitSection CTA: render gating
    (rfid+no-detectedMedia → render; detected → hide; rfid without
    barcode → hide), the issue URL contents (barcode + operator
    dimensions in title; full rfid payload + raw hex in body),
    and the continuous-media title shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors the LW 5xx NFC-unknown flow for niimbot. When the chassis
reports an RFID payload whose barcode isn't in
niimbot-core/data/media.json5, the harness:

1. Synthesises a minimal MediaDescriptor from status.rfid so the
   picker drops into 'detected-unrecognized' mode (geometry-edit
   panel instead of catalogue lock-in).
2. customMedia.build produces a printable NiimbotMedia from the
   operator-confirmed dimensions.
3. Submit grows a second CTA 'Catalogue this RFID barcode →'
   alongside the main verification submit, opening a prefilled
   GitHub issue at the niimbot repo with the full rfid payload
   ready to drop into media.json5.

Shared helper renderRfidBlock + buildRfidCatalogueIssue land in
packages/harness-shell/src/submit/submit.ts for cross-driver reuse.

# Conflicts:
#	apps/harness-niimbot/src/adapter.ts
`niimbot-web@link` is calling `WebBluetoothTransport.requestAny` and
`fromDevice` — both added to the transport package today but not in
published 0.6.0. Swap the override from `^0.6.0` to
`link:../transport` so the bundle picks up the new methods.

Mirrors the existing labelwriter-core/web prerelease pin pattern.
Must swap back to a published version (≥0.6.1 once that ships) before
any harness release build, alongside the labelwriter pin removal —
see [[project_harness_labelwriter_link_override]].

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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