Page MenuHomePhabricator

Value by key function Z803 fails for Key reference "Z1K1" on objects with some supported types (Z6, Z20, ?Z13518)
Open, MediumPublicBUG REPORT

Description

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

  • Go to https://www.wikifunctions.org/view/en/Z803
  • In the Try this function box, enter Z1K1 as the “reference” under “key” (you may need to fiddle with “key” to get the “reference” box to appear T360580)
  • In “type” under “object”, select “String”
  • In the (literal string) “object” box, enter a string (or not)
  • Click Run function

What happens?:
The result is Void. Click “Errors” to see the error(s): “Call tuples failed in returnOnFirstError. Error: TypeError: responseEnvelope.Z22K1.asJSON is not a function.”

What should have happened instead?:

The value associated with the Z1K1 key should have been returned ("Z6", interpreted (for consistency, see below) as a reference to the String type).

(Alternatively, a meaningful error result should have been returned.)

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

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

Behaviour for other objects is not entirely consistent.

  • ✅ For Z41 and Z42 a reference to Boolean ("Z40") is displayed.
  • 🤷‍♂️ For a Natural number, a full Type is displayed, rather than (a link to) Z13518 [edit: this seems to apply to all Types added since Z13518 but the expanded Type is observably not the value in the Z1K1 key of identity objects like Z16101, so this is wrong, in my opinion.]
  • ✅ For a Typed list, the (generic type) function call is displayed [edit: I think I must have been mistaken here. For a Typed list, the fully expanded Type is displayed (including, in its identity key, the Z881 function call, where the list’s Type is an unexpanded Reference).]
  • 🤷‍♂️ For a Function call, the displayed result follows from the type of the call’s evaluation (although the error in Z866 is “Call tuples failed in returnOnFirstError. Error: TypeError: Z1.getNameEphemeral is not a function.“) [edit: in particular, this means that a function returning a Type object will return an expanded Type rather than a Reference (unless it’s a pre-Z13518 Type). (See, for example, Z18628, where attempting to extract the Type (Reference) from a Typed list’s identity key will return a fully expanded Type even when the Z4K1 from the Z4K1 is specified.)]
  • ✅ For types (generally), the displayed result is (a link to) Z4
  • ❌ For Z20s, the result is a “Key not found” error, rather than (a link to) Z20

(This is not an exhaustive list.)

Where the value in the key–value pair is a string/reference we should consider displaying the result as a literal as well as a reference (the value in the object’s specified key being a string and the reference being an interpretation of that string).

Please also see https://www.wikifunctions.org/view/en/Z15781. This may be a separate bug, but the test shows as “Passed”, with Details being:
Reached time limit in orchestrator
Error type: Reached time limit in orchestrator

Editing the source, it seems always to produce this result for the Z4K1 of Natural number so long as the Key reference is either "Z1K1" or "Z6K1". This suggests that the initial (Z4K1) call to Z803 is returning a String object and the second call is timing out. However, trying Z803 with Z4K1 on Z13518 currently times out (as it sometimes does with Z1K1), with Errors viewable. [edit: This no longer times out and will return a Reference to Z13518 if the Z4K1 of the Z1K1 of a Natural number is requested (as well as if the Z4K1 of Z13518 is requested) ✅🤔 This is good but inconsistent with the behaviour of Z18628 described above. Running Z803 in Try this function returns a Reference rather than a fully expanded Type:

IMG_1025.png (2×960 px, 211 KB)
but a recursive implementation of Z18628 that wraps the function with a further Z803 call still returns a fully expanded Type:
IMG_1026.png (2×960 px, 185 KB)
.]

Event Timeline

Good idea, thanks. I made:
*https://www.wikifunctions.org/view/en/Z15903 for a Boolean (passes)
*https://www.wikifunctions.org/view/en/Z15904 for a Natural number (fails: Z507 in result validation using Z13052/object equality). I was assuming that a reference was being returned and then expanded but I have a hunch that Natural number types are expanded before Z803 is executed and Z803 is simply returning the type object that it finds associated with the Z1K1. Given the apparent performance overhead with expanded types (if my hunch is correct), I think it might be better to continue with the “inconsistency”. Attempting to extract the Z4K1 from the Z1K1 of a Natural number currently times out, however (Z574), so I have left the test case failing (and consistent).
*https://www.wikifunctions.org/view/en/Z15905 for a test case (fails: Z507 with Z511 in Z507K2 in actual result)

This comment was removed by GrounderUK.

All result validations of test cases are missing the first argument as that argument is filled in by the testing system. It looks like it is trying to evaluate that function call and is failing as it is incomplete.

According to these two tests, https://www.wikifunctions.org/view/en/Z16849 and https://www.wikifunctions.org/view/en/Z16852 it looks like the function calls are being evaluated when they are not suppose to be

More generally, Z903 fails for any Z6/string, so "Z6K1" is also unavailable.

The error returned is now a Z507/Error in evaluation.

Should this be split off as a separate Bug report?