Page MenuHomePhabricator

Discuss as a team how to approach PHP code generation
Closed, ResolvedPublic3 Estimated Story Points

Description

Volunteer contributor @Dogu has created a great proof-of-concept for generating Codex css-only component markup (see T372759 and https://gerrit.wikimedia.org/r/1058599 for more details). This work touches on a long-standing problem we've had for Codex usage in MediaWiki, namely: how do we want to approach markup-generation for CSS-only components (see T326850 for some background).

Providing some PHP classes in MediaWiki core could allow for developers to benefit from a more user-friendly way of using CSS-only Codex components (our current solution requires that anyone who wishes to use a CSS-only component must copy, paste, and potentially adapt the example markup we provide on our docs site).

However, if we decide to go down this route then we need to be clear about the potential maintenance burden and other requirements of such a solution. We'll need to ensure that the PHP code is updated in tandem with any major Codex markup changes, we may need to revisit some of our current thinking about backwards compatibility and what constitutes a breaking change, etc.

Acceptance Criteria

  • The DST engineers (along with any other relevant folks) have met to discuss how we want to move forward with this feature. We should consider the pros, cons, and other considerations (edge cases, etc) of a PHP-based markup generation system for Codex that lives in MW core.
  • The decision is recorded in a suitable format (possibly an ADR on the docs site) and published.

Event Timeline

egardner renamed this task from [placeholder] Discuss as a team how to approach PHP code generation to Discuss as a team how to approach PHP code generation.Aug 19 2024, 6:43 PM
egardner updated the task description. (Show Details)
egardner added a subscriber: Dogu.
This comment was removed by Dogu.
This comment was removed by Dogu.

One other consideration is testing: what tools do we have available to make sure the PHP-generated components look and behave correctly when changes to Codex are made "upstream"?

We should also discuss how, if at all, this can/should be reconciled with the work we did around CodexHTMLForm.

Hello everyone, I have developed a PHP library called wikimedia/codex that simplifies the creation of codex component markup directly in PHP. This library could be a useful tool for developers working with Codex in MediaWiki. I have also requested a Gerrit repository for this library: T373012. I want to share my work with the Codex team, so I requested the repository.

Update:
I also created this, https://gitlab.wikimedia.org/abaris/codex

Hi @CCiufo-WMF, I've been working on the PHP library for Codex and would love to be part of the discussion if that's okay. I think I could share some useful insights, but I'm also eager to learn from the team's perspective. If there's room for me to join the meeting, I'd be happy to contribute.

Change #1066904 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[design/codex@main] docs: Add ADR 11

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

Hi @CCiufo-WMF, I've been working on the PHP library for Codex and would love to be part of the discussion if that's okay. I think I could share some useful insights, but I'm also eager to learn from the team's perspective. If there's room for me to join the meeting, I'd be happy to contribute.

Hey @Dogu, @CCiufo-WMF will reach out to you some time soon and we'll see if we can find a good time to meet in the next week or two. We have some ideas about where this code could live (stand-alone library is good, maybe this should even be part of the Codex monorepo as a new dedicated workspace). I think we can have an initial discussion about how to proceed, and then we can find time for some dedicated code review.

Hi @egardner, Thanks for the update! I'm looking forward to hearing from @CCiufo-WMF.

Hi @egardner, Thanks for the update! I'm looking forward to hearing from @CCiufo-WMF.

@Dogu I sent you an email, let's coordinate a time there!

Change #1066904 merged by jenkins-bot:

[design/codex@main] docs: Add ADR 11

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

Change #1070656 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/core@master] Update Codex from v1.11.1 to v1.12.0

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

Test wiki created on Patch demo by EGardner (WMF) using patch(es) linked to this task:
http://patchdemo.wmcloud.org/wikis/6bc5837bc4/w/

Change #1070656 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v1.11.1 to v1.12.0

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