Skip to content

Buy it: lead-free HASL by default, finish from KiCad, specs and notes before paying - #1973

Draft
jlcjak wants to merge 1 commit into
mainfrom
backplane/buy-specs-notes
Draft

jlcjak wants to merge 1 commit into
mainfrom
backplane/buy-specs-notes

Conversation

@jlcjak

@jlcjak jlcjak commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Why

A customer's boards went out with leaded HASL. KiCad's job files said "Finish": "None", but Buy it's manifest sent options.finish = "hasl". The bundled fab-spec skill told agents that omitted options take the first catalog value, which is the leaded one, and the DRC profile also defaulted to hasl. The customer also never saw the board specs before paying, and had no place to write manufacturing notes.

What

Finish: lead-free by default, KiCad's when it says one (native/host/src/fab/finish.rs)

  • Order of precedence: the finish chosen in the options, then KiCad's, then hasl_lead_free.
  • KiCad's finish comes from the gerber job file exported with the gerbers (GeneralSpecs.Finish), or from the board stackup's (copper_finish ...).
  • Mapping: HAL SnPb → hasl, HAL lead-free → hasl_lead_free, ENIG/ENEPIG → enig, OSP → osp. None or anything unknown falls back to the default.
  • A plain hasl written by an agent counts as lead-free unless KiCad says HAL SnPb, which matches the ordering side. The explicit ways to get leaded are the KiCad stackup or the manufacturing notes.
  • order_quote writes every board's finish into manifest.json before the person is asked to send, so they approve, and the server gets, what will be made.
  • The estimate and the DRC profile (Opts::default) follow the same rule.
  • The fab-spec and backplane-buy skills now tell agents to leave the finish out.

Specs before paying

  • Once the quote is in, the Order card lists every board: copper layers, thickness, solder mask, surface finish in words ("Lead-free HASL", "HASL with lead", "ENIG"), copper weight, quantity, assembled count and sides (read from the positions file).
  • The specs are taken from the manifest as sent and kept in the order.specs.<thread> setting.
  • GPUI, Android and iOS all show them.

Notes for manufacturing (GPUI)

  • An optional multi-line box sits above Buy now (max 2000 characters).
  • With notes, Buy now calls the new hub RPC order.notes {thread, notes}. It sends POST /v1/quotes/<id>/notes with the quote's bearer token and returns the pay link only after the server accepts the notes.
  • If the request fails (409 already paid, 400, or the server can't be reached), the card shows the error and checkout doesn't open, so notes are never lost silently.
  • Empty notes open the link straight away, as before.
  • The Buy now link inside the quote message takes the same path as the card's button.
  • The phone apps have no notes box in this PR. Their Buy now opens checkout directly, as before; they do show the specs.

New UI strings are in i18n/{en,ja,es}.msg, and the Android and iOS catalogs are regenerated.

Testing

  • Hub, cargo test --release --bin backplane-hub with fab::, settings::order, settings::fab, agents::tests::order, present::thread, state::policy, import014: 150 passed.
  • The new hub tests cover:
    • the customer's case: job file "None" gives hasl_lead_free
    • KiCad HAL SnPb gives hasl
    • a chosen finish is kept as is
    • an agent's plain hasl becomes lead-free
    • the spec words
    • order.notes against a stand-in order server: the notes are sent with the quote's token before the link is returned; nothing is sent when the notes are empty or too long; a 409 returns no link.
  • GPUI, cargo test --release filtered to screens::order, i18n, keys: 93 passed.
  • scripts/i18n-check.py and scripts/i18n-android.py --check pass.
  • scripts/check-android-i18n.py reports 4 problems, all in DataSections.kt, which this PR doesn't touch.
  • The Android unit test (OrderCardTest) did not run. Main's DataSections.kt currently fails to compile (projectKey is unresolved); the compiler reported no errors in the files this PR changes.
  • iOS was not built.

Follow-ups

  • A notes box on the phones.
  • hasl from a client with this change means KiCad explicitly said leaded. The ordering playbook currently makes leaded only from operator instructions, so it may want to honour that value.

🤖 Generated with Claude Code

… before paying

A customer's boards went out with leaded HASL. KiCad's job files said
"Finish": "None", but Buy it's manifest sent options.finish = "hasl".
The skill told agents that omitted options take the first catalog value,
which is the leaded one, and the DRC profile also defaulted to "hasl".
The customer also never saw the board specs at checkout and had no place
to write manufacturing notes.

- fab/finish.rs: a board's finish is the one chosen in its options, else
  KiCad's, else hasl_lead_free. KiCad's finish comes from the gerber job
  file exported with the gerbers (GeneralSpecs.Finish) or from the board
  stackup's copper_finish. HAL SnPb maps to hasl, HAL lead-free to
  hasl_lead_free, ENIG/ENEPIG to enig and OSP to osp; None or unknown
  falls back to the default. A plain "hasl" written by an agent counts as
  lead-free unless KiCad says HAL SnPb, matching the ordering side.
  order_quote writes the finish into the manifest before the person is
  asked to send, and the estimate and the DRC profile (Opts default)
  follow the same rule. The fab-spec and backplane-buy skills now tell
  agents to leave the finish out.
- The Order card lists every board's specs once the quote is in: copper
  layers, thickness, mask, surface finish in words ("Lead-free HASL",
  "HASL with lead", "ENIG"), copper weight, quantity, assembled count and
  sides. They are kept at Send as order.specs.<thread>. GPUI, Android and
  iOS all show them.
- GPUI: an optional "Notes for manufacturing" box (max 2000 characters)
  sits above Buy now. With notes, the new hub RPC order.notes posts them
  to the order server (POST /v1/quotes/<id>/notes with the quote's token)
  and answers the pay link only once the server takes them. A refusal
  (already paid, too long, server away) shows on the card and checkout
  stays closed. The quote message's Buy now link goes through the same
  step. The phone apps have no notes box yet.

Tested: cargo test --release --bin backplane-hub with fab::,
settings::order, settings::fab, agents::tests::order, present::thread,
state::policy and import014 (150 passed). The new tests cover the
customer's case (job file "None" gives lead-free), KiCad SnPb, a chosen
finish, an agent's plain hasl, the specs words, and notes against a
stand-in order server (sent with the token before the link, nothing sent
when empty or too long, 409 gives no link). gpui: cargo test
screens::order, keys, i18n (all pass). scripts/i18n-check.py and
i18n-android.py --check pass. The Android unit test did not run: main's
DataSections.kt has unrelated compile errors (projectKey), and the
compiler reported none in the changed files. iOS was not built.

Co-Authored-By: Claude Opus 5.5 <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