Page MenuHomePhabricator

Allow users to identify mistakes/typos with ref tag arguments more easily
Closed, ResolvedPublic

Description

User story

As a user adding sub-references in wikitext I want to be informed about when there are mistakes in the syntax.

Context

Whenever there's an issue with unknown/misspelled attribute names in <ref> tags there is currently an error message that's implemented with the cite_error_ref_too_many_keys i18n key.

Current behavior (since T299280): Cite error: Invalid parameter in <ref> tag

In the context of Sub-referencing (product board) we expect the existing message to show up quite often when users make mistakes in the new details="…" attribute. The most obvious example is a missing "s" at the end of detail="…".

Suggestions:

  • Re-classify the message from a fatal to a warning. This makes sure the <ref> is rendered as normal and the error message is moved down to the reference list. Already done via https://gerrit.wikimedia.org/r/1142560.
  • Cite error: Invalid parameter "detail" in <ref> tag. Did you mean "details"? Proof of concept: https://gerrit.wikimedia.org/r/1126623
  • Cite error: Invalid <ref> tag; “detail” is not a supported attribute.
  • Cite error: Invalid <ref> tag; the supported attributes are: name, details, follow, …
  • …?

Open questions:

  • Is it technically possible to include the invalid attribute name? What if there is more than one?
    • Yes. We can show the first or a comma-separated list.
  • Is a special message for common typos like "detail" worth it?
    • Probably not. While technically possible it could cover only very few known typos.
  • Terminology should be consistent across messages. Should it be "attribute" or "parameter" or something else? WMDE-Design?

Outcome

image.png (960×209 px, 28 KB)

image.png (1,258×234 px, 34 KB)

Event Timeline

Change #1126623 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Cite@master] [WIP] Add parameter name to "invalid argument" error message

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

WMDE-Fisch renamed this task from Make confusing cite_error_ref_too_many_keys message more actionable to Allow users to identify mistakes/typos with ref tag arguments more easily.Mar 13 2025, 3:07 PM
WMDE-Fisch added a project: Story.
WMDE-Fisch updated the task description. (Show Details)

The prefered variant is: Cite error: Invalid <ref> tag; the supported attributes are: name, details, follow, group.

improvements can be done post MVP rollout.

@Lina_Farid_WMDE That sounds a bit like we would need to undo what we already achieved in the prove-of-concept patch 😅️ as well as reduce the clarity of the existing message. What about combining the ideas in something like Invalid parameter "xxx" in <ref> tag; the supported parameters are: name, details, follow, group.

@thiemowmde I am unsure what proof of concept you are refering to, as it has not been presented in any previous sprint reviews. I cannot make any assessment, at this stage other than the currently emmited message 'Cite error: Invalid parameter in <ref> tag' is unhelpful for the user to discern what error they made. Especially in the case of the details attribute, confusing it with 'detail' will presumably be a common thing.

@Lina_Farid_WMDE Sorry for the confusion. I don't think we have a format to present POC patches. The POC patch is mentioned in the task description and currently produces Cite error: Invalid parameter "detail" in <ref> tag. Did you mean "details"?

A slightly more advanced version of that POC patch could produce two error messages:

  • Cite error: Invalid parameter "detail" in <ref> tag. Did you mean "details"? in case there is really only a typo and the user input is very close to one of the allowed parameters.
  • Cite error: Invalid parameter "extras" in <ref> tag. The supported parameters are: details, follow, group, name. in case the user input is something completely different.

That's not much extra work. The necessary algorithm is already in the POC patch.

Thanks for the clarification @thiemowmde . I'd love to see the proof of concept in action. Let's take this into our storytime meeting next week.

Macro full-steam-ahead:

Change #1170113 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Cite@master] Add more comments to new Validator methods

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

Change #1170114 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Cite@master] Add new DataMwError conversion utility method

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

Change #1126623 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Add parameter name to "invalid argument" error message

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

Change #1170113 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Add more comments to new Validator methods

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

Change #1170114 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Add new DataMwError conversion utility method

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

Change #1171987 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: C. Scott Ananian):

[mediawiki/extensions/Cite@master] citeParserTests.txt: Add missing !! config declarations

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

Change #1171987 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] citeParserTests.txt: Add missing !! config declarations

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