René's URL Explorer Experiment


Title: ifcpatch MergeDuplicateTypes: default merges distinct untagged types (data loss) and can crash on cross-class merges · Issue #8609 · IfcOpenShell/IfcOpenShell · GitHub

Open Graph Title: ifcpatch MergeDuplicateTypes: default merges distinct untagged types (data loss) and can crash on cross-class merges · Issue #8609 · IfcOpenShell/IfcOpenShell

X Title: ifcpatch MergeDuplicateTypes: default merges distinct untagged types (data loss) and can crash on cross-class merges · Issue #8609 · IfcOpenShell/IfcOpenShell

Description: Summary The ifcpatch recipe MergeDuplicateTypes can silently destroy distinct element types (and, as a knock-on effect, break Bonsai array modifiers that reference them). There are two related problems in the recipe: should_merge_null=Tr...

Open Graph Description: Summary The ifcpatch recipe MergeDuplicateTypes can silently destroy distinct element types (and, as a knock-on effect, break Bonsai array modifiers that reference them). There are two related prob...

X Description: Summary The ifcpatch recipe MergeDuplicateTypes can silently destroy distinct element types (and, as a knock-on effect, break Bonsai array modifiers that reference them). There are two related prob...

Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/8609

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ifcpatch MergeDuplicateTypes: default merges distinct untagged types (data loss) and can crash on cross-class merges","articleBody":"## Summary\n\nThe `ifcpatch` recipe **`MergeDuplicateTypes`** can silently destroy distinct element types (and, as a knock-on effect, break Bonsai array modifiers that reference them). There are two related problems in the recipe:\n\n1. **`should_merge_null=True` is the default**, which merges *every* type that has an empty merge attribute into a single type — even when those types are clearly not duplicates.\n2. **Types are grouped by the attribute value only, ignoring their IFC class**, so two unrelated types that happen to share a value can be merged, which then raises a `TypeError` from `assign_type` (or, worse, silently mis-types occurrences).\n\nRecipe: [`src/ifcpatch/ifcpatch/recipes/MergeDuplicateTypes.py`](https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.8.0/src/ifcpatch/ifcpatch/recipes/MergeDuplicateTypes.py)\n\n## Problem 1 — `should_merge_null=True` destroys distinct untagged types\n\nThe default groups types by `Tag`. With `should_merge_null=True`, all types with an empty `Tag` are treated as duplicates of one another and collapsed into a single type. But an empty attribute is an *absence of evidence*, not proof of duplication.\n\nOn a Bonsai-authored (or mixed) model this is destructive. For example a masonry assembly built with array modifiers had three distinct, differently-named types that all happened to lack a `Tag`:\n\n- `IfcBuildingElementProxyType` \"Wire Ladder\"\n- `IfcBuildingElementProxyType` \"CMU Core\"\n- `IfcBuildingElementProxyType` \"Mortar Joint\"\n\nRunning the default patch collapsed all three into one and removed the other two. Because these types were referenced as **array children** in `BBIM_Array` psets, re-opening the patched file in Bonsai produced:\n\n```\nsetup_arrays: array parent 3QecqJiErB$9TeAgOjclzW references missing child GUID '2N9VxgdQL2eO0eoCEe8Bi_'.\nsetup_arrays: array parent 0QwQTUhPr6EAqfEjNat8se references missing child GUID '0d1KDqYRrCE9_7zIFzbh7M'.\nsetup_arrays: array parent 3iGRJZfy51iAd8K3LgiYDq references missing child GUID '3FI_7o4Dz1keW3geVnqXHX'.\n```\n\n(\"Arrays With Missing Children\" warning in the Project panel.)\n\nGenuine Revit duplicates — the recipe's intended target — always carry a populated `Tag`, so merging untagged types buys nothing for that workflow while risking data loss elsewhere.\n\n### Minimal repro\n\n```python\nimport ifcopenshell, ifcopenshell.api.root, ifcpatch\n\nf = ifcopenshell.file(schema=\"IFC4\")\nfor name in (\"Wire Ladder\", \"CMU Core\", \"Mortar Joint\"):\n    ifcopenshell.api.root.create_entity(f, ifc_class=\"IfcBuildingElementProxyType\", name=name)\n    # Tag left as None\n\nout = ifcpatch.execute({\"file\": f, \"recipe\": \"MergeDuplicateTypes\", \"arguments\": []})\nprint(len(out.by_type(\"IfcBuildingElementProxyType\")))  # -> 1 (expected 3)\n```\n\n## Problem 2 — cross-class merge raises `TypeError`\n\nBecause the grouping key ignores the IFC class, two unrelated types with the same (or both-empty) attribute value can be merged. When the \"keeper\" type cannot type the other type's occurrences, `assign_type` raises. Observed on a Revit export:\n\n```\nTypeError: IfcTypeProduct cannot type IfcBeam in schema IFC4 (allowed occurrence classes: IfcAnnotation)\n```\n\n(Bonsai uses `IfcTypeProduct` for annotation types; it collided with a beam type on an empty `Tag`.)\n\n### Minimal repro\n\n```python\nimport ifcopenshell, ifcopenshell.api.root, ifcopenshell.api.type, ifcpatch\n\nf = ifcopenshell.file(schema=\"IFC4\")\nat = ifcopenshell.api.root.create_entity(f, ifc_class=\"IfcTypeProduct\")\na = ifcopenshell.api.root.create_entity(f, ifc_class=\"IfcAnnotation\")\nifcopenshell.api.type.assign_type(f, related_objects=[a], relating_type=at, should_map_representations=False)\nbt = ifcopenshell.api.root.create_entity(f, ifc_class=\"IfcBeamType\")\nb = ifcopenshell.api.root.create_entity(f, ifc_class=\"IfcBeam\")\nifcopenshell.api.type.assign_type(f, related_objects=[b], relating_type=bt, should_map_representations=False)\n\nifcpatch.execute({\"file\": f, \"recipe\": \"MergeDuplicateTypes\", \"arguments\": [\"Tag\", True]})  # -> TypeError\n```\n\n## Proposed fix\n\n1. Include the IFC class in the grouping key so only same-class types are ever merged.\n2. Change the default to `should_merge_null=False`, so untagged types are kept separate unless the caller explicitly opts in via `[\"Tag\", True]`.\n\nBoth changes are small and localized to the recipe. Happy to open a PR with these plus regression tests covering: same-class populated-attribute duplicates still merge; distinct null-attribute types are preserved by default; cross-class types are never merged (no `TypeError`); and the explicit `should_merge_null` toggle still works.\n\n### Remaining edge case (not addressed by the above)\n\nEven with those fixes, any type removal in this recipe can orphan a `BBIM_Array` \"children\" reference if a genuinely-duplicate type is also an array child. A more complete fix would make the recipe array-aware (repoint or clean up `BBIM_Array` child GUIDs when a referenced type is merged away). Noting it here for completeness.\n\n## Environment\n\n- IfcOpenShell / Bonsai `v0.8.0` branch\n- Blender 4.5, Windows 10\n","author":{"url":"https://github.com/theoryshaw","@type":"Person","name":"theoryshaw"},"datePublished":"2026-07-15T21:12:44Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/8609"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:1e2732cd-06b2-9819-e42e-d1123e655355
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA7CC:2505E9:361F:49B6:6B04AD1F
html-safe-noncea6c5c99138b290ee34c08ba8583cead3c34a69dcb6bf64b61c8329fbd97bf0a9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0NDOjI1MDVFOTozNjFGOjQ5QjY6NkIwNEFEMUYiLCJ2aXNpdG9yX2lkIjoiNDU1Nzg3NzE2MjQwNTA0NzU4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaccc1caca6bc1522341bb8960647813382f32c323f3f423db8f893e38332cf600b
hovercard-subject-tagissue:4896373890
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IfcOpenShell/IfcOpenShell/8609/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4acb846bdc7bc027ed6949976652bb24e92b22d5d010cb1b68f0654687282962/IfcOpenShell/IfcOpenShell/issues/8609
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4acb846bdc7bc027ed6949976652bb24e92b22d5d010cb1b68f0654687282962/IfcOpenShell/IfcOpenShell/issues/8609
og:image:altSummary The ifcpatch recipe MergeDuplicateTypes can silently destroy distinct element types (and, as a knock-on effect, break Bonsai array modifiers that reference them). There are two related prob...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametheoryshaw
hostnamegithub.com
expected-hostnamegithub.com
Nonef1d110ea058a0915c1d8aa3fc2069fa15801e128f591e5762525abe77490ecb1
turbo-cache-controlno-preview
go-importgithub.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git
octolytics-dimension-user_id13692563
octolytics-dimension-user_loginIfcOpenShell
octolytics-dimension-repository_id40473201
octolytics-dimension-repository_nwoIfcOpenShell/IfcOpenShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id40473201
octolytics-dimension-repository_network_root_nwoIfcOpenShell/IfcOpenShell
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseffa22a65e4c46d376940fe34b05e6a7e9c7fdb9b
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/IfcOpenShell/IfcOpenShell/issues/8609#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F8609
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F8609
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=IfcOpenShell%2FIfcOpenShell
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/8609
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/8609
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/8609
IfcOpenShellhttps://github.com/IfcOpenShell
IfcOpenShellhttps://github.com/IfcOpenShell/IfcOpenShell
Codehttps://github.com/IfcOpenShell/IfcOpenShell
Issues1.2k (1.2k)https://github.com/IfcOpenShell/IfcOpenShell/issues
Pull requests938 (938)https://github.com/IfcOpenShell/IfcOpenShell/pulls
Discussionshttps://github.com/IfcOpenShell/IfcOpenShell/discussions
Actionshttps://github.com/IfcOpenShell/IfcOpenShell/actions
Projectshttps://github.com/IfcOpenShell/IfcOpenShell/projects
Wikihttps://github.com/IfcOpenShell/IfcOpenShell/wiki
Security and qualityhttps://github.com/IfcOpenShell/IfcOpenShell/security
Insightshttps://github.com/IfcOpenShell/IfcOpenShell/insights
https://github.com/IfcOpenShell/IfcOpenShell
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/8609
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/8609
ifcpatch MergeDuplicateTypes: default merges distinct untagged types (data loss) and can crash on cross-class mergeshttps://github.com/IfcOpenShell/IfcOpenShell/issues/8609#top
PR Proposedhttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
https://github.com/theoryshaw
theoryshawhttps://github.com/theoryshaw
on Jul 15, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8609#issue-4896373890
src/ifcpatch/ifcpatch/recipes/MergeDuplicateTypes.pyhttps://github.com/IfcOpenShell/IfcOpenShell/blob/v0.8.0/src/ifcpatch/ifcpatch/recipes/MergeDuplicateTypes.py
https://github.com/theoryshaw
theoryshawhttps://github.com/theoryshaw
on Jul 15, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8609#issuecomment-4985340930
https://ifcopenshell.org/upload.htmlhttps://ifcopenshell.org/upload.html
https://github.com/theoryshaw
theoryshawhttps://github.com/theoryshaw
on Jul 15, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8609#issuecomment-4985403247
#8610https://github.com/IfcOpenShell/IfcOpenShell/pull/8610
theoryshawhttps://github.com/theoryshaw
PR Proposedhttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
on Jul 15, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8609#event-28038165551
https://github.com/theoryshaw
theoryshawhttps://github.com/theoryshaw
on Jul 15, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8609#issuecomment-4985462753
https://github.com/osarchorg/wiki/pull/1/changeshttps://github.com/osarchorg/wiki/pull/1/changes
theoryshawhttps://github.com/theoryshaw
on Oct 2, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8609#event-32361107411
ifcpatch: fix MergeDuplicateTypes destroying distinct/cross-class typeshttps://github.com/IfcOpenShell/IfcOpenShell/commit/e8d25868e7a012f71b4fef0998d8650fd6403bd0
e8d2586https://github.com/IfcOpenShell/IfcOpenShell/commit/e8d25868e7a012f71b4fef0998d8650fd6403bd0
Sign up for freehttps://github.com/signup?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/8609
Sign in to commenthttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/8609
PR Proposedhttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.