Skip to content

fix: rename cache key for tree details builds to avoid key collision#1849

Merged
gustavobtflores merged 1 commit intokernelci:mainfrom
gustavobtflores:fix/tree-details-cache-key-collision
Apr 13, 2026
Merged

fix: rename cache key for tree details builds to avoid key collision#1849
gustavobtflores merged 1 commit intokernelci:mainfrom
gustavobtflores:fix/tree-details-cache-key-collision

Conversation

@gustavobtflores
Copy link
Copy Markdown
Contributor

Description

Fixes a cache key collision between get_tree_details_builds and get_tree_data(data_type="builds"). Both functions used the identical cache key "treeDetailsBuilds", causing the summary endpoint to populate the cache with dict rows. When the builds endpoint subsequently accessed that cache, get_tree_data tried to read those dicts as tuples via positional indexing row[0], triggering KeyError: 0.

Changes

  • Renamed get_tree_details_builds cache key from "treeDetailsBuilds" to "treeDetailsBuildsDirect" to avoid collision with get_tree_data

@gustavobtflores gustavobtflores self-assigned this Apr 10, 2026
@gustavobtflores gustavobtflores added the bug Something isn't working label Apr 10, 2026
Fetch builds for a given tree commit.
"""
cache_key = "treeDetailsBuilds"
cache_key = "treeDetailsBuildsDirect"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

since direct already has some meaning in the sense of "the endpoints that don't require all the tree information", I would say it's better to rename treeDetails[type] to treeData[type] or treeDetais[type]Data, which would also reflect the function name

@gustavobtflores gustavobtflores force-pushed the fix/tree-details-cache-key-collision branch from f18075a to 9e3cac8 Compare April 13, 2026 12:32
Copy link
Copy Markdown
Collaborator

@MarceloRobert MarceloRobert left a comment

Choose a reason for hiding this comment

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

I was thinking about changing the cache_key of the other function, but this works too. LGTM

@gustavobtflores gustavobtflores added this pull request to the merge queue Apr 13, 2026
Merged via the queue into kernelci:main with commit 9af36b8 Apr 13, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants