Skip to content

chore: remove unused flatten_layers_to_masks pass - #1247

Open
detail-app[bot] wants to merge 1 commit into
mainfrom
detail/dead-code/chore-remove-unused-flatten-layers-to-masks-pass-f459df
Open

detail-app[bot] wants to merge 1 commit into
mainfrom
detail/dead-code/chore-remove-unused-flatten-layers-to-masks-pass-f459df

Conversation

@detail-app

@detail-app detail-app Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Remove the flatten_layers_to_masks function from pcb-ir's IPC process
pipeline, along with its four dedicated tests in process.rs and the
flatten-specific block in gerber/export.rs's
real_board_export_parseback_and_svg_paths_smoke test (whose
compose_for_rendering half is retained).

This pass had no production callers. Its only production caller — the
--flat render option in ipc2581 render — was deliberately removed in
#1026, replaced by instance-aware artwork lowering. The remaining
call-sites were all tests, which don't count as production consumers.
process is also the only sibling module in ipc/mod.rs without a
pub use re-export, so flatten_layers_to_masks was never part of the
advertised external API. The FeatureKind::FlattenedBucket enum variant
(now never constructed) is left in place in feature.rs to avoid a
breaking change to the public enum.

History


Dead Code PRs can be configured here.


Note

Low Risk
Dead-code deletion with no production callers; behavior of Gerber export and live IPC pipelines is unchanged aside from removed test coverage for the flatten pass.

Overview
Removes the dead flatten_layers_to_masks IPC process pass, which lowered each layer to artwork, composed a single unioned fill mask per layer, rewrote features as FeatureKind::FlattenedBucket, and cleared placement groups. Nothing in the repo calls it anymore after the old --flat render path was dropped.

process.rs: deletes the public function and four unit tests (mask union, stroke expansion, cutouts, placement groups). Test imports are trimmed so FeatureKind is only pulled in where still needed.

gerber/export.rs: shortens real_board_export_parseback_and_svg_paths_smoke by dropping the flatten-and-SVG block; the compose_for_rendering → artwork → mask → SVG path stays.

FeatureKind::FlattenedBucket remains on the public enum but is never constructed, avoiding a breaking API change.

Reviewed by Cursor Bugbot for commit 77e0b2f. Bugbot is set up for automated code reviews on this repo. Configure here.

@detail-app
detail-app Bot requested a review from akhilles September 8, 2026 05:52

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review

Comment on lines -462 to -465
pub fn flatten_layers_to_masks<S, L>(
doc: &mut Document<S, L>,
resolution: Resolution,
) -> Result<(), AccuracyError>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Public flattening API disappears

External users calling flatten_layers_to_masks lose the public function without a compatibility path. process remains public, so direct callers stop compiling after upgrading.

Prompt for agents
The published pcb-ir crate exposes dialects::ipc::process publicly, making flatten_layers_to_masks callable by downstream crates despite its lack of a root re-export. Preserve compatibility, preferably by retaining and deprecating the function before a planned breaking release. If immediate removal is required, treat it as a public API break and coordinate the crate version and migration documentation accordingly.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Build Performance

Board Base (median) Head (median) Change
demo/b/Demeter 67ms ±7 75ms ±15 +12.8%
demo/b/DM0001/Governor 88ms ±5 122ms ±7 1.39× ±0.11 slower
demo/b/DM0002/Marlow 69ms ±7 73ms ±13 +5.8%
demo/b/DM0003/Bramble 85ms ±5 83ms ±7 -1.6%
demo/b/Feign 60ms ±9 60ms ±8 -1.5%
demo/b/Renfield 64ms ±6 65ms ±7 +0.8%
demo/b/Seward 67ms ±5 67ms ±5 -0.7%
arduino/b/Nano 62ms ±3 61ms ±2 -0.8%
arduino/b/unoQ 146ms ±6 142ms ±3 -2.4%

Measured with hyperfine. Times show median ±stddev.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved. Cursor Bugbot and Cursor Security Agent completed with no findings that need human review, and this is a small unused-code cleanup rather than a user-facing functional change. No reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

This branch has not been deployed

No deployments
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