Dev Chat Agenda: August 7

It’s the last devchat of July, my friends! Here is the agenda for the weekly meeting a Wednesday, August 7, 20:00 UTC.

  • Announcements
  • Upcoming Release Discussions
    • 5.3 Planning and Updates
    • Minor planning
  • Calls from component maintainers
  • Open Floor

If you have anything to propose for the agenda or specific items related to those listed above, please leave a comment below.

This meeting is held in the #core channel in the Making WordPress Slack.

#5-3#agenda#devchat

Editor Chat Agenda: August 7th

Note taker: @mikeschroder

This is the agenda for the weekly editor chat scheduled for August 7, 2019 at 1300 UTC.

This meeting is held in the #core-editor channel in the Making WordPress Slack.

  • Tasks Coordination
  • Open Floor

Last week it was suggested to post items for Tasks Coordination as comments on posts so that it’s easier to follow for folks that can’t attend the regular meeting.

So, let’s give it a try! If you have anything to share for the Tasks Coordination section, please leave it as a comment on this post.

As always, if you have anything to propose for the agenda or other specific items related to those listed above, please leave a comment below.

#agenda, #core-editor, #editor-chat

#agenda, #core-editor, #editor-chat

Feature Project Proposal: WP Notify

This detailed proposal was originally drafted by @schlessera, who unfortunately does not have the resources to commit to executing the project. I am however thankful that he has agreed to assist, in an advisory role.

Introduction

WordPress is currently lacking a fundamental mechanism: sending notifications to users to give them feedback about state changes in the system. Traditionally, plugin developers and Core have been using admin notices for this purpose, but this solution is lackluster at best and comes with a lot of disadvantages:

  • They are rendered into the normal working area in the dashboard and can even push the actual page content below the fold.
  • The user has no control over how or when they want to deal with them, therefore they see them in a mostly negative fashion.
  • They are nothing more than printed HTML. Because they lack any kind of structure, it is not possible to manipulate them in an automated fashion.
  • Their persistence is not regulated, which leads to many different implementations as well as cruft in the database.

For the above reasons, there’s a general consensus that admin notice are not up to the task and need a more robust replacement that can deal with current and future notification needs.

I hereby want to officially kickstart a Feature Project called “WP Notify“.

Project Scope

The initial project will cover an extensible backend implementation as well as a single frontend use case.

A. Backend implementation

The backend implementation will cover the following elements:

  • An object model that is extensible as well as serializable (to JSON).
  • A persistence abstraction that comes with an initial WPDB implementation.
  • A background queue that processes notifications to distribute them across channels, for use cases where this is a costly operation, like sending them through email.
  • A simplified procedural API that allows for easy manipulations the way plugin developers are accustomed to.
  • REST API controllers that provide endpoints to manage the notification from the frontend.

B. Frontend use case

The frontend use case will cover the following elements:

  • An admin bar integration that shows notification state and opens a panel to read and dismiss current notifications.
  • An settings page that lets the user control which notifications to show/hide in the admin bar and which notifications to forward through email.

Technical Requirements

  • Objects must be serializable to JSON in such a way that it can be sent to the client, either as a localized JavaScript snippet or as a REST API response.
  • A notification can have one or more recipients, which can be users, roles or a mixture of both.
  • A recipient can configure the channel(s) they want to receive the notifications in, on a “per-group” basis.
  • Distribution across channels is not directly coupled to the frontend request, but works as a background queue.
  • The admin bar integration needs to build on top of the work done with Gutenberg and use a reactive interface powered by the REST API.

Some Clarifications

Did this just come out of the blue?

No, the need for a notification subsystem has been identified a long time ago. Current discussions have been centralized in the Trac ticket #43484.

Why does this document talk about a “single frontend use case”? Does the proposal not already cover everything anyway?

No, having a sort of “admin bar hub” to manage your notifications is indeed only one potential use of the the notifications subsystem. The way it is currently planned, it could easily have other use cases, like the following examples:

  • Forwarding notifications to a webhook, for integrations into third-party services like Slack
  • Providing a webhook to feed notifications from third-party services like GitHub into WordPress
  • Showing notifications in a management system like cPanel or ManageWP
  • Integrating notifications contextually into other parts of the admin experience in a targeted way
  • Providing a “feed” view/endpoint
  • Letting other servers or tools send notifications to WordPress users/roles over the REST API, like a cron job completing a shell maintenance task
  • Attaching server notification systems like notify-send or growl to your WordPress dashboard

