Skip to content

fix(ci): the BIM4LCA fetcher retries a dropped connection and fails a shorter archive as stale (#766) - #794

Merged
DrunkOnJava merged 2 commits into
mainfrom
fix/bim4lca-fetch-errors
Oct 18, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
fix/bim4lca-fetch-errors

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

tools/ci/fetch-bim4lca.py retries a connection dropped in the middle of a body, and fails a shorter replacement archive as a stale pin instead of reporting the host unreachable. These are the two findings Bugbot posted on #789 after it merged.

Motivation

The fetcher's exit status decides what tier two does: 0 runs the BIM4LCA targets, 1 fails the job (re-pin), and 2 warns NOT MEASURED and skips them. Two errors landed on the wrong side:

  • A dropped connection. response.read() raises http.client.IncompleteRead, which is not an OSError. Nothing caught it, so the run ended in a traceback with exit 1 and failed the job as a stale pin, for a network blip.
  • A shorter archive. When the host's archive is replaced by a smaller one, the range past its end is answered 416. That was retried five times and reported unreachable (exit 2), so the targets skipped instead of the stale pin failing.

Changes

  • http.client.HTTPException, which includes IncompleteRead, is retried with the URL and OS errors, and ends in Unreachable (exit 2) if it persists.
  • HTTP 416 raises Stale (exit 1) at once, naming the bytes asked for and the pinned size.

Testing

End to end, the real script against a local stub host, with a pins file whose one entry is not on disk, so it has to ask the host. Each mode was run with this branch's script and main's:

Host answers main This branch
416 to every range retried 151 s, exit 2, unreachable: ... HTTP Error 416 exit 1 at once, error: the host has no bytes 3951424-4999999: the archive is shorter than the pinned 5000000; re-pin pins-416.tsv
206 with Content-Length: 100, then closes after 10 bytes traceback (IncompleteRead), exit 1 retried 150 s, exit 2, unreachable: ... IncompleteRead(10 bytes read, 90 more expected)

This pull request's tier-two run restores the cache, so it does not reach the host. It shows the healthy path is unchanged: five [ok] lines, and the four targets run.

Breaking changes

None.

Refs #766, #789


Note

Low Risk
CI-only fetch retry and error-classification changes; no production runtime or auth/data paths affected.

Overview
Hardens fetch() in tools/ci/fetch-bim4lca.py so transient network failures and a shrunk archive map to the correct CI exit codes (2 vs 1).

HTTP 416 on a byte-range request now raises Stale immediately (exit 1, re-pin) when the host’s file is shorter than the pinned archive size, instead of retrying and ending as unreachable.

Dropped mid-body reads (http.client.IncompleteRead via HTTPException) are caught with URL/OS errors, retried, and only then reported as Unreachable (exit 2)—avoiding a traceback and a false stale-pin failure on a blip.

Reviewed by Cursor Bugbot for commit 4c7f191. Configure here.

@DrunkOnJava DrunkOnJava added area:ci Work in the ci area. type:ci Continuous integration or automation work. labels Oct 18, 2026
@DrunkOnJava
DrunkOnJava merged commit b2f415e into main Oct 18, 2026
25 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/bim4lca-fetch-errors branch October 18, 2026 19:02
DrunkOnJava added a commit that referenced this pull request Oct 18, 2026
…ver its Export to IFC As says (#792) (RE-188) (#796)

## Summary

A curtain wall in a Revit 2024 file is written as `IfcCurtainWall` whatever its "Export to IFC As" says, as Revit 2024's own exporter writes it. On both BIM4LCA office files, that takes the 124 curtain walls rvt-rs wrote as `IfcShadingDevice` back to `IfcCurtainWall`, all 220 matching Revit's export. The export diagnostics also warn with every "Export to IFC As" value the export does not apply, which `category_map`'s documentation already claimed (#792, RE-188).

## Motivation

#792 measured 124 office curtain walls that Revit's export writes as `IfcCurtainWall` and rvt-rs as `IfcShadingDevice`. Run [39153127128](https://github.com/DrunkOnJava/rvt-rs/actions/runs/39153127128) found the value is the curtain walls' own (RE-45 owner records of category `Walls`), not misattributed. The cause is the exporter version:
- In revit-ifc `IFC_v24.1.0` to `IFC_v24.3.40`, `CurtainSystemExporter.ExportBase` creates every curtain wall as an `IfcCurtainWall` without consulting the export type.
- From `IFC_v25.2.0`, it takes the entity from `ExporterUtil.GetProductExportType`, as other elements do.
- On floors, Revit 2024 does follow the value: Core Interior's 20 floors set to `IfcShadingDevice` stay correct.

For 2025 and 2026 files the maintainer chose to keep following the setting, as the newer exporters' source does. That half is not measured: the RE1 models carry no value.

## Changes

- `category_map::export_override_applies(class, release)`: false for a `CurtainWall` in a 2024 file. Its doc cites the revit-ifc tags and says what is and is not measured.
- `partition_schema_mvp`: the file's release travels with each element's export value (`m_ifc_export_release`). The writer's `ifc_export_override` consults the rule, so the value stays on the element for the diagnostics.
- `export_content::unapplied_export_value` and a diagnostics warning, which counts exported elements whose value names another entity than the one written, by `"<value> on <class>"`.
- The wording in `category_map.rs` and `partition_ifc_export_overrides.rs`: `IfcShadingDevice` is proven on floors and disproven on 2024 curtain walls, not "the one proven value".
- `docs/status.md`, `docs/supported-profile.md`, the CHANGELOG `[Unreleased]` Fixed entry, and `reports/element-framing/RE-188-curtain-wall-export-as.md`.

## Testing

Measure run [39156744563](https://github.com/DrunkOnJava/rvt-rs/actions/runs/39156744563), with `-f nordic=true` and `main` as the base, read the two office files and CI's reference models. The office files are VTT BIM4LCA, CC BY-SA 4.0, each with Revit 2024's own export.

| Against Revit's export, by `Tag` (`class_sets_vs_ifc.py`) | main | this PR |
|---|---:|---:|
| Office as built: Revit's 220 `IfcCurtainWall` written as `IfcCurtainWall` | 96 | 220 |
| Office as built: written as `IfcShadingDevice` | 124 | 0 |
| Office at building permit: written as `IfcCurtainWall` | 96 | 220 |
| Office at building permit: written as `IfcShadingDevice` | 124 | 0 |
| Core Interior: Revit's 20 `IfcShadingDevice` (floors) | 20 | 20 |

- **Core Interior, Einhoven and the four RE1 models:** every output is byte-identical to main's apart from the timing lines, and none gains a warning.
- **The office files:** only `class_sets`, `aggregates`, `names`, the diagnostics and the IFC hash change.
- **The as-built file's warning:** it lists 381 elements whose value the export does not apply: `IfcShadingDevice` on `CurtainWall` 124, `IfcWasteTerminal` on `PlumbingFixture` 78, `IfcElectricAppliance` on `ElectricalEquipment` 51, `IfcSpace` on `GenericModel` 42, `IfcFireSuppressionTerminal` on `SpecialtyEquipment` 40, `IfcWall` on `CurtainWall` 21, `IfcSanitaryTerminal` on `Casework` 15, and five groups of 10 elements together. Those values account for the rest of #792's class mismatches, which stay open.
- **Not measured:** a Revit 2025 or 2026 curtain wall carrying a value. The 9 wall sweeps Revit writes as proxies are also left open: their exporter path is the same in every version, so this rule does not explain them.

The rebase onto main after this measurement (#793 and #794) touches no Rust source.

## Clean room

The changes in this PR are based on public byte observations of the BIM4LCA and magnetar models (sources 1 to 3) and on Autodesk's open-source IFC exporter, revit-ifc, for what Revit's own export writes (source 5): `CurtainSystemExporter.ExportBase` and `ExportWall`, `ExporterUtil.GetProductExportType` and `WallSweepExporter`, read at the release tags named above. I have not used Autodesk SDK source, ODA SDK source, leaked internal documentation, NDA material, or decompiled internal Revit implementation code beyond public symbol exports, and I have not copied or translated code from revit-ifc.

## Breaking changes

None. Diagnostics gain a warning string; their schema is unchanged.

Refs #792
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci Work in the ci area. type:ci Continuous integration or automation work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant