Fix wrong info being loaded into InstalledModule #6720

Merged
Jackenmen merged 2 commits from fix_wrong_info_for_installed_cogs into V3/develop 2026-05-24 20:55:15 +02:00
Jackenmen commented 2026-03-31 23:35:38 +02:00 (Migrated from github.com)

Description of the changes

This updates Downloader to load info.json from the install location for installed cogs/libs rather than the data from the currently checked commit in the repository.
This is necessary for the metadata to be accurate when trying to e.g. compare values before and after the update which we do for end user data statements, for example:
github.com/Cog-Creators/Red-DiscordBot@e868872214/redbot/cogs/downloader/downloader.py (L1643-L1645)

My belief is that the information about the EUD statement changes was broken since its introduction in #4169 as Downloader never used data from the installed info.json to begin with.
I should note that this probably did not affect people who only run:

  • the regular cog install and cog uninstall command
  • cog update without any arguments
  • cog updateallfromrepos

In such a case, the only time their repo would be updated is when all the cogs from it are also updated, meaning that the installed info.json data would always be consistent with the state of the repo. Notably, any use of repo update would obviously make that not true.

The best way to test this is to install a cog from some repo, then push an update to that cog's end user data statement and then run repo update first, followed by cog update cog_name.
Here's a reproduction example where I found existing cog where the end user data statement changed since:

repo add jack https://github.com/Jackenmen/JackCogs
cog installversion jack 7f4085fab53c77e9b049c13ada147576521f3675 linkwarner
cog unpin linkwarner
cog update linkwarner
Before image
After image

Have the changes in this PR been tested?

Yes

### Description of the changes This updates Downloader to load info.json from the install location for installed cogs/libs rather than the data from the currently checked commit in the repository. This is necessary for the metadata to be accurate when trying to e.g. compare values before and after the update which we do for end user data statements, for example: https://github.com/Cog-Creators/Red-DiscordBot/blob/e86887221416f686b7759b9c90cd8751cc71da07/redbot/cogs/downloader/downloader.py#L1643-L1645 My belief is that the information about the EUD statement changes was broken since its introduction in #4169 as Downloader never used data from the **installed** info.json to begin with. I should note that this probably did not affect people who only run: - the regular `cog install` and `cog uninstall` command - `cog update` without any arguments - `cog updateallfromrepos` In such a case, the only time their repo would be updated is when all the cogs from it are *also* updated, meaning that the installed `info.json` data would always be consistent with the state of the repo. Notably, any use of `repo update` would obviously make that not true. The best way to test this is to install a cog from some repo, then push an update to that cog's end user data statement and then run `repo update` first, followed by `cog update cog_name`. Here's a reproduction example where I found existing cog where the end user data statement changed since: ``` repo add jack https://github.com/Jackenmen/JackCogs cog installversion jack 7f4085fab53c77e9b049c13ada147576521f3675 linkwarner cog unpin linkwarner cog update linkwarner ``` <details> <summary>Before</summary> <img width="1751" height="636" alt="image" src="https://github.com/user-attachments/assets/656df268-31c0-424d-8ccc-4a88b9057f3c" /> </details> <details> <summary>After</summary> <img width="1760" height="850" alt="image" src="https://github.com/user-attachments/assets/5758580b-6af5-4a97-86a4-f385f70bd070" /> </details> ### Have the changes in this PR been tested? Yes
Flame442 (Migrated from github.com) approved these changes 2026-05-24 20:55:00 +02:00
Sign in to join this conversation.
No reviewers
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!6720
No description provided.