René's URL Explorer Experiment


Title: ifcopenshell.api: five removal functions write empty aggregates that the schema forbids · Issue #9165 · IfcOpenShell/IfcOpenShell · GitHub

Open Graph Title: ifcopenshell.api: five removal functions write empty aggregates that the schema forbids · Issue #9165 · IfcOpenShell/IfcOpenShell

X Title: ifcopenshell.api: five removal functions write empty aggregates that the schema forbids · Issue #9165 · IfcOpenShell/IfcOpenShell

Description: Summary Five ifcopenshell.api removal functions write schema-invalid IFC when they remove the last member of an aggregate whose schema minimum is 1. Each was confirmed by running the function and validating the result, not by reading cod...

Open Graph Description: Summary Five ifcopenshell.api removal functions write schema-invalid IFC when they remove the last member of an aggregate whose schema minimum is 1. Each was confirmed by running the function and v...

X Description: Summary Five ifcopenshell.api removal functions write schema-invalid IFC when they remove the last member of an aggregate whose schema minimum is 1. Each was confirmed by running the function and v...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ifcopenshell.api: five removal functions write empty aggregates that the schema forbids","articleBody":"## Summary\n\nFive `ifcopenshell.api` removal functions write **schema-invalid IFC** when they remove the last member of an aggregate whose schema minimum is 1. Each was confirmed by running the function and validating the result, not by reading code.\n\nThey are grouped here rather than filed separately because **each one needs the same kind of decision**, and in two cases the obvious fix makes things worse. No patch is proposed, because guessing here would trade one invalid state for another.\n\nThis matters more than a normal validation nit: Bonsai authors IFC natively, so the `.ifc` is the live database. These corrupt the user's model at the moment they click a button, with no error shown.\n\n## The five\n\n| Function | Leaves | Schema requires |\n|---|---|---|\n| `material.remove_layer` | `IfcMaterialLayerSet.MaterialLayers = ()` | `list [1:?]` |\n| `material.remove_profile` | `IfcMaterialProfileSet.MaterialProfiles = ()` | `list [1:?]` |\n| `material.remove_list_item` | `IfcMaterialList.Materials = ()` | `list [1:?]` |\n| `grid.remove_grid_axis` | `IfcGrid.UAxes` / `VAxes = ()` | `list [1:?]` |\n| `style.remove_surface_style` | `IfcSurfaceStyle.Styles = ()` | `set [1:5]` |\n\n## Why the obvious fix is wrong for the material cases\n\nThe natural fix is to cascade-delete the owning set when it empties, mirroring the precedent in `layer/unassign_layer.py`. **That was implemented and rejected**, because it produces a worse invalid state:\n\n```\nIfcRelAssociatesMaterial.RelatingMaterial = None   ->  \"Attribute not optional\"\n```\n\nReproduced for both `remove_layer` and `remove_list_item`. So a correct fix must also clean up the material-assignment relationship, which means silently un-materialising every product that used that set. That is a behavioural decision about what the API should do to the user's model, not a bug fix.\n\n**Question for maintainers:** when the last layer is removed from a material set that products are still using, should the API (a) refuse and raise, (b) delete the set and the assignment relationship, un-materialising those products, or (c) leave the set with a single placeholder layer?\n\n## Why `grid.remove_grid_axis` is worse\n\nThe only schema-legal outcome of removing the last U or V axis is **deleting the entire `IfcGrid`**. Auto-deleting a whole product as a side effect of removing one axis is a large and surprising behaviour, so it should be a deliberate decision rather than something slipped into a bug fix.\n\n**Question:** should removing the last axis raise, or delete the grid?\n\n## Why `style.remove_surface_style` is blocked differently\n\nHere two functions disagree about ownership. `style/remove_style.py` loops `for style_ in style.Styles: remove_surface_style(...)` and then unconditionally calls `file.remove(style)` itself. If `remove_surface_style` starts deleting the now-empty parent, `remove_style` double-removes a dangling handle. `remove_surface_style` is also used standalone elsewhere with no such cleanup.\n\n**Question:** which of the two owns deleting the emptied `IfcSurfaceStyle`?\n\n## How these were found, and what is NOT broken\n\nEvery `remove_*` and `unassign_*` function under `ifcopenshell.api` was enumerated and checked against schema cardinality:\n\n- 89 functions enumerated, 84 audited (5 excluded as already in open PRs)\n- 64 distinct entity types cross-referenced against schema cardinality\n- 9 last-member cases constructed and validated\n- **5 genuine defects, listed above**\n\n**The large majority of the 84 were already correctly guarded**, via `len(x) == 1` checks, singleton comparisons, or an existing fallback to `None` or delete-the-relationship. This class is concentrated, not endemic.\n\nConfirmed benign by direct test rather than assumption: `material.remove_constituent`, `sequence.remove_work_time` and `sequence.remove_time_period` auto-null correctly; `pset_template.remove_prop_template` no-ops safely on the last template.\n\nThree aggregates are unreachable through the current API because no `add_*` populates them: `IfcStructuralAnalysisModel.LoadedBy`, `IfcStructuralLoadConfiguration.Values`, `IfcMaterialClassificationRelationship.MaterialClassifications`.\n\n## Related, already fixed\n\nThe same defect class in `cost.unassign_cost_item_quantity`, `group.update_group_products` and `resource.remove_resource` is fixed in #9161, and in `cost.remove_cost_item_quantity` in #9164. Those had unambiguous fixes with existing precedent; these five do not.\n\nHappy to implement whichever answers you prefer, with tests.\n\nGenerated with the assistance of an AI coding tool.\n","author":{"url":"https://github.com/petruconduraru","@type":"Person","name":"petruconduraru"},"datePublished":"2026-07-30T20:33:20Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/9165"}

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:199528c9-62dc-67f4-3683-305bc377796f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC74E:4818E:27A43D:3682B1:6B046940
html-safe-nonce8103c46d70a11d86e9fed1b6a64815b77429663b3f5d677e5fe78ef32bdde749
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzRFOjQ4MThFOjI3QTQzRDozNjgyQjE6NkIwNDY5NDAiLCJ2aXNpdG9yX2lkIjoiMjczMDMxNDIzODAzMDgwMTIxNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac67ce559e0e2173390c5c0570e6b5785d361092fe3196a644ccc253f6bab0a520
hovercard-subject-tagissue:5023762478
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/9165/issue_layout
twitter:imagehttps://opengraph.githubassets.com/49f10fc3a39731e8e7c2ca2ea7e37392e769782bbd6abac592b2397538762a8d/IfcOpenShell/IfcOpenShell/issues/9165
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/49f10fc3a39731e8e7c2ca2ea7e37392e769782bbd6abac592b2397538762a8d/IfcOpenShell/IfcOpenShell/issues/9165
og:image:altSummary Five ifcopenshell.api removal functions write schema-invalid IFC when they remove the last member of an aggregate whose schema minimum is 1. Each was confirmed by running the function and v...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepetruconduraru
hostnamegithub.com
expected-hostnamegithub.com
None83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f
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
releaseca4d07a7cef4e4b75f821dc25e7300d80c1450a9
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/IfcOpenShell/IfcOpenShell/issues/9165#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F9165
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%2F9165
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/9165
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/9165
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/9165
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 requests936 (936)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/9165
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9165
#9258https://github.com/IfcOpenShell/IfcOpenShell/pull/9258
ifcopenshell.api: five removal functions write empty aggregates that the schema forbidshttps://github.com/IfcOpenShell/IfcOpenShell/issues/9165#top
#9258https://github.com/IfcOpenShell/IfcOpenShell/pull/9258
PR ProposedA PR has been proposed for this bug/feature.https://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
https://github.com/petruconduraru
petruconduraruhttps://github.com/petruconduraru
on Jul 30, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9165#issue-5023762478
#9161https://github.com/IfcOpenShell/IfcOpenShell/pull/9161
#9164https://github.com/IfcOpenShell/IfcOpenShell/pull/9164
petruconduraruhttps://github.com/petruconduraru
PR ProposedA PR has been proposed for this bug/feature.https://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
on Aug 5, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9165#event-29015450752
brunopostlehttps://github.com/brunopostle
on Nov 12, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9165#event-35885304553
Structural analysis: fix load cases, load groups and activities (#9868)https://github.com/IfcOpenShell/IfcOpenShell/commit/9b5374b7f57ae82c66c597cf186453ea03b7ff43
#9868https://github.com/IfcOpenShell/IfcOpenShell/pull/9868
9b5374bhttps://github.com/IfcOpenShell/IfcOpenShell/commit/9b5374b7f57ae82c66c597cf186453ea03b7ff43
Sign up for freehttps://github.com/signup?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9165
Sign in to commenthttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9165
PR ProposedA PR has been proposed for this bug/feature.https://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.