Skip to content

fix: displace_symbol regex group count#11

Merged
electron-rare merged 1 commit into
mainfrom
fix/d2-displace-symbol-groups-2026-05-11
May 11, 2026
Merged

fix: displace_symbol regex group count#11
electron-rare merged 1 commit into
mainfrom
fix/d2-displace-symbol-groups-2026-05-11

Conversation

@electron-rare
Copy link
Copy Markdown
Contributor

Quick fix: displace_at callback referenced m.group(4) but the regex defines only 3 capture groups. IndexError: no such group killed scale-up runs.

Fix

Collapsed y + angle into the 3rd group, format as f"{pre}{x+500}{tail}".

Scale-up validated

--max-projects 30 --skip-prose28 triplets across 60 intact projects:

  • permissive: 19 (truncate_tail × 14 + drop_global_label × 5)
  • copyleft: 9 (truncate_tail × 8 + drop_global_label × 1)

Pipeline E2E now stable. Closes tasks #2, #3, #5 (verified end-to-end).

The displace_at callback referenced m.group(4) but the regex
defines only 3 capture groups (prefix, x, tail). IndexError
killed scale-up runs (--max-projects 30 hit this on a leaf
schematic that did have a matchable (symbol (at x y a)) block).

Fix: collapse y + angle into the 3rd group, format as
f\"{pre}{x + 500}{tail}\". Adjusted regex closing paren so the
tail group includes the closing ).

Scale-up validated: 28 triplets across 60 intact projects:
  permissive: 19 (truncate_tail x14 + drop_global_label x5)
  copyleft:    9 (truncate_tail x8 + drop_global_label x1)
Copilot AI review requested due to automatic review settings May 11, 2026 20:11
@electron-rare electron-rare merged commit fe297be into main May 11, 2026
0 of 2 checks passed
@electron-rare electron-rare deleted the fix/d2-displace-symbol-groups-2026-05-11 branch May 11, 2026 20:11
Copy link
Copy Markdown

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

Fixes a runtime failure in the KiCad D2 combined dataset builder’s displace_symbol noise injection by aligning the displace_at callback with the actual regex capture groups, preventing IndexError: no such group from aborting scale-up runs.

Changes:

  • Adjusted the displace_symbol substitution to use the correct capture groups (prefix, x, tail) and rebuild the (at ...) clause without referencing a non-existent group.
  • Updated the regex so the “tail” capture includes the closing ) needed by the replacement formatting.
  • Added an explanatory comment documenting the intended capture-group structure.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

y = m.group(3)
angle = m.group(4)
return f"{pre}(at {x + 500} {y} {angle})"
tail = m.group(3) # contains " y angle"
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.

2 participants