Skip to content

Fix markdown metadata propagation, silent pin drops, and mermaid keyword gaps#57

Merged
zcohen-nerd merged 2 commits intomainfrom
copilot/analyze-code-for-issues
Feb 27, 2026
Merged

Fix markdown metadata propagation, silent pin drops, and mermaid keyword gaps#57
zcohen-nerd merged 2 commits intomainfrom
copilot/analyze-code-for-issues

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

Deep analysis of emitter pipeline revealed three bugs and one missing CLI feature.

Bug fixes

  • emit_markdown.py: canonical_dict not passed to _get_special_function() in the special pins section and single-ended table — TOML-only profiles (nRF52840, ATmega328P, etc.) always showed "General Purpose I/O" instead of actual special function descriptions
  • emit_markdown.py / emit_mermaid.py: Pins with no numeric characters in their name silently dropped from output (guarded by if num_match: with no else branch). Uses float("inf") as fallback sort key so they sort last instead of vanishing
  • emit_mermaid.py: _group_pins_by_function() and _get_node_style() missing SCK, TX, RX, CS, SS keywords — standalone nets like SCK miscategorized as "Digital I/O" instead of "Communication"

Enhancement

  • cli.py: Added --version flag

Before/after (markdown special functions)

# Before: TOML profile metadata ignored, falls back to hardcoded table
_get_special_function(pin, mcu_lower)  # → "General Purpose I/O" for custom MCUs

# After: canonical_dict propagated, profile metadata used
_get_special_function(pin, mcu_lower, canonical_dict)  # → "NFC Antenna Pin" etc.

12 regression tests added in test_fixes_61_64.py.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

… dropped, missing communication keywords, add --version flag

Co-authored-by: zcohen-nerd <61070171+zcohen-nerd@users.noreply.github.com>
Copilot AI changed the title [WIP] Analyze code for potential bugs and usability problems Fix markdown metadata propagation, silent pin drops, and mermaid keyword gaps Feb 27, 2026
@zcohen-nerd zcohen-nerd marked this pull request as ready for review February 27, 2026 00:55
Copilot AI review requested due to automatic review settings February 27, 2026 00:55
@zcohen-nerd zcohen-nerd merged commit 3d0b8c0 into main Feb 27, 2026
1 check passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes three bugs in the emitter pipeline and adds a --version flag to the CLI. The bugs were causing incorrect output for TOML-defined MCU profiles and silently dropping pins with non-numeric names.

Changes:

  • Fixed emit_markdown.py to pass canonical_dict to _get_special_function() so TOML profiles display correct special function metadata instead of "General Purpose I/O"
  • Fixed silent pin drops in both emit_markdown.py and emit_mermaid.py by using float("inf") as fallback sort key for pins without numeric characters
  • Added missing communication protocol keywords (SCK, TX, RX, CS, SS) to Mermaid grouping and styling functions
  • Added --version flag to CLI displaying "0.1.0" from pyproject.toml

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tools/pinmapgen/emit_markdown.py Fixed metadata propagation to _get_special_function() calls (line 85, 219) and added fallback sort key for non-numeric pins (line 218)
tools/pinmapgen/emit_mermaid.py Added fallback sort key for non-numeric pins (line 108) and expanded communication keyword lists in two functions (lines 266-269, 329-332)
tools/pinmapgen/cli.py Added --version argument displaying version "0.1.0" (lines 102-104)
tests/test_fixes_61_64.py Added 12 regression tests covering all four issues (#61-#64) with proper test structure following codebase conventions

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.

3 participants