Page MenuHomePhabricator

Wikidata components behave weirdly when given argument reference or function call
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:
You see the lexeme icon and nothing else. If you try to edit. You see a select lexeme input until you expand

What should have happened instead?:
It should indicate that the Lexeme is being fetched from an argument reference, and not show the select lexeme input before you expand if it is not a literal Lexeme.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

Weird things also happen with the Lexeme/Item selector elsewhere on Wikifunctions.

Feeglgeef renamed this task from Wikidata Lexeme GUI behaves weirdly when given argument reference. to Wikidata components behave weirdly when given argument reference or function call.Feb 25 2025, 4:41 PM
Feeglgeef added a subscriber: DVrandecic.

Change #1212594 had a related patch set uploaded (by Genoveva Galarza; author: Genoveva Galarza):

[mediawiki/extensions/WikiLambda@master] Handle Wikidata entities with empty, non-valid and non-terminal IDs

https://gerrit.wikimedia.org/r/1212594

For manual testing (read/write, out of composition context), use:

{
    "Z1K1": "Z2",
    "Z2K1": {
        "Z1K1": "Z6",
        "Z6K1": "Z0"
    },
    "Z2K2": [
        "Z1",
        "✨ Wikidata Items (terminal)",
        {
            "Z1K1": "Z6091",
            "Z6091K1": "Q104587954"
        },
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6821",
            "Z6821K1": {
                "Z1K1": "Z6091",
                "Z6091K1": "Q104587954"
            }
        },
        "💎 Wikidata Items (empty)",
        {
            "Z1K1": "Z6091",
            "Z6091K1": ""
        },
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6821",
            "Z6821K1": {
                "Z1K1": "Z6091",
                "Z6091K1": ""
            }
        },
        "🐸 Wikidata Items (unknown)",
        {
            "Z1K1": "Z6091",
            "Z6091K1": "somebadstuff"
        },
        {
            "Z1K1": "Z6091",
            "Z6091K1": "Q987654321"
        },
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6821",
            "Z6821K1": {
                "Z1K1": "Z6091",
                "Z6091K1": "Q0"
            }
        },
        "⛔ Wikidata Items (non-terminal)",
        {
            "Z1K1": "Z6091",
            "Z6091K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z801",
                "Z801K1": "Q104587954"
            }
        },
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6821",
            "Z6821K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z801",
                "Z801K1": {
                    "Z1K1": "Z6091",
                    "Z6091K1": "Q104587954"
                }
            }
        },
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6821",
            "Z6821K1": {
                "Z1K1": "Z6091",
                "Z6091K1": {
                    "Z1K1": "Z7",
                    "Z7K1": "Z801",
                    "Z801K1": "Q104587954"
                }
            }
        },
        "✨ Wikidata Lexemes (terminal)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6825",
            "Z6825K1": {
                "Z1K1": "Z6095",
                "Z6095K1": "L1122"
            }
        },
        {
            "Z1K1": "Z6095",
            "Z6095K1": "L1122"
        },
        "💎 Wikidata Lexemes (empty)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6825",
            "Z6825K1": {
                "Z1K1": "Z6095",
                "Z6095K1": ""
            }
        },
        {
            "Z1K1": "Z6095",
            "Z6095K1": ""
        },
        "🐸 Wikidata Lexemes (unknown)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6825",
            "Z6825K1": {
                "Z1K1": "Z6095",
                "Z6095K1": "pangolins?redirect=http://example.com"
            }
        },
        {
            "Z1K1": "Z6095",
            "Z6095K1": "L0"
        },
        {
            "Z1K1": "Z6095",
            "Z6095K1": "L1-F3"
        },
        "⛔ Wikidata Lexemes (non-terminal)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6825",
            "Z6825K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z801",
                "Z801K1": {
                    "Z1K1": "Z6095",
                    "Z6095K1": "L1122"
                }
            }
        },
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6825",
            "Z6825K1": {
                "Z1K1": "Z6095",
                "Z6095K1": {
                    "Z1K1": "Z7",
                    "Z7K1": "Z801",
                    "Z801K1": "L1122"
                }
            }
        },
        {
            "Z1K1": "Z6095",
            "Z6095K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z10000",
                "Z10000K1": "L",
                "Z10000K2": "1122"
            }
        },
        "✨ Wikidata Properties (terminal)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6822",
            "Z6822K1": {
                "Z1K1": "Z6092",
                "Z6092K1": "P31"
            }
        },
        {
            "Z1K1": "Z6092",
            "Z6092K1": "P31"
        },
        "💎 Wikidata Properties (empty)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6822",
            "Z6822K1": {
                "Z1K1": "Z6092",
                "Z6092K1": ""
            }
        },
        {
            "Z1K1": "Z6092",
            "Z6092K1": ""
        },
        "🐸 Wikidata Properties (unknown)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6822",
            "Z6822K1": {
                "Z1K1": "Z6092",
                "Z6092K1": "P31?uselang=es"
            }
        },
        {
            "Z1K1": "Z6092",
            "Z6092K1": "badproperty"
        },
        "⛔ Wikidata Properties (non-terminal)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6822",
            "Z6822K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z29727",
                "Z29727K1": "P31"
            }
        },
        {
            "Z1K1": "Z6092",
            "Z6092K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z811",
                "Z811K1": [
                    "Z1",
                    "P31",
                    "P32"
                ]
            }
        },
        "✨ Wikidata Lexeme Forms (terminal)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6824",
            "Z6824K1": {
                "Z1K1": "Z6094",
                "Z6094K1": "L333333-F3"
            }
        },
        {
            "Z1K1": "Z6094",
            "Z6094K1": "L333333-F3"
        },
        "💎 Wikidata Lexeme Forms (empty)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6824",
            "Z6824K1": {
                "Z1K1": "Z6094",
                "Z6094K1": ""
            }
        },
        {
            "Z1K1": "Z6094",
            "Z6094K1": ""
        },
        "🐸 Wikidata Lexeme Forms (unknown)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6824",
            "Z6824K1": {
                "Z1K1": "Z6094",
                "Z6094K1": "F3-L2"
            }
        },
        {
            "Z1K1": "Z6094",
            "Z6094K1": "badlexeme"
        },
        "⛔ Wikidata Lexeme Forms (non terminal)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6824",
            "Z6824K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z801",
                "Z801K1": {
                    "Z1K1": "Z6094",
                    "Z6094K1": "L333333-F3"
                }
            }
        },
        {
            "Z1K1": "Z6094",
            "Z6094K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z15175",
                "Z15175K1": "L333333",
                "Z15175K2": "F3",
                "Z15175K3": "-"
            }
        },
        "✨ Wikidata Lexeme Senses (terminal)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6826",
            "Z6826K1": {
                "Z1K1": "Z6096",
                "Z6096K1": "L1122-S1"
            }
        },
        {
            "Z1K1": "Z6096",
            "Z6096K1": "L1122-S1"
        },
        "💎 Wikidata Lexeme Senses (empty)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6826",
            "Z6826K1": {
                "Z1K1": "Z6096",
                "Z6096K1": ""
            }
        },
        {
            "Z1K1": "Z6096",
            "Z6096K1": ""
        },
        "🐸 Wikidata Lexeme Senses (empty)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6826",
            "Z6826K1": {
                "Z1K1": "Z6096",
                "Z6096K1": "this is bad and dangerous?redirect=http://example.data"
            }
        },
        {
            "Z1K1": "Z6096",
            "Z6096K1": "Q123"
        },
        "⛔ Wikidata Lexeme Senses (non-terminal)",
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6826",
            "Z6826K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z801",
                "Z801K1": {
                    "Z1K1": "Z6096",
                    "Z6096K1": "L1122-S1"
                }
            }
        },
        {
            "Z1K1": "Z7",
            "Z7K1": "Z6826",
            "Z6826K1": {
                "Z1K1": "Z6096",
                "Z6096K1": {
                    "Z1K1": "Z7",
                    "Z7K1": "Z801",
                    "Z801K1": "L1122-S1"
                }
            }
        },
        "✨ Wikidata Statements (terminal)",
        {
            "Z1K1": "Z6003",
            "Z6003K1": {
                "Z1K1": "Z7",
                "Z7K1": "Z6821",
                "Z6821K1": {
                    "Z1K1": "Z6091",
                    "Z6091K1": "Q5414"
                }
            },
            "Z6003K2": {
                "Z1K1": "Z6092",
                "Z6092K1": "P4743"
            },
            "Z6003K3": {
                "Z1K1": "Z7",
                "Z7K1": "Z6821",
                "Z6821K1": {
                    "Z1K1": "Z6091",
                    "Z6091K1": "Q144"
                }
            },
            "Z6003K4": {
                "Z1K1": "Z9",
                "Z9K1": ""
            },
            "Z6003K5": [
                "Z6007"
            ],
            "Z6003K6": [
                "Z6008"
            ],
            "Z6003K7": {
                "Z1K1": "Z9",
                "Z9K1": ""
            }
        },
        "💎 Wikidata Statements (empty)",
        {
            "Z1K1": "Z6003",
            "Z6003K1": {
                "Z1K1": "Z6091",
                "Z6091K1": ""
            },
            "Z6003K2": {
                "Z1K1": "Z6092",
                "Z6092K1": ""
            },
            "Z6003K3": {
                "Z1K1": "Z6091",
                "Z6091K1": ""
            },
            "Z6003K4": {
                "Z1K1": "Z9",
                "Z9K1": ""
            },
            "Z6003K5": [
                "Z6007"
            ],
            "Z6003K6": [
                "Z6008"
            ],
            "Z6003K7": {
                "Z1K1": "Z9",
                "Z9K1": ""
            }
        },
        "⛔ Wikidata Statements (non-terminal)",
        {
            "Z1K1": "Z6003",
            "Z6003K1": {
                "Z1K1": "Z6091",
                "Z6091K1": {
                    "Z1K1": "Z7",
                    "Z7K1": "Z801",
                    "Z801K1": "Q5414"
                }
            },
            "Z6003K2": {
                "Z1K1": "Z7",
                "Z7K1": "Z29727",
                "Z29727K1": "P4743"
            },
            "Z6003K3": {
                "Z1K1": "Z7",
                "Z7K1": "Z24868",
                "Z24868K1": [
                    "Z6001",
                    {
                        "Z1K1": "Z7",
                        "Z7K1": "Z6821",
                        "Z6821K1": {
                            "Z1K1": "Z6091",
                            "Z6091K1": "Q144"
                        }
                    },
                    {
                        "Z1K1": "Z7",
                        "Z7K1": "Z6821",
                        "Z6821K1": {
                            "Z1K1": "Z6091",
                            "Z6091K1": "Q7377"
                        }
                    }
                ],
                "Z24868K2": {
                    "Z1K1": "Z13518",
                    "Z13518K1": "2"
                }
            },
            "Z6003K4": {
                "Z1K1": "Z9",
                "Z9K1": ""
            },
            "Z6003K5": [
                "Z6007"
            ],
            "Z6003K6": [
                "Z6008"
            ],
            "Z6003K7": {
                "Z1K1": "Z9",
                "Z9K1": ""
            }
        }
    ],
    "Z2K3": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "list of red/empty wikidata objects"
            }
        ]
    }
}