Why have so many complex moving pieces? Isn’t this called over-engineering?

Complex solutions can easily be adapted to fit simpler needs, while the opposite is not true. As you can see with the current admin notices, a simplistic solution that tries to solve a complex problem causes more harm than good, as you cannot just get rid of inherent complexity. On the contrary, a solution that is not properly adapted will cause additional complexity just because of the amount of side-effects it will generate.

I am certain that building a notifications mechanism for an entire platform like WordPress that fits the entire spectrum of scenarios from simple blogs to enterprise-grade custom solutions is inherently complex. An abstraction allows us to put the main extensibility points in place to stay future-proof and then concentrate on the few basic implementations we need for 80% use cases… without having locked out developers with more exotic needs and while at the same time leaving the solution open to creative improvements in the future.

What is this “simplified procedural API” all about?

While building an extensible object model will allow us to extend the implementations in a safe way in the future, it also comes with more complex usage when interacted with directly.

That is why we should include a simplified procedural wrapper around the object model that mimics the way plugin & theme developers are used to work with WordPress.

As an example, instead of creating an instance of a factory first, to then retrieve a base notification with a simple message and a single recipient to it, we could have a simplified wrapper that looks like this:

// Create a new notification for the current user.
wp_notify( 'MyBackupPlugin', get_current_user_id(), 'Backup completed!' );

// Mark a specific notification as read.
get_notification( $notification_id )->mark_as_read();

These procedural functions come with a default setup that can be controlled via actions & filters.

Such a simplified layer allows us to have the best of both worlds: robust and extensible behind the scenes, and simple and intuitive facing the user.

So we’re building a complex object model and then wrap it with simplified functions. This is not how WordPress code is usually done…

Indeed. Given that this project is mostly isolated and can be approached in an unencumbered way, it offers the perfect opportunity to improve the general way WordPress Core code is done. It should demonstrate that it is possible to get the combined benefits of both an extensible object model that is robust to work with as well as an intuitive public-facing API that provides a low barrier of entry.

There is a lot of momentum right now on the WordPress Core developer front. But general coding conventions are still based in large parts on what we inherited from the project’s roots. This project can help define a new set of WordPress-specific coding patterns that are not tied to the compromised patterns we inherited from the PHP 4 era.

Yes, this is not how WordPress code is usually done … yet! But we can change that!

Wasn’t there a similar Feature Project already?

You’re referring to the post by John Blackbourn that he wrote in 2016. That project proposal never really got off the ground, and I got confirmation from John that it is abandoned and should hopefully be replaced, as the need for it is still there.

Call for Volunteers

If the above sounds like something you would like to contribute to, please either write a brief comment below this post, with the area you are interested in and the skills you can offer.

Alternatively, you can join the discussions on Slack in the #feature-notifications channel or on Trac ticket #43484.

This project covers a lot of different areas, like advanced backend code, scalable database gymnastics, reactive JavaScript code and dynamic UI/UX design.

All help is welcome, but please be aware that different topics will be in focus at different stages of the project.

Next Steps

There have already been a number of interested parties on the Trac ticket or in the #feature-notifications channel and I look forward to your feedback, comments and suggestions. By the 19th of August I plan to have an initial project kick off meeting scheduled, so that we can set up a plan of how best to move forward.

WordPress Local Environment

The e2e test infrastructure was recently introduced to WordPress Core, using Docker to create a local WordPress environment for running the tests.

Almost immediately, folks started trying to use it as a full local development environment, which is a pretty good indication that we should make that easier. 🙂 #47767 is a complete rebuild of the e2e environment, turning it into a dedicated development environment, that also happens to function as an e2e environment. 🎉

The Goal

As we discovered with the Gutenberg local environment, trying to make a shell script based do-it-all tool results in a sub-par experience for everyone. It’s difficult for such a tool to work well across all use cases: if it tries to handle common problems automatically, it will cause problems for regular contributors. If it does the bare minimum, it will be unusable for infrequent contributors. There doesn’t appear to be a happy middle ground.

As such, the idea with this new tool is to allow setting up a local development environment by running as few commands as possible, providing sensible defaults, but allowing as much customisation as possible. This gives a solid base for regular contributors to work from (particularly when testing against uncommon configurations), but also provides room for an external tool that provides new contributors with a seamless experience.

