Skip to content

fix(known_good): make update_module_latest.py work on grouped modules - #371

Open
hskang-amelia wants to merge 1 commit into
eclipse-score:mainfrom
hskang-amelia:fix-known-good-scripts
Open

hskang-amelia wants to merge 1 commit into
eclipse-score:mainfrom
hskang-amelia:fix-known-good-scripts

Conversation

@hskang-amelia

Copy link
Copy Markdown
Contributor

Summary

Two bugs in the known_good scripts.

1. update_module_latest.py crashes on every run

KnownGood.modules is grouped ({"target_sw": {...}, "tooling": {...}}), but update_module_latest.py iterated known_good.modules.values() as if it yielded Module objects:

AttributeError: 'dict' object has no attribute 'pin_version'

It now walks both levels, as known_good_to_workspace_metadata.py already does. This is the script the (currently disabled) "build latest mains" workflow and reusable_integration-build.yml call, so it has probably been broken silently since the grouping was introduced.

2. Malformed timestamps

KnownGood.write() and override_known_good_repo.py appended "Z" to an aware datetime's isoformat(), which already ends in +00:00. The result was 2026-09-28T05:39:55+00:00Z, and that value also ends up in the "Generated from known_good.json at …" banners. Both now write YYYY-MM-DDTHH:MM:SSZ, the same format as the timestamp committed in known_good.json.

Tests

New scripts/known_good/tests/test_update_module_latest.py:

  • a module in each group gets the fetched hash, and a pin_version module is skipped (fails without fix 1);
  • the written timestamp matches ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$.

bazel test //scripts/known_good:known_good_tests //scripts/tooling:tooling_tests passes locally (124 + 66). With the fix, python3 scripts/known_good/update_module_latest.py --output known_good.updated.json runs through and updates 13 of 16 modules.

update_module_latest.py iterated `known_good.modules.values()` as if it
held Module objects, but KnownGood.modules is grouped
({"target_sw": {...}, "tooling": {...}}), so every run died with
`AttributeError: 'dict' object has no attribute 'pin_version'`. It now
walks both levels, as known_good_to_workspace_metadata.py already does.

KnownGood.write() and override_known_good_repo.py also appended "Z" to
an aware datetime's isoformat(), which already ends in "+00:00", giving
timestamps like "2026-09-28T05:39:55+00:00Z". Both now write
"YYYY-MM-DDTHH:MM:SSZ", matching the timestamp committed in
known_good.json.

Adds scripts/known_good/tests/test_update_module_latest.py covering both
(a module in each group is updated, a pinned one is skipped, and the
written timestamp has a single Z); the first test fails without the fix.
@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant