Description
Implement in ClientHook and FunctionCallHandler the solution for default value replacement decided in T391019: [Spike] Decide whether to set the date default value in ClientHook or in FunctionCallHandler
Acceptance criteria
- Functions which take Gregorian calendar date input types should successfully run when called with empty values
- An input with an empty value should be interpreted as today's date in the client wiki locale.
(see testing wikitext at the bottom)
Implementation details
According to the decisions made for spike T391019: [Spike] Decide whether to set the date default value in ClientHook or in FunctionCallHandler:
We set default values in the client:
- If we don't encounter any empty argument, we go as normally (zero fetches)
- If we encounter at least one empty argument, we do:
- fetch function from cache
- or, if cache miss, fetch from wikilambda_fetch
- get empty argument type
- see if there's any default value callback for this type
- if there is, generate default value and set instead of empty argument
- we use the final function call to generate the WikiLambdaClientFunctionCall cache key
- we proceed normally (check cache, else run WikifunctionsClientRequestJob asynchronously, etc.
Testing Wikitext
== Default Values (T391021) ==
Age:
{{#function:Z20756|31-05-1985|06-05-2025}}
Age with default value:
{{#function:Z20756|31-05-1985|}}
Years to Connect:
{{#function:Z20756|06-05-2025|01-09-2026}}
Years to Connect with default value:
{{#function:Z20756||01-09-2026}}
Distance to the moon today:
{{#function:Z20741|06-05-2025}}
Distance to the moon today with default values:
{{#function:Z20741|}}
Today's date:
{{#function:Z20788|06-05-2025}}
Today's date with default values:
{{#function:Z20788|}}
Fecha de hoy:
{{#function:Z20794|06-05-2025}}
Fecha de hoy with default values:
{{#function:Z20794|}}Completion checklist
- Before closing this task, review one by one the checklist available here: https://www.mediawiki.org/wiki/Abstract_Wikipedia_team/Definition_of_Done#Back-end_Task/Bug_completion_checklist