Infrastructure

In order to make this work as cleanly as possible, there are custom Docker images configured for running WordPress. They work for all versions of PHP from 5.2 to 7.3, allowing easy testing of different PHP versions. The image definitions are generated and committed to the wpdev-docker-images GitHub repository, they’re then built and deployed to Docker Hub by Travis.

These images aren’t intended for folks that wish to host Docker-based WordPress sites. Their primary focus is on creating a WordPress development environment.

Using

This tool currently isn’t optimised for inexperienced contributors. Setting it up and using it requires some familiarity with both Docker and the command line.

First off, you’ll need to install Docker.

You’ll also need a recent version of Node. We rarely bump the minimum version of Node required, so if you don’t have a particular need for switching Node versions, installing the latest LTS version is probably the easiest option.

Following that, you’ll need to run npm install to download some build tools that WordPress needs, then npm run env:start will start the server at http://localhost:8889. npm run env:install will set up a clean installation, with the user admin and the password password.

Congratulations! You can now work on WordPress! Here are some extra commands that will help you along the way:

npm run env:stop

If you prefer to stop your Docker containers when you’re not using them, this command will stop them. You can always restart them by running npm run env:start again.

npm run env:clean / npm run env:reset

These can be used to clean up your development environment if things aren’t working correctly. The former will delete the database and some temporary files, while the latter will remove all images, so the next time you run npm run env:start, they’ll be downloaded fresh.

npm run env:logs

Shows the logs server logs.

npm run env:cli

This will run WP-CLI. Where the WP-CLI documentation mentions running wp, run npm run env:cli instead. For example, npm run env:cli help.

npm run test:php / npm run test:e2e

These commands will run the PHPUnit and E2E test suites, respectively.

Configuring

You can also customise the development environment by setting particular environment variables before starting it. After changing any of these settings, you’ll need to run npm run env:stop then npm run env:start before they take effect.

Each OS has a slightly different way of setting environment variables. In these examples, substitute VARIABLE_NAME for the name of the setting you want to change, and value for the value you want to set it to.

Linux, macOS, and WSL: export VARIABLE_NAME=value
Windows (DOS/CMD.exe): SET VARIABLE_NAME=value
Windows (PowerShell): Set-Item Env:VARIABLE_NAME=value

LOCAL_PORT

Change the port number that the site will be available on. You’ll need to run npm run env:install after changing this.

LOCAL_DIR

Change whether the site runs from the src or build directory.

LOCAL_PHP

The PHP version to use when running the site. Valid options are ‘latest’, and ‘{version}-fpm’, where ‘{version}’ is any x.y PHP version from 5.2 onwards.

LOCAL_PHP_XDEBUG

Set to true or false to enable or disable the XDebug module in PHP.

LOCAL_MYSQL

The MySQL version to use. See https://hub.docker.com/_/mysql/ for valid versions. If you downgrade the MySQL version, you may need to run npm run env:clean to reset the MySQL data files.

LOCAL_WP_DEBUG / LOCAL_WP_DEBUG_LOG / LOCAL_WP_DEBUG_DISPLAY / LOCAL_SCRIPT_DEBUG

The debug settings to add to wp-config.php. Set to true or false to change their corresponding debug setting. If you already have a site up and running, it may be easier to just edit these in the wp-config.php file.

What’s Next?

Right now, this has only been committed to trunk. It can soak there for a bit, ensuring it works well for everyone.

Following that, it will be backported to all branches back to WordPress 3.7. Since this is the oldest version we still occasionally make releases for, there’s no value in porting it further back. Importantly, since the Security Team is evaluating ceasing backporting of security fixes to WordPress 3.7, it’s likely that we’ll need to be doing work on that branch to both inform and help site owners upgrade. Having a working development environment makes this a much less painful task.

I’ve been sporadically working on a tool called TestPress, which is intended to make the experience of contributing to WordPress as seamless as possible, particularly for new and non-developer contributors. It hasn’t been updated to make use of this new local environment yet, but that’s high on my todo list. For folks who aren’t comfortable downloading and installing Docker, managing Node versions, or working on the command line, TestPress manages all of that for you. I’ll have more to write about TestPress when it’s in a more usable state. 🙂

