Question: Altair: only show related field on hover, not all of them

This is a follow-up question to a previous (solved) question about Altair with the same toy dataset.
In the code below, we have a dataset that can be read as: "two cooks cook1, cook2 are doing a competition. They have to make four dishes, each time with two given ingredients ingredient1, ingredient2. A jury has scored the dishes and the grades are stored in _score.
My code is working well already:

on the y-axis the score is given, both for cook1 and cook2
in the legend, cook1 and cook2 are separate
a vertical line is drawn over the nearest x-axis item when hovering

I would like to make changes to the legend.
Now it shows the following properties:

dish (x-axis number)
ingredient 1, ingredient 2
cook1's dish, cook2's dish
score of the cook that we're hovering closest to
cookX_score (cook1_score, cook2_score) of the cook that we're hovering closest to

Instead, I would like to change it so that the dishes (cook1 and cook2) are not both shown but that, just like with score, only the respective dish is included. So if I hover closer to a point of cook1_score I only want to show cook1 and not also cook2.
My attempts to restrict this have failed, but the reason is simply because Altair does not know that cook1 and cook1_score, and cook2 and cook2_score are linked. But I am not sure how I can tell Altair that so that it only shows the relevant fields when hovering close to a point.
import altair as alt
import pandas as pd

alt.renderers.enable("altair_viewer")
df = pd.DataFrame({
    "ingredient1": ["potato", "onion", "carrot", "beet"],
    "ingredient2": ["tomato", "pepper", "zucchini", "lettuce"],
    "dish": [1, 2, 3, 4],
    "cook1": ["cook1 dish1", "cook1 dish2", "cook1 dish3", "cook1 dish4"],
    "cook1_score": [0.4, 0.3, 0.7, 0.9],
    "cook2": ["cook2 dish1", "cook2 dish2", "cook2 dish3", "cook2 dish4"],
    "cook2_score": [0.6, 0.2, 0.5, 0.6],
})


value_vars = [c for c in df.columns if c.endswith("_score")]
cook_names = [c.replace("_score", "") for c in value_vars]
id_vars = ["dish", "ingredient1", "ingredient2"] + cook_names
df_melt = df.melt(id_vars=id_vars, value_vars=value_vars, var_name="cook", value_name="score")

nearest_dish = alt.selection(type="single", nearest=True, on="mouseover", fields=["dish"], empty="none")

# Main chart with marked circles
chart = alt.Chart(df_melt).mark_circle().encode(
    x="dish:O",
    y="score:Q",
    color="cook:N",
    tooltip=id_vars + ["score", "cook"]
).add_selection(
    nearest_dish
)

# Draw a vertical rule at the location of the selection
vertical_line = alt.Chart(df_melt).mark_rule(color="gray").encode(
    x="dish:O",
).transform_filter(
    nearest_dish
)

# Combine the chart and vertical_line
layer = alt.layer(
    chart, vertical_line
).properties(
    width=600, height=300
).interactive()

layer.show()

Note: I'm stuck on Altair<5.


Answer:
I ended up modifying my DataFrame so that every row contains the dish name and the scores separately as well. That way I could target those items within the tooltip.
import altair as alt
import pandas as pd

alt.renderers.enable("altair_viewer")
df = pd.DataFrame({
    "ingredient1": ["potato", "onion", "carrot", "beet"],
    "ingredient2": ["tomato", "pepper", "zucchini", "lettuce"],
    "dish_id": [1, 2, 3, 4],
    "cook1": ["cook1 dish1", "cook1 dish2", "cook1 dish3", "cook1 dish4"],
    "cook1_score": [0.4, 0.3, 0.7, 0.9],
    "cook2": ["cook2 dish1", "cook2 dish2", "cook2 dish3", "cook2 dish4"],
    "cook2_score": [0.6, 0.2, 0.5, 0.6],
})


value_vars = [c for c in df.columns if c.endswith("_score")]
cook_names = [c.replace("_score", "") for c in value_vars]
id_vars = ["dish_id", "ingredient1", "ingredient2"] + cook_names
df_melt_score = df.melt(id_vars=["dish_id", "ingredient1", "ingredient2"], value_vars=value_vars, var_name="cook_score", value_name="score")
df_melt_score["cook"] = df_melt_score["cook_score"].str.replace("_score", "")
df_melt_score = df_melt_score.drop(columns=["cook_score"])
df_melt_dish = df.melt(id_vars=["dish_id", "ingredient1", "ingredient2"], value_vars=["cook1", "cook2"], var_name="cook", value_name="dish_name")

df_concat = pd.merge(df_melt_score, df_melt_dish, on=["dish_id", "cook", "ingredient1", "ingredient2"], how="left").reset_index()

nearest_dish = alt.selection(type="single", nearest=True, on="mouseover", fields=["dish_id"], empty="none")

# Main chart with marked circles
chart = alt.Chart(df_concat).mark_circle().encode(
    x="dish_id:O",
    y="score:Q",
    color="cook:N",
    tooltip=["dish_id", "ingredient1", "ingredient2", "cook", "dish_name"]
).add_selection(
    nearest_dish
)

# Draw a vertical rule at the location of the selection
vertical_line = alt.Chart(df_melt_score).mark_rule(color="gray").encode(
    x="dish_id:O",
).transform_filter(
    nearest_dish
)

# Combine the chart and vertical_line
layer = alt.layer(
    chart, vertical_line
).properties(
    width=600, height=300
).interactive()

layer.show()