Skip to content

Add support for full recipe loading#4661

Merged
psss merged 7 commits intomainfrom
fvagner-full-recipe-loading
Apr 7, 2026
Merged

Add support for full recipe loading#4661
psss merged 7 commits intomainfrom
fvagner-full-recipe-loading

Conversation

@therazix
Copy link
Copy Markdown
Contributor

@therazix therazix commented Mar 9, 2026

This PR implements a full recipe loading feature. All phases can now be loaded directly from the recipe. Serialization and deserialization were replaced with to_spec/from_spec methods, and the generated recipe will now contain only non-empty values to reduce its size.

Resolves: #4531

Pull Request Checklist

  • implement the feature
  • write the documentation
  • extend the test coverage
  • update the specification
  • adjust plugin docstring
  • modify the json schema
  • mention the version
  • include a release note

@therazix therazix added this to the 1.69 milestone Mar 9, 2026
@therazix therazix added the area | recipe Related to the tmt recipe handling label Mar 9, 2026
@therazix therazix added this to planning Mar 9, 2026
@github-project-automation github-project-automation bot moved this to backlog in planning Mar 9, 2026
@therazix therazix moved this from backlog to implement in planning Mar 9, 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 implements full recipe loading, serializing the complete plan state into a recipe file to enable reproducible runs. A key change involves dynamically deriving the discover-phase attribute from test paths. However, a critical security vulnerability has been identified: the implementation of test path recreation in the discover step is susceptible to Path Traversal. The path attribute from the recipe is used to construct filesystem paths for directory creation without adequate sanitization, potentially allowing an attacker to create directories outside the intended workdir using .. sequences. This requires remediation by validating that the resulting paths do not escape the intended base directory. Additionally, there are a couple of suggestions to improve code robustness and clarity in tmt/recipe.py.

@thrix thrix self-requested a review March 9, 2026 19:09
@therazix therazix force-pushed the fvagner-full-recipe-loading branch from 3c63f94 to 18b7353 Compare March 9, 2026 22:04
@therazix therazix added the ci | full test Pull request is ready for the full test execution label Mar 9, 2026
Copy link
Copy Markdown
Contributor

@thrix thrix left a comment

Choose a reason for hiding this comment

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

The full recipe loading direction is good. Three findings, one requiring a change:

  1. Run.environment silently ignores CLI --environment when recipe is loaded - The recipe env unconditionally overrides CLI options. New --environment overrides on replay are silently lost. This should merge recipe env with CLI env, letting CLI take precedence.

  2. link field type mismatch after unserialization removal - Raw data stored where Links object is expected. Not an active runtime bug but incorrect typing that could break on re-serialization paths.

  3. Unrelated schema change - display-guest in report/display.yaml should be split out.

@skycastlelily
Copy link
Copy Markdown
Collaborator

Besides other comments, the code appears to assume the recipe file is well-formed, do you consider add some validation to the recipe file provided, say, a schema file?

@happz
Copy link
Copy Markdown
Contributor

happz commented Mar 10, 2026

@therazix please, set the "Size" of this PR.

Copy link
Copy Markdown
Contributor

@thrix thrix left a comment

Choose a reason for hiding this comment

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

Review: Add support for full recipe loading

Good progress on extending recipe loading from discover-only to all plan steps. The environment simplification and removal of discover_phase are clean.

Issues

Blocking:

  • CLI environment silently ignored (tmt/base/core.py): The early return bypasses _environment_from_cli, so --environment FOO=bar is silently dropped when using --recipe. See inline comment for suggested fix.

Latent bug:

  • _RecipeTest.link unserialization removed (tmt/recipe.py): Works today because all test links are [] (falsy short-circuit), but would AttributeError on any recipe with non-empty test links. See inline comment.

Hygiene:

  • Unrelated schema change (tmt/schemas/report/display.yaml): display-guest addition is not related to recipe loading — should be a separate commit/PR.
  • PR checklist: All items are unchecked — docs, spec, schema, version, release note still needed.

Verified non-issues

  • Path traversal in discover_from_recipe: The relative_to() + resolve() + parent check is sufficient. The gemini-code-assist security warning is overblown.
  • Removed "non-existent plan" test: Correct — with tree.children.clear(), the tree IS the recipe, so the old error case no longer applies.
  • Only saving _environment_from_fmf in _RecipePlan: Reasonable — _RecipeRun.environment captures the full merged env, and intrinsics should be regenerated per run.

Generated-by: Claude Code

@bajertom bajertom modified the milestones: 1.69, 1.70 Mar 12, 2026
@therazix therazix force-pushed the fvagner-full-recipe-loading branch from 18b7353 to 4201f23 Compare March 16, 2026 13:55
@therazix therazix force-pushed the fvagner-full-recipe-loading branch 3 times, most recently from 452c14b to 7165403 Compare March 17, 2026 11:54
@therazix therazix moved this from implement to review in planning Mar 17, 2026
@therazix therazix force-pushed the fvagner-full-recipe-loading branch from 7165403 to 8360382 Compare March 17, 2026 14:51
@therazix therazix force-pushed the fvagner-full-recipe-loading branch 2 times, most recently from 8810887 to 27d199a Compare March 17, 2026 18:06
@therazix therazix requested a review from lbrabec as a code owner March 17, 2026 18:06
@thrix
Copy link
Copy Markdown
Contributor

thrix commented Mar 17, 2026

@therazix would it be possible to provide a solid MR description for the changes, so it is easier to follow the changes, for example I am looking at this diff:

https://github.com/teemtee/tmt/pull/4661/changes#diff-f3bed0c5c8c7fcc2e8e296e3e85675c9c29c322c3a66f8def8f1d6d6d8dce260

And I would like to understand why this was changed, I would expect it would be mentioned that this is one of the improvements made to support full recipe loading ... (or something similar)

@therazix therazix force-pushed the fvagner-full-recipe-loading branch from d246817 to c5f0683 Compare March 24, 2026 17:31
@therazix therazix force-pushed the fvagner-full-recipe-loading branch 2 times, most recently from 611ed5d to 6cbd173 Compare March 26, 2026 08:59
@psss psss modified the milestones: 1.70, 1.71 Mar 27, 2026
@therazix therazix force-pushed the fvagner-full-recipe-loading branch from 6cbd173 to 3a5b24b Compare March 30, 2026 09:28
@happz happz force-pushed the fvagner-full-recipe-loading branch from 3a5b24b to ed6e5da Compare April 1, 2026 06:56
@happz
Copy link
Copy Markdown
Contributor

happz commented Apr 1, 2026

Eh, it's still far from satisfactory, but that's not @therazix's fault, it's just so complex field, with a tech debt of its own. Hopefully, this wouldn't be the last patch, and together with the transition of dataclass-based containers, a lot would clear up eventually.

@happz happz moved this from review to merge in planning Apr 1, 2026
@thrix thrix removed the request for review from lbrabec April 1, 2026 12:23
@thrix thrix force-pushed the fvagner-full-recipe-loading branch from ed6e5da to f09cb56 Compare April 1, 2026 12:23
@happz happz removed their assignment Apr 2, 2026
@psss psss force-pushed the fvagner-full-recipe-loading branch from f09cb56 to a08cbbf Compare April 2, 2026 11:42
@psss psss merged commit 710c85a into main Apr 7, 2026
33 checks passed
@psss psss deleted the fvagner-full-recipe-loading branch April 7, 2026 07:08
@github-project-automation github-project-automation bot moved this from merge to done in planning Apr 7, 2026
thrix added a commit that referenced this pull request Apr 8, 2026
Release notes for the following user-facing changes:

- Full recipe loading support (#4661)
- Artifact plugin lists packages in `artifacts.yaml` (#4703)
- Auto-verify artifact packages against `require`/`recommend` (#4726)
- Fix beakerlib library cache in `tmt try` (#4759)

Assisted-by: Claude Code
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
@thrix thrix mentioned this pull request Apr 8, 2026
18 tasks
thrix added a commit that referenced this pull request Apr 8, 2026
Release notes for the following user-facing changes:

- Full recipe loading support (#4661)
- Artifact plugin lists packages in `artifacts.yaml` (#4703)
- Auto-verify artifact packages against `require`/`recommend` (#4726)
- Fix beakerlib library cache in `tmt try` (#4759)

Assisted-by: Claude Code
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
thrix added a commit that referenced this pull request Apr 8, 2026
Release notes for the following user-facing changes:

- Full recipe loading support (#4661)
- Artifact plugin lists packages in `artifacts.yaml` (#4703)
- Auto-verify artifact packages against `require`/`recommend` (#4726)
- Fix beakerlib library cache in `tmt try` (#4759)

Assisted-by: Claude Code
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area | recipe Related to the tmt recipe handling ci | full test Pull request is ready for the full test execution

Projects

Status: done

Development

Successfully merging this pull request may close these issues.

Implement full loading of the recipe

7 participants