Skip to content

Show pad names in the viewer (#96) - #104

Merged
Gherkin merged 2 commits into
agent-mcpfrom
issue-96-pad-names
Oct 11, 2026
Merged

Gherkin merged 2 commits into
agent-mcpfrom
issue-96-pad-names

Conversation

@Gherkin

@Gherkin Gherkin commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Closes #96. Part of #73.

When the export has a pad name, the viewer shows it. On netdaq, U24's third pad now reads pin 11 — GND in the tooltip, not pad 3. Boards without names (stock ibom, Allegro, the ciaa-acc fixture) still show pin 1 / pad N.

Wording: pin <name>. The name is the pin as the netlist calls it (REFDES:PIN), and the MCP tools return it as pin, so the viewer and the agent use the same word. An exposed pad named EP reads pin EP. That matches what the netlist and the tools call it (U24:EP), so I kept it. An empty name (KiCad NPTH holes) falls back to pad N.

Where labels show:

  • Canvas tooltip (padLabel in web/render.js, used by padHitScan).
  • The # column of the detail pane's pad table (web/app.js). It shows the name, or the place in the list when there is none.

The pad search and net lists show no pad labels, so nothing else changes.

Payload: no change needed. make_pcb_payload copies pcbdata as is, so name reaches the page. The new test reads it from the built page.

The tooltip now escapes its text. Ref, value, net and pad name went into innerHTML as they were.

Tests:

  • New tests/browser/pad-names.spec.js: hover on the named board (U24 pin 11 and pin 1, plus the pad table), hover on ciaa-acc (U46 shows pad 4, pad table 1..N), and a name with markup shows as text. The named-board and markup tests fail on agent-mcp without this change.
  • Playwright: 104 passed, 2 failed on a first full run (cull.spec.js zoomed render, interaction.spec.js inner layer checkbox). Both were load timeouts while the MCP tests ran Chromium at the same time. Both passed when run again on their own (47 passed). Perf counter tests passed.
  • mcp npm test: http 105 passed, stdio 103 passed, 2 skipped (HTTP only).
  • tools/smoke_test_api.js: ALL OK.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FzHC7LspikUyimHw5ptN8x

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzHC7LspikUyimHw5ptN8x
@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-11 16:54 UTC

@Gherkin

Gherkin commented Oct 11, 2026

Copy link
Copy Markdown
Owner Author

PR review, round 1 (code-review skill + manual check of escaping, label sites, Allegro fallback, table order).

Findings:

  1. web/render.js:1071, web/app.js:995: pad.name is tested by truthiness. MCP (mcp/src/pads.js:125) only takes a non-empty string. A numeric name would read "pin 5" in the viewer but have no pin in the tools. Fix: one padName() helper with the same test, used by tooltip and table.
  2. web/app.js:994: the comment says the table matches the tooltip. It does not for an unnamed pin-1 pad (tooltip "pin 1", table shows its list place, as before this PR). Fix: comment corrected.
  3. web/app.js:995: a footprint with some named and some unnamed pads can show the same "2" for a name and a list place. Not fixed: needs a display choice. KiCad NPTH pads are the only real case.
  4. web/render.js:1072: an unnamed pad flagged pin1 on a named footprint reads "pin 1". Not fixed: ibom sets pin1 from the pad name, so this does not occur in practice.
  5. web/render.js:1278: tooltip uses escapeHtml from app.js. Not fixed: render.js already relies on app.js globals (settings), and the escape is correct.
  6. web/app.js:983: header is still # over names like "A1", "EP". Not fixed: renaming it is a wording choice not in the approved scope.
  7. tests/browser/pad-names.spec.js:21: fixture JSON parsed per call (3 times). Not fixed: cost is small.

Checked, no finding: pad table uses textContent (safe); no other place in web/ shows a pad label; pad table is not sorted; Allegro/ciaa-acc keep "pin 1" / "pad N".

padName() takes a pad name only when it is a string, as mcp/src/pads.js
does, so the viewer and the tools agree on which pads have a pin name.
Tooltip and pad table both use it. Fix the pad table comment: it does not
match the tooltip for an unnamed pin-1 pad.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzHC7LspikUyimHw5ptN8x
@Gherkin
Gherkin merged commit 56fa7c6 into agent-mcp Oct 11, 2026
10 checks passed
@Gherkin
Gherkin deleted the issue-96-pad-names branch October 11, 2026 16:54
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