Skip to content

ci(corpus): the tier-two job reads the BIM4LCA models CI's targets need (#766) - #789

Merged
DrunkOnJava merged 1 commit into
mainfrom
corpus/bim4lca-ci
Oct 18, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
corpus/bim4lca-ci

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

CI's tier-two job reads the BIM4LCA models its targets need, by byte range from VTT's ARCH.zip, so four targets that skipped in CI now run on every pull request (#766, second item).

Motivation

Several of this month's fixes were measured on VTT's BIM4LCA example buildings (CC BY-SA 4.0). Their targets skip without RVT_NORDIC_LCA_DIR, which CI never set. A regression on those files would therefore pass CI, as #736 did on Snowdon. The targets are level_parameters (#751), level_shared_elevation (#752), column_node_z (#753) and column_cut_body (#757).

Changes

  • tools/ci/fetch-bim4lca.py (stdlib Python):
    • reads the archive's central directory from its last MiB;
    • for each pinned entry, reads the local header for the data offset, range-fetches the compressed bytes and inflates them as they arrive;
    • checks each file's size and sha256 against its pin.
    • A 200 answer to a range request, or an archive size other than the pinned 1,579,459,850 bytes, stops it as stale.
    • Exit codes: 0 when all files verify, 1 for a stale pin, 2 for an unreachable host after five tries.
    • --pin prints pin rows.
  • research/bim4lca-models.tsv: the archive and five entries, 286 MB: four Revit 2024 models and Revit's IFC export of Housing_Terrain-Concrete.
  • .github/workflows/ci.yml, tier-two job:
    • restores _bim4lca from a cache keyed on the pins file and fetches on a miss;
    • sets RVT_NORDIC_LCA_DIR only when all five verified;
    • reports a NOT MEASURED warning when the host is unreachable (the targets then skip visibly) and fails on a stale pin;
    • saves the cache from main only, so pull requests restore main's copy rather than each storing 286 MB.
  • Docs: corpus/tier2/README.md, a BIM4LCA section in docs/reference-models.md, and a Research entry in CHANGELOG.md.

Testing

  • Pins: the range reader's output for the five entries equals the hashes measured earlier on a full download of the archive, as recorded in corpus/tier2/README.md: 3df759b8…, c6b53726…, 74712000…, 23675d6c… and the IFC's c3946ee4….
  • This pull request's tier-two run (job 117734636435):
    • The cache missed, as it does before main has saved one. The fetcher read the five files by range in about 8 seconds, [verified] each, and set RVT_NORDIC_LCA_DIR.
    • The four targets ran and passed, with no "skipping" line:
      • column_cut_body::nordic_office_concrete_columns_stop_at_the_slab (11.0 s)
      • column_node_z::nordic_housing_concrete_column_z_is_revits (8.5 s)
      • level_shared_elevation::nordic_housing_timber_keeps_its_storeys (1.2 s)
      • level_parameters::nordic_housing_terrain_levels_are_revits_storeys (2.5 s)
  • After merge, main's run should save the cache and later runs restore it. Checked and noted here then.

Out of scope

Breaking changes

None.

…ed (#766)

Four targets measure fixes on VTT's BIM4LCA models (CC BY-SA 4.0) and
skipped in CI, where RVT_NORDIC_LCA_DIR was never set. ARCH.zip is
1.58 GB, so tools/ci/fetch-bim4lca.py reads the archive's central
directory and then only the five entries the targets open, by range
request: four Revit 2024 models and Revit's IFC export of one, each
written flat and checked against research/bim4lca-models.tsv. It requires
206 answers and the pinned archive size, inflates each entry as it
arrives, and exits 1 when a pin no longer matches and 2 when the host
cannot be reached. The tier-two job restores the files from main's cache,
fetches them on a miss, sets RVT_NORDIC_LCA_DIR only when all five
verified, reports NOT MEASURED when the host is down and fails on a stale
pin; only main saves the cache. The five hashes, extracted by range,
equal the ones measured on a full download of the archive.
@DrunkOnJava DrunkOnJava added area:corpus Work in the corpus area. type:ci Continuous integration or automation work. labels Oct 18, 2026
@DrunkOnJava
DrunkOnJava merged commit 082ca47 into main Oct 18, 2026
27 checks passed
@DrunkOnJava
DrunkOnJava deleted the corpus/bim4lca-ci branch October 18, 2026 17:05

@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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a115654. Configure here.

Comment thread tools/ci/fetch-bim4lca.py Resolved
Comment thread tools/ci/fetch-bim4lca.py Resolved
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Confirmed after merge. main's tier-two job (run 39147943605) missed the cache, read and [verified] the five files, and saved bim4lca-cd042e21…: 266 MB on refs/heads/main. The next pull request run, #788's (run 39148262948), restored it from that key without fetching, and the four BIM4LCA targets passed there as well.

DrunkOnJava added a commit that referenced this pull request Oct 18, 2026
…e host (#766) (#791)

## Summary

`tools/ci/fetch-bim4lca.py` checks the files already in its target directory before asking VTT's host for anything, so a cache-restored run never contacts the host (#766, follow-up to #789).

## Motivation

The fetcher read the archive's central directory first, so every tier-two run asked VTT's host, even when the cache had restored all five files.

- **Host down:** the four BIM4LCA targets skipped, though their files were in place.
- **Archive replaced on the host:** every pull request would fail `CI passed` on a stale pin, with good files in hand.

## Changes

- Files in place are checked against their pins first. The host is asked only for those missing or wrong; when none are, the fetcher exits 0 without a request.
- `--pin` mode is unchanged.
- A stale pin's message names the pins file it was given, not always `research/bim4lca-models.tsv` (Measure passes `research/bim4lca-measure.tsv`).

## Testing

- **Locally:** a pins file whose archive URL cannot resolve, with one entry present and matching. The fetcher printed `[ok]` and exited 0 without a request. With the entry deleted, it went to the host and was still retrying when stopped.
- **This pull request's tier-two run** (job 117746631014) restored `main`'s cache and printed five `[ok]` lines and no `[fetch]`, so it made no request to the host. The four targets ran and passed: `column_node_z`, `column_cut_body`, `level_shared_elevation` and `level_parameters`.

## Breaking changes

None.
DrunkOnJava added a commit that referenced this pull request Oct 18, 2026
… shorter archive as stale (#766) (#794)

## 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 restored the cache, so it did not reach the host, and showed the healthy path unchanged: five `[ok]` lines, no `[fetch]`, and the four targets ran and passed.

## Breaking changes

None.

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant