Skip to content

Switch to using fmf.ContextDimension#4894

Draft
LecrisUT wants to merge 3 commits into
teemtee:mainfrom
LecrisUT:fmf/293
Draft

Switch to using fmf.ContextDimension#4894
LecrisUT wants to merge 3 commits into
teemtee:mainfrom
LecrisUT:fmf/293

Conversation

@LecrisUT
Copy link
Copy Markdown
Member

Depends-on teemtee/fmf#293

LecrisUT added 3 commits May 13, 2026 15:39
Signed-off-by: Cristian Le <git@lecris.dev>
Signed-off-by: Cristian Le <git@lecris.dev>
Signed-off-by: Cristian Le <git@lecris.dev>
@LecrisUT LecrisUT added status | blocked The merging of PR is blocked on some other issue area | context The context adjust implementation ci | full test Pull request is ready for the full test execution labels May 18, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a custom TmtContext to replace the standard fmf.context.Context, updating dependencies to fmf>=1.8.0 and adjusting various components to use the new implementation. Feedback focuses on ensuring the new context correctly inherits from DistroContext and maintains standard dimension matching logic. Specifically, TmtContextDimension should not redefine _registrar as it hides standard dimensions like arch and distro, and TmtContext should inherit from DistroContext to leverage distribution-aware logic. Additionally, the uv-pre-commit hooks should not be commented out, and the new context plugin registry requires proper integration with the fmf dimensions registrar to function.

Comment thread tmt/context/__init__.py
Comment on lines +21 to +23
class TmtContextDimension(ContextDimension[T], Generic[T]):
_default_dimension_cls = TmtDefaultContextDimension
_registrar = {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Defining _registrar = {} in TmtContextDimension hides all standard dimensions (e.g., arch, distro, os) registered in the base fmf.context.ContextDimension. This will cause TmtContext to lose special matching logic for these dimensions. Remove the explicit registrar definition to inherit the standard one.

Suggested change
class TmtContextDimension(ContextDimension[T], Generic[T]):
_default_dimension_cls = TmtDefaultContextDimension
_registrar = {}
class TmtContextDimension(ContextDimension[T], Generic[T]):
_default_dimension_cls = TmtDefaultContextDimension

Comment thread tmt/context/__init__.py
_registrar = {}


class TmtContext(Context):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Inherit TmtContext from DistroContext instead of Context to fulfill the pull request's objective of switching to the distribution-aware context.

Suggested change
class TmtContext(Context):
class TmtContext(DistroContext):

Copy link
Copy Markdown
Member Author

@LecrisUT LecrisUT May 19, 2026

Choose a reason for hiding this comment

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

One typo in the title and it thinks cows grow on trees 🙄

Comment thread .pre-commit-config.yaml
Comment on lines +257 to +269
# - repo: https://github.com/astral-sh/uv-pre-commit
# rev: 0.10.9
# hooks:
# # Keep pyproject.toml and uv.lock in sync
# - id: uv-lock
# # Keep pylock.toml in sync
# - id: uv-export
# args:
# - "--frozen"
# - "--format=pylock.toml"
# - "--output-file=pylock.toml"
# - "--all-extras"
# - "--quiet"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The uv-pre-commit hooks are commented out. Revert this change or remove the lines if they are no longer needed for the final implementation.

Comment thread tmt/context/__init__.py
@@ -0,0 +1,31 @@
from typing import Generic, TypeVar

from fmf.context import Context, ContextDimension, DefaultContextDimension
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Import DistroContext from fmf.context to align with the pull request title and leverage the new distribution-aware context logic introduced in fmf 1.8.0.

Suggested change
from fmf.context import Context, ContextDimension, DefaultContextDimension
from fmf.context import Context, ContextDimension, DefaultContextDimension, DistroContext

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

☝️ this is the kind of stuff I have to cope with weekly wit Gemini

Comment thread tmt/context/__init__.py
Comment on lines +30 to +31
_CONTEXT_REGISTRY = PluginRegistry('context')
provides_context = _CONTEXT_REGISTRY.create_decorator()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The _CONTEXT_REGISTRY and provides_context decorator are defined but not integrated with TmtContextDimension. Without a mechanism to register these plugins into the fmf dimensions registrar, context plugins will not be recognized during context evaluation.

@LecrisUT
Copy link
Copy Markdown
Member Author

/packit build

@LecrisUT LecrisUT changed the title Switch to using fmf.DistroContext Switch to using fmf.ContextDimension May 19, 2026
@happz happz added this to planning May 20, 2026
@happz happz moved this to implement in planning May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area | context The context adjust implementation ci | full test Pull request is ready for the full test execution status | blocked The merging of PR is blocked on some other issue

Projects

Status: implement

Development

Successfully merging this pull request may close these issues.

2 participants