From 752d3a978ff4352885ca12b545b1714e3b056189 Mon Sep 17 00:00:00 2001 From: mavrick Date: Sat, 7 Nov 2026 09:24:44 -0600 Subject: [PATCH 1/2] ci(nightly): bound the Census downloads and the real-data job; check a null assessment through the overlay The real-data job's curl had no timeout, so a stalled connection to census.gov could hold the job, and the report waiting on it, for GitHub's six hours. Each download now gives up after 30 s to connect or 10 minutes in all, which takes the existing "could not download, skip" path, and the job stops after an hour (it takes about ten minutes). The parcel job's assessment table now has no row for "00103" as well as the last parcel. "00103" straddles the R1/C2 boundary, so the overlay check now sees two pieces whose joined value must stay null; the last parcel is in no zone and made no piece, so nulls were never checked through the overlay before. Both were promised in review of #1165. --- .github/workflows/nightly.yml | 3 ++- crates/engine/tests/workflows.rs | 25 ++++++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e5da47888a..b93dd6a37c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -65,6 +65,7 @@ jobs: needs: changed if: needs.changed.outputs.run == 'true' runs-on: ubuntu-latest + timeout-minutes: 60 outputs: tested: ${{ steps.data.outputs.ok }} steps: @@ -87,7 +88,7 @@ jobs: while read -r sum url; do file="${url##*/}" if ! echo "$sum $file" | sha256sum -c --status 2>/dev/null; then - curl -sSfL --retry 3 -o "$file" "$url" || { echo "::warning::could not download $url"; ok=false; continue; } + curl -sSfL --retry 3 --connect-timeout 30 --max-time 600 -o "$file" "$url" || { echo "::warning::could not download $url"; ok=false; continue; } echo "$sum $file" | sha256sum -c || { echo "::error::$file has changed: update its checksum and check the test"; exit 1; } fi done <<'LIST' diff --git a/crates/engine/tests/workflows.rs b/crates/engine/tests/workflows.rs index 8e040efb5f..e1e160193b 100644 --- a/crates/engine/tests/workflows.rs +++ b/crates/engine/tests/workflows.rs @@ -379,8 +379,9 @@ fn parcel_id(col: usize, row: usize) -> String { /// The parcels and zoning layers, and an assessment table to join to the parcels. /// -/// The table keys parcels by the same text ids. It has no row for the last parcel, and has a row -/// for "101": the first parcel's id read as a number, which must not match it. +/// The table keys parcels by the same text ids. It has no rows for "00103", which straddles the +/// zones' boundary, or for the last parcel, and has a row for "101": the first parcel's id read as +/// a number, which must not match it. fn job_data() -> (String, String, String) { let mut parcels = Vec::new(); for row in 0..3 { @@ -396,7 +397,7 @@ fn job_data() -> (String, String, String) { json!({"type": "Feature", "properties": {"zone": "C2"}, "geometry": rect(SPLIT, SOUTH, WEST + 4.0 * STEP, SOUTH + 2.0 * STEP)}), ]; let mut csv = String::from("parcel_id,value_usd\n"); - for k in 0..11 { + for k in (0..12).filter(|&k| !unassessed(k)) { csv += &format!("{},{}\n", parcel_id(k % 4, k / 4), 100_000 + k * 1_000); } csv += "101,999999\n"; @@ -480,10 +481,16 @@ fn check_totals(stats: &Dataset) { } } -/// The value the assessment table gives a parcel: none for the last, which has no row. +/// Whether the assessment table has no row for the parcel numbered `k` from 0: "00103", split +/// into two pieces by the overlay, and the last, which is in no zone. +fn unassessed(k: usize) -> bool { + k == 2 || k == 11 +} + +/// The value the assessment table gives a parcel: none for those with no row. fn assessment(parcel: &str) -> Field { - let k = parcel.parse::().unwrap_or_else(|_| panic!("{parcel}")) - 101; - if k < 11 { Field::Int(100_000 + k * 1_000) } else { Field::Null } + let k = parcel.parse::().unwrap_or_else(|_| panic!("{parcel}")) - 101; + if unassessed(k) { Field::Null } else { Field::Int(100_000 + k as i64 * 1_000) } } /// Checks that every feature carries its parcel's assessed value; the number checked. @@ -509,12 +516,12 @@ fn join_overlay_summarise_map_save_reopen_and_share() { s.run("gp.run", step).unwrap_or_else(|e| panic!("{}: {e}", step["tool"])); } - // The join matched every parcel by its text id; "101" matched none, and the parcel with no - // assessment kept its row with no value. + // The join matched every parcel by its text id; "101" matched none, and the parcels with no + // assessment kept their rows with no value. assert_eq!(check_values(layer(&s, "assessed")), 12); check_totals(table(&s, "zoned_Statistics")); let zoned = layer(&s, "zoned").clone(); - // Every piece keeps its parcel's value through the overlay. + // Every piece keeps its parcel's value through the overlay, "00103"'s two pieces none. assert_eq!(check_values(&zoned), 13); let png = dir.path("map.png"); From 7efba11aae1d9df9378ab68b031a2aa32206b48d Mon Sep 17 00:00:00 2001 From: mavrick Date: Sat, 7 Nov 2026 10:26:25 -0600 Subject: [PATCH 2/2] ci(nightly): keep the download budget within the job, cache only a full set, report a job that runs out of time Each download now stops retrying after 10 minutes, with 5 minutes per attempt: with --retry 3 and 10 minutes an attempt, two stalled files could outlast the job's hour and fail it rather than skip the tests. The Census files are restored and saved as separate steps, saved only when every file downloaded and matched its checksum: the combined action saved a set missing a file, and an exact hit is never saved again. The report runs unless the run itself was cancelled. A job that runs out of time ends cancelled, which the report skipped; it now counts as a failure. The job test also checks that both of 00103's pieces have no assessment, apart from the fixture's helper. --- .github/workflows/nightly.yml | 18 ++++++++++++++---- crates/engine/tests/workflows.rs | 4 ++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b93dd6a37c..c944f0515f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -74,7 +74,10 @@ jobs: - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: save-if: false - - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6 + # Restored and saved as separate steps: the combined action would save a set missing a file + # whose download failed, and an exact hit is never saved again. + - id: cache + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6 with: path: workflow-data key: workflow-data-census-2024-1 @@ -88,7 +91,7 @@ jobs: while read -r sum url; do file="${url##*/}" if ! echo "$sum $file" | sha256sum -c --status 2>/dev/null; then - curl -sSfL --retry 3 --connect-timeout 30 --max-time 600 -o "$file" "$url" || { echo "::warning::could not download $url"; ok=false; continue; } + curl -sSfL --retry 3 --retry-max-time 600 --connect-timeout 30 --max-time 300 -o "$file" "$url" || { echo "::warning::could not download $url"; ok=false; continue; } echo "$sum $file" | sha256sum -c || { echo "::error::$file has changed: update its checksum and check the test"; exit 1; } fi done <<'LIST' @@ -96,6 +99,12 @@ jobs: 38cdd818f50248f67fabf4baf4b82df4ed6110dcaafebcbe4d4f9a389bb47ab8 https://www2.census.gov/geo/docs/maps-data/data/gazetteer/2024_Gazetteer/2024_gaz_tracts_47.txt LIST echo "ok=$ok" >> "$GITHUB_OUTPUT" + - name: Keep the Census files + if: steps.data.outputs.ok == 'true' && steps.cache.outputs.cache-hit != 'true' + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6 + with: + path: workflow-data + key: workflow-data-census-2024-1 - name: Run the workflow tests on them if: steps.data.outputs.ok == 'true' env: @@ -105,8 +114,9 @@ jobs: report: name: Report needs: [changed, rust, workflows] - # A cancelled run is neither a failure nor a fix. - if: always() && github.event_name == 'schedule' && needs.changed.outputs.run == 'true' && needs.rust.result != 'cancelled' && needs.workflows.result != 'cancelled' + # A cancelled run is neither a failure nor a fix. A job that ran out of time ends cancelled too, + # but the run isn't: that is a failure. + if: ${{ !cancelled() && github.event_name == 'schedule' && needs.changed.outputs.run == 'true' }} runs-on: ubuntu-latest permissions: issues: write diff --git a/crates/engine/tests/workflows.rs b/crates/engine/tests/workflows.rs index e1e160193b..e3337b8be8 100644 --- a/crates/engine/tests/workflows.rs +++ b/crates/engine/tests/workflows.rs @@ -523,6 +523,10 @@ fn join_overlay_summarise_map_save_reopen_and_share() { let zoned = layer(&s, "zoned").clone(); // Every piece keeps its parcel's value through the overlay, "00103"'s two pieces none. assert_eq!(check_values(&zoned), 13); + let (id, value) = (zoned.field_index("parcel_id").unwrap(), zoned.field_index("value_usd").unwrap()); + let split = (0..zoned.features.len()).filter(|&r| zoned.value(r, id).to_string() == "00103").collect::>(); + assert_eq!(split.len(), 2, "the overlay splits 00103"); + assert!(split.iter().all(|&r| zoned.value(r, value) == &Field::Null), "00103 has no assessment"); let png = dir.path("map.png"); s.run("share.exportMap", &json!({"path": png, "width": 320, "height": 200})).unwrap();