That’s about it! Please test and report bugs as you find them! 🐛

#core

Javascript Chat Summary: July 30, 2019

Below is a of the discussion from this week’s JavaScript chat (agenda, Slack Transcript)

Have a topic for discussion for the next meeting? Leave a suggested edit on next week’s agenda.

Housekeeping

Slack Conversation

@gziolo substitutes @aduth as the chat’s co-host in the next 3 months while he enjoys well deserved time off. It was a good opportunity to refresh the group of Note Takers. Kudos to @cbravobernal for volunteering to help with summary posts like this one. For those who still would like to get involved let us know. Here is the document which explains in-depth what does it entail.

Type Definitions

Slack Conversation

First, there is some exciting news to share for those who use TypeScript in their workflows. The last of the DefinitelyTyped submissions for package type definitions has been merged. Great work @dsifford on the related PR.

We also discussed possible next steps in terms of improving the auto-generated documentation. There was a general agreement that we should seek ways to improve the current approach with JSDoc comments before we jump into deep integration with TypeScript.

Action items

  • Replace the existing JSDoc ESLint rules with eslint-plugin-jsdoc (GitHub issue).
  • Improve existing JSDoc comments as we enable TypeScript checking gradually for all packages. This task should be coordinated with the tracking issue on GitHub.

#core-js, #javascript

Editor chat summary: 31 July 2019

This post summarizes for the weekly editor chat meeting on Wednesday, 31st July 2019, 13:00 UTC held in Slack.

Gutenberg 6.2

This week, we celebrate the Gutenberg 6.2: a release packed with many improvements and bug fixes, including: 

  • Button block target support, 
  • No limitations in nested blocks for Media, Text and Cover blocks,
  • New API to register block style variations, 
  • Control the available RichText formats
  • And much more…

For a full write-up see this post: What’s new in Gutenberg? It’s great to see that we have contributors from all around the world. Thank you all! But as exciting as this release is, even more amazing things are in the works!

Last week we talked about the need for more reviewers to help out with the growing numbers of open PRs. The number of people who were actively helping in the reviews this week was noticeable. Big kudos everyone.

Task Coordination

Open Floor

  • @tellthemachines commented on ways to communicate the updates from people in the APAC region. “We’re trying out posting updates as comments to the meeting agenda. It would be nice to give this some visibility so more folks from different timezones feel encouraged to participate. Also, let us know if you think this method is useful and/or if you have any other ideas on how we can improve communciations!”
  • @nadir had some questions about how can I handle search & external libraries. He is working on an Icon component that should have a list of icons to select from, and looking for suggestions.
  • @youknowriad responded to @nadir:
    • For the search component: we might want to take a look at how the “link format” is built in order to share components/consolidate?
    • – The icons list is another good question we need to figure out. An initial approach could be to pick from the list of the Dashicons SVGs (they’re available in the Dashicon component)
  • @matias Suggested that some of the block libraries out there have good ideas for icon selection and filtering.
  • @nicolad is working on and has some questions about Social links block.
  • Responding to @nicolad, @youknowriad believes that we might want to share the same mechanism of providing icons between the Social Links block and the Icon block maybe? The question is how to filter that list for social icons only, or even do we want to filter it?
  • @brentswisher:  last week when asking about the process of reviews, I was given the advice to review and if all was good to merge the change. Then when reviewing the documentation, I found this which conflicted with the documentation: The final pull request merge decision is made by the wordpress/gutenberg-core team.
  • @youknowriad suggested the process should be:
    • *I review it
    • *If it looks good to me approve, and mention someone on the core team saying it is ready to merge.
    • *If someone from core says it looks good to them merge it
    • *If nobody comments in a day or two go ahead and merge it anyways.
    • I’m hoping to update the documentation to make this process more transparent and just wanted to verify there was some consensus about that process / get opinions here first. 
  • @brentswisher will work on writing an update to the documentation,

Note: Anyone reading this summary outside of the meeting, please drop a comment if you can/want to help with something.

The agenda for the next meeting, 7 August 2019 13:00 UTC is here, please add anything you want to discuss.#meeting-notes, #core-editor, #editor, #gutenberg

Dev Chat Summary: July 31

This post summarizes the weekly devchat meeting from July 31st, 2019 ( Slack Archive).

Announcements

@chanthaboune reported that she was recently told what a patient and welcoming group Core is. Kudos to all for being so welcoming!

The following announcements were posted requesting feedback in the last week:

Also, PHP 7.4 has hit the beta stages and is target for public release in late November.

@kadamwhite asked what the most productive way to express support for the proposed plan to raise the minimum PHP version. The fear expressed was that +1 comments would be unproductive noise. @miss_jwo confirmed she was OK with +1 comments.

Upcoming Releases

5.3 Update

@chanthaboune has a few updates that she still needs to post.

However, after reaching out to a few people (and being proactively reached out to by several others), the picture being painted indicates an early November release is feasible. This would mean a post WordCamp US (November 1-3) but pre US Thanksgiving (November 28) timeframe.

Some attendees expressed hesitation to committing to a release date too soon after WCUS. But there seemed to be a sentiment that with enough advance notice and an early enough release candidate (early October at the latest), a date within this general timeline could work. There is currently no new default theme planned for 5.3.

5.2.3

A few people thought that 5.2.3 could still be warranted between now and November. #47797 was raised as a possible ticket (and anything else needed to prepare for a PHP version bump in 5.3) for inclusion in 5.2.3.

Component Maintainers:

The following upcoming meetings were called out by component maintainers in attendance:

  • Media – Thursday, August 1, 2019 @ 13:00UTC
  • REST API – Thursday, August 1, 2019 @ 1800 UTC

@jorbin also called out that now is a great time to make the push for PHP 7.4 compatibility. Getting the 7.4 job to pass in Travis is a good first step.

#dev-chat, #summary #5-3

What’s new in Gutenberg? (31 July)

The number of Gutenberg contributors is growing significantly and it’s a pleasure to see how people from all around the world come together to build and improve the software. I’d like to take this opportunity to thank the 48 contributors that participated in this release.

Among the improvements of Gutenberg 6.2, a feature that might seem small but which a lot of people were waiting for: the possibility to customize the target of the Button block (open the link in a new tab).

We also had a lot of people asking for the possibility to use all kinds of block types in the Cover and Media & Text blocks, so we’ve removed their nested block restrictions.

From a Developer Experience perspective, this release introduces a new PHP API to simplify the registration of block styles variations.

// Registering a style variation using a registered WP style.
register_block_style(
	'core/quote',
	array(
		'name'         => 'fancy-quote',
		'label'        => 'Fancy Quote',
		'style_handle' => 'myguten-style',
	)
);

// Registering a style variation using an inline style.
register_block_style(
	'core/quote',
	array(
		'name'         => 'not-fancy-quote',
		'label'        => 'Not Fancy Quote',
		'inline_style' => '.wp-block-quote.is-style-not-fancy-quote { color: blue; }',
	)
);

6.2

Enhancements

New APIs

Bug Fixes

Documentation

Divers

Mobile

Performance Benchmark

The following benchmark compares performance for a particularly sizeable post (~ 36000 words, ~ 1000 blocks) over the last releases. Such a large post isn’t representative of the average editing experience but is adequate for spotting variations in performance.

Version Loading Time KeyPress event (typing)
Gutenberg 6.2.0 4.8s 67.2ms
Gutenberg 6.1.0 5.9s 67.2ms
Gutenberg 5.3 (WordPress 5.2) 7.6s 80.13ms

👏 Kudos to all the contributors. Thank you.

#core-editor, #editor, #gutenberg

Dev Chat Agenda: July 31

It’s the last devchat of July, my friends! Here is the agenda for the weekly meeting at Wednesday, July 31, 2019, 2000 UTC.

  • Announcements
  • Upcoming Release Discussions
    • 5.3 Planning and Updates
  • Calls from component maintainers
  • Open Floor

If you have anything to propose for the agenda or specific items related to those listed above, please leave a comment below.

This meeting is held in the #core channel in the Making WordPress Slack.

#5-3#agenda#devchat

Editor Chat Agenda: July 31st

Note taker: @pbrocks

This is the agenda for the weekly editor chat meeting held in the #core-editor channel on Wednesday, July 31, 2019, 6:00 AM PDT.

  • Gutenberg 6.2
  • Tasks Coordination
  • Open Floor

If you have anything to propose for the agenda or specific items related to those listed above, please leave a comment below. #agenda, #core-editor, #editor-chat