Skip to content

ENT-13001: Expand release-information with history of releases.json files#18

Merged
olehermanse merged 2 commits intocfengine:mainfrom
sarakthon:add-release-history
Mar 5, 2026
Merged

ENT-13001: Expand release-information with history of releases.json files#18
olehermanse merged 2 commits intocfengine:mainfrom
sarakthon:add-release-history

Conversation

@sarakthon
Copy link
Contributor

Added functions for creating a history of releases.json to the generate-release-information dev command.

@sarakthon sarakthon force-pushed the add-release-history branch 2 times, most recently from 2725ced to 5da6c6f Compare March 4, 2026 12:33
@sarakthon sarakthon force-pushed the add-release-history branch from 465300f to 8fb920e Compare March 4, 2026 12:45
@larsewi larsewi changed the title Expand release-information with history of releases.json files ENT-13001: Expand release-information with history of releases.json files Mar 5, 2026
Copy link
Contributor

@larsewi larsewi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job 🚀 Only some smaller nit picks. Feel free to dismiss the suggestions if you don't agree.

return versions_dict, checksums_dict, files_dict


def filter_unstable_releases(data):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name says "filter unstable" but it's actually returning stable releases. Worth considering a name like get_stable_releases or filter_out_unstable_releases for clarity.

Comment on lines +97 to +110
# Filter the data to only include stable releases (not debug, alpha, or beta releases):
filtered_data = []

for release_data in data.get("releases", []):
if release_data.get("debug") is True:
continue
if release_data.get("alpha") is True:
continue
if release_data.get("beta") is True:
continue

filtered_data.append(release_data)

return filtered_data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is correct but the three if/continue blocks are redundant. They can be collapsed into a single condition. You could also consider using list comprehension which is an idiomatic pattern in Python.

    return [
        r for r in data.get("releases", [])
        if not (r.get("debug") or r.get("alpha") or r.get("beta"))
    ]

def sort_release_data(file_checksums_dict):
# Newest versions first, and files sorted alphabetically within each version
for v in file_checksums_dict.keys():
file_checksums_dict[v] = dict_sorted_by_key(file_checksums_dict[v])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function mutates its input (file_checksums_dict[v] = ...) before building the sorted copy below. The caller may not expect their dict to be modified as a side effect of this function. Consider creating the copy first.

@olehermanse olehermanse merged commit b11ed62 into cfengine:main Mar 5, 2026
1 of 21 checks passed
@sarakthon sarakthon deleted the add-release-history branch March 9, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants