Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-release handling #4260

Merged
merged 1 commit into from
Nov 24, 2024
Merged

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Nov 20, 2024

Motivation

@JonnyOThan wants to make prereleases of RPM and FreeIva available to CKAN users on an opt-in basis.

Currently the inflator just ignores prereleases, so they aren't added to the default metadata repo at all.

Problems

Bugs encountered during dev:

Causes

  • The labeled progress bar's OnPaint method never runs on Windows, so the text never gets drawn!

Changes

  • Now ReleaseStatus is changed from a rich class containing a string to an enum with integer values and Display attributes for each option
    • JsonReleaseStatusConverter is created to migrate alpha to development and beta to testing
  • Now a CKAN.Configuration.StabilityToleranceConfig class is created to hold JSON-serializable data representing an overall Release status plus per-mod overrides
    • RelationshipResolverOptions now requires one of these and provides it to the relationship resolver code that needs it to pick modules; from there it is passed layer-by-layer to AvailableModules.Latest which actually applies the filter
    • CompatibleGameVersions is moved to the Configuration folder and the CKAN.Configuration namespace
  • Now GameInstance.StabilityToleranceConfig represents such an object for each game instance, saved to <game root>/CKAN/stability_tolerance.json
  • JsonConfiguration now raises a PropertyChanged event when the system level install filters are changed
    • GUI's Version tab now listens for this event and no longer needs Main to tell it to refresh after the install filters window closes
  • Now Netkan's --prerelease option is changed from boolean to nullable boolean, so the options are:
    • true: Inflate only prereleases (same as before)
    • false: Inflate only non-prereleases (same as before, also the old default)
    • null (omitted, therefore the new default): Inflate both
  • x_netkan_github may now contain a prereleases flag with the same values and effects as above, in case we need to override this behavior for an individual mod
  • Now if the GitHub transformer inflates a prerelease, it sets release_status to testing
  • Now if the SpaceDock transformer inflates a release whose version string contains "alpha", "beta", or "pre", it sets release_status to testing
  • Now for a mod to be considered installable, its release_status has to be as stable as the configured stability tolerance
    • The old client never filters on release_status, which will become a problem once we start indexing prereleases. Therefore the spec version analyzer is updated to set spec_version to v1.36 for any module with a release_status other than stable, which will ensure that they will be hidden by the old client
    • The inflator can't handle future spec versions, even though it is always the cutting edge code and it makes sense to pregenerate metadata in anticipation of future releases. To account for this, Meta.IsNetKAN is now created to return true from inside Netkan and false in the client, which we then use to turn off spec version validation
  • Multi-hosted mods are likely to upload their prereleases to just one host, so the Generated 2 modules but only 1 requested check is relaxed for prereleases
    • To make this work, we now mix the non-x_netkan properties of the sections of a netkan before inflation. In the near term this will mean we no longer need to put install: under both the GitHub and SpaceDock sections.
  • Now CmdLine has new commands ckan stability list and ckan stability set to show and edit the new settings; set --mod can be used to set mod overrides
  • Now the "Install:" label in ConsoleUI's mod info screen is internationalized
  • Now ConsoleUI has a ConsoleComboButtons control representing a group of radio buttons, and a derived class ReleaseStatsComboButtons using it to represent choosing a value from ReleaseStatus, which is added to the instance edit and mod info screens
    • Since the radio buttons in the mod info screen can accept focus, so can the other text boxes if they have enough contents to be scrolled
  • Now a combobox dropdown control is added to GUI's settings dialog to represent the instance-level setting and the Versions tab to represent the per-mod override
  • Now the labeled progress bar control sets the UserPaint style to make OnPaint run, where it uses ProgressBarRenderer to draw the progress bar before it draws the text, which hopefully will work everywhere
  • Some missing SuspendLayout, ResumeLayout, and PerformLayout calls are added to GUI, which fixes a few UI glitches and reduces some flickering
  • The Versions tab no longer highlights the selected row, because this uselessly conceals the row color
  • The Versions tab's legend is now moved to the bottom, just above the stability override combobox
    • The legend now only shows the installed version label if the mod is installed
    • The legend now shows a label for pre-releases if there is one in the current mod

Fixes #4159.

@HebaruSan HebaruSan added Bug Something is not working as intended Enhancement New features or functionality GUI Issues affecting the interactive GUI Cmdline Issues affecting the command line Core (ckan.dll) Issues affecting the core part of CKAN Netkan Issues affecting the netkan data ConsoleUI Issues affecting the interactive console UI i18n Issues regarding the internationalization of CKAN and PRs that need translating labels Nov 20, 2024
@HebaruSan
Copy link
Member Author

HebaruSan commented Nov 20, 2024

@JonnyOThan, wanna take this one for a spin?

To mock up testing data, what I did was edit %LOCALAPPDATA%\CKAN\repos\4A85405A-KSP-default.json, scroll through to some mod, and add

"release_status": "testing",

or

"release_status": "development",

@HebaruSan HebaruSan force-pushed the feature/pre-releases branch 2 times, most recently from f0902c8 to 5d81726 Compare November 21, 2024 22:55
@HebaruSan HebaruSan merged commit 4c31557 into KSP-CKAN:master Nov 24, 2024
3 checks passed
@HebaruSan HebaruSan deleted the feature/pre-releases branch November 24, 2024 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended Cmdline Issues affecting the command line ConsoleUI Issues affecting the interactive console UI Core (ckan.dll) Issues affecting the core part of CKAN Enhancement New features or functionality GUI Issues affecting the interactive GUI i18n Issues regarding the internationalization of CKAN and PRs that need translating Netkan Issues affecting the netkan data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: easier distribution for pre-release versions of mods
1 participant