Page MenuHomePhabricator

Document how to safely make changes to ParserOutput serialization
Closed, ResolvedPublic

Description

When changing the content or structure of ParserOutput's serialization, both forward and backward compatibility must be ensured. SerializationTestTrait implements mechanisms for ensuring this, but the process needs documentation, especially for creating tests that ensure forward compatibility.

This doumentation needs to be linked in places that developers would typically touch when making the relevant changes, to allow it to be discovered naturally.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Krinkle subscribed.

I think this may've been mis-tagged because ParserCache falls under MW-Parser rather than MW-HTTP-Cache (which deals with CDN and wgFileCache). Feel free to re-tag if I misunderstood.

I think this may've been mis-tagged because ParserCache falls under MW-Parser rather than MW-HTTP-Cache (which deals with CDN and wgFileCache). Feel free to re-tag if I misunderstood.

No, you are right.

We need to clean up some of the ancient test case in SerializationTestUtils as well. It goes back to 1.35 and still uses PHP serialization. As far as I'm aware, the official upgrade procedure for mediawiki purges the cache anyway, so there shouldn't be any reason to test further back than (at most) the latest release. In actual practice, in production, the important thing is testing against "the last train" and "the next train".

(PHP serialization was *mostly* removed in 697f28df320d957676ad2cbaaeedba9b2e80bdfa but we still have lots of code left around from it.)

We should also add test cases that ensure aliases are properly handled; see T353883: JsonCodec should be robust against class aliases.