Skip to main content
Penyaskito Blog

Main navigation

  • Home
Language switcher
  • English
  • Español
User account menu
  • Log in

Last articles

By penyaskito , 4 July, 2026
Image
The same JSON, stored and read back from different database engines

Canvas Internals - JSON data types in different databases: It works on my machine!

Drupal has been working to add a JSON data type since 2023, but that has not landed yet. Drupal Canvas jumps ahead of that in its inputs for a component tree item with

'inputs' => [
  'description' => 'The input for this component instance in the component tree.',
  'type' => 'json',
  'pgsql_type' => 'jsonb',
  'mysql_type' => 'json',
  'sqlite_type' => 'json',
  'not null' => FALSE,
],

Recently some of our tests started failing for MySQL and Postgres on CI, but passed in SQLite and MariaDB, which is what most of us use locally. 

The problem was that the sorting of the keys of that field was not deterministic, and we used assertSame in our tests to see if operations added/removed the inputs as expected when components evolved. 

How does that translate to different engines?

For MySQL, there's a native data type. Quoting their docs:

To make lookups more efficient, MySQL also sorts the keys of a JSON object. You should be aware that the result of this ordering is subject to change and not guaranteed to be consistent across releases.

For PostgreSQL, the engine offers two different data types: json and jsonb, with the second being the option we (and core) opted for because of its efficiency. But that's key, as the docs explain:

In general, most applications should prefer to store JSON data as jsonb, unless there are quite specialized needs, such as legacy assumptions about ordering of object keys.

That's exactly what our problem was.

For MariaDB, the JSON type is just an alias. See their docs:

JSON is an alias for LONGTEXT COLLATE utf8mb4_bin introduced for compatibility reasons with MySQL's JSON data type. MariaDB implements this as a LONGTEXT rather, as the JSON data type contradicts the SQL:2016 standard, and MariaDB's benchmarks indicate that performance is at least equivalent.

And the last one, SQLite, has support for a jsonb format since 3.45, but the work in progress for introducing this in Core uses json, which, like MariaDB, is ordinary text and sorting of the keys is respected.

How did we fix this?

The actual sorting of the inputs in the database is, as of today, irrelevant to us. So we ended up with:

  • Our own assertSameInputs, which sorts the keys before comparison. assertEqualsCanonicalizing is not an option, as that sorts by value.
  • Our own PHPStan rule, which is not 100% accurate but detects most usages of assertSame with these inputs, and suggests using assertSameInputs instead. 

Translating Drupal Canvas

This is just one of the many show-stoppers that we faced while working on the much-anticipated symmetric translation support for Drupal Canvas. If you want to test this experimental feature, check the release notes in Canvas 1.7.0, but please only on test sites for now!

Tags

  • contributing
  • Drupal
  • Drupal Core
  • Drupal Canvas
  • multilingual
  • databases
  • PHPStan
  • JSON
  • Drupal planet
  • testing
By penyaskito , 3 July, 2026

Quarterly Contributions summary for 2026 Q2

Last April I started blogging about my quarterly contributions as a way to look back and see what I've been working on, even if I've been tracking for 6 quarters already.

On Drupal.org, last quarter I had credits at 1376. Now it's 1495. So 119 new credits, which is above 1.3 credits/day. Just by numbers, this is the biggest quarter since I have been tracking it.

Breaking those down, all of them have been on my 4 focus projects:

Canvas: 247 (+104)
Core: 162 (+12)
CMS*: 44 (+2)
Dashboard: 62 (+1)

Of course the majority of them concentrate in Drupal Canvas. Thanks Acquia for sponsoring lots of my open-source work.

This doesn't measure at all complexity, but I feel like these on Canvas have been more complex on average: bugs and features are definitely harder to implement. I guess I ate the AI Red Pill 🤷🏽. But it's not just 2x quantity-wise than previous quarter, it has a bigger impact quality-wise. 

And these numbers don't track the work on security fixes and/or releases which I've been doing for Canvas. 

I'd highlight that, outside of Drupal, I also got my first contributions to jsonrainbow/json-schema, the PHP library that Drupal core and Canvas use for JSON Schema validation. 

Happy coding! 🎉

Tags

  • contributing
  • quarterly-report
  • Drupal
  • Drupal Core
  • Drupal Canvas
By penyaskito , 18 April, 2026

Your SKILLs don't matter: deterministic checks do

Your SKILLs don't matter

Or better said: you are sharing them with the wrong goal.

Every other LinkedIn/Slack post is talking about LLMs. But most specifically, it's dozens of developers sharing their SKILLs repo as the best SKILLs ever that will make you write the perfect code.

I've written only a very few of them, and I am already tired of copying them over from project to project. So I might create the next best-drupal-skills-ever repo. And you might look at it. But I'm 90% sure it won't work for you. Because my preferences and code quirks aren't yours.

Code standards should be (and they are) enforced. We have PHP_CodeSniffer for that. We have PHPStan for that. Don't write a non-deterministic skill. If you really care about enforcing it, write a deterministic rule. LLMs are pretty good at creating these.

If you can't write a deterministic rule, or you think it's not worth it, probably it's just your personal preference.

Deterministic checks (a Drupal Canvas story)

The Drupal Canvas module has created quite a few phpstan custom rules and phpcs custom rules. 

There's some team consensus on them. We've suffered bugs because of their absence. Most of the time, they are caught in code reviews, but that requires an extra back and forth. With LLMs becoming more and more popular, I'm not discovering anything new to you: the open source bottleneck is code reviews, not creating code. You should avoid at all costs an extra code review.

As an example, we are disallowing implementing hook_schema for Drupal Canvas and its submodules. In this case, we are leaping ahead of Drupal core, but we don't know when that will land and become the standard way in the Drupal ecosystem. We just think it benefits us already, and that becomes our standard. And we deterministically enforce it. Having this as a SKILL would be just useless context 95% of the time, burning your tokens, and only applied to AI-generated code, not any human written code: humans still write code, right? RIGHT?

Share your SKILLs

Don't get me wrong, share your SKILLs. Use permissive licenses for them. Share knowledge with others and learn from others.

But at the end of the day, when the hype ends, I'd expect SKILLs repos to become like dotfiles repos. Everyone has their preferences. Each project has different needs. Starting from someone else's might be a good starting point if you aren't familiar with the tech. But at the end, you MUST customize them to your own preferences and your project needs.

Tags

  • Drupal
  • Drupal AI
  • Drupal Canvas
  • Drupal planet
  • AI
  • LLMs
  • SKILLs
  • phpcs
  • PHPStan

Pagination

  • Page 1
  • Page 2
  • Page 3
  • Page 4
  • Page 5
  • Page 6
  • Page 7
  • Page 8
  • Page 9
  • Next page
  • Last page

Monthly archive

  • July 2026 (2)
  • April 2026 (4)
  • August 2025 (1)
  • April 2025 (1)
  • July 2023 (1)
  • December 2021 (1)
  • May 2021 (2)
  • April 2021 (1)
  • September 2014 (1)
  • November 2012 (1)
  • September 2012 (2)
  • August 2012 (3)
  • June 2012 (6)

Recent content

Canvas Internals - JSON data types in different databases: It works on my machine!
1 day ago
Quarterly Contributions summary for 2026 Q2
2 days 17 hours ago
Your SKILLs don't matter: deterministic checks do
2 months 2 weeks ago

Recent comments

That's a great idea! I would…
2 months 2 weeks ago
D.org integration
2 months 2 weeks ago
Can't blame you 😜For me…
2 months 2 weeks ago

Blogs I follow

  • Mateu Aguiló "e0ipso"
  • Gábor Hojtsy
  • Pedro Cambra
  • The Russian Lullaby, davidjguru
  • Can It Be All So Simple
  • Maria Arias de Reyna "Délawen"
  • Matt Glaman
  • Daniel Wehner
  • Jacob Rockowitz
  • Wim Leers
  • Dries Buytaert
  • arcturus
  • Drupal Core AI digest
  • Drupal CMS AI digest
  • Drupal Canvas AI digest
  • Drupal AI AI digest
  • Drupal Patterns AI digest
  • Trisha Gee
  • Très Bien Tech, by _nod
  • Moshe Weitzman
  • Drupal core change records
  • Ed Zitron's Where's Your Ed At
  • Sebastian Bergmann (phpunit.expert)
  • PHP Reads
  • mandclu
  • Marissa Epstein
  • WordPress Core
  • David Bushell
Syndicate

Footer

  • Drupal.org
  • LinkedIn
  • GitHub
  • Mastodon
  • Twitter
Powered by Drupal

Free 🇵🇸