Title: ifcopenshell.util.sequence applies a single-day IfcWorkTime exception to every earlier date · Issue #9128 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: ifcopenshell.util.sequence applies a single-day IfcWorkTime exception to every earlier date · Issue #9128 · IfcOpenShell/IfcOpenShell
X Title: ifcopenshell.util.sequence applies a single-day IfcWorkTime exception to every earlier date · Issue #9128 · IfcOpenShell/IfcOpenShell
Description: Bug Description ifcopenshell.util.sequence.is_day_in_work_time() evaluates the Start and Finish range of an IfcWorkTime incorrectly. For a single-day calendar exception with: Start = 2026-12-25 Finish = 2026-12-25 the exception: incorrec...
Open Graph Description: Bug Description ifcopenshell.util.sequence.is_day_in_work_time() evaluates the Start and Finish range of an IfcWorkTime incorrectly. For a single-day calendar exception with: Start = 2026-12-25 Fin...
X Description: Bug Description ifcopenshell.util.sequence.is_day_in_work_time() evaluates the Start and Finish range of an IfcWorkTime incorrectly. For a single-day calendar exception with: Start = 2026-12-25 Fin...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/9128
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ifcopenshell.util.sequence applies a single-day IfcWorkTime exception to every earlier date","articleBody":"### Bug Description\n\nifcopenshell.util.sequence.is_day_in_work_time() evaluates the Start and Finish range of an IfcWorkTime incorrectly.\n\nFor a single-day calendar exception with:\n\nStart = 2026-12-25\nFinish = 2026-12-25\n\nthe exception:\n\nincorrectly applies to every date before 2026-12-25;\nincorrectly does not apply on 2026-12-25 itself.\n\nAs a result, a valid future holiday may cause all preceding weekdays to be reported as non-working days. This affects scheduling helpers that rely on is_working_day(), including date offsetting and task-time recalculation.\n\nEnvironment\nConfirmed with IfcOpenShell 0.8.5\nPython 3.11\nIFC schema: IFC4\nLinux\nThe same range implementation is also present in the source from 2026-07-26 used around the 0.8.6a260726 daily build:\nhttps://github.com/IfcOpenShell/IfcOpenShell/blob/8deefe497cca8b9fd41e29e809ec0d0ad9478169/src/ifcopenshell-python/ifcopenshell/util/sequence.py#L203-L220\nMinimal reproduction\n\nThe following script creates:\n\na Monday-to-Friday work calendar;\nworking hours from 08:00 to 16:00;\none non-recurring exception on 2026-12-25;\na minimal calendar_exception_bug.ifc test file.\n\n\nActual result\n\nOn the affected implementation:\n\n2026-09-07: exception_applies=True, working_day=False\n2026-12-25: exception_applies=False, working_day=True\n2026-12-28: exception_applies=False, working_day=True\n\nThe first regression assertion fails.\n\nExpected result\n2026-09-07: exception_applies=False, working_day=True\n2026-12-25: exception_applies=True, working_day=False\n2026-12-28: exception_applies=False, working_day=True\n\nAn IfcWorkTime with Start == Finish should apply on that date only. The Start and Finish boundaries should be inclusive.\n\nSuspected cause\n\nThe current implementation performs two independent assignments:\n\nif start:\n result = day > start\nif finish:\n result = day \u003c finish\n\nThere are two problems:\n\n> and \u003c exclude the Start and Finish dates themselves.\nThe Finish result overwrites the earlier Start result instead of combining both range conditions.\n\nFor Start == Finish == D, this effectively returns True for dates before D and False for D itself.\n\nThe intended range check appears to be equivalent to:\n\nreturn (\n (start is None or day >= start)\n and (finish is None or day \u003c= finish)\n)\nImpact\n\nThis is more than an isolated boolean error:\n\none future ExceptionTime can mark every preceding weekday as non-working;\noffset_date() may move dates far beyond the intended range;\nget_soonest_working_day() and get_recent_working_day() may return incorrect dates;\na backwards search may continue indefinitely because every earlier date remains covered by the future exception;\nsequence.edit_task_time() and schedule cascading can therefore return incorrect dates or appear to hang when a real calendar is assigned.\n\nThe IFC data itself is valid. The issue appears to be limited to the interpretation in ifcopenshell.util.sequence.\n\nSuggested regression coverage\n\nPlease cover at least:\n\na one-day work time where Start == Finish;\nthe exact start and finish boundaries of a multi-day work time;\ndates before and after the range;\nboth WorkingTimes and ExceptionTimes;\nforward and backward working-day searches.\n\n\n[reproduce_ifcopenshell_calendar_exception_bug.py](https://github.com/user-attachments/files/30547144/reproduce_ifcopenshell_calendar_exception_bug.py)\n\n```\nC:\\Users\\pahlawan\\GITT\\IfcOpenShell_Scripts\\.venv\\Scripts\\python.exe C:\\Users\\pahlawan\\GITT\\IfcOpenShell_Scripts\\test.py \nTraceback (most recent call last):\n File \"C:\\Users\\pahlawan\\GITT\\IfcOpenShell_Scripts\\test.py\", line 91, in \u003cmodule>\n assert not sequence.is_work_time_applicable_to_day(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError\nIfcOpenShell: 0.8.6-alpha260726\n2026-09-07: exception_applies=True, working_day=False\n2026-12-25: exception_applies=False, working_day=True\n2026-12-28: exception_applies=False, working_day=True\n\nProcess finished with exit code 1\n\n\n### Attachments\n\n``\n\n### Debug and Error Output\n\n```true\n\n```","author":{"url":"https://github.com/PahlawanJoey","@type":"Person","name":"PahlawanJoey"},"datePublished":"2026-07-30T13:16:36Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/9128"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0346f42e-7ae2-96e2-6c91-79703659edac |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 903C:10338A:8EB391:C51A2B:6B04758D |
| html-safe-nonce | 1951e66aba55d320f72da32ad9416ded163378f2a86ee19c09a130a201e88105 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDNDOjEwMzM4QTo4RUIzOTE6QzUxQTJCOjZCMDQ3NThEIiwidmlzaXRvcl9pZCI6IjM0MDg3NzcxNDM2MDQ1MDgwNDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 94137291ec2d9cf3b91d004cfd7c2c4841924f5c68cdbd9524a381db64660736 |
| hovercard-subject-tag | issue:5020122030 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IfcOpenShell/IfcOpenShell/9128/issue_layout |
| twitter:image | https://opengraph.githubassets.com/68eb531e5ecf4f2f7c8fa2363a37d066ca016d9e5a5e8ed805b05882e1bd4164/IfcOpenShell/IfcOpenShell/issues/9128 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/68eb531e5ecf4f2f7c8fa2363a37d066ca016d9e5a5e8ed805b05882e1bd4164/IfcOpenShell/IfcOpenShell/issues/9128 |
| og:image:alt | Bug Description ifcopenshell.util.sequence.is_day_in_work_time() evaluates the Start and Finish range of an IfcWorkTime incorrectly. For a single-day calendar exception with: Start = 2026-12-25 Fin... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | PahlawanJoey |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9c099f1b85def81ca352464c276510dfef32deaf3c305404e65b8d270284a58b |
| turbo-cache-control | no-preview |
| go-import | github.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git |
| octolytics-dimension-user_id | 13692563 |
| octolytics-dimension-user_login | IfcOpenShell |
| octolytics-dimension-repository_id | 40473201 |
| octolytics-dimension-repository_nwo | IfcOpenShell/IfcOpenShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 40473201 |
| octolytics-dimension-repository_network_root_nwo | IfcOpenShell/IfcOpenShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cf73f57448d52b3a7b619195e182b33d3b3454ca |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width