For manual testing (read/write, inside a composition), use:

{
    "Z1K1": "Z2",
    "Z2K1": {
        "Z1K1": "Z6",
        "Z6K1": "Z0"
    },
    "Z2K2": {
        "Z1K1": "Z14",
        "Z14K1": "Z10119",
        "Z14K2": {
            "Z1K1": "Z7",
            "Z7K1": "Z21394",
            "Z21394K1": [
                "Z6",
                "Valid, terminal and non-empty Wikidata item",
                {
                    "Z1K1": "Z7",
                    "Z7K1": "Z23468",
                    "Z23468K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z6821",
                        "Z6821K1": {
                            "Z1K1": "Z6091",
                            "Z6091K1": "Q144"
                        }
                    },
                    "Z23468K2": "Z1002"
                },
                "Non-terminal Wikidata items",
                {
                    "Z1K1": "Z7",
                    "Z7K1": "Z23468",
                    "Z23468K1": {
                        "Z1K1": "Z18",
                        "Z18K1": "Z10119K1"
                    },
                    "Z23468K2": "Z1002"
                },
                {
                    "Z1K1": "Z7",
                    "Z7K1": "Z23468",
                    "Z23468K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z6821",
                        "Z6821K1": {
                            "Z1K1": "Z18",
                            "Z18K1": "Z10119K1"
                        }
                    },
                    "Z23468K2": "Z1002"
                },
                {
                    "Z1K1": "Z7",
                    "Z7K1": "Z23468",
                    "Z23468K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z801",
                        "Z801K1": {
                            "Z1K1": "Z7",
                            "Z7K1": "Z6821",
                            "Z6821K1": {
                                "Z1K1": "Z6091",
                                "Z6091K1": "Q144"
                            }
                        }
                    },
                    "Z23468K2": "Z1002"
                },
                {
                    "Z1K1": "Z7",
                    "Z7K1": "Z23468",
                    "Z23468K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z6821",
                        "Z6821K1": {
                            "Z1K1": "Z7",
                            "Z7K1": "Z801",
                            "Z801K1": {
                                "Z1K1": "Z6091",
                                "Z6091K1": "Q144"
                            }
                        }
                    },
                    "Z23468K2": "Z1002"
                },
                {
                    "Z1K1": "Z7",
                    "Z7K1": "Z23468",
                    "Z23468K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z6821",
                        "Z6821K1": {
                            "Z1K1": "Z6091",
                            "Z6091K1": {
                                "Z1K1": "Z18",
                                "Z18K1": "Z10119K1"
                            }
                        }
                    },
                    "Z23468K2": "Z1002"
                },
                {
                    "Z1K1": "Z7",
                    "Z7K1": "Z23468",
                    "Z23468K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z6821",
                        "Z6821K1": {
                            "Z1K1": "Z7",
                            "Z7K1": "Z801",
                            "Z801K1": {
                                "Z1K1": "Z6091",
                                "Z6091K1": "Q144"
                            }
                        }
                    },
                    "Z23468K2": "Z1002"
                },
                "Empty Wikidata items",
                {
                    "Z1K1": "Z7",
                    "Z7K1": "Z23468",
                    "Z23468K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z6821",
                        "Z6821K1": {
                            "Z1K1": "Z6091",
                            "Z6091K1": ""
                        }
                    },
                    "Z23468K2": "Z1002"
                },
                {
                    "Z1K1": "Z7",
                    "Z7K1": "Z23468",
                    "Z23468K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z6821",
                        "Z6821K1": {
                            "Z1K1": "Z6091",
                            "Z6091K1": ""
                        }
                    },
                    "Z23468K2": {
                        "Z1K1": "Z9",
                        "Z9K1": ""
                    }
                },
                "Non valid Wikidata items",
                {
                    "Z1K1": "Z7",
                    "Z7K1": "Z23468",
                    "Z23468K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z6821",
                        "Z6821K1": {
                            "Z1K1": "Z6091",
                            "Z6091K1": "bad QID"
                        }
                    },
                    "Z23468K2": "Z1002"
                },
                {
                    "Z1K1": "Z7",
                    "Z7K1": "Z23468",
                    "Z23468K1": {
                        "Z1K1": "Z7",
                        "Z7K1": "Z6821",
                        "Z6821K1": {
                            "Z1K1": "Z6091",
                            "Z6091K1": "bad QID"
                        }
                    },
                    "Z23468K2": "Z1002"
                }
            ]
        }
    },
    "Z2K3": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "composition with red/empty wikidata objects"
            }
        ]
    }
}

some examples:

beforeafter
collapsed composition
Screenshot from 2025-11-28 17-24-17.png (1,027×463 px, 87 KB)
Screenshot from 2025-11-28 17-23-20.png (1,026×482 px, 99 KB)
expanded composition
Screenshot from 2025-11-28 17-24-28.png (993×819 px, 97 KB)
Screenshot from 2025-11-28 17-23-09.png (991×819 px, 108 KB)
empty wikidata entities
Screenshot from 2025-11-28 17-29-31.png (297×131 px, 4 KB)
empty field
Screenshot from 2025-11-28 17-29-44.png (362×135 px, 7 KB)
signaling empty value
non-valid IDs
Screenshot from 2025-11-28 17-30-02.png (412×168 px, 10 KB)
invalid links
Screenshot from 2025-11-28 17-29-56.png (415×173 px, 10 KB)
no invalid links
non-terminal items
Screenshot from 2025-11-28 17-33-45.png (392×173 px, 5 KB)
Screenshot from 2025-11-28 17-33-49.png (655×163 px, 23 KB)
non-terminal properties
Screenshot from 2025-11-28 17-34-44.png (451×136 px, 5 KB)
Screenshot from 2025-11-28 17-34-49.png (673×133 px, 20 KB)

Change #1212594 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Handle Wikidata entities with empty, non-valid and non-terminal IDs

https://gerrit.wikimedia.org/r/1212594