Page MenuHomePhabricator

Default namespace for line numbering can not be unset
Closed, ResolvedPublic2 Estimated Story PointsBUG REPORT

Description

The setting used in $wgCodeMirrorLineNumberingNamespaces will not allow users to set an empty list or exclude the default. [ 10 ] will then always be part of the array when retrieved from the configuration. Except wgCodeMirrorLineNumberingNamespaces is set to null.

See T225753: Default configuration parameter settings get merged with new settings

First reported in https://www.mediawiki.org/wiki/Topic:Wenwtaeuex0xyuax

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
WMDE-Fisch set the point value for this task to 2.
WMDE-Fisch moved this task from Backlog to In sprint on the WMDE-Templates-FocusArea board.
thiemowmde subscribed.

extension.json supports a merge_strategy. They are not really described anywhere, unfortunately. It looks like we can't use any of them because they are all designed to work with keyed arrays (maps). The setting we talk about here isn't one.

I can see two ways forward:

  1. Change our default in extension.json from [ 10 ] to []. This means line numbering will be disabled in all namespaces by default. Warning: We must make a config change first so we don't loose the [ 10 ] setting we want on the Wikimedia cluster.
  2. Change the format from [ 10 ] to [ 10 => true ]. This (currently) does not need any other change on our cluster, but will potentially break 3rd-party users.

I believe #1 is the easier approach. While the format described in #2 would be nice, it's not easy to change now, and doesn't really have a benefit. When we simply turn off line numbering by default, there is never a reason to ever set it to false for any namespace.

  1. Change our default in extension.json from [ 10 ] to []. This means line numbering will be disabled in all namespaces by default. Warning: We must make a config change first so we don't loose the [ 10 ] setting we want on the Wikimedia cluster.

Lets just change the default. There is also no really good reason, why setting (only) the template namespace as default. This is more for convenience to our specific use case. The open question would be rather if null or [] should be the default. Hard to tell whats more desirable for 3rd parties. We only have that one report because disabling did not work. Enabling for every namespace always worked.

null means enabled by default everywhere. Do we want this for all 3rd-party users? I feel like it makes more sense to have it disabled by default, and then enable it per namespace.

null means enabled by default everywhere. Do we want this for all 3rd-party users? I feel like it makes more sense to have it disabled by default, and then enable it per namespace.

That's the question. :-D

Change 717192 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[operations/mediawiki-config@master] Set template namespace for code mirror line numbering

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

Change 717200 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/CodeMirror@master] Change line numbers default to null

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

FYI: We decided on defaulting to show line numbers in all namespaces of no configuration is provided. Setting [] well allow disabling the feature completely. Production configuration will be adjusted so that the current setting is preserved there.

When patches are merged we should update the extension help page as well.

WMDE-Fisch added a subscriber: awight.

@awight I'll assign you to manage the deployment beginning of next week ;-). I did not add it to the deployment calendar yet.

I'll deploy this on Wednesday, I have a schedule conflict today.

Change 719170 had a related patch set uploaded (by Awight; author: WMDE-Fisch):

[mediawiki/extensions/CodeMirror@wmf/1.37.0-wmf.21] Change line numbers default to null

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

Change 717192 merged by jenkins-bot:

[operations/mediawiki-config@master] Set template namespace for code mirror line numbering

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

Mentioned in SAL (#wikimedia-operations) [2021-09-07T11:28:43Z] <awight@deploy1002> Synchronized wmf-config/InitialiseSettings.php: Config: [[gerrit:717192|Set template namespace for code mirror line numbering (T290226)]] (duration: 00m 59s)

Change 719170 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@wmf/1.37.0-wmf.21] Change line numbers default to null

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

Mentioned in SAL (#wikimedia-operations) [2021-09-07T11:33:46Z] <awight@deploy1002> Synchronized php-1.37.0-wmf.21/extensions/CodeMirror/extension.json: Backport: [[gerrit:719170|Change line numbers default to null (T290226)]] (duration: 00m 59s)

The fix is deployed, I'll mention on the original topic.

Change 717200 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] Change line numbers default to null

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