<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet href="https://jolicode.com/feed.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:reactions="https://jolicode.com/xmlns/reactions/1.0" xml:lang="fr-FR">
    <id>https://jolicode.com/blog</id>
    <link type="text/html" rel="alternate" href="https://jolicode.com/blog"/>
    <link type="application/rss+xml" rel="self" href="https://jolicode.com/feed" />

        <script src="https://jolicode.com/build/xslt-polyfill.min.js" xmlns="http://www.w3.org/1999/xhtml"></script>

            <title>JoliCode blog - les derniers articles</title>
        <updated>2026-11-24T00:57:16+01:00</updated>    <entry>
        <id>https://jolicode.com/blog/many-small-reads-a-few-huge-invalidations-what-i-learned-alongside-symfony-cache-on-redis-cluster</id>
        <published>2026-11-17T15:42:00+01:00</published>
        <updated>2026-11-17T15:42:00+01:00</updated>
        <link type="text/html" rel="alternate" href="https://jolicode.com/blog/many-small-reads-a-few-huge-invalidations-what-i-learned-alongside-symfony-cache-on-redis-cluster"/>
        <title>Many small reads, a few huge invalidations: what I learned alongside Symfony Cache on Redis Cluster</title>
        <author>
            <name>JoliCode Team</name>
            <uri>https://jolicode.com/</uri>
        </author>            <category term="symfony" />            <category term="performance" />            <category term="redis" />            <reactions:summary total="8">                <reactions:reaction emoji="🚀" shortname="rocket" count="4"/>                <reactions:reaction emoji="🤯" shortname="mindblown" count="4"/>            </reactions:summary>
        <summary><![CDATA[On our e-commerce API, we invalidate a few hundred cache entries all the time, and that is easy with any cache. But switching the active catalogue means invalidating around a million entries at once,…]]></summary>
        <content type="html">
            &lt;p&gt;On our e-commerce API, we invalidate a few hundred cache entries all the time, and that is easy with any cache. But switching the active catalogue means invalidating around a million entries at once, and that has to be fast too. With the first version of my cache, it blocked everything else for minutes, five minutes in the worst case. Nobody understood what was happening; the business and the customers saw it. So, how do you invalidate a million cache entries fast? Tags are the means, not the goal: a few thousand of them cover all these entries, as long as invalidating a tag does not mean visiting each entry.&lt;/p&gt;
&lt;p&gt;Answering that question led me to &lt;code&gt;RedisCacheWithPreload&lt;/code&gt;, my own little Redis cache class, running in production next to Symfony Cache instead of through one of its pools. It is specific to our use case, not a library to adopt, and I do not want to keep it. I tried another design to see where it could beat the existing one, so that what works goes back into Symfony, is there by default for everybody in 8.3, and I can return to stock Symfony Cache.&lt;/p&gt;
&lt;p&gt;This post started as a note to Nicolas Grekas, who maintains the component, to explain all that. &amp;quot;It was faster&amp;quot; is not an answer you give to a maintainer, so I built a lab and measured everything.&lt;/p&gt;

&lt;div class=&quot;c-alert c-alert--tip&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 46 72&quot;&gt;&lt;path fill-rule=&quot;nonzero&quot; d=&quot;M45.7 23.2C45.7 10.7 35.5.5 23 .5S.3 10.7.3 23.2c0 1.8.2 3.6.7 5.4.6 2.9 1.7 4.7 3.2 7.2.3.6.7 1.2 1.1 1.9.5.8.9 1.6 1.4 2.3 2 3.3 3.2 5.2 3.2 9.1v9.4c0 2.4 1.7 4.3 4 4.7 1 5.1 4 8.3 9.1 8.3s8.2-3.2 9.1-8.3c2.3-.4 4-2.4 4-4.7v-9.4c0-3.9 1.2-5.9 3.2-9.1.4-.7.9-1.5 1.4-2.3.4-.7.8-1.3 1.1-1.9 1.5-2.5 2.6-4.3 3.2-7.2.5-1.8.7-3.6.7-5.4M31.2 50.9H15.287v-1.917c0-.416 0-.75-.087-1.083h16c0 .333-.087.667-.087 1.083V50.9zm-1.016 7.5H15.603c-.44 0-.703-.308-.703-.615V55.4h15.986v2.385c.088.307-.263.615-.702.615m-7.124 8c-.87 0-3.089 0-3.96-3h8c-.871 3-3.168 3-4.04 3m17.091-38.664c-.468 2.072-1.216 3.484-2.526 5.65-.375.564-.655 1.129-1.03 1.788-.468.753-.842 1.506-1.216 2.071-1.123 1.883-2.153 3.578-2.808 5.555h-18.53c-.654-1.977-1.59-3.672-2.807-5.555-.374-.659-.842-1.318-1.216-2.071-.375-.659-.749-1.318-1.03-1.789-1.31-2.26-2.059-3.577-2.527-5.743a16.5 16.5 0 0 1-.561-4.236C5.9 13.708 13.761 5.8 23.4 5.8s17.5 7.908 17.5 17.606c-.187 1.412-.374 2.824-.749 4.33&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Astuce&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
TL;DR, four things you can do on Monday:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Batch your misses&lt;/strong&gt;: &lt;code&gt;getItems()&lt;/code&gt;, one loader for everything that is missing, &lt;code&gt;saveDeferred()&lt;/code&gt;, &lt;code&gt;commit()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Compress your values&lt;/strong&gt;: wire &lt;code&gt;DeflateMarshaller&lt;/code&gt;, it is off by default.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;On Redis Cluster, count round trips, not milliseconds&lt;/strong&gt;: a multi-key read costs one round trip per slot, even with a single shard.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Pick your tag adapter by the size of your invalidations&lt;/strong&gt;: versions (&lt;code&gt;TagAwareAdapter&lt;/code&gt;) when a tag covers many entries, Sets (&lt;code&gt;RedisTagAwareAdapter&lt;/code&gt;) for small tags whose memory must be freed right away.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;And before writing your own cache, go read how &lt;code&gt;TagAwareAdapter&lt;/code&gt; works.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Three questions will guide us:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Where can another design beat Symfony Cache, for our workload?&lt;/strong&gt; On one point, maybe two.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What did trying teach me?&lt;/strong&gt; A lot, starting with the bugs in my own class.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What does Symfony Cache already get right?&lt;/strong&gt; A lot, including compression, which is there but off by default.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Everything was measured on Symfony 6.4 (what runs in production), 8.1 and the upcoming 8.2, against a standalone server and a cluster with replicas. The servers run Valkey, the open-source fork of Redis that ElastiCache runs for us; it speaks the same protocol, so &amp;quot;Redis&amp;quot; below means either. The lab, its commands and its limits are described at the end, in &lt;a href=&quot;#how-the-lab-works&quot;&gt;How the lab works&lt;/a&gt;. Nicolas has since answered with pull requests: they are listed in &lt;a href=&quot;#what-i-asked-for-and-what-happened-next&quot;&gt;What I asked for, and what happened next&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Contents:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-workload&quot;&gt;The workload&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#one-configuration-three-topologies&quot;&gt;One configuration, three topologies&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#three-redis-adapters-two-ideas-of-what-a-tag-is&quot;&gt;Three Redis adapters, two ideas of what a tag is&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#reading-100-keys&quot;&gt;Reading 100 keys&lt;/a&gt;, in four steps&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#compressing-values-off-by-default&quot;&gt;Compressing values: off by default&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#invalidating-a-million-entries&quot;&gt;Invalidating a million entries&lt;/a&gt;, and the race that comes with versions&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-trying-taught-me&quot;&gt;What trying taught me&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-symfony-gets-right&quot;&gt;What Symfony gets right&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-i-asked-for-and-what-happened-next&quot;&gt;What I asked for, and what happened next&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#so-can-i-delete-my-class&quot;&gt;So, can I delete my class?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Appendices: &lt;a href=&quot;#appendix-every-pull-request&quot;&gt;every pull request&lt;/a&gt;, &lt;a href=&quot;#appendix-dsn-and-connections&quot;&gt;DSN and connections&lt;/a&gt;, &lt;a href=&quot;#appendix-compression&quot;&gt;compression&lt;/a&gt;, &lt;a href=&quot;#appendix-bans&quot;&gt;bans&lt;/a&gt;, &lt;a href=&quot;#appendix-key-prefixes&quot;&gt;key prefixes&lt;/a&gt;, &lt;a href=&quot;#how-the-lab-works&quot;&gt;how the lab works&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;The workload&lt;/h2&gt;
&lt;p&gt;Let&#039;s start with the endpoint. It receives a list of product identifiers (EANs) and returns one rendered product per known EAN:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;POST&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; /products/by-eans&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;&quot;eans&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: [&lt;/span&gt;&lt;span class=&quot;syntax-15&quot;&gt;&quot;3600000000011&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-15&quot;&gt;&quot;3600000000028&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-15&quot;&gt;&quot;…&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;]}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;200 OK&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;&quot;products&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    {&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;&quot;ean&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-15&quot;&gt;&quot;3600000000011&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;&quot;properties&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: { &lt;/span&gt;&lt;span class=&quot;syntax-13&quot;&gt;…&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; }},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    {&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;&quot;ean&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-15&quot;&gt;&quot;3600000000028&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;&quot;properties&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: { &lt;/span&gt;&lt;span class=&quot;syntax-13&quot;&gt;…&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;]}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;properties&lt;/code&gt; is the rendered product: it is the expensive part, and it is what gets cached, one entry per EAN and per context (site, locale, currency…).&lt;/p&gt;
&lt;p&gt;The shape of the load: at peak, hundreds of thousands of reads per minute, of about 10 items each. On the invalidation side, small ones (a few hundred entries) all the time, big ones every week, and huge ones (around a million entries at once) up to about 20 times a year.&lt;/p&gt;
&lt;p&gt;Three facts drive everything else, so let&#039;s take the time to explain them:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;A miss is expensive.&lt;/strong&gt; Building one product needs SQL queries and an HTTPS call to another service: about 3 ms when Varnish has the answer, about 30 ms when it does not.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Entries are invalidated by tag, and the request does not know the tag.&lt;/strong&gt; A &lt;em&gt;tag&lt;/em&gt; is a label attached to a cache entry, so that entries can be invalidated as a group. Here, every entry built from a product carries that product&#039;s tag: &lt;code&gt;fr-EUR-3600000000011&lt;/code&gt; and &lt;code&gt;en-USD-3600000000011&lt;/code&gt; (the same EAN in two contexts), and the entries of the other EANs of that product, are all tagged &lt;code&gt;product-42&lt;/code&gt; (names simplified). When product 42 changes, a single &amp;quot;ban &lt;code&gt;product-42&lt;/code&gt;&amp;quot; invalidates all of them, without having to list them. The catch: the request gives me EANs, and finding which product, and therefore which tag, an EAN belongs to is a SQL query. I do not want to run that query just to read the cache, so the cache itself has to remember the tag of each key.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Invalidations are mostly small, sometimes huge, and tags are what makes the huge ones cheap.&lt;/strong&gt; About 90 % of the bans touch two tags, a few hundred entries: easy, whatever the cache. But when the active catalogue switches (we call it a workspace switch), the diff between the two catalogues is banned at once. That is around a million cache keys, but at most about 5,000 tags: going through tags is the only way to keep that operation small, and the whole point of this post is that it must be fast. Those are the bulks that blocked production: the first version of my class deleted every entry of a banned tag. Since it versions its tags instead of deleting entries, the same bulks are fast and invisible in production. And ideally I want to go one step further and compute the entries of the next catalogue &lt;em&gt;before&lt;/em&gt; the switch, which requires cache keys I can guess in advance.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;One configuration, three topologies&lt;/h2&gt;
&lt;p&gt;The same code runs on a standalone Redis in dev, on ElastiCache Serverless in staging, and on an ElastiCache cluster (one shard, two replicas) in production. And this is where Symfony Cache shines: the pool configuration never changes, only the DSN does. I love that.&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;# config/packages/framework.yaml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;framework&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    cache&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        default_redis_provider&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;%env(REDIS_DSN)%&#039;&lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;   # also injectable as the cache.default_redis_provider service&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        app&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;cache.adapter.redis&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;# dev: standalone&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;REDIS_DSN&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;redis://valkey:6379&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;# staging, ElastiCache Serverless: one endpoint, cluster protocol, TLS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;REDIS_DSN&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;rediss://&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;.serverless.euw3.cache.amazonaws.com:6379/0?&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;persistent&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;&amp;#x26;redis_cluster&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;&amp;#x26;failover&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;slaves&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;# production, ElastiCache cluster mode enabled: configuration endpoint, 1 shard (1 primary + 2 replicas)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;REDIS_DSN&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;redis://&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;.clustercfg.euw3.cache.amazonaws.com:6379/0?&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;persistent&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;&amp;#x26;redis_cluster&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;&amp;#x26;failover&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;slaves&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Symfony builds a &lt;code&gt;\Redis&lt;/code&gt; for the first DSN and a &lt;code&gt;\RedisCluster&lt;/code&gt; for the other two, and &lt;code&gt;failover=slaves&lt;/code&gt; sends every read-only command to a replica: in the lab, 100 % of the reads of Symfony pools were served by replicas (the other &lt;code&gt;failover&lt;/code&gt; modes are compared in the appendix). My class does not open its own connection: it injects the one Symfony built from &lt;code&gt;default_redis_provider&lt;/code&gt;, through the &lt;code&gt;cache.default_redis_provider&lt;/code&gt; service. That is why it lives &lt;em&gt;next to&lt;/em&gt; Symfony Cache rather than &lt;em&gt;instead of&lt;/em&gt; it. The details (Serverless, failover modes, option names, how to inject that connection, and how to do the same for a second DSN) are in &lt;a href=&quot;#appendix-dsn-and-connections&quot;&gt;Appendix: DSN and connections&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Three Redis adapters, two ideas of what a tag is&lt;/h2&gt;
&lt;p&gt;Symfony Cache ships three ways to put a cache in Redis and, honestly, their names did not help me to tell them apart. It all comes down to one question: how do you invalidate, at once, every entry linked to a product?&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;framework&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    cache&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        pools&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;            plain&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:     { &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;adapter&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;cache.adapter.redis&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; }               &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;# RedisAdapter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;            versioned&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: { &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;adapter&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;cache.adapter.redis&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;tags&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; }   &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;# TagAwareAdapter around a RedisAdapter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;            sets&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:      { &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;adapter&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;cache.adapter.redis_tag_aware&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; }     &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;# RedisTagAwareAdapter&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;RedisAdapter&lt;/code&gt;&lt;/strong&gt; has no tags: a key/value pool, &lt;code&gt;MGET&lt;/code&gt; to read, &lt;code&gt;SETEX&lt;/code&gt; to write. To invalidate, you must know and delete every key.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;TagAwareAdapter&lt;/code&gt;&lt;/strong&gt; adds tags on top of any pool (Redis, filesystem, APCu…) by &lt;em&gt;versioning&lt;/em&gt; them. A tag&#039;s version is a random value, stored as an ordinary item of the pool. When an entry tagged &lt;code&gt;product-42&lt;/code&gt; is saved, Symfony reads the current version of &lt;code&gt;product-42&lt;/code&gt;, or draws one if the tag has none yet, say &lt;code&gt;a1b2&lt;/code&gt;, and copies it into the entry&#039;s metadata. On every read, it fetches the current versions of the entry&#039;s tags (a second fetch, skipped for versions the same process has read in the last 0.15 s) and compares them with the recorded ones: if they match, it is a hit. Invalidating &lt;code&gt;product-42&lt;/code&gt; deletes its version, and nothing else (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/cache/blob/1d70b5557fdf9cba0a31f2a5caa4f66a7b85d62b/Adapter/TagAwareAdapter.php#L121-L131&quot;&gt;TagAwareAdapter.php#L121-L131&lt;/a&gt;): the entries tagged with it stay in the pool until their TTL, but the &lt;code&gt;a1b2&lt;/code&gt; they carry no longer matches anything, so they count as misses. The next save draws a new version, and only entries written from then on are served. Because the version is random rather than a counter, a version lost to eviction cannot come back with an old value and revive stale entries.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;RedisTagAwareAdapter&lt;/code&gt;&lt;/strong&gt; is Redis-only and does the opposite: it keeps, for each tag, a Redis Set of the keys tagged with it. Invalidating a tag &lt;strong&gt;deletes every entry of the Set&lt;/strong&gt;, inside a Lua script (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/cache/blob/1d70b5557fdf9cba0a31f2a5caa4f66a7b85d62b/Adapter/RedisTagAwareAdapter.php#L277-L374&quot;&gt;RedisTagAwareAdapter.php#L277-L374&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;code&gt;TagAwareAdapter&lt;/code&gt; (versions)&lt;/th&gt;
&lt;th&gt;&lt;code&gt;RedisTagAwareAdapter&lt;/code&gt; (Sets)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;write&lt;/td&gt;
&lt;td&gt;the entry stores its tags&#039; versions in its metadata&lt;/td&gt;
&lt;td&gt;&lt;code&gt;SETEX&lt;/code&gt; the entry, &lt;code&gt;SADD&lt;/code&gt; its key to each tag&#039;s Set&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;read&lt;/td&gt;
&lt;td&gt;&lt;code&gt;MGET&lt;/code&gt; the entries, then &lt;code&gt;MGET&lt;/code&gt; their tags&#039; versions&lt;/td&gt;
&lt;td&gt;one &lt;code&gt;MGET&lt;/code&gt;, no check&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;invalidate a tag&lt;/td&gt;
&lt;td&gt;&lt;code&gt;UNLINK&lt;/code&gt; the tag version key&lt;/td&gt;
&lt;td&gt;Lua: walk the Set, &lt;code&gt;DEL&lt;/code&gt; each entry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;cost of a ban&lt;/td&gt;
&lt;td&gt;grows with the number of &lt;strong&gt;tags&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;grows with the number of &lt;strong&gt;entries&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;memory after a ban&lt;/td&gt;
&lt;td&gt;stale entries stay until their TTL&lt;/td&gt;
&lt;td&gt;freed at once&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;constraints&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;td&gt;eviction policy &lt;code&gt;volatile-*&lt;/code&gt; or &lt;code&gt;noeviction&lt;/code&gt;, so that Sets are never evicted; Sets keep references to expired entries (&lt;code&gt;prune()&lt;/code&gt; since 8.2)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Picture &lt;code&gt;TagAwareAdapter&lt;/code&gt; changing the lock: the old keys still exist, they open nothing anymore, and they expire on their own. &lt;code&gt;RedisTagAwareAdapter&lt;/code&gt; throws the boxes away: it has to know where each one is, and carry them out one by one. The first is made for bans of many entries, the second for small tags when memory must be reclaimed right away. My class belongs to the first family, as we will see.&lt;/p&gt;
&lt;h2&gt;Reading 100 keys&lt;/h2&gt;
&lt;p&gt;Let&#039;s simulate one request in the lab: 100 identifiers, each mapped to one tag, a 2.6 KB serialized model per entry (743 bytes once gzipped). That is ten times our usual request, on purpose: it makes the differences easy to see. &amp;quot;Warm&amp;quot; means everything is cached, &amp;quot;cold&amp;quot; means nothing is.&lt;/p&gt;
&lt;h3&gt;Step 1: &lt;code&gt;CacheInterface::get()&lt;/code&gt; in a loop&lt;/h3&gt;
&lt;p&gt;Let&#039;s begin with the idiomatic Symfony way:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$models &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; ($ids &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $id) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    $models[] &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $cache&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&quot;variant-&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; (&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;ItemInterface&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $item) &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; ($id) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;        $item&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;expiresAfter&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;3600&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;        $item&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;tag&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&quot;product-&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;$id&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        return&lt;/span&gt;&lt;span class=&quot;syntax-11&quot;&gt; $this&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;loader&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;load&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;([$id])[$id]; &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// SQL queries + one HTTPS call, for one item&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    });&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It works, but it reads one key per call: 100 round trips when everything is cached, 200 with tags (each &lt;code&gt;get()&lt;/code&gt; also fetches the tag versions). And there is worse: the callback can only compute one item at a time. On a cold cache, the 100 HTTPS calls happen one after the other. Ouch.&lt;/p&gt;
&lt;h3&gt;Step 2: &lt;code&gt;getItems()&lt;/code&gt; + one batch load + &lt;code&gt;saveDeferred()&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;PSR-6 lets you do much better. Of the four things in the TL;DR, this is the one that changes response times the most:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$items &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $pool&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;getItems&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;($keys);            &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// one MGET&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$missing &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; ($items &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $key &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $item) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    if&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; (&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;$item&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;isHit&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;()) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;        $missing[$key] &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $item;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; (&lt;/span&gt;&lt;span class=&quot;syntax-11&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;loader&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;load&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;array_keys&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;($missing)) &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $key &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $model) { &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// batched SQL + HTTPS calls in parallel&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    $pool&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;saveDeferred&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;($missing[$key]&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;($model)&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;tag&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;…&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;));&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$pool&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;commit&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;();                            &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// one pipeline&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;saveDeferred()&lt;/code&gt; only queues the item in memory: nothing is sent to Redis until &lt;code&gt;commit()&lt;/code&gt;, which writes every queued item at once (one pipeline on a standalone Redis). Calling &lt;code&gt;save()&lt;/code&gt; in the loop would send one write per item.&lt;/p&gt;
&lt;p&gt;Before you copy this loop, know what it leaves behind: &lt;code&gt;get()&lt;/code&gt; comes with stampede protection (a lock around the callback, so that concurrent requests do not all compute the same missing value) and early expiration. &lt;code&gt;getItems()&lt;/code&gt; has neither. If the same keys can go cold for many requests at once, that is yours to handle.&lt;/p&gt;
&lt;p&gt;What does it change once the HTTPS calls are part of the picture? The lab has a small HTTP service that answers after 3 or 30 ms; the batch loader calls it for every missing item at once with &lt;code&gt;curl_multi&lt;/code&gt;, while the &lt;code&gt;get()&lt;/code&gt; callback only ever sees one item.&lt;/p&gt;
&lt;p&gt;One warning before the table: the batched variants are given as one range, on purpose. They moved by up to 60 ms between two runs of the same benchmark, about as much as what separates them, so time cannot rank them. That does not mean they are all equal: step 3 ranks them, on round trips.&lt;/p&gt;
&lt;p&gt;p50 per request of 100 items, in milliseconds, on the cluster, Symfony 8.2:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;strategy&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;30 ms upstream, 100 misses&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;30 ms, 10 misses&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;3 ms, 100 misses&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;3 ms, 10 misses&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;get()&lt;/code&gt; loop, &lt;code&gt;RedisAdapter&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;3266&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;344&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;461&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;52&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;get()&lt;/code&gt; loop, &lt;code&gt;TagAwareAdapter&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;3325&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;403&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;561&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;101&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;getItems()&lt;/code&gt; + batch, any of the three adapters, or my class&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;59 to 123&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;35 to 64&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;20 to 32&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;7 to 16&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The &lt;code&gt;get()&lt;/code&gt; loop rows did not move between runs.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The lesson has nothing to do with Redis: compute your misses as a batch.&lt;/strong&gt; From 3.3 seconds to around 100 ms: it is the largest drop in response time of this whole post, and it works with Symfony Cache as it is. The callback API of &lt;code&gt;CacheInterface::get()&lt;/code&gt; does not allow it, PSR-6 does, and my class makes it the only way to use it. Once the misses are batched, what is left? Round trips.&lt;/p&gt;
&lt;h3&gt;Step 3: what is left on a cluster&lt;/h3&gt;
&lt;p&gt;On a standalone Redis, step 2 is unbeatable: 1 round trip warm, 2 cold (&lt;code&gt;MGET&lt;/code&gt;, then a pipeline of &lt;code&gt;SETEX&lt;/code&gt;). With &lt;code&gt;TagAwareAdapter&lt;/code&gt; it is 2 warm (items, then tag versions) and 4 cold. Job done, nothing to add.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;On a cluster, the picture changes completely.&lt;/strong&gt; &lt;code&gt;RedisTrait::doFetch()&lt;/code&gt; calls &lt;code&gt;mget()&lt;/code&gt; on the &lt;code&gt;\RedisCluster&lt;/code&gt; (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/cache/blob/1d70b5557fdf9cba0a31f2a5caa4f66a7b85d62b/Traits/RedisTrait.php#L553-L584&quot;&gt;RedisTrait.php#L553-L584&lt;/a&gt;). phpredis splits a cluster &lt;code&gt;MGET&lt;/code&gt; by slot and, outside of &lt;code&gt;MULTI&lt;/code&gt;, sends each sub-command and waits for its reply before sending the next one (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/phpredis/phpredis/blob/6.3.0/redis_cluster.c#L419-L450&quot;&gt;redis_cluster.c#L419-L450&lt;/a&gt;). Our 100 keys live in about 100 different slots: that is 100 sequential round trips, even on a single-shard cluster, because the split is per &lt;em&gt;slot&lt;/em&gt;, not per node. Writes are no better: Symfony&#039;s &lt;code&gt;pipeline()&lt;/code&gt; helper falls back to one command at a time for &lt;code&gt;\RedisCluster&lt;/code&gt;, as phpredis cannot pipeline across a cluster (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/cache/blob/1d70b5557fdf9cba0a31f2a5caa4f66a7b85d62b/Traits/RedisTrait.php#L758-L767&quot;&gt;RedisTrait.php#L758-L767&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Same code, same 100 keys, round trips per request (identical on Symfony 6.4, 8.1 and 8.2):&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;strategy&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;standalone warm&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;cluster warm&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;standalone cold&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;cluster cold&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;get()&lt;/code&gt; loop, &lt;code&gt;RedisAdapter&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;100&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;100&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;200&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;get()&lt;/code&gt; loop, &lt;code&gt;TagAwareAdapter&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;200&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;200&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;400&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;400&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;getItems()&lt;/code&gt; + batch, &lt;code&gt;RedisAdapter&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;100&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;2&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;getItems()&lt;/code&gt; + batch, &lt;code&gt;TagAwareAdapter&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;2&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;200&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;4&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;400&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;getItems()&lt;/code&gt; + batch, &lt;code&gt;RedisTagAwareAdapter&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;100&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;3&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;300&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;RedisCacheWithPreload&lt;/code&gt;, &lt;strong&gt;all its keys in one slot&lt;/strong&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;2&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The last line looks great, but it comes with a price: every key of the class lives in the same cluster slot. Step 4 explains how, and what it costs.&lt;/p&gt;
&lt;p&gt;Round trips are what you pay for in AWS. With a 0.5 ms round trip between the PHP container and the cache node (a plausible cross-AZ figure, not something I measured here), 200 round trips add at least 100 ms to a request, whatever Redis does. Even in the lab, where a round trip costs tens of microseconds, the warm &lt;code&gt;TagAwareAdapter&lt;/code&gt; read takes 8.8 ms p50 on the cluster against 1.2 ms on the standalone instance.&lt;/p&gt;
&lt;h3&gt;Step 4: what &lt;code&gt;RedisCacheWithPreload&lt;/code&gt; does&lt;/h3&gt;
&lt;p&gt;So what does my class do? It keeps the shape of step 2 (one batch loader for all the misses) and moves the tag resolution into Redis. Its &lt;code&gt;get()&lt;/code&gt;, simplified:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;// RedisCacheWithPreload::get(), simplified pseudo-code&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$keys &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt; array_map&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;($keyClosure, $items);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$cached &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-11&quot;&gt; $this&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;runScript&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;READ_SCRIPT&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, $keys);         &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// 1 round trip, on a replica&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$missing &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt; /* items whose key is not in $cached */&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; ($missing) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    $preloaded &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $preloadClosure($missing);            &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// one batch: SQL + parallel HTTPS calls&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    foreach&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; ($missing &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $item) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;        $value &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $computeClosure($item, $preloaded);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;        $tag &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $tagsClosure($item)[&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;] &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;??&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; null&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;         &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// the tag is only known after loading&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        if&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; (&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; !==&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $value &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;&amp;#x26;&amp;#x26;&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; null&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; !==&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $tag) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;            $toWrite[] &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [$key, $tag, $ttl, &lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;gzdeflate&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;serialize&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;($value))];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;        }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-11&quot;&gt;    $this&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;runScript&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;WRITE_SCRIPT&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, $toWrite);          &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// 1 round trip, on the primary&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt; /* cached and computed values, in input order */&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And the read script, also simplified:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;-- KEYS: key-tags hash, tag-versions hash. ARGV: the logical keys of the request.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;local&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; tags &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; redis.&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;HMGET&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, KEYS[&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;], &lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;unpack&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(ARGV))              &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;-- key → tag&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;local&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; versions &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; redis.&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;HMGET&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, KEYS[&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;], &lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;unpack&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(uniqueTags))    &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;-- tag → current version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;-- build &#039;cache:{tag_versions}:data:&amp;#x3C;key&gt;::v::&amp;#x3C;version&gt;&#039; for every key whose tag has a version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;local&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; values &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; redis.&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;MGET&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;unpack&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(dataKeys))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;-- return the hits as (key, value) pairs; everything else is a miss&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Before going further, we need two Redis Cluster notions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Slots and shards.&lt;/strong&gt; A cluster spreads keys over 16,384 &lt;em&gt;slots&lt;/em&gt;; the slot of a key is a hash of its name. A &lt;em&gt;shard&lt;/em&gt; is a primary with its replicas, and each shard owns a range of slots. A command or a script that touches several keys only works if all of them hash to the same slot: that is why phpredis cuts an &lt;code&gt;MGET&lt;/code&gt; into one command per slot, even when one shard owns every slot, as in our production.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hash tags.&lt;/strong&gt; When a key name contains &lt;code&gt;{…}&lt;/code&gt;, only the part between the braces is hashed. Every key that shares &lt;code&gt;{tag_versions}&lt;/code&gt; therefore lands in the same slot, whatever the rest of its name. This &lt;code&gt;{…}&lt;/code&gt; has nothing to do with cache tags; the name is unfortunate.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A Symfony pool cannot use hash tags: &lt;code&gt;{&lt;/code&gt; and &lt;code&gt;}&lt;/code&gt; are among the characters PSR-6 reserves in keys, and &lt;code&gt;RedisAdapter&lt;/code&gt; refuses them in its namespace. Symfony only uses one internally, in &lt;code&gt;RedisTagAwareAdapter&lt;/code&gt;, to keep the temporary Set of an invalidation in the slot of the tag&#039;s Set.&lt;/p&gt;
&lt;p&gt;Storage is made of three things, all under the &lt;code&gt;{tag_versions}&lt;/code&gt; hash tag:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;cache:{tag_versions}:key-tags&lt;/code&gt;, a hash: logical key → tag;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cache:{tag_versions}:tag-versions&lt;/code&gt;, a hash: tag → version;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cache:{tag_versions}:data:&amp;lt;logical key&amp;gt;::v::&amp;lt;version&amp;gt;&lt;/code&gt;, the gzipped, serialized value.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The version of the tag is part of the name of the data key. That is what turns a ban into a version bump, and what makes keys guessable: a key, a tag and a version are enough to name an entry before it exists. It is also why a read needs the tag: to find an entry, I first need the current version of its tag.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;All of this data lives in one slot, on purpose.&lt;/strong&gt; Look at the three key names above: they all contain &lt;code&gt;{tag_versions}&lt;/code&gt;. Redis Cluster only hashes the part between braces to pick the slot, so &lt;code&gt;cache:{tag_versions}:key-tags&lt;/code&gt;, &lt;code&gt;cache:{tag_versions}:tag-versions&lt;/code&gt; and every &lt;code&gt;cache:{tag_versions}:data:…&lt;/code&gt; key get the same hash, hence the same slot, whatever comes after. Nothing else is needed: no configuration, no special command, just that part of the name. And since every key the read script touches is in that one slot, the cluster accepts the script, and the 100 sequential round trips become one. Our production cluster has a single shard today (one primary, two replicas), so this costs nothing yet.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Do not take &amp;quot;put a hash tag everywhere&amp;quot; away from this post. Pinning data to one slot has a price:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;no sharding&lt;/strong&gt; for this data: the day we add shards, none of it will move to them;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;every write goes to one primary&lt;/strong&gt;;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;read capacity only grows through the replicas&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Reads: one script, one round trip.&lt;/strong&gt; A read is one &lt;code&gt;EVALSHA_RO&lt;/code&gt; of a Lua script that does &lt;code&gt;HMGET key-tags&lt;/code&gt;, &lt;code&gt;HMGET tag-versions&lt;/code&gt;, builds the versioned keys and runs a single &lt;code&gt;MGET&lt;/code&gt;, all on the server. This is where fact #2 matters: the request knows the EAN, not the tag, and the script resolves &amp;quot;EAN → tag → current version → value&amp;quot; without SQL and without knowing the tag up front. To be fair to Symfony, &lt;code&gt;TagAwareAdapter&lt;/code&gt; does not need the tag up front either: it reads the tags from the item metadata and checks their versions after the fetch (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/cache/blob/1d70b5557fdf9cba0a31f2a5caa4f66a7b85d62b/Adapter/TagAwareAdapter.php#L145-L212&quot;&gt;TagAwareAdapter.php#L145-L212&lt;/a&gt;). The difference is not &amp;quot;SQL or no SQL&amp;quot;, it is that second fetch: one more round trip on a standalone server, one more round trip &lt;em&gt;per slot&lt;/em&gt; on a cluster.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Writes: one more script.&lt;/strong&gt; Once the batch loader has run, a second script receives every computed value with its tag and TTL, and for each one reads the tag&#039;s version (creating it if needed), records the key → tag link and writes the entry under that version, atomically, on the primary. &lt;code&gt;null&lt;/code&gt; results and items without a tag are not written at all: nothing could ever read them back. Invalidating a chunk of tags is a third script: one round trip for the 50 tags of a Messenger message. Invalidating means bumping versions: old entries are not deleted, they are simply never read again and expire with their TTL. That is &lt;code&gt;TagAwareAdapter&lt;/code&gt;&#039;s family, with the version in the key &lt;em&gt;name&lt;/em&gt; instead of the value.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Replicas: one trap.&lt;/strong&gt; Because the read script never writes, it is sent with &lt;code&gt;EVALSHA_RO&lt;/code&gt;, and with &lt;code&gt;failover=slaves&lt;/code&gt; phpredis routes it to a replica: in the lab, 100 % of the warm reads of the class were served by replicas, in one round trip. I fell into a trap on the way. The script cache is not part of the dataset: it is a volatile, per-node cache, and since Redis 7.0 scripts are only replicated by their effects (the write commands they run), never by their source (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://redis.io/docs/latest/develop/programmability/eval-intro/&quot;&gt;Scripting with Lua&lt;/a&gt;). In the lab, neither an &lt;code&gt;EVAL&lt;/code&gt; nor a &lt;code&gt;SCRIPT LOAD&lt;/code&gt; on a primary made the script appear on its replica. So the first &lt;code&gt;EVALSHA_RO&lt;/code&gt; on each replica answers &lt;code&gt;NOSCRIPT&lt;/code&gt;, and the fallback matters:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$response &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-11&quot;&gt; $this&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;redis&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;evalsha_ro&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;($sha, $args, &lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; (&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; ===&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $response) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;    // NOSCRIPT: EVAL_RO stays on the same replica and caches the script there.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;    // A plain EVAL is a write command: it goes to the primary, and the replica never learns the script.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    $response &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-11&quot;&gt; $this&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;redis&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;eval_ro&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;($luaScript, $args, &lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With &lt;code&gt;eval()&lt;/code&gt; as the fallback, which is what I had first, every read went to a replica, failed, and was replayed on the primary: two round trips, and not a single read served by the replicas. With &lt;code&gt;eval_ro()&lt;/code&gt;, each replica pays one &lt;code&gt;NOSCRIPT&lt;/code&gt; after a start, a failover or a node replacement, then serves everything. Redis Functions would avoid the problem altogether, since they are replicated and persisted (a &lt;code&gt;FUNCTION LOAD&lt;/code&gt; on the primary did show up on the replica in the lab), but phpredis 6.3&#039;s &lt;code&gt;RedisCluster&lt;/code&gt; has no &lt;code&gt;fcall_ro()&lt;/code&gt;, so there is no way to route them to replicas from PHP today.&lt;/p&gt;
&lt;h2&gt;Compressing values: off by default&lt;/h2&gt;
&lt;p&gt;My class stores &lt;code&gt;gzdeflate(serialize($value))&lt;/code&gt;. That was not a design choice, it was a fix. Without compression, the bandwidth of our ElastiCache nodes kept growing and their &amp;quot;Engine CPU&amp;quot; metric (the CPU used by the Redis engine itself) sat at 100 %. With compression, the payloads are small and the engine sleeps: that metric dropped by about 80 %. That is a production observation, not a lab result, and a different kind of gain from the batching above: batching cut the response time of requests with misses, compression relieved the servers. And since all of this data lives on one shard, its three nodes carry all of it: every write on the primary, every read on the two replicas.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Symfony Cache does not compress by default.&lt;/strong&gt; Its default marshaller only serializes. On the lab&#039;s fixture (product models with natural-looking text, URLs, identifiers; your ratio will differ), &lt;code&gt;gzdeflate()&lt;/code&gt; divides a 2609-byte model by 3.5, to 743 bytes. For a warm read of 100 models, Valkey sent 256 KB per request to &lt;code&gt;getItems()&lt;/code&gt; on an uncompressed &lt;code&gt;RedisAdapter&lt;/code&gt;, and 74 KB once the pool used &lt;code&gt;DeflateMarshaller&lt;/code&gt;, the same as my class (81 KB including its keys). The price is CPU on the PHP side: about 12 µs per value to decompress, 2 ms for the 100 values of the request. On ElastiCache Serverless the bytes are also the bill: according to &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://aws.amazon.com/elasticache/pricing/&quot;&gt;the pricing page&lt;/a&gt;, a read or a write costs 1 ECPU per kilobyte transferred (a request under 1 KB still costs 1 ECPU, and commands that need more CPU cost more), and stored data is billed per GB-hour.&lt;/p&gt;
&lt;p&gt;So if your cache is read-heavy with kilobyte-sized values: turn it on! Symfony has shipped &lt;code&gt;DeflateMarshaller&lt;/code&gt; since 5.3, but you have to know it exists and wire it yourself. Decorating the default marshaller compresses every pool:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;# config/services.yaml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    Symfony\Component\Cache\Marshaller\DeflateMarshaller&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        decorates&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;cache.default_marshaller&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        arguments&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;@.inner&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Since FrameworkBundle 8.1 you can also compress only some pools, with the pool&#039;s &lt;code&gt;marshaller&lt;/code&gt; option. The read tables above compare uncompressed Symfony pools with my compressed class: round trips do not change with compression, timings do by the amount above. Compression levels and phpredis&#039; own compression are in &lt;a href=&quot;#appendix-compression&quot;&gt;Appendix: compression&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Invalidating a million entries&lt;/h2&gt;
&lt;p&gt;Here is the scenario that started it all: a workspace switch, a million entries to invalidate, and thousands of tags to do it. The lab populates entries through each public API (one tag per entry), then invalidates every tag by chunks of 50, like our Messenger handler does, while another client sends &lt;code&gt;PING&lt;/code&gt; to every primary in a loop. A slow &lt;code&gt;PING&lt;/code&gt; means the server was busy doing something else.&lt;/p&gt;
&lt;p&gt;Standalone Valkey with its default settings (&lt;code&gt;lazyfree-lazy-user-del yes&lt;/code&gt;), 1000 tags × 1000 entries (1 million entries), then 5000 tags × 200 entries:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;stack&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;ban duration&lt;/th&gt;
&lt;th&gt;commands on the server&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;&lt;code&gt;PING&lt;/code&gt; p50 / max during the 1000 × 1000 ban&lt;/th&gt;
&lt;th&gt;memory after the 1000 × 1000 ban&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TagAwareAdapter&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;14 ms / 67 ms&lt;/td&gt;
&lt;td&gt;20 / 100 &lt;code&gt;UNLINK&lt;/code&gt; (tag keys only)&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;0.26 ms / 0.58 ms&lt;/td&gt;
&lt;td&gt;unchanged (173 MB)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;RedisTagAwareAdapter&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;2.0 s / 2.5 s&lt;/td&gt;
&lt;td&gt;1,001,000 &lt;code&gt;DEL&lt;/code&gt; inside Lua, plus &lt;code&gt;SSCAN&lt;/code&gt;, &lt;code&gt;SUNIONSTORE&lt;/code&gt;…&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;&lt;strong&gt;58.6 ms / 166 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;freed (2.7 MB)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;RedisCacheWithPreload&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;11 ms / 54 ms&lt;/td&gt;
&lt;td&gt;20 / 100 scripts (1000 / 5000 &lt;code&gt;HINCRBY&lt;/code&gt; inside)&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;0.35 ms / 2.2 ms&lt;/td&gt;
&lt;td&gt;unchanged (212 MB)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Valkey Cluster (3 shards), 1000 tags × 200 entries, then 5000 tags × 40 (a ban only sends write commands, which go to primaries whatever the &lt;code&gt;failover&lt;/code&gt; option):&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;stack&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;ban duration&lt;/th&gt;
&lt;th&gt;commands on the primaries&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;&lt;code&gt;PING&lt;/code&gt; max&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TagAwareAdapter&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;51 ms / 326 ms&lt;/td&gt;
&lt;td&gt;1000 / 5000 &lt;code&gt;UNLINK&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;0.7 ms / 2.4 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;RedisTagAwareAdapter&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;7.3 s / 9.3 s&lt;/td&gt;
&lt;td&gt;~133k &lt;code&gt;UNLINK&lt;/code&gt; sent by PHP + ~70k &lt;code&gt;DEL&lt;/code&gt; inside Lua&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;3.4 ms / 5.5 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;RedisCacheWithPreload&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;4 ms / 22 ms&lt;/td&gt;
&lt;td&gt;20 / 100 scripts (1000 / 5000 &lt;code&gt;HINCRBY&lt;/code&gt; inside)&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;0.14 ms / 0.76 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;This is the version-versus-Set split, now with numbers. &lt;code&gt;TagAwareAdapter&lt;/code&gt; and my class stay in the milliseconds, whatever the number of entries, and leave stale entries in memory until their TTL. &lt;code&gt;RedisTagAwareAdapter&lt;/code&gt; reclaims memory immediately, but its work grows with the number of entries: on a standalone server the script runs atomically, one tag at a time, and other clients waited 58 ms on median during the ban; on a cluster, the entries live on other nodes than the tag Set, so most of them are deleted from PHP, one &lt;code&gt;UNLINK&lt;/code&gt; at a time, and the ban takes seconds. A couple of side questions (&lt;code&gt;DEL&lt;/code&gt; or &lt;code&gt;UNLINK&lt;/code&gt;, ElastiCache Serverless) are answered in &lt;a href=&quot;#appendix-bans&quot;&gt;Appendix: bans&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A word on &lt;code&gt;UNLINK&lt;/code&gt;, often presented as the non-blocking &lt;code&gt;DEL&lt;/code&gt;: here it is not really asynchronous. &lt;code&gt;UNLINK&lt;/code&gt; still removes the key from the keyspace at once, inside the command. What it can hand to a background thread is freeing the value&#039;s memory, and only for values made of many allocations: Valkey frees in the background when that effort exceeds 64, and a string counts for 1 (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/valkey-io/valkey/blob/8.1/src/lazyfree.c#L117-L178&quot;&gt;lazyfree.c&lt;/a&gt;). Our values are small strings, a few hundred bytes once compressed, so there is nothing to defer. Deleting a million keys is a million operations either way, and inside one Lua script no other client is served until they are done. In the lab, replacing &lt;code&gt;DEL&lt;/code&gt; with &lt;code&gt;UNLINK&lt;/code&gt; in that script took the ban from 3.0 s to 2.4 s (one run each): a bit better, still blocking. The payload is light; the number of keys is the problem.&lt;/p&gt;
&lt;p&gt;For our bans, &lt;code&gt;TagAwareAdapter&lt;/code&gt; would have done the job. What it does not offer is to choose the next version. My &lt;code&gt;invalidateTags()&lt;/code&gt; accepts one, and the workspace switch passes the start timestamp of the new workspace, while &lt;code&gt;TagAwareAdapter&lt;/code&gt; creates a random version (&lt;code&gt;random_bytes(6)&lt;/code&gt;) the first time a tag is needed after a ban (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/cache/blob/1d70b5557fdf9cba0a31f2a5caa4f66a7b85d62b/Adapter/TagAwareAdapter.php#L385-L397&quot;&gt;TagAwareAdapter.php#L385-L397&lt;/a&gt;). A predictable version is what would allow computing the entries of the next workspace &lt;em&gt;before&lt;/em&gt; the switch. &lt;strong&gt;That is a possibility, not a result: I have not built it yet.&lt;/strong&gt; It is the main reason I kept versions under my control.&lt;/p&gt;
&lt;p&gt;A note on the tables above: they show &lt;code&gt;HINCRBY&lt;/code&gt; because the lab bans without giving a version, and in that case the class increments the current one. When a version is given, as the workspace switch does, the same script does an &lt;code&gt;HSET&lt;/code&gt; with that value instead. The cost is the same: one write per tag.&lt;/p&gt;
&lt;h3&gt;The race that versioned tags must not lose&lt;/h3&gt;
&lt;p&gt;Versioning tags has one trap, and of course I fell into it. On a miss, the class reads the current version of the tag, then writes the entry under that version. My first version did this from PHP, in separate commands, and then wrote the version back with &lt;code&gt;HSET&lt;/code&gt; to create it when the tag had none. If a ban lands between the read and the write-back, the write-back puts the old version back, and every entry cached before the ban comes back to life until its TTL:&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/redis-performance/mermaid-diagram-2026-11-17-160842.png&quot; data-original-width=&quot;1660&quot; data-original-height=&quot;924&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/redis-performance/mermaid-diagram-2026-11-17-160842.5e6eff59.webp&quot; /&gt;&lt;source type=&quot;image/png&quot; srcset=&quot;/media/cache/content/2026/redis-performance/mermaid-diagram-2026-11-17-160842.png&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;aspect-ratio: calc(1660 / 924)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/redis-performance/mermaid-diagram-2026-11-17-160842.png&quot; alt=&quot;Sequence diagram of ban workflow&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;And it happens precisely when it hurts: right after a big ban, when every worker recomputes misses on the tags that were just banned. With &lt;code&gt;failover=slaves&lt;/code&gt; the &lt;code&gt;HGET&lt;/code&gt; was also served by a replica that may lag behind the primary, which widened the window. The lab measures it with &lt;code&gt;lab:race&lt;/code&gt;: one process caches a value, bans its tag and checks whether the old value is still served, 1000 times, while other processes compute misses on the same tag.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;write path&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;concurrent writers&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;bans lost out of 1000 (standalone)&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;(cluster, &lt;code&gt;failover=slaves&lt;/code&gt;)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;first version: &lt;code&gt;HGET&lt;/code&gt;, &lt;code&gt;SET&lt;/code&gt;, &lt;code&gt;HSET&lt;/code&gt; from PHP&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;564&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;522&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;first version: &lt;code&gt;HGET&lt;/code&gt;, &lt;code&gt;SET&lt;/code&gt;, &lt;code&gt;HSET&lt;/code&gt; from PHP&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;4&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;678&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;741&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;write script: &lt;code&gt;HSETNX&lt;/code&gt; + &lt;code&gt;HGET&lt;/code&gt; + &lt;code&gt;SET&lt;/code&gt;, atomic&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;1&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;0&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;write script: &lt;code&gt;HSETNX&lt;/code&gt; + &lt;code&gt;HGET&lt;/code&gt; + &lt;code&gt;SET&lt;/code&gt;, atomic&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;4&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;0&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;With the write script: 0 ban lost.&lt;/strong&gt; On the primary, atomically, it only creates a version for a tag that has none, reads the current one, and writes the entry under it. It never writes back a version it read, which is exactly what &lt;code&gt;TagAwareAdapter&lt;/code&gt; has always done; Symfony loses 0 bans out of 1000 in the same test.&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;-- never write back a version we read: create it only if missing, then use the current one&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;redis.&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;HSETNX&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, KEYS[&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;], tag, defaultVersion)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;local&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; version &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; redis.&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;HGET&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, KEYS[&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;], tag)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;redis.&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;SET&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, CACHE_PREFIX &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; logicalKey &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; VERSION_SEPARATOR &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; version, value, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;EX&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, ttl)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The difference between the two commands is the whole fix. &lt;code&gt;HSET tag-versions T v1&lt;/code&gt; writes &lt;code&gt;v1&lt;/code&gt;, whatever the hash already holds: if a ban has just replaced the version, &lt;code&gt;HSET&lt;/code&gt; silently undoes it. &lt;code&gt;HSETNX&lt;/code&gt; (&amp;quot;set if not exists&amp;quot;) only writes when the tag has no version at all, and leaves an existing one untouched. A writer can therefore create the first version of a tag, but never overwrite the version a ban has set.&lt;/p&gt;
&lt;h2&gt;What trying taught me&lt;/h2&gt;
&lt;p&gt;This is the humbling section. Every item below was reproduced with a command of the lab, and every one of them was a bug or a blind spot of mine. Two have already been told above: reads that skipped the replicas (&lt;code&gt;EVAL_RO&lt;/code&gt;) and bans that got lost (the write script). The others:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;One expired entry made the following ones miss.&lt;/strong&gt; The first read script walked the &lt;code&gt;MGET&lt;/code&gt; results with an index that was only incremented on hits: if the entry of &lt;code&gt;b&lt;/code&gt; expired in a batch &lt;code&gt;a, b, c, d&lt;/code&gt;, &lt;code&gt;c&lt;/code&gt; and &lt;code&gt;d&lt;/code&gt; were recomputed too. The lab reproduced &lt;code&gt;[b, c, d]&lt;/code&gt; instead of &lt;code&gt;[b]&lt;/code&gt;; it now recomputes &lt;code&gt;[b]&lt;/code&gt; only.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Misses cost 4 round trips each&lt;/strong&gt;, not pipelined: 401 round trips for 100 misses, and 120 s to populate one million entries. With the write script: 2 round trips for 100 misses, 15 s for a million entries (&lt;code&gt;TagAwareAdapter&lt;/code&gt;: 11 s).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;null&lt;/code&gt; results were written and never read back.&lt;/strong&gt; The read side used &lt;code&gt;isset()&lt;/code&gt;, and &lt;code&gt;isset()&lt;/code&gt; is false for &lt;code&gt;null&lt;/code&gt;. Yes, the very bug I &lt;a href=&quot;https://jolicode.com/blog/battle-log-a-deep-dive-in-symfony-stack-in-search-of-optimizations-1-n&quot;&gt;wrote about in 2020&lt;/a&gt;. Entries without a tag had the same fate. Now neither is written.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Invalidation sent one command per tag&lt;/strong&gt;; it is now one script per chunk of tags.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The connection was taken from the pool by reflection&lt;/strong&gt;; it is now injected (see the appendix).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Still open:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Metadata never shrinks.&lt;/strong&gt; The &lt;code&gt;key-tags&lt;/code&gt; hash has no TTL and gets one field per logical key, forever.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;cache:pool:clear&lt;/code&gt; does not see these keys.&lt;/strong&gt; They are written with the raw client, outside of the pool namespace: in the lab, &lt;code&gt;cache:pool:clear --all&lt;/code&gt; left all of them in place.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A source change during a computation&lt;/strong&gt; stores the stale result under the new version. This one is shared with Symfony: both my class and &lt;code&gt;TagAwareAdapter&lt;/code&gt; serve &lt;code&gt;v2-computed-from-old-data&lt;/code&gt; in the lab. Only a lock, or a version check at write time, would fix it.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You know the famous quote from Phil Karlton: &amp;quot;There are only two hard things in Computer Science: cache invalidation and naming things.&amp;quot; I can confirm the first one. A cache looks like twenty lines of code, and the hard part is everything around them. Races between readers and invalidations, replicas that do not know your scripts, values that expire in the middle of a batch, metadata that grows forever, keys that &lt;code&gt;cache:pool:clear&lt;/code&gt; cannot see. Symfony Cache has years of bug reports and fixes behind it on exactly these points.&lt;/p&gt;
&lt;h2&gt;What Symfony gets right&lt;/h2&gt;
&lt;p&gt;Here is what the lab showed Symfony Cache doing well, often better than my class:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;One DSN, every topology.&lt;/strong&gt; Standalone, ElastiCache Serverless and a replicated cluster with the same pool configuration, replica routing included. My class only works on all three because it borrows Symfony&#039;s connection.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tag versioning without races.&lt;/strong&gt; &lt;code&gt;TagAwareAdapter&lt;/code&gt; bans in a number of commands that depends on the number of tags, not entries, and lost 0 bans out of 1000 where my first version lost more than half. I ended up copying its rule.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Writes.&lt;/strong&gt; &lt;code&gt;getItems()&lt;/code&gt; + &lt;code&gt;saveDeferred()&lt;/code&gt; + &lt;code&gt;commit()&lt;/code&gt; pipelines every write on a standalone server: a million entries in 11 s. My first version took 120 s; it took a Lua script to get down to 15 s.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Batching is already possible.&lt;/strong&gt; PSR-6 lets you load all misses at once: that alone took a cold request from 3.3 s to around 100 ms.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Compression is built in&lt;/strong&gt;, if you turn it on. &lt;code&gt;DeflateMarshaller&lt;/code&gt; divides the bytes by 3.5 (see &lt;a href=&quot;#compressing-values-off-by-default&quot;&gt;Compressing values&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Safe key prefixes by default, with an off switch.&lt;/strong&gt; Every pool prefixes its keys with a namespace, so two apps, two environments or two pools sharing one Redis can never overwrite each other&#039;s keys. The default namespace depends on the project directory, which cools the whole cache at each release on Capistrano-style deployments; one line of configuration, &lt;code&gt;prefix_seed&lt;/code&gt;, fixes it. Details in &lt;a href=&quot;#appendix-key-prefixes&quot;&gt;Appendix: key prefixes&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The details nobody thinks about.&lt;/strong&gt; Keys stay inside the pool namespace and &lt;code&gt;cache:pool:clear&lt;/code&gt; works; &lt;code&gt;null&lt;/code&gt; is a cacheable value; stampede protection and early expiration come with &lt;code&gt;get()&lt;/code&gt;; &lt;code&gt;RedisTagAwareAdapter&lt;/code&gt; refuses an eviction policy that would corrupt its tag sets, and recent releases recognize ElastiCache Serverless.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;What I asked for, and what happened next&lt;/h2&gt;
&lt;p&gt;The first draft of this post ended with a list of things I wished Symfony Cache had: the ones that would let me delete my class. I shared it with Nicolas Grekas in private, as a gist, on 22 October 2026. Nobody owed me an answer: Symfony is open source, I had gone my own way with a homemade class, and a wish list is easy to write.&lt;/p&gt;
&lt;p&gt;The next day, Nicolas had started opening pull requests. Thirteen so far, plus an RFC: in Symfony itself, in its documentation, and even in phpredis, to fix the round trips at their source rather than work around them. A batch API, smarter compression, bounded invalidation scripts, new documentation, and a few bugs found and fixed on the way. He did not just read the post: he checked it, took what was right, left what was not, and went further than I had asked.&lt;/p&gt;
&lt;p&gt;So before the list: thank you, Nicolas. That is an incredible amount of work, and I do not take any of it for granted, whatever ends up merged. It is exactly why I love this community: you show up with a problem, and people give their time to make the framework better for everybody.&lt;/p&gt;
&lt;p&gt;As of 10 November 2026, three of them change the story of this post:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;The batch loop becomes an API.&lt;/strong&gt; &lt;code&gt;BatchCache&lt;/code&gt; (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67371&quot;&gt;symfony#67371&lt;/a&gt;) fetches several keys and loads all the misses with one callback, on any PSR-6 pool, with an optional lock that reuses the stampede protection.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cluster reads get cheaper at the source.&lt;/strong&gt; Pipelining per node, in phpredis itself (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/phpredis/phpredis/pull/2963&quot;&gt;phpredis#2963&lt;/a&gt;) and in Symfony (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67353&quot;&gt;symfony#67353&lt;/a&gt;), would bring a cluster read from one round trip per slot down to one per node.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Big bans stop blocking.&lt;/strong&gt; &lt;code&gt;RedisTagAwareAdapter&lt;/code&gt; would invalidate big tags in bounded scripts (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67358&quot;&gt;symfony#67358&lt;/a&gt;), and the cost of a ban with each adapter is now documented (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony-docs/pull/23417&quot;&gt;symfony-docs#23417&lt;/a&gt;, merged, along with compression and &lt;code&gt;prefix_seed&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And it does not stop at Nicolas: Marcin Gil has since picked up the torch, with two libraries, three RFCs and a talk. Among other things, he proposes a tag-aware Redis adapter that versions its tags (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/issues/68050&quot;&gt;symfony#68050&lt;/a&gt;), which is the idea behind my class as a real adapter. Every pull request, what became of each of my wishes and these follow-ups are in &lt;a href=&quot;#appendix-every-pull-request&quot;&gt;Appendix: every pull request&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The new features are milestoned for Symfony 8.3, not 8.2. I have not re-run the lab against these branches: every number in this post describes Symfony 6.4.47, 8.1.9 and 8.2.x-dev as of 19 October.&lt;/p&gt;
&lt;h2&gt;So, can I delete my class?&lt;/h2&gt;
&lt;p&gt;Not yet, but that is the plan. Two things still keep it alive.&lt;/p&gt;
&lt;p&gt;The first one is measured: &lt;strong&gt;reads on a cluster&lt;/strong&gt;, in 1 round trip served by replicas instead of 100 to 200, by pinning the data to one slot and resolving &amp;quot;key → tag → version → value&amp;quot; in one Lua script. It only pays because of our workload (many keys per request on a Redis Cluster), and it costs the sharding of that data. The pull requests in review do not cover it yet: as written, &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/phpredis/phpredis/pull/2963&quot;&gt;phpredis#2963&lt;/a&gt; keeps sequential execution when reads go to replicas (&lt;code&gt;failover=slaves&lt;/code&gt;), which is our setup.&lt;/p&gt;
&lt;p&gt;The second one is only a possibility: &lt;strong&gt;choosing the next version&lt;/strong&gt; would let us compute the next workspace ahead of a switch. The class makes it possible; nobody has built it yet.&lt;/p&gt;
&lt;p&gt;Everything else, Symfony already does as well or better, and I only saw how much once I had tried to redo it myself. And what worked is on its way back: a batch &lt;code&gt;get()&lt;/code&gt;, cheaper cluster reads and bounded bans are in review for Symfony 8.3, and the rest is tracked in an RFC. The day they cover my case, replicas included, I delete &lt;code&gt;RedisCacheWithPreload&lt;/code&gt; and go back to 100 % Symfony Cache. I can&#039;t wait.&lt;/p&gt;
&lt;hr /&gt;
&lt;h2&gt;Appendix: every pull request&lt;/h2&gt;
&lt;p&gt;State as of 10 November 2026. Six of Nicolas&#039; pull requests and the RFC cite the draft; the seven others are tied to those by reference (a prerequisite, a follow-up, a bug found on the way). The kind is the one declared in each pull request, and the version is the branch it targets.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pull request&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Kind&lt;/th&gt;
&lt;th&gt;State&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67371&quot;&gt;symfony#67371&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;BatchCache&lt;/code&gt;: fetch several keys and load all the misses with one callback, on any PSR-6 pool; an optional lock key reuses the stampede protection&lt;/td&gt;
&lt;td&gt;new feature&lt;/td&gt;
&lt;td&gt;open (8.3)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67332&quot;&gt;symfony#67332&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;DeflateMarshaller&lt;/code&gt; skips small or incompressible values and accepts a compression level; nesting it is deprecated&lt;/td&gt;
&lt;td&gt;new feature, deprecation&lt;/td&gt;
&lt;td&gt;open (8.3)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67353&quot;&gt;symfony#67353&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;use native &lt;code&gt;RedisCluster&lt;/code&gt; pipelines when the extension has them (needs #67341 and &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/phpredis/phpredis/pull/2798&quot;&gt;phpredis#2798&lt;/a&gt;, by another contributor)&lt;/td&gt;
&lt;td&gt;new feature&lt;/td&gt;
&lt;td&gt;draft (8.3)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67407&quot;&gt;symfony#67407&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;keep the known tag versions when saving a value computed by &lt;code&gt;TagAwareAdapter::get()&lt;/code&gt;, so that a concurrent invalidation still applies&lt;/td&gt;
&lt;td&gt;new feature&lt;/td&gt;
&lt;td&gt;open (8.3)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67358&quot;&gt;symfony#67358&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;RedisTagAwareAdapter&lt;/code&gt; invalidates big tags in bounded scripts, so that other clients run between batches&lt;/td&gt;
&lt;td&gt;performance&lt;/td&gt;
&lt;td&gt;open (8.3)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67333&quot;&gt;symfony#67333&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;with Predis Cluster, bulk reads use one pipeline per node&lt;/td&gt;
&lt;td&gt;performance&lt;/td&gt;
&lt;td&gt;open (8.3)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67574&quot;&gt;symfony#67574&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;an item saved after a concurrent invalidation lost its tags and could never be invalidated by tag again&lt;/td&gt;
&lt;td&gt;bug fix&lt;/td&gt;
&lt;td&gt;merged (6.4), released in 6.4.49 and 8.1.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67341&quot;&gt;symfony#67341&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;lazy Redis proxies with the development version of phpredis&lt;/td&gt;
&lt;td&gt;bug fix&lt;/td&gt;
&lt;td&gt;draft (6.4)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67412&quot;&gt;symfony#67412&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Relay Cluster: clearing a pool could skip nodes&lt;/td&gt;
&lt;td&gt;bug fix&lt;/td&gt;
&lt;td&gt;merged (7.4)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67413&quot;&gt;symfony#67413&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Relay Cluster: same when pruning tags&lt;/td&gt;
&lt;td&gt;bug fix&lt;/td&gt;
&lt;td&gt;merged (8.2)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony-docs/pull/23417&quot;&gt;symfony-docs#23417&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;documents how to compress values, what a tag invalidation costs with each adapter, and &lt;code&gt;prefix_seed&lt;/code&gt; for deployments that change directory&lt;/td&gt;
&lt;td&gt;documentation&lt;/td&gt;
&lt;td&gt;merged (6.4)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony-docs/pull/23416&quot;&gt;symfony-docs#23416&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;documents the bounded invalidation of #67358&lt;/td&gt;
&lt;td&gt;documentation&lt;/td&gt;
&lt;td&gt;open (8.3)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/phpredis/phpredis/pull/2963&quot;&gt;phpredis#2963&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;RedisCluster::mget()&lt;/code&gt; sends its per-slot batches to each node before reading the replies&lt;/td&gt;
&lt;td&gt;performance&lt;/td&gt;
&lt;td&gt;open, not reviewed yet&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The RFC, &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/issues/67391&quot;&gt;symfony#67391&lt;/a&gt;, keeps track of three follow-ups: combining tag versions and Sets in &lt;code&gt;RedisTagAwareAdapter&lt;/code&gt;, preventing a stale computation from repopulating the cache after an invalidation, and prewarming the changed products while keeping the shared cache.&lt;/p&gt;
&lt;p&gt;And against my list, what became of each wish:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;A batch API&lt;/strong&gt;: one fetch, one callback for all the misses, one save, without writing the PSR-6 loop by hand. That is &lt;code&gt;BatchCache&lt;/code&gt; (#67371).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A way to put a pool in one slot&lt;/strong&gt;, since a pool cannot use hash tags. Not taken as such: the round trips are attacked from the other side, by pipelining per node (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/phpredis/phpredis/pull/2963&quot;&gt;phpredis#2963&lt;/a&gt;, &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67353&quot;&gt;#67353&lt;/a&gt;, &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67333&quot;&gt;#67333&lt;/a&gt;), which would bring a cluster read from one round trip per slot down to one per node. One caveat for my setup: as written, phpredis#2963 only applies with the default failover mode. Its documentation says that &amp;quot;other failover modes keep sequential execution&amp;quot;, so reads sent to replicas with &lt;code&gt;failover=slaves&lt;/code&gt; would not benefit yet.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Items and tag versions in one round trip.&lt;/strong&gt; Tracked in the RFC (first point).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Choosing the version on invalidation&lt;/strong&gt;, to compute entries ahead of a planned ban. The RFC takes the need from another angle (third point: prewarm what changed).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Document the cost of &lt;code&gt;RedisTagAwareAdapter&lt;/code&gt; bans.&lt;/strong&gt; Done: symfony-docs#23417 is merged, and #67358 goes further by bounding the pauses, at the price of a longer total invalidation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;UNLINK&lt;/code&gt; instead of &lt;code&gt;DEL&lt;/code&gt; in the invalidation script.&lt;/strong&gt; Not taken, and rightly so: one run each way gave 3.0 s against 2.4 s, still blocking. #67358 addresses the blocking itself.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Make compression visible.&lt;/strong&gt; Done: the same documentation pull request adds a &amp;quot;Compressing Cache Values&amp;quot; section, and #67332 makes the marshaller smarter.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Two things came out that I had not asked for. The race I listed as shared with Symfony (a source change during a computation) is the second point of the RFC and the subject of #67407. And a reader of the RFC reported a related bug in the Set-based adapters, which is now fixed (#67574).&lt;/p&gt;
&lt;p&gt;Since then, &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/marcing&quot;&gt;Marcin Gil&lt;/a&gt; picked up the torch. He published two libraries for Symfony Cache, &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/artigo-dev/versioned-cache&quot;&gt;&lt;code&gt;artigo/versioned-cache&lt;/code&gt;&lt;/a&gt; (tag invalidation in constant time, backed by Redis) and &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/artigo-dev/cache-stampede&quot;&gt;&lt;code&gt;artigo/cache-stampede&lt;/code&gt;&lt;/a&gt; (stampede protection across the whole fleet), and on 9 and 10 November he opened three RFCs to bring them into Symfony, plus a first pull request, all open:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/issues/68050&quot;&gt;symfony#68050&lt;/a&gt; follows the first point of the RFC: a tag-aware Redis adapter that versions its tags, so that an invalidation does not walk the entries, while reads keep the round trips of &lt;code&gt;RedisTagAwareAdapter&lt;/code&gt;. That is the idea behind my class, as a real adapter.&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/issues/68051&quot;&gt;symfony#68051&lt;/a&gt; and &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/issues/68052&quot;&gt;symfony#68052&lt;/a&gt; go further than anything in this post: a stampede protection that spans all the servers, and serving the old value while one request refreshes it (stale-while-revalidate).&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/68083&quot;&gt;symfony#68083&lt;/a&gt; follows #67332 with a &lt;code&gt;ZstdMarshaller&lt;/code&gt;, milestoned for 8.3.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;He also tells the whole road, from a file cache to versioned Redis, in an excellent talk: &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://artigo-dev.github.io/cache-talk/&quot;&gt;Teaching Websites When to Forget&lt;/a&gt; (slides online, for rg-dev #69 on 25 November 2026).&lt;/p&gt;
&lt;p&gt;I have not tested any of them. But a wish list shared in private turning into this many proposals, from several people, is the best outcome I could hope for.&lt;/p&gt;
&lt;h2&gt;Appendix: DSN and connections&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Topologies.&lt;/strong&gt; &lt;code&gt;AbstractAdapter::createConnection()&lt;/code&gt; wraps the client in Symfony&#039;s lazy &lt;code&gt;RedisProxy&lt;/code&gt; / &lt;code&gt;RedisClusterProxy&lt;/code&gt;. &lt;code&gt;failover=slaves&lt;/code&gt; maps to phpredis&#039; &lt;code&gt;RedisCluster::OPT_SLAVE_FAILOVER = FAILOVER_DISTRIBUTE_SLAVES&lt;/code&gt; (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/cache/blob/1d70b5557fdf9cba0a31f2a5caa4f66a7b85d62b/Traits/RedisTrait.php#L450-L455&quot;&gt;RedisTrait.php#L450-L455&lt;/a&gt;); &lt;code&gt;failover=distribute&lt;/code&gt; spreads reads over primaries and replicas instead (about 50 % on replicas in the lab).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ElastiCache Serverless is a special case: AWS documents that it surfaces &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/RedisConfiguration.html&quot;&gt;every slot on a single virtual node&lt;/a&gt; and serves replica reads on &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/ReadReplicas.html&quot;&gt;a separate port, 6380&lt;/a&gt;. The lab cannot reproduce that, so everything in this post about replicas applies to the provisioned cluster, not to Serverless.&lt;/li&gt;
&lt;li&gt;Since Symfony 7.3 the options are named &lt;code&gt;cluster&lt;/code&gt; and &lt;code&gt;sentinel&lt;/code&gt;; &lt;code&gt;redis_cluster&lt;/code&gt; and &lt;code&gt;redis_sentinel&lt;/code&gt; remain accepted aliases (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/cache/blob/1d70b5557fdf9cba0a31f2a5caa4f66a7b85d62b/Traits/RedisTrait.php#L200-L213&quot;&gt;RedisTrait.php#L200-L213&lt;/a&gt;). 7.3 also added the &lt;code&gt;valkey://&lt;/code&gt; scheme. 8.2 introduces a &lt;code&gt;CacheBundle&lt;/code&gt; that provides the &lt;code&gt;cache&lt;/code&gt; configuration previously found under &lt;code&gt;framework.cache&lt;/code&gt;, with a new &lt;code&gt;cache.default_provider&lt;/code&gt; option. The &lt;code&gt;framework.cache&lt;/code&gt; configuration above still worked unchanged on 8.2.x-dev in the lab.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;failover&lt;/code&gt; only exists for cluster clients (and Predis replication). With a non-clustered primary plus a reader endpoint and phpredis, Symfony has no way to send reads to the reader: declare a second pool with the reader DSN.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Getting the connection.&lt;/strong&gt; My first version read the private &lt;code&gt;redis&lt;/code&gt; property of the &lt;code&gt;RedisAdapter&lt;/code&gt; with a bound closure (and unwrapped &lt;code&gt;TraceableAdapter&lt;/code&gt; in debug mode):&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;// don&#039;t do this&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$getter &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; fn&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; ($name) =&gt; &lt;/span&gt;&lt;span class=&quot;syntax-11&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;$name;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$redis &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $getter&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;($pool, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;redis&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It works, but it depends on a private property name, on the decoration chain, and phpstan rightly hates it. Symfony already exposes the connection as a service. &lt;code&gt;framework.cache.default_redis_provider&lt;/code&gt; is turned into a connection service built by &lt;code&gt;AbstractAdapter::createConnection($dsn, [&#039;lazy&#039; =&amp;gt; true])&lt;/code&gt;, aliased as &lt;code&gt;cache.default_redis_provider&lt;/code&gt;, and that is the very object the Redis pools receive (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/cache/blob/1d70b5557fdf9cba0a31f2a5caa4f66a7b85d62b/DependencyInjection/CachePoolPass.php#L290-L306&quot;&gt;CachePoolPass.php#L290-L306&lt;/a&gt;). Inject it:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; function&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt; __construct&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    #[Autowire(service: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;cache.default_redis_provider&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;)]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    private&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; readonly&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; \&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;Redis&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;|\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;RedisCluster&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $redis,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The lab checks it with &lt;code&gt;lab:conn&lt;/code&gt;: on 6.4, 8.1 and 8.2, standalone and cluster, the injected object and the one hidden in the pool are the same instance (&lt;code&gt;spl_object_id&lt;/code&gt; included), so there is still a single connection per DSN. For a second Redis with its own DSN, declare the connection as a named service and give it to the pool as its provider, so that both share it:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    app.redis.secondary&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        class&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;Redis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        factory&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;Symfony\Component\Cache\Adapter\RedisAdapter&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;createConnection&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        arguments&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;%env(SECONDARY_REDIS_DSN)%&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, { &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;lazy&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; }]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;framework&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    cache&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        pools&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;            app.cache.secondary&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;                adapter&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;cache.adapter.redis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;                provider&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;app.redis.secondary&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;class&lt;/code&gt; only matters for autowiring: with a cluster DSN the factory returns a &lt;code&gt;\RedisCluster&lt;/code&gt; proxy, hence the union type in the constructor.&lt;/p&gt;
&lt;h2&gt;Appendix: compression&lt;/h2&gt;
&lt;p&gt;Measured with &lt;code&gt;lab:payload&lt;/code&gt; on 1000 fixture models:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;encoding&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;bytes per model&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;ratio&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;µs to compress&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;µs to decompress&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;serialize()&lt;/code&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;2609&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;1.00&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;-&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;-&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;gzdeflate()&lt;/code&gt;, level 1&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;786&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;3.32&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;35&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;14&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;gzdeflate()&lt;/code&gt;, default level 6&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;743&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;3.51&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;43&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;12&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;On the standalone instance, a warm &lt;code&gt;getItems()&lt;/code&gt; of 100 models went from 0.8 to 2.9 ms p50 once compressed; writes pay 43 µs per value, once. Level 1 compresses almost as well as the default level for less CPU. Without any configuration, Symfony&#039;s &lt;code&gt;DefaultMarshaller&lt;/code&gt; only serializes (with igbinary when available): compression is always opt-in, either by decorating &lt;code&gt;cache.default_marshaller&lt;/code&gt; as shown above, or per pool with the &lt;code&gt;marshaller&lt;/code&gt; option since FrameworkBundle 8.1. phpredis can compress natively too (&lt;code&gt;lzf&lt;/code&gt;, &lt;code&gt;zstd&lt;/code&gt;, &lt;code&gt;lz4&lt;/code&gt;, when compiled with them), but &lt;code&gt;RedisTagAwareAdapter&lt;/code&gt; refuses that and asks for &lt;code&gt;DeflateMarshaller&lt;/code&gt; instead (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/cache/blob/1d70b5557fdf9cba0a31f2a5caa4f66a7b85d62b/Adapter/RedisTagAwareAdapter.php#L76-L84&quot;&gt;RedisTagAwareAdapter.php#L76-L84&lt;/a&gt;).&lt;/p&gt;
&lt;h2&gt;Appendix: bans&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;DEL&lt;/code&gt; or &lt;code&gt;UNLINK&lt;/code&gt;?&lt;/strong&gt; &lt;code&gt;TagAwareAdapter&lt;/code&gt; deletes its tag version keys through &lt;code&gt;doDelete()&lt;/code&gt;, which uses &lt;code&gt;UNLINK&lt;/code&gt; and only falls back to &lt;code&gt;DEL&lt;/code&gt; if &lt;code&gt;UNLINK&lt;/code&gt; fails (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/cache/blob/1d70b5557fdf9cba0a31f2a5caa4f66a7b85d62b/Traits/RedisTrait.php#L691-L723&quot;&gt;RedisTrait.php#L691-L723&lt;/a&gt;). The entries deleted inside &lt;code&gt;RedisTagAwareAdapter&lt;/code&gt;&#039;s Lua script are deleted with &lt;code&gt;DEL&lt;/code&gt;. Valkey 8 ships with &lt;code&gt;lazyfree-lazy-user-del yes&lt;/code&gt; (that is what &lt;code&gt;CONFIG GET&lt;/code&gt; returns in the lab), so there &lt;code&gt;DEL&lt;/code&gt; already frees memory the way &lt;code&gt;UNLINK&lt;/code&gt; does. With lazy freeing disabled, like Redis&#039; default, I patched the script to use &lt;code&gt;UNLINK&lt;/code&gt; and ran the 1000 × 1000 ban once each way: 3.0 s and a 85 ms median &lt;code&gt;PING&lt;/code&gt; with &lt;code&gt;DEL&lt;/code&gt;, 2.4 s and 71 ms with &lt;code&gt;UNLINK&lt;/code&gt;. One run each, so read it as &amp;quot;a bit better&amp;quot;, not as a fix: what blocks the server is walking a million keys inside one script, not freeing them.&lt;/p&gt;
&lt;p&gt;This is also why the median &lt;code&gt;PING&lt;/code&gt; here (85 ms with &lt;code&gt;DEL&lt;/code&gt;) is higher than the 58.6 ms of the main table: that one was measured with Valkey&#039;s default, lazy freeing enabled.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ElastiCache Serverless.&lt;/strong&gt; &lt;code&gt;RedisTagAwareAdapter&lt;/code&gt; refuses to save when it cannot detect a &lt;code&gt;volatile-*&lt;/code&gt; or &lt;code&gt;noeviction&lt;/code&gt; eviction policy, and ElastiCache Serverless does not report its policy. In the versions I first tested, 6.4.47 and 8.1.9, the policy resolves to an empty string and &lt;code&gt;doSave()&lt;/code&gt; throws; I could not reproduce Serverless locally, so this comes from reading the code. It was fixed as a bug on the 6.4 branch (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/symfony/pull/67036&quot;&gt;symfony#67036&lt;/a&gt;, merged on 18 October 2026, a few days before I shared the draft): 6.4.49 and 8.1.10 contain the detection (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/cache/blob/1d70b5557fdf9cba0a31f2a5caa4f66a7b85d62b/Adapter/RedisTagAwareAdapter.php#L404-L416&quot;&gt;RedisTagAwareAdapter.php#L404-L416&lt;/a&gt;).&lt;/p&gt;
&lt;h2&gt;Appendix: key prefixes&lt;/h2&gt;
&lt;p&gt;Every pool prefixes its keys with a namespace, a hash of three things (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/cache/blob/1d70b5557fdf9cba0a31f2a5caa4f66a7b85d62b/DependencyInjection/CachePoolPass.php#L42-L85&quot;&gt;CachePoolPass.php#L42-L85&lt;/a&gt;):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;framework.cache.prefix_seed&lt;/code&gt;, which defaults to &lt;code&gt;_%kernel.project_dir%.%kernel.container_class%&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;the pool name;&lt;/li&gt;
&lt;li&gt;the adapter class.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The project directory is the catch. The kernel finds it from the real path of its own file (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/dependency-injection/blob/1ded174fe1efc97b78d9a5ce5220f2bb639ed1f4/Kernel/AbstractKernel.php#L194-L214&quot;&gt;AbstractKernel.php#L194-L214&lt;/a&gt;), and PHP resolves symlinks when it loads a file:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;deployment&lt;/th&gt;
&lt;th&gt;project directory seen by Symfony&lt;/th&gt;
&lt;th&gt;namespace across releases&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Docker image, always run from &lt;code&gt;/app&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/app&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;stable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Capistrano-style, served through &lt;code&gt;current&lt;/code&gt; → &lt;code&gt;releases/&amp;lt;date&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;releases/&amp;lt;date&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;new at each release&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;In the lab, the same code booted through &lt;code&gt;current&lt;/code&gt; wrote &lt;code&gt;lAsiso3rNA:product-42&lt;/code&gt; while &lt;code&gt;current&lt;/code&gt; pointed to &lt;code&gt;releases/20261020-1200&lt;/code&gt;, then &lt;code&gt;+HI-rSPH5a:product-42&lt;/code&gt; once it pointed to &lt;code&gt;releases/20261022-0900&lt;/code&gt;. Every release starts with a cold cache, and the previous one&#039;s keys linger until their TTL.&lt;/p&gt;
&lt;p&gt;The fix is one line, and the default &lt;code&gt;framework.yaml&lt;/code&gt; even ships it commented out:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;framework&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    cache&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        prefix_seed&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;my-app/%kernel.environment%&#039;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;How the lab works&lt;/h2&gt;
&lt;p&gt;Versions: Symfony 6.4.47 (what runs in production), 8.1.9 and 8.2.x-dev (commit &lt;code&gt;1d70b55&lt;/code&gt; of 2026-10-19), phpredis 6.3.0, PHP 8.5, Valkey 8.1.&lt;/p&gt;
&lt;p&gt;The lab lives next to this post: a Docker Compose stack with a standalone Valkey, a 3-shard Valkey Cluster with one replica per shard, a fake slow HTTP service, and a tiny Symfony app that switches between the three Symfony versions. Every number comes from one of its commands: &lt;code&gt;./run &amp;lt;dev|serverless|prod&amp;gt; &amp;lt;64|81|82&amp;gt; lab:read&lt;/code&gt;, &lt;code&gt;lab:ban&lt;/code&gt;, &lt;code&gt;lab:race&lt;/code&gt;, &lt;code&gt;lab:bugs&lt;/code&gt;, &lt;code&gt;lab:dsn&lt;/code&gt;, &lt;code&gt;lab:conn&lt;/code&gt;, &lt;code&gt;lab:payload&lt;/code&gt;. The &lt;code&gt;prod&lt;/code&gt; target uses the production DSN options (&lt;code&gt;failover=slaves&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Round trips are counted on the server side (&lt;code&gt;total_reads_processed&lt;/code&gt; and &lt;code&gt;INFO commandstats&lt;/code&gt; on every node, with tiny payloads so that one request burst is one socket read); timings come from a local Docker network with no added latency. It runs on one machine, so absolute timings are optimistic; round trips and command counts are the numbers that carry over.&lt;/p&gt;

        </content>
    </entry>    <entry>
        <id>https://jolicode.com/blog/secret-santa-in-2026-exclusions-slack-connect-and-a-fresh-coat-of-paint</id>
        <published>2026-11-12T15:42:00+01:00</published>
        <updated>2026-11-12T15:42:00+01:00</updated>
        <link type="text/html" rel="alternate" href="https://jolicode.com/blog/secret-santa-in-2026-exclusions-slack-connect-and-a-fresh-coat-of-paint"/>
        <title>Secret Santa in 2026: exclusions, Slack Connect, and a fresh coat of paint</title>
        <author>
            <name>JoliCode Team</name>
            <uri>https://jolicode.com/</uri>
        </author>            <category term="christmas" />            <category term="open-source" />            <category term="secret-santa" />            <reactions:summary total="4">                <reactions:reaction emoji="❤️" shortname="heart" count="2"/>                <reactions:reaction emoji="🤯" shortname="mindblown" count="1"/>                <reactions:reaction emoji="👏" shortname="clapclap" count="1"/>            </reactions:summary>
        <summary><![CDATA[Every year since 2015, right when the first fairy lights go up, Secret Santa comes out of hibernation. The idea has not changed: sign in with Slack, Discord or Webex, pick the participants, and everyone…]]></summary>
        <content type="html">
            &lt;p&gt;Every year since 2015, right when the first fairy lights go up, &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://secret-santa.team/&quot;&gt;Secret Santa&lt;/a&gt; comes out of hibernation. The idea has not changed: sign in with Slack, Discord or Webex, pick the participants, and everyone gets a private message with the name of the person they will be buying a gift for. No account, no sign-up, no ads, and no database either: the draw lives in your session and is gone a few hours later.&lt;/p&gt;
&lt;p&gt;Ten years in, the counter shows a bit more than 30,000 draws and 300,000 participants since we started counting (October 2019), with a record of 474 people in a single draw. Every November, the app takes around 1,500 draws, more than the first nine months of the year combined (not exactly a shock, I know 🙃).&lt;/p&gt;
&lt;p&gt;On the code side, 2026 has been the busiest year for the repository since 2021. Two requests opened in 2019 finally got closed: keeping certain pairs apart in the draw, and letting people from several companies take part. The site got a new look, and under the hood we took the opportunity to bring the whole stack up to date.&lt;/p&gt;
&lt;p&gt;Here is a tour of what is new: first the things you will notice when running your draw, then the ones only contributors will care about. To keep you reading until the end: one of these features shipped, got switched off two days later, and waited nearly ten months before coming back for good.&lt;/p&gt;
&lt;h2&gt;One draw across several Slack workspaces&lt;/h2&gt;
&lt;p&gt;The idea was simple, and the request dated back to 2019: run a draw with participants from different Slack organizations. Rather than making the app more complex (say, with a separate login for every organization you want to include), we built on &lt;strong&gt;Slack Connect&lt;/strong&gt;, the native Slack feature for sharing channels between organizations. In our case, we share our Slack (and our office) with &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.premieroctet.com/&quot;&gt;Premier Octet&lt;/a&gt; so this would be perfect for us.&lt;/p&gt;
&lt;p&gt;The organizer of the Secret Santa is now able to add to their draw every external member they share at least one channel with.&lt;/p&gt;
&lt;p&gt;In practice, right after signing in with Slack, a new &amp;quot;Channels&amp;quot; step comes before the participant list. Two modes sit side by side:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the whole workspace, as before (so only the members of your own workspace);&lt;/li&gt;
&lt;li&gt;only the members of the channels you select. A channel shared with another workspace brings all of its members along, whether they belong to your organization or not.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/secret-santa-2026/channels.png&quot; data-original-width=&quot;1280&quot; data-original-height=&quot;1340&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/secret-santa-2026/channels.b93e8b97.webp&quot; /&gt;&lt;source type=&quot;image/png&quot; srcset=&quot;/media/cache/content/2026/secret-santa-2026/channels.png&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(1280 / 1340)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/secret-santa-2026/channels.png&quot; alt=&quot;The channel selection step&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;Simple on paper. In practice, Slack has a permission model that has to be followed to the letter, and we learned three things along the way.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The list of channels has to be the admin&#039;s, not the organization&#039;s&lt;/strong&gt;: We call &lt;code&gt;users.conversations&lt;/code&gt; for the signed-in user: they only see the channels they are a member of, and private ones only when the bot has been invited too. That is Slack&#039;s privacy model, and rightly so: Secret Santa must not let you list people you could not see yourself.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A bot can only message an external user if it shares a channel with them&lt;/strong&gt;: If you select a shared channel where Secret Santa has not been invited yet, the app tells you, explains what to do, and lets you refresh the page once the invitation is done. Another subtlety: posting straight to an external user&#039;s id fails with &lt;code&gt;channel_not_found&lt;/code&gt;. You first have to open a DM with &lt;code&gt;conversations.open&lt;/code&gt;, then post to the conversation you get back.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New scopes do not apply retroactively&lt;/strong&gt;: This feature needs four more permissions on the Slack app (&lt;code&gt;channels:read&lt;/code&gt;, &lt;code&gt;groups:read&lt;/code&gt;, &lt;code&gt;im:write&lt;/code&gt;, &lt;code&gt;team:read&lt;/code&gt;). A workspace that approved the previous version of the app signs its users in with a token that lacks them, and we found out on our preprod with a lovely 500 on the channels step. The granted scopes are now checked at sign-in, with a message asking a workspace admin to approve the new permissions.&lt;/p&gt;
&lt;p&gt;External members, missing from &lt;code&gt;users.list&lt;/code&gt;, are loaded through &lt;code&gt;users.info&lt;/code&gt; in batches of 25, inside the existing loading loop that already shows a progress bar for big teams. Every selected channel also becomes a group on the participants page, so you can tick or untick a whole team in one click.&lt;/p&gt;
&lt;p&gt;On to the second long-standing request.&lt;/p&gt;
&lt;h2&gt;Exclusions, for real this time&lt;/h2&gt;
&lt;p&gt;It is one of the most requested features of the project, and that ticket also dated back to late 2019: preventing certain pairings. A couple who would rather not draw each other, a manager and their team, two people who already exchanged gifts last year. The important part is to never reveal the draw itself: you declare rules, not results.&lt;/p&gt;
&lt;p&gt;We shipped it at the end of October 2025, just before the season, for our own internal draw. And we switched it off two days later 😝. The draw was correct in the strict sense, everyone gave to someone and received from exactly one person, but the algorithm could produce &lt;strong&gt;several loops&lt;/strong&gt;: Alice gives to Bob who gives to Alice, and the other eight form a second circle of their own. Technically valid, humanly disappointing: to me, the charm of a Secret Santa is that everyone is linked in one big chain.&lt;/p&gt;
&lt;p&gt;Without exclusions, the problem does not exist: shuffle the list, everyone gives to the next person, the last one gives to the first. One single circle, by construction. As soon as you forbid some pairs, that trick stops working: the next person in the list may be exactly the one you excluded, and you need an order that avoids every forbidden pair while still closing the loop on the first person.&lt;/p&gt;
&lt;p&gt;The version running since August 2026 builds the circle step by step. Start with one person, pick at random an allowed receiver among those not yet in the chain, and continue from that receiver. When you hit a dead end, someone whose every possible receiver is already taken, step back one notch and try another choice. Once everyone is in, the last person still has to be allowed to give to the first, otherwise step back again. The randomness at every step guarantees that two draws with the same participants and the same exclusions do not give the same result.&lt;/p&gt;
&lt;p&gt;For the curious, the fancy name for what we are looking for is a &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://en.wikipedia.org/wiki/Hamiltonian_path&quot;&gt;Hamiltonian cycle&lt;/a&gt; in the graph of allowed pairings, and the &amp;quot;try, get stuck, step back&amp;quot; method is called &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://en.wikipedia.org/wiki/Backtracking&quot;&gt;backtracking&lt;/a&gt;. Nothing new under the tree, but it helps to know what to search for.&lt;/p&gt;
&lt;p&gt;This kind of search can blow up on twisted exclusions, say one person excluded by almost everyone. Rather than letting PHP grind until the timeout, we count the attempts and give up past 100,000, then restart from another starting point, ten times at most. If nothing comes out, the organizer gets a clear message inviting them to review their exclusions, instead of an error page.&lt;/p&gt;
&lt;p&gt;A randomized test locks it all down: it generates participants, hides a valid circle among arbitrary exclusions, and checks that the result always forms a single loop.&lt;/p&gt;
&lt;p&gt;Since the feature came back, more than 180 draws have used exclusions. And for big draws, the dialog to add an exclusion was reworked in October: search by name, and multi-select in one click.&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/secret-santa-2026/exclusions.png&quot; data-original-width=&quot;1280&quot; data-original-height=&quot;801&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/secret-santa-2026/exclusions.308b759f.webp&quot; /&gt;&lt;source type=&quot;image/png&quot; srcset=&quot;/media/cache/content/2026/secret-santa-2026/exclusions.png&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(1280 / 801)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/secret-santa-2026/exclusions.png&quot; alt=&quot;The exclusions step&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;h2&gt;A new look&lt;/h2&gt;
&lt;p&gt;The design had barely moved since the early days, and it was starting to show: tomato red, emoji snowflakes and gifts, a screenshot of the app as the hero illustration, and a &amp;quot;Why do I need this app?&amp;quot; section telling our life story. The whole site has been redone, public pages as well as the draw flow and the error pages.&lt;/p&gt;
&lt;p&gt;The new red is deeper and flat, no gradient, no pattern. The rest of the page is white, with soft-shadowed cards for content blocks, and yellow for the accents: the &amp;quot;free, open-source, no registration&amp;quot; badges, the &amp;quot;your team&amp;quot; in the title, the icons of the three promises at the bottom of the page. The hero shows the actual private message a participant receives, rather than a screenshot of the interface. The emoji gave way to a numbered timeline walking through the five steps, exclusions included, with a real slice of the interface for each. The draw flow swaps its chevron breadcrumb for a stepper with numbered dots.&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/secret-santa-2026/home-avant-apres.png&quot; data-original-width=&quot;1800&quot; data-original-height=&quot;2634&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/secret-santa-2026/home-avant-apres.f76fff7d.webp&quot; /&gt;&lt;source type=&quot;image/png&quot; srcset=&quot;/media/cache/content/2026/secret-santa-2026/home-avant-apres.png&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(1800 / 2634)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/secret-santa-2026/home-avant-apres.png&quot; alt=&quot;The homepage, before and after&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;A facelift is also the right time for an accessibility audit. We ran one on the new design before putting it online, and it fixed several things we would not have spotted on our own: links inside text are underlined again, the content sits in a proper &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt;, the secondary text on red and the light gray pass the AA contrast ratio, the menu targets are 44 pixels tall, and external links announce that they open a new tab.&lt;/p&gt;
&lt;h2&gt;The small things that matter&lt;/h2&gt;
&lt;p&gt;Beyond the three big projects, a handful of fixes that make organizers&#039; lives easier:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;sending no longer stops at the first failure.&lt;/strong&gt; One participant refusing private messages on Discord blocked everyone after them in the list, and the finish page showed all of them as &amp;quot;not received yet&amp;quot; while only one had actually been tried. That Discord ticket dated back to 2023. Sending now keeps going, and &amp;quot;Retry&amp;quot; only retries the failures;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;a real page when the OAuth sign-in fails.&lt;/strong&gt; When Slack or Discord answered with an error during the token exchange, we showed our generic error page, as if the app had crashed. The failure is almost always transient and on the provider&#039;s side: the new page says so in plain words, offers to try again, and gives the cause in understandable terms;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;starting over from the homepage really starts over.&lt;/strong&gt; A draw abandoned halfway left its context in the session, and the homepage button sent you straight to the participants step, with the channels from last time. Every new draw now goes through the first step again;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;the privacy policy now spells out what we collect&lt;/strong&gt;, and what we do not do with it. A good occasion to repeat the principle that has not changed in ten years: the app has no database. The participant list, the message and the result of the draw live in your session, stored in Redis for three hours, then everything is wiped. Only anonymous counters remain. We now show the total number of draws on the homepage, by the way.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Under the hood&lt;/h2&gt;
&lt;p&gt;And for those who get their hands into the code, we cleaned up there too.&lt;/p&gt;
&lt;h3&gt;The whole stack up to date&lt;/h3&gt;
&lt;p&gt;The app now runs on PHP 8.5 and Symfony 8.1. The two upgrades came together, somewhat forced: Symfony 8.0 was reaching end of life with an unpatched CVE on &lt;code&gt;http-foundation&lt;/code&gt;, and phpspec 8.1 refused PHP 8.5. We took the opportunity to drop the homemade forks of a few dependencies we had been dragging along for years, and to bring the local Docker stack in line with our &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/docker-starter&quot;&gt;docker-starter&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;AssetMapper instead of inline scripts&lt;/h3&gt;
&lt;p&gt;Until now, the frontend was &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; blocks in the Twig templates and libraries vendored by hand in &lt;code&gt;public/&lt;/code&gt;. Everything moved to &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://symfony.com/doc/current/frontend/asset_mapper.html&quot;&gt;AssetMapper&lt;/a&gt;: one ES module per page plus shared helpers, data passed through &lt;code&gt;data-*&lt;/code&gt; attributes, one stylesheet per family of pages, and Bugsnag or flatpickr declared in the importmap and downloaded at install time. Every file is versioned with a digest in its name, which let us delete our homemade asset versioning.&lt;/p&gt;
&lt;p&gt;Our &lt;abbr title=&quot;Content Security Policy&quot;&gt;CSP&lt;/abbr&gt; is strict: a script only runs if it carries the nonce generated for the request, and nothing loads from a third-party domain. AssetMapper did not plan for that in two places:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;by default, it injects into the page a polyfill for browsers that do not understand importmaps, loaded from a CDN. The CSP blocks it, and anyway every browser we support understands importmaps natively: we disabled it. The other generated &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags get the nonce through the option built for that in the &lt;code&gt;importmap()&lt;/code&gt; Twig function;&lt;/li&gt;
&lt;li&gt;an &lt;code&gt;import &#039;./style.css&#039;&lt;/code&gt; in a JavaScript module is turned by AssetMapper into a fake module that appends the stylesheet to the document, served as a &lt;code&gt;data:&lt;/code&gt; URL. Again, the CSP says no. Library stylesheets, flatpickr&#039;s in our case, are therefore linked the classic way with a &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; in the template rather than imported from JavaScript.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;c-alert c-alert--note&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 70 71&quot;&gt;&lt;path fill-rule=&quot;nonzero&quot; d=&quot;M35 .9c19.3 0 35 15.7 35 35s-15.7 35-35 35-35-15.7-35-35S15.7.9 35 .9m0 5c-16.552 0-30 13.449-30 30s13.448 30 30 30c16.552.103 30-13.448 30-30 0-16.551-13.448-30-30-30m0 24.9c1.7 0 3 1.3 3 3v15.3c0 1.7-1.3 3-3 3s-3-1.3-3-3V33.8c0-1.7 1.3-3 3-3m0-11c.8 0 1.6.3 2.3.9.6.5.9 1.3.9 2.1 0 .2-.1.4-.1.6-.1.2-.1.4-.2.6s-.2.3-.3.5-.3.4-.4.5c-1.1 1.1-3.1 1.1-4.2 0-.2-.2-.3-.3-.4-.5s-.2-.3-.3-.5-.2-.4-.2-.6c-.1-.2-.1-.4-.1-.6 0-.8.3-1.6.9-2.1.5-.6 1.3-.9 2.1-.9&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Info&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
Clever Cloud, which kindly hosts the app, runs &lt;code&gt;composer install&lt;/code&gt; with &lt;code&gt;--no-scripts&lt;/code&gt;. The &lt;code&gt;importmap:install&lt;/code&gt; and &lt;code&gt;asset-map:compile&lt;/code&gt; commands therefore run in a post-build hook, declared through the &lt;code&gt;CC_POST_BUILD_HOOK&lt;/code&gt; environment variable.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;h3&gt;End-to-end tests, screenshots included&lt;/h3&gt;
&lt;p&gt;The project had unit and functional tests, but nothing ran a complete draw in a real browser. That is now done with &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/playwright-php/playwright&quot;&gt;playwright-php&lt;/a&gt;: a full journey for each of the three platforms, against mocked APIs, from sign-in to the finish page.&lt;/p&gt;
&lt;p&gt;And since we were about to redo the whole design, we added visual regression tests just before: full-page screenshots of every step and every public page, compared with references versioned in the repository. Our &lt;a href=&quot;https://jolicode.com//blog/detecter-les-regressions-visuelles-dans-la-ci-avec-playwright-et-docker&quot;&gt;previous article&lt;/a&gt; (in French) detailed the method with the Node version of Playwright. At the time, playwright-php had no equivalent of &lt;code&gt;toHaveScreenshot()&lt;/code&gt;, so the comparison is done in PHP with gd. A fast path when the files are byte-identical, otherwise a pixel-by-pixel diff with a small tolerance, and the expected, actual and diff images uploaded as a CI artifact when it breaks.&lt;/p&gt;

&lt;div class=&quot;c-alert c-alert--note&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 70 71&quot;&gt;&lt;path fill-rule=&quot;nonzero&quot; d=&quot;M35 .9c19.3 0 35 15.7 35 35s-15.7 35-35 35-35-15.7-35-35S15.7.9 35 .9m0 5c-16.552 0-30 13.449-30 30s13.448 30 30 30c16.552.103 30-13.448 30-30 0-16.551-13.448-30-30-30m0 24.9c1.7 0 3 1.3 3 3v15.3c0 1.7-1.3 3-3 3s-3-1.3-3-3V33.8c0-1.7 1.3-3 3-3m0-11c.8 0 1.6.3 2.3.9.6.5.9 1.3.9 2.1 0 .2-.1.4-.1.6-.1.2-.1.4-.2.6s-.2.3-.3.5-.3.4-.4.5c-1.1 1.1-3.1 1.1-4.2 0-.2-.2-.3-.3-.4-.5s-.2-.3-.3-.5-.2-.4-.2-.6c-.1-.2-.1-.4-.1-.6 0-.8.3-1.6.9-2.1.5-.6 1.3-.9 2.1-.9&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Info&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
Five days after our merge, playwright-php 1.6.0 shipped exactly that assertion, baselines, masks and diff images included. Our homemade trait will have lived a month, and that is fine by us: the next step is to delete it.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The references are rendered by a Chromium installed in the Docker image, so they are only reproducible from there, and a Castor task regenerates them after an intended UI change. The redesign was the first to benefit: every page was reviewed screenshot by screenshot before going to production.&lt;/p&gt;
&lt;h2&gt;Wrapping up&lt;/h2&gt;
&lt;p&gt;Here is what 2026 brought to Secret Santa:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;exclusions that guarantee a single circle, with an algorithm that knows how to step back when it gets stuck;&lt;/li&gt;
&lt;li&gt;draws across several Slack workspaces through shared channels, while respecting Slack&#039;s permission model;&lt;/li&gt;
&lt;li&gt;a design brought up to date;&lt;/li&gt;
&lt;li&gt;sending that no longer stops at the first stubborn participant;&lt;/li&gt;
&lt;li&gt;PHP 8.5, Symfony 8.1, AssetMapper, and an end-to-end test suite with visual regression so we never ship a broken step without noticing.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The code is &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/secret-santa&quot;&gt;on GitHub&lt;/a&gt; under the MIT license, the issues are open, and if your team uses Secret Santa, the &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://secret-santa.team/hall-of-fame&quot;&gt;Hall of Fame&lt;/a&gt; is waiting for you. Happy drawing 🎁&lt;/p&gt;

        </content>
    </entry>    <entry>
        <id>https://jolicode.com/blog/secret-santa-2026-slack-connect-exclusions-et-un-coup-de-neuf</id>
        <published>2026-11-12T15:42:00+01:00</published>
        <updated>2026-11-12T15:42:00+01:00</updated>
        <link type="text/html" rel="alternate" href="https://jolicode.com/blog/secret-santa-2026-slack-connect-exclusions-et-un-coup-de-neuf"/>
        <title>Secret Santa 2026 : Slack Connect, exclusions et un coup de neuf</title>
        <author>
            <name>JoliCode Team</name>
            <uri>https://jolicode.com/</uri>
        </author>            <category term="events" />            <category term="christmas" />            <category term="open-source" />            <category term="secret-santa" />            <reactions:summary total="3">                <reactions:reaction emoji="🎉" shortname="party" count="1"/>                <reactions:reaction emoji="👍" shortname="plus1" count="1"/>                <reactions:reaction emoji="🤯" shortname="mindblown" count="1"/>            </reactions:summary>
        <summary><![CDATA[Chaque année depuis 2015, au moment où les premières guirlandes s’allument, Secret Santa reprend du service. Le principe n’a pas changé : vous vous connectez avec Slack, Discord ou Webex, vous choisissez…]]></summary>
        <content type="html">
            &lt;p&gt;Chaque année depuis 2015, au moment où les premières guirlandes s’allument, &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://secret-santa.team/&quot;&gt;Secret Santa&lt;/a&gt; reprend du service. Le principe n’a pas changé : vous vous connectez avec Slack, Discord ou Webex, vous choisissez les participants et chacun reçoit en message privé le nom de la personne à qui offrir un cadeau. Pas de compte, pas d’inscription, pas de pub et pas de base de données non plus : le tirage vit dans votre session et disparaît quelques heures plus tard.&lt;/p&gt;
&lt;p&gt;Dix ans plus tard, le compteur affiche un peu plus de 30 000 tirages et 300 000 participants depuis que nous les comptons (octobre 2019), avec un record à 474 personnes dans un seul tirage. Chaque mois de novembre, l’application encaisse autour de 1 500 tirages, plus que les neuf premiers mois de l’année réunis (pas très surprenant en même temps 🙃).&lt;/p&gt;
&lt;p&gt;Côté code, 2026 a été l’année la plus active du dépôt depuis 2021. Deux demandes ouvertes en 2019 ont enfin été fermées : exclure certaines paires du tirage, et faire participer des gens de plusieurs entreprises. Le site a changé de tête, et sous le capot, nous avons profité de l’occasion pour remettre toute la stack à niveau.&lt;/p&gt;
&lt;p&gt;Je vous propose un tour des nouveautés, celles que vous verrez en lançant votre tirage d’abord, puis celles que seuls les contributeurs remarqueront. Pour vous donner envie de lire jusqu’au bout : l’une de ces fonctionnalités a été livrée, désactivée deux jours plus tard, et a attendu près de dix mois avant de revenir pour de bon.&lt;/p&gt;
&lt;h2&gt;Un tirage entre plusieurs workspaces Slack&lt;/h2&gt;
&lt;p&gt;L&#039;idée était simple et la demande datait de 2019 : permettre de faire des tirages avec des participants provenant d&#039;organisations Slack différentes. Plutôt que de complexifier le fonctionnement de l&#039;app (par exemple en imaginant un système avec un login pour chaque organisation désirée), nous nous sommes appuyés sur &lt;strong&gt;Slack Connect&lt;/strong&gt;. Ce système permet, nativement dans Slack, de partager des channels entre plusieurs organisations. Dans notre cas, nous partageons notre Slack (et nos locaux) avec &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.premieroctet.com/&quot;&gt;Premier Octet&lt;/a&gt; donc le fonctionnement serait idéal.&lt;/p&gt;
&lt;p&gt;L’organisateur du Secret Santa va pouvoir ajouter à son tirage tous les membres externes avec lesquels il partage au moins un channel. Concrètement, après la connexion Slack, une nouvelle étape « Channels » s’intercale avant la liste des participants. Deux modes sont présentés côte à côte :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;soit tout le workspace, comme avant (donc uniquement les membres de son propre workspace) ;&lt;/li&gt;
&lt;li&gt;soit uniquement les membres des canaux sélectionnés. Un canal partagé avec un autre workspace amène ainsi tous ses membres (qu&#039;ils soient internes ou externes à votre organisation).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/secret-santa-2026/channels.png&quot; data-original-width=&quot;1280&quot; data-original-height=&quot;1340&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/secret-santa-2026/channels.b93e8b97.webp&quot; /&gt;&lt;source type=&quot;image/png&quot; srcset=&quot;/media/cache/content/2026/secret-santa-2026/channels.png&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(1280 / 1340)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/secret-santa-2026/channels.png&quot; alt=&quot;L’étape de choix des canaux&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;Sur le papier c’est simple. En pratique, Slack a un modèle de permissions qu’il faut respecter à la lettre, et nous avons appris trois choses au passage.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;La liste des canaux proposés doit être celle de l’administrateur, pas la liste complète de l&#039;organisation.&lt;/strong&gt; Nous passons par &lt;code&gt;users.conversations&lt;/code&gt; pour l’utilisateur connecté : il ne voit que les canaux dont il est membre, et les canaux privés uniquement si le bot y a aussi été invité. C’est le modèle de confidentialité de Slack, et c’est très bien ainsi : Secret Santa ne doit pas permettre de lister des gens qu’on ne verrait pas soi-même.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Un bot ne peut écrire à un utilisateur externe que s’il partage un canal avec lui.&lt;/strong&gt; Si vous sélectionnez un canal partagé où Secret Santa n’a pas encore été invité, l’application vous le dit, vous explique quoi faire, et vous laisse rafraîchir la page une fois l’invitation faite. Autre subtilité : poster directement sur l’identifiant d’un utilisateur externe échoue avec &lt;code&gt;channel_not_found&lt;/code&gt;. Il faut d’abord ouvrir un DM avec &lt;code&gt;conversations.open&lt;/code&gt;, puis poster dans la conversation obtenue.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Les nouveaux scopes ne s’appliquent pas rétroactivement.&lt;/strong&gt; Cette nouvelle fonctionnalité demande quatre permissions de plus du côté de l&#039;application Slack (&lt;code&gt;channels:read&lt;/code&gt;, &lt;code&gt;groups:read&lt;/code&gt;, &lt;code&gt;im:write&lt;/code&gt;, &lt;code&gt;team:read&lt;/code&gt;). Un workspace qui avait approuvé l’ancienne version de l’application connecte ses utilisateurs avec un token qui ne les a pas, et nous l’avons découvert sur notre préproduction avec une belle erreur 500 à l’étape des canaux. Les scopes effectivement accordés sont maintenant vérifiés dès l’authentification, avec un message qui demande à un administrateur du workspace d’approuver les nouvelles permissions.&lt;/p&gt;
&lt;p&gt;Les membres externes, absents de &lt;code&gt;users.list&lt;/code&gt;, sont chargés via &lt;code&gt;users.info&lt;/code&gt; par paquets de 25 dans la boucle de chargement existante, celle qui affiche déjà une barre de progression pour les grosses équipes. Chaque canal sélectionné devient aussi un groupe sur la page des participants, pour cocher ou décocher toute une équipe d’un clic.&lt;/p&gt;
&lt;p&gt;Passons à la seconde demande historique.&lt;/p&gt;
&lt;h2&gt;Les exclusions, pour de vrai cette fois&lt;/h2&gt;
&lt;p&gt;C’est une des fonctionnalités les plus réclamées du projet et le ticket datait là aussi de fin 2019 : empêcher certaines associations. Un couple qui ne veut pas se tirer l’un l’autre, un manager et son équipe, deux personnes qui se sont déjà offert un cadeau l’an dernier. L’important étant de ne jamais révéler le tirage lui-même : on déclare des règles, pas des résultats.&lt;/p&gt;
&lt;p&gt;Nous l’avons livrée fin octobre 2025, juste avant la saison, pour notre propre tirage interne. Et nous l’avons désactivée deux jours plus tard 😝. Le tirage était correct au sens strict, chaque personne offrait bien à quelqu’un et recevait d’une seule personne, mais l’algorithme pouvait produire &lt;strong&gt;plusieurs boucles&lt;/strong&gt; : Alice offre à Bob qui offre à Alice, et les huit autres forment une seconde ronde dans leur coin. C&#039;était techniquement valide, mais humainement décevant : selon moi, le charme d’un Secret Santa tient au fait que tout le monde est relié dans une seule grande chaîne.&lt;/p&gt;
&lt;p&gt;Sans exclusion, le problème n’existe pas : on mélange la liste et chacun offre au suivant, le dernier offrant au premier. Une seule ronde, par construction. Dès qu’on interdit certaines paires, cette astuce ne marche plus : le suivant dans la liste peut être justement la personne exclue, et il faut trouver un ordre qui évite toutes les interdictions tout en refermant la boucle sur le premier.&lt;/p&gt;
&lt;p&gt;La version qui tourne depuis août 2026 construit la ronde pas à pas. On part d’une personne, on lui choisit au hasard un receveur autorisé parmi ceux qui ne sont pas encore dans la chaîne, et on recommence depuis ce receveur. Quand on tombe dans une impasse, une personne dont tous les receveurs possibles sont déjà pris, on revient d’un cran en arrière et on essaie un autre choix. Arrivé au bout, le dernier doit encore avoir le droit d’offrir au premier, sinon on recule aussi. Le hasard à chaque étape garantit que deux tirages avec les mêmes participants et les mêmes exclusions ne donnent pas le même résultat.&lt;/p&gt;
&lt;p&gt;Pour les curieux, le nom savant de ce qu’on cherche est un &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://fr.wikipedia.org/wiki/Graphe_hamiltonien&quot;&gt;cycle hamiltonien&lt;/a&gt; dans le graphe des associations autorisées, et la méthode du « on essaie, on se coince, on recule » s’appelle le &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://fr.wikipedia.org/wiki/Retour_sur_trace&quot;&gt;backtracking&lt;/a&gt;. Rien de neuf sous le sapin, mais ça aide à savoir quoi chercher.&lt;/p&gt;
&lt;p&gt;Ce genre de recherche peut exploser sur des exclusions tordues, par exemple une personne exclue par presque tout le monde. Plutôt que de laisser PHP mouliner jusqu’au timeout, on compte les tentatives et on abandonne au-delà de 100 000, puis on relance depuis un autre point de départ, dix fois au maximum. Si rien ne sort, l’organisateur reçoit un message clair qui l’invite à revoir ses exclusions, plutôt qu’une page d’erreur.&lt;/p&gt;
&lt;p&gt;Un test randomisé verrouille le tout : il génère des participants, cache une ronde valide au milieu d’exclusions arbitraires, et vérifie que le résultat forme toujours une seule boucle.&lt;/p&gt;
&lt;p&gt;Depuis la réactivation, plus de 180 tirages ont utilisé des exclusions. Et pour les gros tirages, la boîte de dialogue d’ajout d&#039;exclusion a été revue en octobre : recherche par nom et sélection multiple en un clic.&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/secret-santa-2026/exclusions.png&quot; data-original-width=&quot;1280&quot; data-original-height=&quot;801&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/secret-santa-2026/exclusions.308b759f.webp&quot; /&gt;&lt;source type=&quot;image/png&quot; srcset=&quot;/media/cache/content/2026/secret-santa-2026/exclusions.png&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(1280 / 801)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/secret-santa-2026/exclusions.png&quot; alt=&quot;L’étape des exclusions&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;h2&gt;Une nouvelle robe&lt;/h2&gt;
&lt;p&gt;Le design n’avait pas vraiment bougé depuis les débuts et ça commençait à se voir : rouge tomate, flocons et cadeaux en emoji, une capture d’écran de l’application en guise d’illustration, et un « Why do I need this app? » qui racontait notre vie. Tout le site a été repris, les pages publiques comme le parcours du tirage et les pages d’erreur.&lt;/p&gt;
&lt;p&gt;Le nouveau rouge est plus profond et posé à plat, sans dégradé ni motif. Le reste de la page est blanc, avec des cartes à ombre douce pour les blocs de contenu, et du jaune pour les accents : les badges « free, open-source, no registration », le « your team » du titre, les icônes des trois promesses en bas de page. Le hero montre directement le message privé qu’un participant reçoit, plutôt qu’une capture de l’interface. Les emoji ont laissé la place à une frise numérotée qui déroule les cinq étapes, exclusions comprises, avec un extrait réel de l’interface pour chacune. Le parcours du tirage troque son fil d’Ariane en chevrons pour un stepper à pastilles numérotées.&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/secret-santa-2026/home-avant-apres.png&quot; data-original-width=&quot;1800&quot; data-original-height=&quot;2634&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/secret-santa-2026/home-avant-apres.f76fff7d.webp&quot; /&gt;&lt;source type=&quot;image/png&quot; srcset=&quot;/media/cache/content/2026/secret-santa-2026/home-avant-apres.png&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(1800 / 2634)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/secret-santa-2026/home-avant-apres.png&quot; alt=&quot;La page d’accueil avant et après&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;Un lifting est aussi le bon moment pour passer un audit d’accessibilité. Nous l’avons fait sur le nouveau design avant de le mettre en ligne, et il a corrigé plusieurs choses que nous n’aurions pas vues seuls : les liens dans le texte sont de nouveau soulignés, le contenu est dans un vrai &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt;, les textes secondaires sur fond rouge et le gris clair passent le contraste AA, les cibles du menu font 44 pixels de haut et les liens externes annoncent qu’ils ouvrent un nouvel onglet.&lt;/p&gt;
&lt;h2&gt;Les petites choses qui comptent&lt;/h2&gt;
&lt;p&gt;Au-delà des trois gros chantiers, une poignée de corrections qui changent la vie des organisateurs :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;l’envoi ne s’arrête plus au premier échec&lt;/strong&gt; : Un participant qui refuse les messages privés sur Discord bloquait tous ceux qui venaient après lui dans la liste, et la page de fin les affichait tous comme « pas encore reçu » alors qu’un seul avait été tenté. Le ticket Discord datait de 2023. L’envoi continue désormais, et « Retry » ne retente que les échecs ;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;une vraie page quand la connexion OAuth échoue&lt;/strong&gt; : Quand Slack ou Discord répondait une erreur pendant l’échange du token, nous affichions notre page d’erreur générique, comme si l’application avait planté. La panne est presque toujours transitoire et côté fournisseur : la nouvelle page le dit en clair, propose de réessayer, et donne la cause de l’échec en termes compréhensibles ;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;recommencer depuis l’accueil repart de zéro&lt;/strong&gt; : Un tirage abandonné en route laissait son contexte en session, et le bouton de la page d’accueil renvoyait directement à l’étape des participants, avec les canaux de la fois précédente. Chaque nouveau tirage repasse maintenant par la première étape ;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;la politique de confidentialité détaille maintenant ce que nous collectons&lt;/strong&gt;, et ce que nous n’en faisons pas. L’occasion de rappeler le principe qui n’a pas changé en dix ans : l’application n’a pas de base de données. La liste des participants, le message et le résultat du tirage vivent dans votre session, stockée dans Redis pendant trois heures, puis tout est effacé. Il ne reste que des compteurs anonymes. Nous affichons d&#039;ailleurs désormais le total de tirages effectués sur la page d&#039;accueil.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Sous le capot&lt;/h2&gt;
&lt;p&gt;Et pour ceux qui mettent les mains dans le code, le ménage a été fait aussi.&lt;/p&gt;
&lt;h3&gt;Toute la stack à jour&lt;/h3&gt;
&lt;p&gt;L’application tourne désormais sur PHP 8.5 et Symfony 8.1. Les deux montées de version sont venues ensemble, un peu forcées : Symfony 8.0 arrivait en fin de vie avec une CVE non corrigée sur &lt;code&gt;http-foundation&lt;/code&gt;, et phpspec 8.1 refusait PHP 8.5. Nous en avons profité pour supprimer les forks maison de quelques dépendances que nous traînions depuis des années, et pour remettre la stack Docker locale au niveau de notre &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/docker-starter&quot;&gt;docker-starter&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;AssetMapper plutôt que des scripts inline&lt;/h3&gt;
&lt;p&gt;Le front, c’était jusqu’ici des blocs &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; dans les templates Twig et des librairies vendorées à la main dans &lt;code&gt;public/&lt;/code&gt;. Tout est passé sous &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://symfony.com/doc/current/frontend/asset_mapper.html&quot;&gt;AssetMapper&lt;/a&gt; : un module ES par page et des helpers partagés, les données passées par attributs &lt;code&gt;data-*&lt;/code&gt;, une feuille de style par famille de pages, Bugsnag ou flatpickr déclarés dans l’importmap et téléchargés à l’installation. Chaque fichier est versionné par un digest dans son nom, ce qui a permis de supprimer notre mécanisme maison de version des assets.&lt;/p&gt;
&lt;p&gt;Notre &lt;abbr title=&quot;Content Security Policy&quot;&gt;CSP&lt;/abbr&gt; est stricte : un script ne s’exécute que s’il porte le nonce généré pour la requête, et rien ne se charge depuis un domaine tiers. AssetMapper n’avait pas prévu ça à deux endroits :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;par défaut, il injecte dans la page un polyfill pour les navigateurs qui ne comprennent pas les importmaps, chargé depuis un CDN. La CSP le bloque, et de toute façon tous les navigateurs que nous supportons comprennent les importmaps nativement : nous l’avons désactivé. Le reste des balises &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; générées reçoit le nonce via l’option prévue pour ça dans la fonction Twig &lt;code&gt;importmap()&lt;/code&gt; ;&lt;/li&gt;
&lt;li&gt;un &lt;code&gt;import &#039;./style.css&#039;&lt;/code&gt; dans un module JavaScript est transformé par AssetMapper en un faux module qui ajoute la feuille de style au document, servi sous forme d’URL &lt;code&gt;data:&lt;/code&gt;. Là encore, la CSP refuse. Les feuilles de style des librairies, celle de flatpickr en l’occurrence, sont donc liées classiquement avec un &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; dans le template plutôt qu’importées depuis le JavaScript.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;c-alert c-alert--note&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 70 71&quot;&gt;&lt;path fill-rule=&quot;nonzero&quot; d=&quot;M35 .9c19.3 0 35 15.7 35 35s-15.7 35-35 35-35-15.7-35-35S15.7.9 35 .9m0 5c-16.552 0-30 13.449-30 30s13.448 30 30 30c16.552.103 30-13.448 30-30 0-16.551-13.448-30-30-30m0 24.9c1.7 0 3 1.3 3 3v15.3c0 1.7-1.3 3-3 3s-3-1.3-3-3V33.8c0-1.7 1.3-3 3-3m0-11c.8 0 1.6.3 2.3.9.6.5.9 1.3.9 2.1 0 .2-.1.4-.1.6-.1.2-.1.4-.2.6s-.2.3-.3.5-.3.4-.4.5c-1.1 1.1-3.1 1.1-4.2 0-.2-.2-.3-.3-.4-.5s-.2-.3-.3-.5-.2-.4-.2-.6c-.1-.2-.1-.4-.1-.6 0-.8.3-1.6.9-2.1.5-.6 1.3-.9 2.1-.9&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Info&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
Clever Cloud, qui nous héberge gracieusement, lance &lt;code&gt;composer install&lt;/code&gt; avec &lt;code&gt;--no-scripts&lt;/code&gt;. Les commandes &lt;code&gt;importmap:install&lt;/code&gt; et &lt;code&gt;asset-map:compile&lt;/code&gt; tournent donc dans un hook de post-build, déclaré par la variable d’environnement &lt;code&gt;CC_POST_BUILD_HOOK&lt;/code&gt;.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;h3&gt;Des tests de bout en bout, captures comprises&lt;/h3&gt;
&lt;p&gt;Le projet avait des tests unitaires et fonctionnels, mais rien ne déroulait un tirage complet dans un vrai navigateur. C’est chose faite avec &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/playwright-php/playwright&quot;&gt;playwright-php&lt;/a&gt; : un parcours entier pour chacune des trois plateformes, contre des API mockées, de la connexion jusqu’à la page de fin.&lt;/p&gt;
&lt;p&gt;Et comme nous allions refaire tout le design, nous avons ajouté juste avant des tests de régression visuelle : des captures pleine page de chaque étape et de chaque page publique, comparées à des références versionnées dans le dépôt. Notre &lt;a href=&quot;https://jolicode.com//blog/detecter-les-regressions-visuelles-dans-la-ci-avec-playwright-et-docker&quot;&gt;précédent article&lt;/a&gt; détaillait la méthode avec le Playwright de Node ; À l’époque, playwright-php n’avait pas d’équivalent de toHaveScreenshot() alors la comparaison se fait en PHP avec gd. Un chemin rapide quand les fichiers sont identiques à l’octet, sinon un diff pixel à pixel avec une petite tolérance, et les images attendue, obtenue et différence déposées en artefact de CI quand ça casse.&lt;/p&gt;

&lt;div class=&quot;c-alert c-alert--note&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 70 71&quot;&gt;&lt;path fill-rule=&quot;nonzero&quot; d=&quot;M35 .9c19.3 0 35 15.7 35 35s-15.7 35-35 35-35-15.7-35-35S15.7.9 35 .9m0 5c-16.552 0-30 13.449-30 30s13.448 30 30 30c16.552.103 30-13.448 30-30 0-16.551-13.448-30-30-30m0 24.9c1.7 0 3 1.3 3 3v15.3c0 1.7-1.3 3-3 3s-3-1.3-3-3V33.8c0-1.7 1.3-3 3-3m0-11c.8 0 1.6.3 2.3.9.6.5.9 1.3.9 2.1 0 .2-.1.4-.1.6-.1.2-.1.4-.2.6s-.2.3-.3.5-.3.4-.4.5c-1.1 1.1-3.1 1.1-4.2 0-.2-.2-.3-.3-.4-.5s-.2-.3-.3-.5-.2-.4-.2-.6c-.1-.2-.1-.4-.1-.6 0-.8.3-1.6.9-2.1.5-.6 1.3-.9 2.1-.9&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Info&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
Cinq jours après notre merge, la version 1.6.0 de playwright-php a livré exactement cette assertion, baselines, masques et images de diff compris. Notre trait maison aura vécu un mois, et c’est très bien ainsi : la prochaine étape sera de le supprimer.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Les références sont rendues par un Chromium installé dans l’image Docker, donc reproductibles uniquement depuis celle-ci, et une task Castor les régénère après un changement d’interface voulu. La refonte graphique a été la première à en profiter : chaque page a été relue capture par capture avant de partir en production.&lt;/p&gt;
&lt;h2&gt;Le mot de la fin&lt;/h2&gt;
&lt;p&gt;Nous avons vu dans cet article ce que 2026 a apporté à Secret Santa :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;des exclusions qui garantissent une seule ronde, avec un algorithme qui sait revenir en arrière quand il se coince ;&lt;/li&gt;
&lt;li&gt;des tirages entre plusieurs workspaces Slack via les canaux partagés, en respectant le modèle de permissions de Slack ;&lt;/li&gt;
&lt;li&gt;un design remis au goût du jour ;&lt;/li&gt;
&lt;li&gt;des envois qui ne s’arrêtent plus au premier participant récalcitrant ;&lt;/li&gt;
&lt;li&gt;PHP 8.5, Symfony 8.1, AssetMapper, et une suite de tests de bout en bout avec régression visuelle pour ne plus livrer une étape cassée sans le voir.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Le code est &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/secret-santa&quot;&gt;sur GitHub&lt;/a&gt; sous licence MIT, les tickets sont ouverts, et si votre équipe utilise Secret Santa, le &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://secret-santa.team/hall-of-fame&quot;&gt;Hall of Fame&lt;/a&gt; n’attend que vous. Bon tirage 🎁&lt;/p&gt;

        </content>
    </entry>    <entry>
        <id>https://jolicode.com/blog/jane-8-modern-php-models-symfony-httpclient-and-lazy-api-calls</id>
        <published>2026-11-09T16:42:00+01:00</published>
        <updated>2026-11-09T16:42:00+01:00</updated>
        <link type="text/html" rel="alternate" href="https://jolicode.com/blog/jane-8-modern-php-models-symfony-httpclient-and-lazy-api-calls"/>
        <title>Jane 8: modern PHP models, Symfony HttpClient and lazy API calls</title>
        <author>
            <name>JoliCode Team</name>
            <uri>https://jolicode.com/</uri>
        </author>            <category term="php" />            <category term="jane" />            <reactions:summary total="5">                <reactions:reaction emoji="🎉" shortname="party" count="2"/>                <reactions:reaction emoji="🚀" shortname="rocket" count="1"/>                <reactions:reaction emoji="❤️" shortname="heart" count="2"/>            </reactions:summary>
        <summary><![CDATA[Jane 7.14 shipped on September 1st. Exactly one month later, we tagged 8.0.0: a major version, with breaking changes we chose one by one.
A major version of a code generator is a strange beast: it changes…]]></summary>
        <content type="html">
            &lt;p&gt;Jane 7.14 shipped on September 1st. Exactly one month later, we tagged &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/janephp/janephp/releases/tag/v8.0.0&quot;&gt;8.0.0&lt;/a&gt;: a major version, with breaking changes we chose one by one.&lt;/p&gt;
&lt;p&gt;A major version of a code generator is a strange beast: it changes the code it writes, and therefore the code you write. We did not take that lightly. Jane generated PSR-18 clients with HTTPlug plugins and getter/setter models for years, and they worked. They also stacked three abstraction layers over an HTTP transport, hid the real shape of your data behind accessors, and made some features impossible to build at all. Jane 8 removes those layers. Jane 8.1, released on October 23rd, uses the room we made to add the most requested feature in the issue tracker: &lt;strong&gt;pagination&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This article walks through what changed in 8.0 and 8.1, why we changed it, and how to upgrade without losing an afternoon.&lt;/p&gt;
&lt;h2&gt;Generated models are plain PHP objects now&lt;/h2&gt;
&lt;p&gt;Let&#039;s start with the change you will see first, in every file that touches a generated model. Jane 7 generated protected properties with a &lt;code&gt;getXxx()&lt;/code&gt; / &lt;code&gt;setXxx()&lt;/code&gt; pair each. Jane 8 generates public, natively typed properties:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;// Jane 7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$pet &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $client&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;getPet&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;pet-1&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-9&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $pet&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;getName&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$pet&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;setTag&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;good boy&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;// Jane 8&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$pet &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $client&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;getPet&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;pet-1&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-9&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $pet&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;name;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$pet&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;tag &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;good boy&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Public typed properties are the way modern PHP recommends to model plain data. Since typed properties, a getter and a setter that only read and write a field add nothing but lines, and property hooks in PHP 8.4 removed the last reason to write them &amp;quot;just in case&amp;quot;. The generated classes are shorter, and your IDE and static analysis read the types straight from the declarations.&lt;/p&gt;
&lt;h2&gt;Jane now runs on Symfony HttpClient&lt;/h2&gt;
&lt;p&gt;This is the heart of 8.0: the OpenAPI generated clients now run on Symfony HttpClient, and PSR-7, PSR-18 and HTTPlug are gone from the dependencies.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why leave the PSR standards?&lt;/strong&gt; We like them, but in Jane&#039;s case they cost more than they gave. A generated request went through PSR-7 message objects, PSR-17 factories, an HTTPlug &lt;code&gt;PluginClient&lt;/code&gt;, then a PSR-18 client, which we were using with Symfony HttpClient anyway. Generated code had to juggle PSR-7 streams for every body. Worst of all, the blocking request/parse cycle of PSR-18 left no room for deferred or concurrent requests. Symfony HttpClient gives us all of this natively, and it is the HTTP client we already use in our Symfony projects.&lt;/p&gt;
&lt;p&gt;Creating a client looks almost the same:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Symfony\Component\HttpClient\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;HttpClient&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;// with no argument, Jane calls HttpClient::create() for you&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$client &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Vendor\Api\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;// or bring your own client: proxy, timeout, scoped client...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$client &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Vendor\Api\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;HttpClient&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;timeout&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; 5&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;]));&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The HTTPlug plugins are gone too. The second argument of &lt;code&gt;create()&lt;/code&gt; now takes &lt;strong&gt;decorator factories&lt;/strong&gt;, any &lt;code&gt;callable(HttpClientInterface): HttpClientInterface&lt;/code&gt;. A closure is enough for most needs:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Symfony\Contracts\HttpClient\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;HttpClientInterface&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$client &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Vendor\Api\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    static&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; fn&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; (&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;HttpClientInterface&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $httpClient)&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; HttpClientInterface&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; =&gt; $httpClient&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;withOptions&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;([&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-1&quot;&gt;        &#039;headers&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;Accept-Language&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;en-GB&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    ]),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;]);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Authentication follows the same model: the generated authentication classes add their header or query parameter to the request options instead of rebuilding a PSR-7 request. The server URL from your specification is still applied automatically, through a small dedicated decorator.&lt;/p&gt;
&lt;h2&gt;Your API calls are lazy by default&lt;/h2&gt;
&lt;p&gt;Leaving PSR-18 unlocked the feature we had wanted for the longest time: choosing &lt;em&gt;when&lt;/em&gt; a request is sent. Jane 8 adds an &lt;code&gt;x-fetch-mode&lt;/code&gt; OpenAPI extension on GET and HEAD operations, with three values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;lazy&lt;/code&gt; (the default) sends nothing when you call the method, and the request goes out on first access to the result;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;eager&lt;/code&gt; keeps the historical behavior: send, wait, parse, return;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;preload&lt;/code&gt; sends the request as soon as you call the method, without waiting for the response, so several preloaded calls run concurrently.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;paths&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;  /pets/{id}&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    get&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;      operationId&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;getPet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;      x-fetch-mode&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;preload&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can also change the default for every GET and HEAD operation with the &lt;code&gt;default-fetch-mode&lt;/code&gt; generation option. Other verbs (POST, PUT, PATCH, DELETE...) always stay eager: a lazy POST that never runs because nobody read its result would be a nasty surprise.&lt;/p&gt;
&lt;p&gt;So what does a lazy call return, if the response does not exist yet? It returns a real instance of the generated model class, built as a &lt;strong&gt;lazy ghost&lt;/strong&gt; with the native lazy objects of PHP 8.4. The object passes &lt;code&gt;instanceof&lt;/code&gt;, can be cloned and serialized, and behaves like any model. The first property read triggers the request, runs the endpoint&#039;s own status code mapping, and fills the object:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$pet &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $client&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;getPet&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;pet-1&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;); &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// nothing has been sent yet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; ($showDetails) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-9&quot;&gt;    echo&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $pet&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;name; &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// the request is sent and parsed here&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;// if $showDetails is false, no request is ever sent&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The same mechanism makes &lt;code&gt;preload&lt;/code&gt; useful for pages that aggregate several API calls. The idea is not new on this blog: &lt;code&gt;preload&lt;/code&gt; comes straight from our 2024 article &lt;a href=&quot;https://jolicode.com//blog/php-object-lazy-loading-is-more-than-what-you-think&quot;&gt;PHP Object Lazy-Loading is More Than What You Think&lt;/a&gt;, which combined lazy-loading with Symfony HttpClient to start hundreds of API calls early and read their responses only when needed. Jane 8 turns that idea into generated code:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;// x-fetch-mode: preload on getPet and getOwner&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$pet &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $client&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;getPet&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;pet-1&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);        &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// the request starts here&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$owner &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $client&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;getOwner&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;owner-42&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;); &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// and this one too, in parallel&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-9&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $pet&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;name;   &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// waits for the pet response if needed, then parses it&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-9&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $owner&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;name; &lt;/span&gt;&lt;span class=&quot;syntax-10&quot;&gt;// most likely already received&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Lazy calls come with a few trade-offs: exceptions are thrown on first access rather than at the call site, ghosts need PHP 8.4 (older versions fall back to eager), and only responses that map to a single model can be deferred. The &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://jane.jolicode.com/latest/openapi/component/#fetch-modes&quot;&gt;fetch modes documentation&lt;/a&gt; covers them in detail. If you prefer the 7.x behavior, &lt;code&gt;&#039;default-fetch-mode&#039; =&amp;gt; &#039;eager&#039;&lt;/code&gt; restores it in one line.&lt;/p&gt;
&lt;h2&gt;Jane is stricter, starting before it writes a single file&lt;/h2&gt;
&lt;h3&gt;Your schema is validated before anything else happens&lt;/h3&gt;
&lt;p&gt;A code generator fails in the worst possible way when it crashes halfway: a raw &lt;code&gt;TypeError&lt;/code&gt; deep inside a denormalizer, a pointer to generated code you never wrote, and no clue about the line of your specification that caused it. During the 7.x cycle, we added a validation pass that runs &lt;em&gt;before&lt;/em&gt; any guessing or generation. It checks the document against the features the selected component supports, collects &lt;strong&gt;every&lt;/strong&gt; problem in a single run, and reports each one with its exact &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://datatracker.ietf.org/doc/html/rfc6901&quot;&gt;JSON pointer&lt;/a&gt; and a fix hint.&lt;/p&gt;
&lt;p&gt;Jane 8 makes this pass the entry gate of every new feature. Put &lt;code&gt;x-fetch-mode&lt;/code&gt; on a POST, for example, and you get this before a single file is written:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Unsupported feature(s) found in your schema:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;`x-fetch-mode` is only supported on GET and HEAD operations but was found on a post operation at &quot;/paths/~1pets/post/x-fetch-mode&quot;. Other verbs are always executed eagerly: remove the attribute.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The same philosophy spreads to the configuration. The &lt;code&gt;--config-file&lt;/code&gt; value is validated before reaching the loaders, and the Symfony bundles now validate &lt;code&gt;jane_json_schema:&lt;/code&gt; / &lt;code&gt;jane_open_api:&lt;/code&gt;: an unknown key fails loudly instead of being silently ignored. A typo in an option name used to cost you a debugging session. Now it costs you one error message.&lt;/p&gt;
&lt;h3&gt;Undeclared status codes throw&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;throw-unexpected-status-code&lt;/code&gt; is now enabled by default. When an API answers with a status code (or a content type) that the specification does not declare, the generated endpoint throws a &lt;code&gt;BadResponseException&lt;/code&gt; carrying the response, instead of silently returning &lt;code&gt;null&lt;/code&gt;. We announced this change back in &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/janephp/janephp/issues/377&quot;&gt;#377&lt;/a&gt;, and users asked for it again in &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/janephp/janephp/issues/815&quot;&gt;#815&lt;/a&gt;. A &lt;code&gt;null&lt;/code&gt; that should have been a &lt;code&gt;Pet&lt;/code&gt; tends to explode three function calls later, far from its cause. An exception at the boundary is easier to debug. If you need the old behavior, set the option to &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;You can now customize the generation&lt;/h2&gt;
&lt;p&gt;Until now, customizing what Jane generates meant forking a generator class. Jane 8 adds an &lt;strong&gt;experimental&lt;/strong&gt; event system built on &lt;code&gt;symfony/event-dispatcher&lt;/code&gt;. You attach subscribers to a dispatcher and pass it to &lt;code&gt;Jane::build()&lt;/code&gt; or &lt;code&gt;JaneOpenApi::build()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The events come in two families. Lifecycle events (&lt;code&gt;GenerationStartedEvent&lt;/code&gt;, &lt;code&gt;SchemaStartedEvent&lt;/code&gt;, &lt;code&gt;FileGeneratedEvent&lt;/code&gt;...) carry read-only payloads. Mutation events carry live references that you can change: &lt;code&gt;PropertyGuessedEvent&lt;/code&gt; lets you replace a guessed type (models &lt;em&gt;and&lt;/em&gt; normalizers follow), while &lt;code&gt;PropertyGeneratedEvent&lt;/code&gt; and &lt;code&gt;ClassGeneratedEvent&lt;/code&gt; hand you the PhpParser AST of the model, to add docblock tags, traits, interfaces or methods.&lt;/p&gt;
&lt;p&gt;Here is a subscriber that makes every generated model implement one of your interfaces:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Jane\Component\JsonSchema\Event\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;ClassGeneratedEvent&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Jane\Component\OpenApi3\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;JaneOpenApi&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; PhpParser\Node\Name\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;FullyQualified&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Symfony\Component\EventDispatcher\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;EventDispatcher&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Symfony\Component\EventDispatcher\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;EventSubscriberInterface&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$dispatcher &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; new&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; EventDispatcher&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$dispatcher&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;addSubscriber&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; class&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; implements&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;syntax-7&quot;&gt;EventSubscriberInterface&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    public&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; static&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; function&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt; getSubscribedEvents&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; array&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        return&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;ClassGeneratedEvent&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::class&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;onClassGenerated&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    public&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; function&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt; onClassGenerated&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;ClassGeneratedEvent&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $event)&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; void&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;        $event&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;getClassNode&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;implements[] &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; new&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; FullyQualified&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(App\Api\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;ApiModel&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::class&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-5&quot;&gt;JaneOpenApi&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;($options, &lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;dispatcher&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;generate&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;registry&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We marked the API experimental on purpose. The constructors of the shipped events are frozen, but the list of events may grow, and you cannot register listeners from the &lt;code&gt;.jane-openapi&lt;/code&gt; configuration file yet.&lt;/p&gt;
&lt;p&gt;The lifecycle events already power something everyone gets for free: the &lt;code&gt;generate&lt;/code&gt; command finally tells you what it is doing. You now see a header per schema, the timings of the guessing and generating phases, the number of files written by kind (models, normalizers, endpoints...) and the total duration. &lt;code&gt;--quiet&lt;/code&gt; keeps it silent.&lt;/p&gt;
&lt;h2&gt;How do you make sure a generator writes correct code?&lt;/h2&gt;
&lt;p&gt;Jane&#039;s test suite compares generated code against committed fixtures. That proves the output did not change by accident. It does not prove the output is correct, and it says nothing about the specifications that real companies publish.&lt;/p&gt;
&lt;p&gt;We added two safety nets during the 8.0 cycle. The first one runs &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/carthage-software/mago&quot;&gt;Mago&lt;/a&gt; on the generated code itself. We measured both candidates on the 183 fixtures of the suite (about 20,200 files): PHPStan needed 638 seconds and five processes to avoid running out of memory, while Mago went through everything in 2 seconds. Mago surfaced, among other things, more than 2,000 missing &lt;code&gt;return&lt;/code&gt; statements in generated code, and 8.0 fixed them.&lt;/p&gt;
&lt;p&gt;The second net is a nightly &lt;strong&gt;corpus job&lt;/strong&gt;. It generates a client for twelve real-world specifications published by their vendors (Kubernetes, Docker, Slack, Netlify, GitHub in 3.0 and 3.1, Stripe, Plaid, Box, Twilio, Discord and OpenAI) and checks that generation does not crash and that the output parses. It paid for itself before the release: it found a fatal error on the public Slack Swagger 2.0 specification and another one on the OpenAI 3.1 specification, both fixed in 8.0.0. Since 8.1, the job also requires zero Mago findings on the whole corpus.&lt;/p&gt;
&lt;h2&gt;Jane 8.1: pagination built in&lt;/h2&gt;
&lt;p&gt;Paginating an API by hand is the kind of code everyone writes, nobody tests, and everyone gets slightly wrong. The request for native pagination support (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/janephp/janephp/issues/324&quot;&gt;#324&lt;/a&gt;) had been open since June 2020. Jane 8.1 closes it.&lt;/p&gt;
&lt;p&gt;The new &lt;code&gt;pagination&lt;/code&gt; option targets GET operations by path regex, with the same semantics as &lt;code&gt;whitelisted-paths&lt;/code&gt;. For each matching operation, Jane generates a sibling &lt;code&gt;&amp;lt;operation&amp;gt;Paginated()&lt;/code&gt; method. It takes the same arguments as the original one and returns a &lt;code&gt;\Generator&lt;/code&gt; that yields the items of every page:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$client &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Vendor\Api\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; ($client&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;listItemsPaginated&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;limit&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; 50&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;]) &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $item) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;    // $item is a Vendor\Api\Model\Item, whatever page it comes from&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The generator is lazy in the good sense: it requests a page only once you have consumed the previous one, so a &lt;code&gt;break&lt;/code&gt; in your loop stops the requests. Real APIs do not agree on how to paginate, so we shipped four strategies to cover the common cases:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-1&quot;&gt;    &#039;openapi-file&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; __DIR__&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; .&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;/openapi.yaml&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-1&quot;&gt;    &#039;namespace&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;Vendor\Api&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-1&quot;&gt;    &#039;directory&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; __DIR__&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; .&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;/generated&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-1&quot;&gt;    &#039;pagination&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;        // ?cursor=... read from &quot;meta.nextCursor&quot; in the body, stops when it is null or empty&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;        [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;^/items$&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;GET&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;strategy&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;cursor&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;param&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;cursor&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;next-cursor&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;meta.nextCursor&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;items&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;data&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;]],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;        // ?page=... incremented from its default in the specification, stops on the first empty page&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;        [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;^/repos$&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;GET&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;strategy&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;page&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;param&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;page&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;]],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;        // follows the RFC 8288 `Link: &amp;#x3C;...&gt;; rel=&quot;next&quot;` header, the GitHub way&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;        [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;^/repos/\{owner\}/issues$&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;GET&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;strategy&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;link-header&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;]],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;        // follows a next page URL found in the body, such as OData&#039;s @odata.nextLink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;        [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;^/users$&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;GET&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;strategy&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;next-link&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;next&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;@odata.nextLink&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;items&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;value&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;]],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    ],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;];&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You probably guessed it: this configuration goes through the same validation as your schema, so a typo or a path that does not exist on the response model stops the generation with a clear message. The &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://jane.jolicode.com/latest/openapi/component/#paginated-operations&quot;&gt;pagination documentation&lt;/a&gt; covers the remaining options, such as yielding whole pages or capping the number of requests.&lt;/p&gt;
&lt;p&gt;8.1 also brings smaller improvements around enums and several fixes, all listed in the &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/janephp/janephp/blob/v8.1.0/CHANGELOG.md&quot;&gt;changelog&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Upgrading without losing an afternoon&lt;/h2&gt;
&lt;p&gt;Jane 8 requires PHP 8.3 (7.x accepted 8.1). The upgrade guide lives in the &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://jane.jolicode.com/latest/guides/compatibility/&quot;&gt;compatibility documentation&lt;/a&gt;, but we went one step further. Jane now ships &lt;strong&gt;agent skills&lt;/strong&gt;, usable by any coding agent that supports skills. One of them, &lt;code&gt;jane-upgrade&lt;/code&gt;, knows the full 7.x to 8.x path:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;npx&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; skills&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; add&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; janephp/janephp&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; --skill&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; jane-upgrade&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The skill bumps every &lt;code&gt;jane-php/*&lt;/code&gt; package together, regenerates your code, rewrites the getter and setter calls, migrates HTTPlug plugins to decorators, and checks the result with a final grep for leftovers. Two sibling skills, &lt;code&gt;jane-openapi-sdk&lt;/code&gt; and &lt;code&gt;jane-json-schema-models&lt;/code&gt;, help you start a new client or a new set of models.&lt;/p&gt;
&lt;p&gt;Whether you upgrade by hand or with an agent, our advice stays the same: upgrade in two steps. First, add these two lines to your OpenAPI configuration to keep the 7.x runtime behavior:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;default-fetch-mode&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;eager&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;throw-unexpected-status-code&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; false&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then bump the packages, regenerate, and fix the calling code until your test suite passes. Once everything is green, remove the two lines one at a time and enjoy lazy calls and strict status codes.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;If you remember one thing from Jane 8: the generated clients now speak Symfony HttpClient natively, and your GET calls are lazy by default. The rest (strict status codes, real typed properties, validation before generation, native pagination) follows from that same decision to generate the code we would write ourselves.&lt;/p&gt;
&lt;p&gt;Give it a try, run the &lt;code&gt;jane-upgrade&lt;/code&gt; skill on a branch, and &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/janephp/janephp/issues&quot;&gt;tell us&lt;/a&gt; what breaks. And if you need help with an API integration or a migration, &lt;a href=&quot;https://jolicode.com//contact&quot;&gt;contact us&lt;/a&gt; 😉&lt;/p&gt;

        </content>
    </entry>    <entry>
        <id>https://jolicode.com/blog/ce-qu-il-fallait-voir-au-forum-php-2026</id>
        <published>2026-10-16T10:42:00+02:00</published>
        <updated>2026-10-16T10:42:00+02:00</updated>
        <link type="text/html" rel="alternate" href="https://jolicode.com/blog/ce-qu-il-fallait-voir-au-forum-php-2026"/>
        <title>Ce qu&#039;il fallait voir au Forum PHP 2026</title>
        <author>
            <name>JoliCode Team</name>
            <uri>https://jolicode.com/</uri>
        </author>            <category term="php" />            <category term="conférence" />            <category term="symfony" />            <category term="afup" />            <category term="veille" />            <category term="ia" />            <reactions:summary total="38">                <reactions:reaction emoji="👀" shortname="eyes" count="4"/>                <reactions:reaction emoji="👍" shortname="plus1" count="6"/>                <reactions:reaction emoji="❤️" shortname="heart" count="15"/>                <reactions:reaction emoji="👏" shortname="clapclap" count="9"/>                <reactions:reaction emoji="🎉" shortname="party" count="4"/>            </reactions:summary>
        <summary><![CDATA[Comme chaque année, nous nous sommes rendus à la conférence phare de l&#039;écosystème PHP en France : le Forum PHP de l&#039;AFUP. En plus d&#039;être sur scène pour parler de lucidité, de headers HTTP ou encore d&#039;embbeding…]]></summary>
        <content type="html">
            &lt;p&gt;Comme chaque année, nous nous sommes rendus à la conférence phare de l&#039;écosystème PHP en France : &lt;strong&gt;le Forum PHP de l&#039;AFUP&lt;/strong&gt;. En plus d&#039;être sur scène pour parler de lucidité, de headers HTTP ou encore d&#039;embbeding et de régression, nous étions aussi dans le public pour assister à de nombreux talks de qualité !&lt;/p&gt;
&lt;p&gt;À travers cet article, nous allons passer en revue les plus grands enseignements de ces deux journées à Disneyland Paris.&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/forum-php-2026/bastien.jpg&quot; data-original-width=&quot;4080&quot; data-original-height=&quot;1668&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/forum-php-2026/bastien.f04ce6ed.webp&quot; /&gt;&lt;source type=&quot;image/jpeg&quot; srcset=&quot;/media/cache/content/2026/forum-php-2026/bastien.jpg&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(4080 / 1668)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/forum-php-2026/bastien.jpg&quot; alt=&quot;&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;h2&gt;Les nouveautés de Symfony 8.2&lt;/h2&gt;
&lt;p&gt;Impossible de passer à côté : le backlog de Symfony a changé de tête ces trois derniers mois :&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/forum-php-2026/symfony8.jpg&quot; data-original-width=&quot;2775&quot; data-original-height=&quot;1761&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/forum-php-2026/symfony8.57a0c1f5.webp&quot; /&gt;&lt;source type=&quot;image/jpeg&quot; srcset=&quot;/media/cache/content/2026/forum-php-2026/symfony8.jpg&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(2775 / 1761)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/forum-php-2026/symfony8.jpg&quot; alt=&quot;Le nombre de PR sur Symfony qui chute de 217 à 40 soudainement&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;Avoir plus de 300 pull requests ouvertes, en attente de review, était un état normal et sain dans la vie du projet - mais depuis que Nicolas GREKAS a adopté le développement et la review agentique, c&#039;est du passé ! Il n&#039;y a plus que 19 PR ouvertes à l&#039;heure actuelle. Toutes les autres n&#039;ont pas simplement été fermées 👋 - mais précieusement relues, testées et enfin mergées ; pour certaines, des années après leur ouverture 🎉&lt;/p&gt;
&lt;p&gt;Ce préambule annonce donc &lt;strong&gt;du lourd&lt;/strong&gt; pour la version à venir de Symfony (8.2), qui va bénéficier de plus de 375 features (contre ~180 d&#039;habitude). En termes de sécurité aussi, les choses ont pris de l&#039;ampleur, avec plus de 200 rapports de sécurité traités (un mélange de vraies failles et de hardening : des améliorations de robustesse).&lt;/p&gt;

&lt;div class=&quot;c-alert c-alert--note&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 70 71&quot;&gt;&lt;path fill-rule=&quot;nonzero&quot; d=&quot;M35 .9c19.3 0 35 15.7 35 35s-15.7 35-35 35-35-15.7-35-35S15.7.9 35 .9m0 5c-16.552 0-30 13.449-30 30s13.448 30 30 30c16.552.103 30-13.448 30-30 0-16.551-13.448-30-30-30m0 24.9c1.7 0 3 1.3 3 3v15.3c0 1.7-1.3 3-3 3s-3-1.3-3-3V33.8c0-1.7 1.3-3 3-3m0-11c.8 0 1.6.3 2.3.9.6.5.9 1.3.9 2.1 0 .2-.1.4-.1.6-.1.2-.1.4-.2.6s-.2.3-.3.5-.3.4-.4.5c-1.1 1.1-3.1 1.1-4.2 0-.2-.2-.3-.3-.4-.5s-.2-.3-.3-.5-.2-.4-.2-.6c-.1-.2-.1-.4-.1-.6 0-.8.3-1.6.9-2.1.5-.6 1.3-.9 2.1-.9&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Info&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
Les failles de sécurité corrigées vont aussi être backportées dans la version 5.4 de Symfony, une très bonne chose pour les projets legacy.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Nicolas utilisait déjà l&#039;IA depuis 2025, mais juste en babysitting. Depuis août, il a crafté des skills très précis basés sur tout son historique de code review, de contribution et de traitement des sujets. &lt;strong&gt;Aujourd&#039;hui, rien n&#039;est fait sans intervention humaine&lt;/strong&gt;, mais l&#039;agent s&#039;occupe de tout ce qui est évident : les rebases, les checks basiques, et une review profonde en se réappropriant tout le sujet de A à Z.&lt;/p&gt;
&lt;h3&gt;Quelques fonctionnalités que nous avons hâte d&#039;utiliser&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Demandé depuis 2019, l&#039;attribut &lt;code&gt;#[SerializedName()]&lt;/code&gt; prend maintenant en charge un nom différent en fonction du groupe de sérialisation !&lt;/li&gt;
&lt;li&gt;Un mode « sudo » pour forcer une re-saisie du mot de passe (ou autre) dans certains endroits très sensibles de votre application ;&lt;/li&gt;
&lt;li&gt;Le support natif d&#039;OpenID Connect pour gérer la connexion des utilisateurs via des providers d&#039;authentification (Google, Apple...) ;&lt;/li&gt;
&lt;li&gt;Le composant KeyManagement pour parler avec HashiCorp Vault, Azure Key Vault ou AWS KMS, et chiffrer les données de façon sécurisée !&lt;/li&gt;
&lt;li&gt;Consommer des messages en parallèle avec un seul worker Messenger via &lt;code&gt;amphp/parallel&lt;/code&gt;. Une seule connexion backend et N threads de traitement 💪&lt;/li&gt;
&lt;li&gt;Le &lt;code&gt;BatchDispatcher&lt;/code&gt; dans Messenger, capable d&#039;envoyer plusieurs messages d&#039;un coup dans la queue, plus rapidement que des ajouts unitaires (à l&#039;exception d&#039;AMQP) ;&lt;/li&gt;
&lt;li&gt;Le &lt;code&gt;ChainStamp&lt;/code&gt; pour créer des enchaînements de messages qui se traitent les uns après les autres ;&lt;/li&gt;
&lt;li&gt;L&#039;unique &lt;code&gt;APP_SECRET&lt;/code&gt;, utilisé pour tout ce qui concerne les signatures, les cookies, les jetons... est désormais séparé par fonctionnalité, et il devient possible de le faire tourner (donc d&#039;utiliser plusieurs secrets en même temps : le premier configuré signe, et tous valident) ;&lt;/li&gt;
&lt;li&gt;Le &lt;code&gt;RecorderHttpClient&lt;/code&gt; est enfin mergé. &lt;a href=&quot;https://jolicode.com//blog/afup-day-2026-paris-retour-sur-une-journee-dans-l-ecosysteme-php#architecture-et-qualite-du-code&quot;&gt;Nous l&#039;avions déjà vu à l&#039;Afup Day Paris&lt;/a&gt; et nous avions hâte de pouvoir l&#039;utiliser. Un attribut &lt;code&gt;#[UseRecord]&lt;/code&gt; permet d&#039;enregistrer le HAR du trafic réel, qui est ensuite rejoué dans nos tests ;&lt;/li&gt;
&lt;li&gt;L&#039;attribut &lt;code&gt;#[AsFormType]&lt;/code&gt; sur un DTO qui crée le formulaire correspondant pour nous 🤯&lt;/li&gt;
&lt;li&gt;Pareil avec &lt;code&gt;#[AsWorkflow]&lt;/code&gt; : les transitions sont directement définies sur nos constantes. &lt;a href=&quot;https://jolicode.com//qui-sommes-nous/equipe/gregoire-pineau&quot;&gt;Bravo à Grégoire&lt;/a&gt;, qui avait commencé cette feature en 2024, et l&#039;a terminée avec Claude !&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Enfin, une nouvelle page d&#039;exception a été intégrée, mais tout va bien, &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/GifExceptionBundle&quot;&gt;notre GifExceptionBundle&lt;/a&gt; supporte déjà le nouveau design, merci Loïck.&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/forum-php-2026/symfony-8-2-exception-gif.gif&quot; data-original-width=&quot;1067&quot; data-original-height=&quot;644&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/forum-php-2026/symfony-8-2-exception-gif.5ea3d5eb.webp&quot; /&gt;&lt;source type=&quot;image/gif&quot; srcset=&quot;/media/cache/content/2026/forum-php-2026/symfony-8-2-exception-gif.gif&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(1067 / 644)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/forum-php-2026/symfony-8-2-exception-gif.gif&quot; alt=&quot;Le nouveau design, amélioré avec un gif&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;h2&gt;Exposer son métier aux agents IA avec API Platform&lt;/h2&gt;
&lt;p&gt;Antoine BLUCHET nous a fait une démo sympa d&#039;un agent IA vocal qu’il a développé en side project pour son garage : gestion documentaire, wireframes 3D des voitures, estimation de devis auto, le tout semblait très complet !&lt;/p&gt;
&lt;p&gt;Sous le capot, on retrouve évidemment plusieurs APIs comme l&#039;accès au &lt;abbr title=&quot;Système d&#039;Immatriculation des Véhicules&quot;&gt;SIV&lt;/abbr&gt; pour récupérer les infos via la plaque d&#039;immatriculation, mais aussi le vecteur principal de son assistant : le &lt;a href=&quot;https://jolicode.com//blog/mcp-the-open-protocol-that-turns-llm-chatbots-into-intelligent-agents&quot;&gt;MCP&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Antoine nous explique que pour faire du MCP en PHP aujourd’hui, on a des librairies bien pratiques :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;le &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/modelcontextprotocol/php-sdk&quot;&gt;SDK PHP&lt;/a&gt; de bas niveau qui permet de lancer un serveur avec transport, chaque outil mis en avant est une méthode en PHP ;&lt;/li&gt;
&lt;li&gt;l’&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/mcp-bundle&quot;&gt;abstraction Symfony&lt;/a&gt;, qui permet, entre autres, d’utiliser des attributs sur les méthodes et de configurer le transport (HTTP, stdio) ;&lt;/li&gt;
&lt;li&gt;une &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/api-platform/mcp&quot;&gt;abstraction API Platform&lt;/a&gt; avec des attributs au niveau des classes et une exposition plus simple des APIs sur le MCP.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Nous nous sommes donc attardés sur ce que propose l&#039;abstraction d&#039;API Platform :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;de la &lt;strong&gt;validation&lt;/strong&gt; avec des Asserts et des Constraints ;&lt;/li&gt;
&lt;li&gt;du &lt;strong&gt;typage&lt;/strong&gt;, y compris avec des choices ;&lt;/li&gt;
&lt;li&gt;la réutilisation des &lt;strong&gt;processors&lt;/strong&gt; existants ;&lt;/li&gt;
&lt;li&gt;de la &lt;strong&gt;sécurité&lt;/strong&gt;, avec le support des isGranted ;&lt;/li&gt;
&lt;li&gt;du retour en &lt;strong&gt;markdown&lt;/strong&gt; et le branchement de providers.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;La liste est longue, et l&#039;idée derrière est simple : exposer un métier à un agent, ce n&#039;est pas réécrire une API, c&#039;est la rendre lisible pour lui.&lt;/p&gt;
&lt;p&gt;Vient alors la vraie question, celle que nous retenons : comment parler à un agent sans lui noyer le contexte ? Antoine écarte les appels HTTP à l’API en direct. Faire des allers-retours avec l’API est assez bavard et gourmand en tokens. Il propose à la place d&#039;exposer la documentation de l&#039;API sur sa racine &lt;code&gt;/&lt;/code&gt;, au format hypermédia, pour que l&#039;agent s&#039;y renseigne seul et aille droit au but, en un seul appel.&lt;/p&gt;
&lt;p&gt;Reste le flux : PHP synchrone n&#039;aime pas rester ouvert, ce qui tombe mal pour tenir une connexion avec un agent. La réponse avancée est &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://mercure.rocks/&quot;&gt;Mercure&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Nous avons mis en place le [MCP fourni par API Platform sur redirection.io] (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://redirection.io/mcp&quot;&gt;https://redirection.io/mcp&lt;/a&gt;) avec succès et nous recommandons chaudement son utilisation.&lt;/p&gt;

&lt;div class=&quot;c-alert c-alert--note&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 70 71&quot;&gt;&lt;path fill-rule=&quot;nonzero&quot; d=&quot;M35 .9c19.3 0 35 15.7 35 35s-15.7 35-35 35-35-15.7-35-35S15.7.9 35 .9m0 5c-16.552 0-30 13.449-30 30s13.448 30 30 30c16.552.103 30-13.448 30-30 0-16.551-13.448-30-30-30m0 24.9c1.7 0 3 1.3 3 3v15.3c0 1.7-1.3 3-3 3s-3-1.3-3-3V33.8c0-1.7 1.3-3 3-3m0-11c.8 0 1.6.3 2.3.9.6.5.9 1.3.9 2.1 0 .2-.1.4-.1.6-.1.2-.1.4-.2.6s-.2.3-.3.5-.3.4-.4.5c-1.1 1.1-3.1 1.1-4.2 0-.2-.2-.3-.3-.4-.5s-.2-.3-.3-.5-.2-.4-.2-.6c-.1-.2-.1-.4-.1-.6 0-.8.3-1.6.9-2.1.5-.6 1.3-.9 2.1-.9&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Info&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
NDLR : la spec de MCP a évoluée : le protocol SSE a été déprécié en faveur d’un protocol HTTP stateless. La partie Mercure n’est plus strictement nécessaire.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;En pratique, Antoine fait cohabiter plusieurs modèles selon les besoins. Avec &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/symfony/ai&quot;&gt;Symfony AI&lt;/a&gt;, on peut limiter certains tools à un modèle précis, par exemple limiter la recherche web à Gemini 2.5 qui le fait très bien et propose un free tier.&lt;/p&gt;
&lt;p&gt;Un mot pour finir sur le testing, où rien n&#039;est vraiment sûr. Tester les choix d&#039;un agent est difficile et coûteux, et si les LLM Judges existent, Antoine les trouve fragiles : on ajoute du déterminisme sur du non-déterminisme. Bref, pas encore de solution solide.&lt;/p&gt;

&lt;div class=&quot;c-alert c-alert--note&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 70 71&quot;&gt;&lt;path fill-rule=&quot;nonzero&quot; d=&quot;M35 .9c19.3 0 35 15.7 35 35s-15.7 35-35 35-35-15.7-35-35S15.7.9 35 .9m0 5c-16.552 0-30 13.449-30 30s13.448 30 30 30c16.552.103 30-13.448 30-30 0-16.551-13.448-30-30-30m0 24.9c1.7 0 3 1.3 3 3v15.3c0 1.7-1.3 3-3 3s-3-1.3-3-3V33.8c0-1.7 1.3-3 3-3m0-11c.8 0 1.6.3 2.3.9.6.5.9 1.3.9 2.1 0 .2-.1.4-.1.6-.1.2-.1.4-.2.6s-.2.3-.3.5-.3.4-.4.5c-1.1 1.1-3.1 1.1-4.2 0-.2-.2-.3-.3-.4-.5s-.2-.3-.3-.5-.2-.4-.2-.6c-.1-.2-.1-.4-.1-.6 0-.8.3-1.6.9-2.1.5-.6 1.3-.9 2.1-.9&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Info&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
NDLR : nous abordons ce point lors de la formation &lt;a href=&quot;https://jolicampus.com/formations/maitriser-ia-symfony&quot;&gt;Symfony AI&lt;/a&gt;, en montrant comment tester ses briques logiciels qui utilisent des IA.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Est-ce que le futur sera fait de pleins de &amp;quot;Jarvis&amp;quot; ? Pas forcément, mais quoi qu’il en soit, c’est autour des APIs qu’il sera construit !&lt;/p&gt;
&lt;h2&gt;PHP Défensif : Arrêtez de faire confiance, défendez votre code !&lt;/h2&gt;
&lt;p&gt;Thomas DUTRION nous ouvre son talk avec une citation de Léonard de Vinci :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;L&#039;expérience prouve que celui qui n&#039;a jamais confiance en personne ne sera jamais déçu.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Le code défensif, ce n’est pas une question de compétence, mais de posture : ne faire confiance à personne, même pas à soi-même.
L’idée directrice du code défensif, comme nous le présente Thomas, c’est de déplacer la responsabilité de l&#039;humain vers la machine. On ne compte plus sur la discipline et la mémoire de chacun ; on écrit les règles noir sur blanc dans le projet pour que l&#039;outillage les fasse respecter à notre place. Ce qui n&#039;est pas explicite n&#039;existe pas.&lt;/p&gt;
&lt;p&gt;Côté pratique, on retient plusieurs vraies actions :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Poka-yoke&lt;/strong&gt; : rendre l’erreur humaine impossible et très facilement détectable si elle arrive (typage, readonly, logging). Préférer la prévention, prévoir la détection ;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;un type par concept&lt;/strong&gt; : unions, intersections, DNF, tant qu&#039;à faire. Si une union dépasse deux types, c&#039;est sûrement qu&#039;il manque un Enum ou un DTO ;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;des types dédiés&lt;/strong&gt; plutôt que des primitifs : on type les IDs, on passe par &lt;code&gt;brick/money&lt;/code&gt; pour les prix au lieu de floats, par une classe Uri au lieu de concaténer des strings ;&lt;/li&gt;
&lt;li&gt;on bannit les &lt;code&gt;@&lt;/code&gt;, on passe aux comparaisons strictes, en gardant en tête que, dans le legacy, les loose comparisons sont parfois des features ;&lt;/li&gt;
&lt;li&gt;on ne fait jamais confiance aux valeurs externes : une couche de sécurité et de cohérence, on vérifie puis on valide ;&lt;/li&gt;
&lt;li&gt;et les petits réflexes qui comptent : des enums plutôt que des constantes, la config injectée plutôt qu&#039;un fichier &lt;code&gt;.env&lt;/code&gt; lu directement, des classes complètes dès leur création (logique dans le constructeur) et &lt;code&gt;final&lt;/code&gt; pour éviter les changements de comportement abusifs, des conventions d&#039;équipe sur le nommage (get ou find ?).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Pour appliquer toutes ces règles, ce sont finalement des outils que nous connaissons déjà qui entrent en jeu : &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/php-cs-fixer/php-cs-fixer&quot;&gt;PHP CS Fixer&lt;/a&gt; pour le style, &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://phpstan.org/&quot;&gt;PHPStan&lt;/a&gt; pour le typage, &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/deptrac/deptrac&quot;&gt;Deptrac&lt;/a&gt; pour les frontières d&#039;architecture, &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/cuyz/valinor&quot;&gt;Valinor&lt;/a&gt; pour valider les valeurs externes et les collections, et d&#039;autres encore. Le tout est de les mettre en place sur nos projets et de les y tenir dans la durée.&lt;/p&gt;
&lt;p&gt;Le fil rouge, en soi, c’est que moins on s’appuie sur l’humain, plus on s’appuie sur la machine. À l’ère des agents qui produisent du code en volume, les bonnes pratiques deviennent une nécessité et la machine devient essentielle pour ne pas faillir là où la discipline et la mémoire humaines fatiguent.&lt;/p&gt;
&lt;h2&gt;Vos coding agents en mode YOLO… mais en toute sécurité&lt;/h2&gt;
&lt;p&gt;Le mode YOLO, c&#039;est ce qui permet à vos agents de pouvoir lancer toutes les commandes sans vous demander la permission. C&#039;est donc... un peu dangereux 😜 Cependant, il a pour gros avantage de laisser l’agent travailler sans avoir à valider chacune de ses opérations. L’agent va plus vite, mais nous sommes moins en sécurité !&lt;/p&gt;
&lt;p&gt;Guillaume LOURS travaille chez Docker et il nous a présenté leur solution : &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.docker.com/products/docker-sandboxes/&quot;&gt;&lt;strong&gt;Docker Sandboxes&lt;/strong&gt;&lt;/a&gt;, avec une &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/glours/afup-sbx-demo/blob/main/DEMO.md&quot;&gt;démo basé sur Symfony Demo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;L&#039;idée est de pouvoir laisser votre agent faire ce qu&#039;il veut mais dans une sandbox où :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;il n&#039;aura pas accès à tout Internet, configurable locale ou par l&#039;organisation ;&lt;/li&gt;
&lt;li&gt;il ne verra pas vos secrets applicatifs, vos jetons, etc. ;&lt;/li&gt;
&lt;li&gt;il n&#039;aura accès qu&#039;aux fichiers de votre projet.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;En interne, c&#039;est comme du Docker-in-Docker : nos projets qui tournent actuellement déjà avec Docker sont cette fois démarrés dans le Docker Sandboxe, avec l&#039;agent et tous les outils dont nous avons besoin.&lt;/p&gt;
&lt;p&gt;Nous pouvons noter que Guillaume n’a pas parlé du mode &amp;quot;auto&amp;quot; de Claude. Ce mode se situe entre le mode &amp;quot;manual&amp;quot; et le mode &amp;quot;yolo&amp;quot;. Il classifie chaque opération, et ne demande pas de validation tant que l’opération est jugée non dangereuse. Est-ce que ce mode permet d’éviter la complexité de faire tourner son agent et sa stack dans une micro VM ?&lt;/p&gt;
&lt;p&gt;C&#039;est plutôt un outil à destination des grands groupes qui ont besoin de contrôler ou limiter les capacités des agents de leurs collaborateurs - à retenir !&lt;/p&gt;
&lt;h2&gt;La lucidité comme architecture&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://jolicode.com//qui-sommes-nous/equipe/bastien-jaillot&quot;&gt;Bastien JAILLOT&lt;/a&gt; a présenté un retour d&#039;expérience à deux voix avec Joël GOMEZ CABALLE, lead dev chez Aropixel. Le point de départ est une billetterie en ligne lancée en 2014 par un développeur seul, qui apprend Symfony 2 en même temps. Le succès arrive vite : rachat, 150 sites en production, plusieurs millions d&#039;euros par mois.&lt;/p&gt;
&lt;p&gt;Avec le succès, Joël a voulu une architecture « sérieuse » : microservices, DDD, interfaces partout. Chaque choix avait une bonne raison. Mais ajouter un champ téléphone imposait de traverser un DTO, un transformer, un handler, un repository et un event listener. Le code était réparti sur quatre dépôts. Une développeuse junior devait publier une version de la librairie front, sans tests ni review, juste pour pouvoir avancer. Et on ne déployait qu&#039;une fois tous les quinze jours : le lundi après-midi, plus personne ne committait.&lt;/p&gt;
&lt;p&gt;Le talk prend le temps de nommer ce qui bloquait vraiment, et ce n&#039;est pas la technique. À l&#039;écran, les affects  s&#039;affichent comme des lignes de log : la confusion et le déni en &lt;code&gt;[WARN]&lt;/code&gt;, la honte en &lt;code&gt;[ERROR]&lt;/code&gt;, la peur en &lt;code&gt;[FATAL]&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Appelé pour un classique « le site est lent » (nous intervenons régulièrement dans ce genre de contexte), Bastien commence par un constat sans affect : un wrapper d&#039;API n&#039;a aucune raison de tomber avant l&#039;API qu&#039;il enveloppe. Varnish et le user context hash absorbent le trafic qui ne rapporte rien. Mais le vrai chantier est ailleurs : rendre les petits changements faciles avant de simplifier toute l&#039;architecture.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;un monorepo, fait en une heure ;&lt;/li&gt;
&lt;li&gt;un environnement Docker lancé avec &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://castor.jolicode.com/&quot;&gt;Castor&lt;/a&gt; ;&lt;/li&gt;
&lt;li&gt;Datadog, que Joël a rebaptisé « Data-drogue » 😂 ;&lt;/li&gt;
&lt;li&gt;du trunk-based development, avec dix déploiements par jour pour une équipe de trois devs ;&lt;/li&gt;
&lt;li&gt;des feature flags activés sur un shop, puis dix, puis tous.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;C&#039;est seulement ensuite que Mercure, Memcache, Elasticsearch et toute une API intermédiaire ont pu disparaître, sans feature freeze.&lt;/p&gt;
&lt;p&gt;Le dernier chapitre parle des agents IA. Tout ce qui avait été mis en place leur profite à plein. Mais l&#039;enthousiasme de ceux qui s&#039;éclatent avec eux peut, une seconde fois, empêcher de voir ceux qu&#039;on laisse sur le bord du chemin. La conclusion : la lucidité ne se décrète pas, elle se construit, comme une architecture. Le talk se termine sur une question à la salle : et chez vous, qui donne l&#039;alerte ?&lt;/p&gt;
&lt;p&gt;Les slides et leurs notes sont &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://aropixel.github.io/conference-lucidite-2026/&quot;&gt;en ligne&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Avant que PHP n&#039;exécute ton premier echo : ce que la couche réseau coûte vraiment&lt;/h2&gt;
&lt;p&gt;Dans son talk, Nicolas PERUSSEL est parti d’un constat. FrankenPHP est arrivé en prod chez beaucoup de monde, et il active par défaut HTTP/3, 0-RTT, Early Hints et les certificats automatiques. Or on ne sait pas toujours ce que ces fonctionnalités font vraiment. L’idée est de suivre ce qui se passe quand un client se connecte, avant même que PHP n’entre en jeu. Ça vaut aussi pour Nginx et Apache.&lt;/p&gt;
&lt;p&gt;Le talk commence par un rappel des bases en présentant le modèle &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://fr.wikipedia.org/wiki/Mod%C3%A8le_OSI&quot;&gt;OSI (Open Systems Interconnection)&lt;/a&gt; pour aider à situer chaque couche du réseau. Vient ensuite le three-way handshake TCP : avant d’échanger la moindre donnée, client et serveur font un aller-retour complet pour établir la connexion.&lt;/p&gt;
&lt;p&gt;Nicolas a ensuite évoqué la fameuse notion de RTT (Round Trip Time), rien à voir avec vos congés 🙂. Elle exprime combien coûte un dialogue avec une autre machine sur le réseau. Chaque étape de la connexion se compte en RTT, et c’est ce qu’on cherche à réduire.&lt;/p&gt;
&lt;p&gt;Le chiffrement TLS ajoute ses propres RTT par-dessus TCP. TLS 1.2 en coûte 2, TLS 1.3 n’en coûte plus qu’1. Passer en 1.3 est donc déjà un gain direct sur chaque nouvelle connexion. Le RTT est généralement très variable sur mobile comparé à la fibre. Économiser quelques RTT a donc un impact bien plus visible pour les utilisateurs mobiles que pour ceux sur une connexion fixe.&lt;/p&gt;
&lt;p&gt;Nous avons ensuite parlé de HTTP/3 et QUIC qui remplace TCP par UDP et englobe TLS 1.3. La connexion et le chiffrement se font en 1 seul RTT au total, contre 2 avec TCP + TLS 1.3. QUIC est implémenté en userspace et non dans le noyau. C’est donc souvent un peu plus gourmand en CPU, avec un p90 légèrement plus élevé. En contrepartie, une perte de paquet n’immobilise plus tous les flux. Avec TCP, un seul paquet perdu bloquait tout le monde. C’est aussi très pratique pour la reprise de connexion lors des changements d’antenne 5G : la connexion survit au changement de réseau au lieu de devoir tout renégocier.&lt;/p&gt;
&lt;p&gt;Grâce au 0-RTT, si un client se reconnecte à un serveur déjà connu, il peut envoyer sa requête dès le premier paquet, sans attendre la fin du handshake. Cependant, le 0-RTT expose aux replay attacks : une requête peut être rejouée par un attaquant. Il faut donc le limiter aux routes idempotentes (GET) et ne pas l’accepter sur un POST qui modifie des données.&lt;/p&gt;
&lt;p&gt;Avec sa conférence, Nicolas nous a non seulement permis de comprendre ce qu&#039;il se passait dans le réseau lorsque l&#039;on se connecte à un serveur, mais aussi nous a donné plusieurs pistes pour optimiser nos infrastructures. Car même si les réglages par défaut des logiciels aident beaucoup, certains paramètres doivent tout de même être faits à la main : restreindre le 0-RTT, s’assurer que l’infra laisse passer QUIC, activer l’OCSP stapling, etc.&lt;/p&gt;
&lt;h2&gt;L’Ecosystem Security Team de la PHP Foundation de l’intérieur&lt;/h2&gt;
&lt;p&gt;Alexandre DAUBOIS est Core Security Engineer à la PHP Foundation. Son rôle est de relire, de tester et de vérifier les différentes failles qui sont découvertes et signalées à la fondation.&lt;/p&gt;
&lt;p&gt;Le monde de la sécurité a beaucoup changé cette année. L&#039;avènement des agents a provoqué un afflux massif de rapports, à tel point que les programmes de bug bounty s&#039;arrêtent : ils ne peuvent plus suivre ! Curl, Google, Internet Bug Bounty (IBB)… sont suspendus sous le poids des propositions.&lt;/p&gt;
&lt;p&gt;Le goulot d&#039;étranglement, c&#039;est l&#039;humain, car chaque notification doit être vérifiée. Beaucoup de mainteneurs font des burnouts ou n&#039;arrivent pas à suivre. La solution pour ces mainteneurs qui n&#039;ont pas toute une core team, c&#039;est &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://thephp.foundation/blog/2026/05/18/announcing-ecosystem-security-team/&quot;&gt;l&#039;Ecosystem Security Team de la fondation&lt;/a&gt;, dont Alexandre fait partie.&lt;/p&gt;
&lt;p&gt;Un des outils qu&#039;ils utilisent est &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/alpha-omega-security/scrutineer&quot;&gt;scrutineer&lt;/a&gt; d&#039;Alpha-Omega. C&#039;est un outil pour scanner les projets open source à la recherche de failles, via des agents LLM et des skills, et gérer le processus de divulgation proprement, sans doublons et sans les tartines de texte que les LLM adorent nous faire lire.&lt;/p&gt;
&lt;p&gt;Leur premier job avec l&#039;outil a été de scanner les 300 projets les mieux classés en nombre de téléchargements sur Packagist. En un mois, ils ont contacté 35 mainteneurs avec des &lt;strong&gt;rapports bien structurés, prouvés et qualitatifs&lt;/strong&gt;, provoquant plus de 100 corrections !&lt;/p&gt;
&lt;p&gt;Lors du scan d&#039;API Platform, une faille a été trouvée. Il a fallu vérifier humainement, car c&#039;est une lourde responsabilité de déclarer une faille : on demande un ID unique mondial, c&#039;est propagé partout, les distributions Linux doivent se mettre à jour, les scanners de dépendances signalent la version concernée… CVE-2026-54164 est né, validé par des humains. On ne peut pas tout automatiser. L&#039;humain voit tout : les conditions que le LLM n&#039;a pas vues, le contexte, la véracité. Merci Alexandre 💪&lt;/p&gt;
&lt;h2&gt;Les lighting-talks ⚡ !&lt;/h2&gt;
&lt;p&gt;Bravo à &lt;a href=&quot;https://jolicode.com//qui-sommes-nous/equipe/baptiste-leduc&quot;&gt;Baptiste LEDUC&lt;/a&gt;, qui a présenté PABLO, son orchestrateur maison d’agents et de tâches (vous pouvez en lire plus &lt;a href=&quot;https://jolicode.com//blog/d-un-ade-a-un-orchestrator-la-construction-de-pablo&quot;&gt;dans sa série d’articles ici-même&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://jolicode.com//qui-sommes-nous/equipe/xavier-lacot&quot;&gt;Xavier LACOT&lt;/a&gt; a présenté, pour sa part, une petite liste d’en-têtes HTTP méconnus. Nous y avons, par exemple, découvert les User-Agent Client Hints, avec &lt;code&gt;Sec-CH-UA&lt;/code&gt;, ou &lt;code&gt;Sec-GPC&lt;/code&gt;, qui remplace le &lt;code&gt;Do Not Track&lt;/code&gt;. Et un clin d’œil à &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://redirection.io/&quot;&gt;redirection.io&lt;/a&gt; avec le bien ancien en-tête &lt;code&gt;Refresh: &amp;lt;time&amp;gt;; url=&amp;lt;url&amp;gt;&lt;/code&gt;, qu’on vous recommande de ne jamais utiliser 😀&lt;/p&gt;
&lt;p&gt;Nous avons aussi découvert &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://nektosact.com/&quot;&gt;nektos/act&lt;/a&gt; par l’intermédiaire d’Estelle GAITS, pour exécuter nos GitHub Actions en local 🙏 Outil particulièrement pertinent à mettre en place à un moment où ce sont les agents qui écrivent nos actions !&lt;/p&gt;
&lt;p&gt;Enfin, citons &lt;a href=&quot;https://jolicode.com//qui-sommes-nous/equipe/gregoire-pineau&quot;&gt;Grégoire PINEAU&lt;/a&gt;, qui a expliqué son clone du site bien connu « De Gauche ou de Droite ? », mais qui tourne à 100 % dans le navigateur avec un petit modèle d’IA embarqué. &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://lyrixx.github.io/gauche-ou-droite/media/slides/&quot;&gt;Les slides expliquent la démarche, ce qui a fonctionné et ce qui a raté&lt;/a&gt; - à lire !&lt;/p&gt;
&lt;h2&gt;Souveraineté numérique à l&#039;ére de l&#039;IA&lt;/h2&gt;
&lt;p&gt;Avec Quentin ADAM, CEO de &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.clever.cloud/fr/&quot;&gt;Clever Cloud&lt;/a&gt;, pas de langue de bois. Dès les premières minutes, on comprend que le propos sera tranché, et il l&#039;assume pleinement. Il commence par la révolution industrielle : le moteur a remplacé les muscles. Avec un tracteur de 400 chevaux, ce sont 400 chevaux et une centaine de personnes pour s&#039;en occuper qui sont remplacés par seulement une personne pour conduire et une personne pour l&#039;entretien. Puis l&#039;ordinateur a commencé à remplacer les cerveaux.&lt;/p&gt;
&lt;p&gt;Selon lui, l&#039;Europe est en train de rater cette nouvelle révolution. Il en donne plusieurs raisons : une gouvernance trop centralisée, une politique qui préserve les emplois des vieilles entreprises au lieu de laisser émerger les jeunes, et une fiscalité qui marche sur la tête (8 % pour les GAFAM, 18 % pour nos grands groupes, 23 % pour nos PME). Les chiffres font mal : sur 100 € dépensés en informatique en Europe, 83 € partent aux États-Unis. Et le &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://fr.wikipedia.org/wiki/CLOUD_Act&quot;&gt;Cloud Act&lt;/a&gt; donne en prime aux autorités américaines un accès permanent à nos données.&lt;/p&gt;
&lt;p&gt;Son message tient en une phrase, qu&#039;il répète sans détour : diversifiez vos achats, achetez local, et écrivez à vos député·es, parce qu&#039;à Bruxelles, en face d&#039;un lobbyiste comme Clever Cloud, il y en a cent payés par les géants américains. Il pousse la logique jusqu&#039;à sa « clause de souveraineté finale » : si Clever Cloud est racheté par un acteur étranger, ses clients obtiennent une licence perpétuelle, ce qui enlève tout intérêt au rachat.&lt;/p&gt;
&lt;p&gt;Le seul adversaire qu&#039;il n&#039;a pas réussi à faire plier ce matin-là, c&#039;est le vidéoprojecteur. À chaque GIF, l&#039;écran se figeait et il devait débrancher puis rebrancher le câble HDMI. Cloud souverain ou GAFAM, tout le monde a ses limites, surtout face à la connectique 🔌.&lt;/p&gt;
&lt;h2&gt;Speed is a byproduct of trust&lt;/h2&gt;
&lt;p&gt;D’après Sebastian BERGMANN, travailler avec un agent, c’est un peu comme jouer à un jeu d’aventure textuel, sauf que la grande majorité des commandes se résume à  &amp;quot;Accept all&amp;quot;. Nous finissons par nous y perdre, jusqu&#039;à devoir repartir de la base. Ce talk parle justement des filets de sécurité qui nous permettent de faire confiance à la vitesse des agents qui produisent du code en masse.&lt;/p&gt;
&lt;p&gt;La vraie question d’ailleurs, n&#039;est pas de savoir si nous faisons confiance à l&#039;agent, mais si nous faisons confiance à notre pipeline pour garantir que ce qu&#039;il génère est valide.&lt;/p&gt;
&lt;p&gt;Sebastian nous présente deux façons de se planter :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Recklessness&lt;/strong&gt; (témérité) : de la vitesse sans contrôle. La dette s&#039;accumule plus vite, les erreurs sont les mêmes qu&#039;à la main, elles arrivent simplement plus vite ;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stagnation&lt;/strong&gt; : du contrôle sans vitesse. Le marché nous largue, et la review devient un goulot d&#039;étranglement.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Les deux mènent dans le mur, mais le message central est ailleurs : les équipes ne vont pas plus vite malgré leur quality control, elles vont plus vite parce qu&#039;elles ont confiance en leur quality control. La confiance n&#039;est pas un sentiment, c&#039;est un track record, une suite de résultats observés et reconnus.&lt;/p&gt;
&lt;p&gt;Dans un exemple concret, voici ce que nous pouvons mettre en place :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Un domaine isolé dans quelques fichiers PHP qui ne dépendent de rien + un dossier &amp;quot;Application&amp;quot; où l&#039;agent travaille en le respectant sans jamais y toucher.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;L&#039;idée : isoler le métier dans quelques fichiers PHP qui ne dépendent de rien, pour que le cœur reste stable et lisible, et laisser l&#039;agent travailler dans un dossier dédié en le respectant sans jamais y toucher. Il gagne un terrain de jeu où produire vite, et une frontière qu&#039;il ne franchit pas.&lt;/p&gt;
&lt;p&gt;Le filet tient dans des outils connus (PHP CS Fixer, PHPStan niveau 10, Deptrac, PHPUnit, mutation testing, une CI qui bloque le merge), avec quatre réflexes :&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Observer le filet attraper des choses ;&lt;/li&gt;
&lt;li&gt;Transformer les tests en specs ;&lt;/li&gt;
&lt;li&gt;Inverser le rapport : c’est nous qui spécifions, et c’est l’agent qui implémente ;&lt;/li&gt;
&lt;li&gt;Puis durcir notre gate.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Et évidemment, écrire les règles en dur dans l&#039;outillage, sinon nous ne les rattrapons jamais.&lt;/p&gt;
&lt;p&gt;Côté tests, Sebastian conseille de nommer les tests comme des phrases de ce qui est attendu, et de préférer le TDD (un test venu du code n&#039;est qu&#039;un log). De plus, le coverage ne suffit pas : d&#039;où le mutation testing, où nous cassons le code exprès pour voir si les tests réagissent.&lt;/p&gt;
&lt;p&gt;Reste la &amp;quot;Definition of Done&amp;quot;, qu’il faut définir, sinon l&#039;agent s&#039;en choisit une tout seul, avec assurance et souvent à tort : plutôt que de dire &amp;quot;écris une classe pour faire X&amp;quot;, demandons &amp;quot;fais passer ce test sans le modifier&amp;quot;, en lui interdisant de toucher aux tests.&lt;/p&gt;
&lt;p&gt;L&#039;humain spécifie le comportement et l&#039;architecture une fois, l&#039;agent implémente jusqu&#039;au vert, l&#039;humain relit.&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/forum-php-2026/Sebastian_DoD.jpg&quot; data-original-width=&quot;4000&quot; data-original-height=&quot;2252&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/forum-php-2026/Sebastian_DoD.3751d90c.webp&quot; /&gt;&lt;source type=&quot;image/jpeg&quot; srcset=&quot;/media/cache/content/2026/forum-php-2026/Sebastian_DoD.jpg&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(4000 / 2252)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/forum-php-2026/Sebastian_DoD.jpg&quot; alt=&quot;4 étapes de la Definition of Done&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;En résumé, &lt;strong&gt;nous ne faisons pas confiance à l&#039;agent, mais au filet construit autour de lui&lt;/strong&gt;.
Les tests sont nos specs, la CI est l&#039;arbitre, l&#039;agent est un outil et pas un collègue. C&#039;est ce track record, et non un sentiment, qui rend la vitesse tenable et qui transforme la fameuse commande « Accept all » en décision.&lt;/p&gt;
&lt;p&gt;La vitesse, au bout du compte, n&#039;est qu&#039;un sous-produit de la confiance. ⚡&lt;/p&gt;
&lt;h2&gt;L&#039;expérience agentique, ou comment tirer le maximum des IAs sur votre code&lt;/h2&gt;
&lt;p&gt;François ZANINOTTO nous a présenté une série de bonnes pratiques pour coder avec des agents. En voici quelques-unes qui nous semblent intéressantes :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Donner le contexte métier : le décrire dans &lt;code&gt;AGENTS.md&lt;/code&gt;, dans les commentaires du code... Si la documentation est ailleurs, connecter un MCP (coucou Jira / Confluence / Notion...) ;&lt;/li&gt;
&lt;li&gt;Les agents ne peuvent pas mettre tout le code dans le contexte. Ils font des &lt;code&gt;grep&lt;/code&gt; en permanence. Il faut donc rendre le code facile à trouver. Utiliser des DTO, du LSP, documenter les synonymes, éviter les noms dupliqués ;&lt;/li&gt;
&lt;li&gt;Il faut être concis, car le contexte de l&#039;agent est limité. Des fichiers courts, des logs peu verbeux, pas de commentaires inutiles, pas de code mort, du Markdown plutôt que du HTML/PDF/DOCX...&lt;/li&gt;
&lt;li&gt;Les modèles ont été entraînés sur du vieux code. Il est donc préférable de choisir des boring tech !&lt;/li&gt;
&lt;li&gt;Aider l&#039;agent à trouver la documentation de vos outils sans parser le Web : ajouter le &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://context7.com/&quot;&gt;MCP Context7&lt;/a&gt; ou fournir la documentation directement dans les vendors ;&lt;/li&gt;
&lt;li&gt;Renforcer les garde-fous avant que le code arrive dans la CI ; la boucle agentique doit être capable de tout tester / valider avant d&#039;envoyer le code ;&lt;/li&gt;
&lt;li&gt;Garder la revue de code 💯 ;&lt;/li&gt;
&lt;li&gt;Améliorer le monitoring de production et les procédures de rollback en cas de soucis ;&lt;/li&gt;
&lt;li&gt;Entretenir la mémoire : mettre à jour la documentation en fin de session, faire des skills, nettoyer le harnais agentique.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Pour finir, François confirme ce que nous avons aussi constaté : écrire des tonnes de skills n&#039;est pas nécessaire quand le code de votre projet est déjà clair / bien fait 👍&lt;/p&gt;
&lt;h2&gt;La review qu&#039;on aurait dû faire depuis toujours : reprendre sa place de reviewer humain à l&#039;ère des agents IA&lt;/h2&gt;
&lt;p&gt;Gaël CRISPYN délègue maintenant la première review à des agents et il a profité de ce talk pour nous présenter ses bonnes pratiques.&lt;/p&gt;
&lt;p&gt;Bien sûr, cela passe par un Skill (de notre côté, nous voyons souvent passer &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/mattpocock/skills/blob/main/skills/engineering/code-review/SKILL.md&quot;&gt;celui-ci&lt;/a&gt;) et par des descriptions de PR complètes. Une information que nous trouvons très intéressante, c’est de forcer le développeur à préciser dans chaque PR deux choses :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ce qu’il a vérifié ;&lt;/li&gt;
&lt;li&gt;ce qu’il n’a pas vérifié !&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ce deuxième point est critique et l’agent pourra focus son étude dessus.&lt;/p&gt;
&lt;p&gt;Tout ce qui concerne les coding standards, l’indentation et la cosmétique doit être ignoré par l’agent. L’agent doit aider l’humain à faire sa review, en mettant le doigt sur les points faibles et en questionnant tout ce qui n’est pas carré. Pour que ça fonctionne, il faut donner à l’agent le contexte, les spécifications, l’intention et des PR de taille raisonnable.&lt;/p&gt;
&lt;p&gt;Un dernier point d’attention : quand l’agent dit « C’est OK, tout va bien », &lt;strong&gt;ce n’est pas OK&lt;/strong&gt; ! L’humain doit toujours valider.&lt;/p&gt;
&lt;h2&gt;L’IA dans l’image : La mort du réel ou le moment qu’on attendait toutes et tous ?&lt;/h2&gt;
&lt;p&gt;La conférence s&#039;est terminée avec Niels ACKERMANN, photographe de presse depuis plus de 20 ans, qui nous a parlé de la transformation de son métier face à l&#039;IA générative. Bien que les générateurs d&#039;images intègrent des filigranes, ils ne sont pas fiables et détecter une vraie photo d&#039;une fausse devient impossible avec les derniers modèles.&lt;/p&gt;
&lt;p&gt;Pourtant aujourd&#039;hui, les grandes entreprises de l&#039;IA ne font pas leurs publicités avec l&#039;IA. L&#039;IA ne sait pas innover. Tout ce qu&#039;elles montrent est basé sur des choses qui ont déjà été faites. Donc pour les photos les plus évidentes / consensuelles, les IA remplacent le photographe, et il ne reste que l&#039;innovant et l&#039;inattendu.&lt;/p&gt;
&lt;p&gt;Là où la vérité est importante (les médias !), le vrai, le réel, restent aussi importants. Mais pour autant, utiliser l&#039;IA générative pour corriger une photo, l&#039;améliorer ou la recomposer ne devrait pas être un problème tant que c&#039;est dit.&lt;/p&gt;
&lt;p&gt;Il a donc créé &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://daliascale.org/&quot;&gt;DALIA Scale&lt;/a&gt;, un moyen simple de noter un travail, sans jugement, en fonction de l&#039;utilisation de l&#039;IA générative dans son processus de création. Avec des questions simples (« Qui a l&#039;idée ? », « Qui exécute ? » et « Qui valide ? »), nous pouvons obtenir une note.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;D0 : tout est fait à la main ;&lt;/li&gt;
&lt;li&gt;D5 : l&#039;IA est autonome, elle a tout fait.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Il pousse ses clients à l&#039;utiliser dans leurs appels d&#039;offres, pour demander un « maximum Dalia 2 », par exemple. Cet article est D1 (les agents ne vont pas encore en conférence à notre place !).&lt;/p&gt;
&lt;h2&gt;Le mot du président de l&#039;AFUP&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://jolicode.com//qui-sommes-nous/equipe/benjamin-clay&quot;&gt;Benjamin&lt;/a&gt; : pour cette année 2026, je suis président de l&#039;AFUP, l&#039;association organisatrice du Forum PHP.&lt;/p&gt;
&lt;p&gt;L&#039;évènement existe et rassemble la communauté depuis plus de 25 ans maintenant et est organisé en grande partie par des bénévoles sur leur temps libre : négociation avec la salle, le traiteur, rédaction du CFP et sélection des conférences, gestion du planning et des venues des conférenciers et conférencières, billetterie, beaucoup de coordination logistique, et vous l&#039;avez sûrement vu, beaucoup de pas parcourus pendant un jour de préparation et deux jours de conférences.&lt;/p&gt;
&lt;p&gt;Merci à tous les bénévoles et à Amélie pour tout ce travail 💪&lt;/p&gt;
&lt;p&gt;À cause des budgets plus serrés que d&#039;habitude ainsi que du profond changement que notre secteur connaît, cette année a été compliquée, et l&#039;AFUP a publié une &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://lettreouverte.afup.org/&quot;&gt;lettre ouverte&lt;/a&gt; pour en parler.&lt;/p&gt;
&lt;p&gt;Cependant, cette édition a été une vraie réussite :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;les quelques conférences auxquelles j&#039;ai pu assister m&#039;ont appris des choses et m&#039;ont donné envie de tester tout ça dès mon retour, d&#039;autres m&#039;ont aidé à prendre du recul sur différents sujets : des projets, du code, de l&#039;organisation ;&lt;/li&gt;
&lt;li&gt;j&#039;ai pu retrouver des bénévoles, mais aussi en croiser de nouveaux (qui eux, ont pu découvrir la quantité d&#039;énergie nécessaire pour tenir 3 jours !) ;&lt;/li&gt;
&lt;li&gt;j&#039;ai discuté avec des conférenciers et des conférencières, des responsables d&#039;antennes de l&#039;AFUP qui organisent des meetups régulièrement près de chez vous, des sponsors dont le soutien est indispensable au fonctionnement de l&#039;association, des confrères et consœurs avec qui on a partagé des bières, et évidemment de nombreux visiteurs.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;L&#039;AFUP travaille maintenant pour s&#039;adapter également, et nous nous revoyons aux prochains événements AFUP en 2027 🎉&lt;/p&gt;
&lt;h2&gt;En conclusion 🐘&lt;/h2&gt;
&lt;p&gt;Merci à l&#039;AFUP pour ces deux jours riches en échanges, en discussions et en IA ! C&#039;était clairement le sujet de l&#039;année, et peu de gens dans la salle lèvent encore la main quand on demande &amp;quot;qui code sans IA&amp;quot;. Notre métier change très vite et vivre de telles conférences nous aide à nous orienter dans ce paysage mouvant.&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/forum-php-2026/stand.jpg&quot; data-original-width=&quot;3344&quot; data-original-height=&quot;2184&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/forum-php-2026/stand.556e3b8d.webp&quot; /&gt;&lt;source type=&quot;image/jpeg&quot; srcset=&quot;/media/cache/content/2026/forum-php-2026/stand.jpg&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(3344 / 2184)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/forum-php-2026/stand.jpg&quot; alt=&quot;Notre stand avec Baptiste&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;Comme dirait un bénévole à la fin d&#039;un talk : On a plus le temps pour les questions ! Merci pour votre attention !&lt;/p&gt;
&lt;p&gt;Et à l&#039;année prochaine 🙏&lt;/p&gt;

        </content>
    </entry>    <entry>
        <id>https://jolicode.com/blog/json-streaming-et-automapper-10-3</id>
        <published>2026-10-15T12:42:00+02:00</published>
        <updated>2026-10-15T12:42:00+02:00</updated>
        <link type="text/html" rel="alternate" href="https://jolicode.com/blog/json-streaming-et-automapper-10-3"/>
        <title>JSON Streaming et AutoMapper 10.3</title>
        <author>
            <name>JoliCode Team</name>
            <uri>https://jolicode.com/</uri>
        </author>            <category term="php" />            <category term="symfony" />            <category term="performance" />            <category term="serializer" />            <reactions:summary total="5">                <reactions:reaction emoji="👍" shortname="plus1" count="1"/>                <reactions:reaction emoji="🚀" shortname="rocket" count="3"/>                <reactions:reaction emoji="👏" shortname="clapclap" count="1"/>            </reactions:summary>
        <summary><![CDATA[Symfony propose depuis peu le composant symfony/json-streamer, permettant d’encoder et décoder du JSON sous forme de flux. Le but : traiter de très gros volumes sans charger l’intégralité du document…]]></summary>
        <content type="html">
            &lt;p&gt;Symfony propose depuis peu le &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://symfony.com/doc/current/serializer/streaming_json.html&quot;&gt;composant &lt;code&gt;symfony/json-streamer&lt;/code&gt;&lt;/a&gt;, permettant d’encoder et décoder du JSON sous forme de flux. Le but : traiter de très gros volumes sans charger l’intégralité du document en mémoire.&lt;/p&gt;
&lt;p&gt;Dans &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://automapper.jolicode.com/latest/&quot;&gt;AutoMapper&lt;/a&gt;, notre solution pour accélérer tous vos mappings de données dans vos projets (sérialisation, object mapping, etc.), nous supportons déjà 2 composants de Symfony en proposant une implémentation alternative :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://symfony.com/doc/current/object_mapper.html&quot;&gt;symfony/object-mapper&lt;/a&gt; : Faire un mapping entre 2 objets&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://symfony.com/doc/current/serializer.html&quot;&gt;symfony/serializer&lt;/a&gt; : (Dé)sérialiser dans différents formats&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ajouter la gestion des flux JSON de la même façon (être une implémentation de l’interface) nous a paru naturel, tous ces composants font exactement la même chose : passer de la donnée de A vers B avec une représentation ou un format légèrement différent.&lt;/p&gt;
&lt;p&gt;Nous supportons déjà depuis quelque temps le fait d’avoir un mapping Lazy, a.k.a le mapping s’effectue uniquement au moment où on a besoin du champ (si jamais on ne touche à rien : rien n’est mappé). Le fait de pouvoir passer d’un objet à un flux json fut donc très facile à réaliser.&lt;/p&gt;
&lt;p&gt;Mais en travaillant sur l’autre sens : lire un flux pour le transformer en objet, l’implémentation nous a paru beaucoup plus complexe, il fallait revoir toute la partie où on lit la donnée dans la source (le flux JSON).&lt;/p&gt;
&lt;h2&gt;Lazy JSON&lt;/h2&gt;
&lt;p&gt;AutoMapper possède déjà toute la connaissance nécessaire pour transformer un tableau vers un objet.&lt;/p&gt;
&lt;p&gt;L’idée était donc de lui fournir quelque chose qui &lt;strong&gt;se comporte comme un tableau PHP, sans réellement décoder tout le JSON&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;C’est cette idée qui a donné naissance à une nouvelle librairie.&lt;/p&gt;
&lt;h3&gt;&lt;code&gt;json-stream-polyfill&lt;/code&gt; : une première implémentation en PHP&lt;/h3&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/joelwurtz/php-json-stream-polyfill&quot;&gt;&lt;code&gt;joelwurtz/json-stream-polyfill&lt;/code&gt;&lt;/a&gt; est la première implémentation, entièrement écrite en PHP.&lt;/p&gt;
&lt;p&gt;L’objectif était d’avoir une API aussi simple que &lt;code&gt;json_decode()&lt;/code&gt; :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$data &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt; json_stream_decode&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;($json);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;avec une différence importante : on peut également lui passer directement un flux.&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$data &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt; json_stream_decode&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-9&quot;&gt;    fopen&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;huge.json&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;r&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-9&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $data[&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;user&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;name&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;];&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Le résultat est un &lt;code&gt;JsonStream\Document&lt;/code&gt;, qui se comporte comme un tableau PHP classique grâce notamment à &lt;code&gt;ArrayAccess&lt;/code&gt;, &lt;code&gt;IteratorAggregate&lt;/code&gt; et &lt;code&gt;Countable&lt;/code&gt;, mais dont les données sont résolues de manière lazy.&lt;/p&gt;
&lt;p&gt;L’appel à &lt;code&gt;json_stream_decode()&lt;/code&gt; est quasiment instantané. Le JSON est parsé au fur et à mesure des accès : demander &lt;code&gt;user.name&lt;/code&gt; fait avancer le flux jusqu’à cette donnée et seules les valeurs nécessaires sont matérialisées en PHP. Un champ a au final trois états :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Non lu : on ne l’a pas encore vu dans le flux&lt;/li&gt;
&lt;li&gt;Bufferisé : on est passé dessus mais on garde toujours sa représentation en JSON (chaîne de caractères)&lt;/li&gt;
&lt;li&gt;Parsé : le champ a été lu, parsé et transformé en valeur PHP&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Pour AutoMapper, c’est particulièrement intéressant : son code généré peut continuer à lire la donnée comme il le fait déjà, tandis que le parsing JSON reste complètement lazy.&lt;/p&gt;
&lt;p&gt;Le polyfill introduit également &lt;code&gt;JSON_STREAM_TRANSIENT&lt;/code&gt; :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$data &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt; json_stream_decode&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;    $stream,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-3&quot;&gt;    JSON_STREAM_TRANSIENT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Dans ce mode, les données déjà parcourues peuvent être libérées. On peut donc lire un document arbitrairement gros avec une consommation mémoire stable.&lt;/p&gt;
&lt;p&gt;La contrepartie est importante : &lt;strong&gt;la lecture devient forward-only&lt;/strong&gt;. Une donnée déjà dépassée peut être définitivement perdue. Ce mode est donc surtout intéressant lorsque l’on parcourt tout le document dans son ordre naturel, typiquement une grosse collection JSON.&lt;/p&gt;
&lt;p&gt;Cette première implémentation fonctionne bien et valide l’API, mais elle possède une limite assez évidente : &lt;strong&gt;scanner un énorme JSON en pur PHP reste lent&lt;/strong&gt;, surtout lorsqu’on finit par lire l’intégralité du document.&lt;/p&gt;
&lt;p&gt;Il fallait donc aller plus bas.&lt;/p&gt;
&lt;h3&gt;&lt;code&gt;json-stream&lt;/code&gt; : la même chose, mais en extension PHP&lt;/h3&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/joelwurtz/php-json-stream&quot;&gt;&lt;code&gt;joelwurtz/json-stream&lt;/code&gt;&lt;/a&gt; expose exactement la même API :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$data &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt; json_stream_decode&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;($json);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;mais directement sous forme d’extension PHP, installable avec &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/php/pie&quot;&gt;pie&lt;/a&gt; via &lt;code&gt;pie install joelwurtz/json-stream&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;L’intérêt n’est pas uniquement de déplacer le code en natif. L’extension utilise également &lt;strong&gt;SIMD&lt;/strong&gt; pour scanner rapidement la structure du JSON, avec différentes implémentations suivant le CPU : AVX2, SSSE3 ou SSE2 sur x86-64, NEON/PMULL sur ARM64, ainsi qu’un fallback scalaire.&lt;/p&gt;
&lt;p&gt;Le fonctionnement reste le même : le document est lazy et seules les valeurs effectivement demandées sont matérialisées.&lt;/p&gt;
&lt;p&gt;C’est important parce que le parsing n’est finalement qu’une partie du coût d’un &lt;code&gt;json_decode()&lt;/code&gt;. Une fois le JSON compris, PHP doit encore créer les &lt;code&gt;zval&lt;/code&gt;, strings, arrays et HashTables correspondants.&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-3&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; →&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; parsing&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; →&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; zval&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; /&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; arrays&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; /&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; strings&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; →&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; objets&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;SIMD permet d’accélérer fortement la première étape, mais pas de faire disparaître les suivantes.&lt;/p&gt;
&lt;p&gt;C’est pourquoi &lt;code&gt;json-stream&lt;/code&gt; peut être plus rapide que &lt;code&gt;json_decode()&lt;/code&gt; dans certains cas, notamment lorsque seule une partie du document est utilisée, sans pour autant être magiquement dix fois plus rapide lorsque tout doit être matérialisé.&lt;/p&gt;
&lt;p&gt;Et comme le polyfill et l’extension partagent la même API, le code ne change pas selon l’environnement : le polyfill fonctionne partout et l’extension peut être installée lorsque les performances deviennent importantes.&lt;/p&gt;
&lt;h2&gt;AutoMapper 10.3&lt;/h2&gt;
&lt;p&gt;Tout cela nous ramène à AutoMapper.&lt;/p&gt;
&lt;p&gt;Avec la 10.3, AutoMapper intègre le support de &lt;code&gt;symfony/json-streamer&lt;/code&gt;. Le bundle peut remplacer l’implémentation de Symfony et utiliser le moteur de mapping généré d’AutoMapper.&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;automapper&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;    json_streamer&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;        enabled&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On continue ensuite à utiliser l’API JsonStreamer :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;$users &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; $reader&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;($stream, $type);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Le mapping passe par AutoMapper et bénéficie de toute la configuration : &lt;strong&gt;ObjectMapper, Serializer et JsonStreamer utilisent désormais le même moteur de mapping&lt;/strong&gt;.
Les attributs et fonctionnalités supportés par AutoMapper fonctionnent donc quelle que soit la porte d’entrée utilisée. Cela inclut également les attributs Symfony Serializer supportés par AutoMapper : il n’est plus nécessaire de maintenir une configuration ou avoir des objets différents simplement parce que l’on passe au streaming.&lt;/p&gt;
&lt;h2&gt;Benchmarks&lt;/h2&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/automapper/maths.fda27186.webp&quot; /&gt;&lt;source type=&quot;image/gif&quot; srcset=&quot;/media/cache/content/2026/automapper/maths.gif&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 560px; ; aspect-ratio: calc(560 / 240)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/automapper/maths.gif&quot; alt=&quot;Alt text&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;Pour la release de cette nouvelle version nous avons aussi mis en place des &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/automapper/tree/main/bench&quot;&gt;benchmarks&lt;/a&gt; que vous pouvez exécuter vous-même si besoin.&lt;/p&gt;
&lt;p&gt;AutoMapper propose de nombreuses options pour optimiser le code généré. La désactivation des checks sur les attributs en est un bon exemple : ils ne servent que si vous faites du mapping dynamique, typiquement un appel d’API qui choisit lui-même les champs à retourner. Par souci de cohérence avec le comportement par défaut du serializer de Symfony, ces checks restent malgré tout activés par défaut, et les benchmarks permettent justement de mesurer ce qu’ils coûtent.&lt;/p&gt;
&lt;p&gt;Plutôt que de dérouler tous les scénarios, voici les quatre comparaisons qui correspondent aux portes d’entrée de Symfony. Les trois premières lignes mappent un objet &lt;code&gt;Person&lt;/code&gt; unique ; les trois dernières lisent ou écrivent une collection de 20 000 &lt;code&gt;Person&lt;/code&gt;, en mode streamé des deux côtés (&lt;code&gt;STREAM&lt;/code&gt; pour AutoMapper, &lt;code&gt;iterable&lt;/code&gt; / &lt;code&gt;getIterator()&lt;/code&gt; pour Symfony), chaque objet étant entièrement hydraté à la lecture.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th align=&quot;left&quot;&gt;Scénario&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;AutoMapper&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;AutoMapper opti.&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;Symfony&lt;/th&gt;
&lt;th align=&quot;right&quot;&gt;Gain / optimisé&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;&lt;code&gt;array&lt;/code&gt; → objet — vs &lt;strong&gt;Serializer&lt;/strong&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;4.77 µs&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;1.96 µs&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;78.92 µs&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;16.5× / 40×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;objet → &lt;code&gt;array&lt;/code&gt; — vs &lt;strong&gt;Serializer&lt;/strong&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;5.24 µs&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;1.71 µs&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;39.53 µs&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;7.5× / 23×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;objet → objet — vs &lt;strong&gt;ObjectMapper&lt;/strong&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;3.07 µs&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;1.01 µs&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;27.52 µs&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;9.0× / 27×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;JSON → objets — vs &lt;strong&gt;JsonStreamer&lt;/strong&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;1.112 s&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;990.3 ms&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;2.447 s&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;2.2× / 2.5×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;JSON → objets — vs &lt;strong&gt;JsonStreamer&lt;/strong&gt;, avec l’extension&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;152.6 ms&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;87.3 ms&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;2.496 s&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;16.4× / 28.6×&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;left&quot;&gt;objets → JSON — vs &lt;strong&gt;JsonStreamer&lt;/strong&gt;&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;169.5 ms&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;95.1 ms&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;68.1 ms&lt;/td&gt;
&lt;td align=&quot;right&quot;&gt;0.40× / 0.72×&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;L’écriture ne décode rien : elle est strictement insensible à l’extension, et c’est le seul scénario où Symfony reste devant — de 2.5× par défaut, de 1.4× une fois l’attribute checking désactivé. C’est logique : son writer compilé lit les champs directement sur l’objet, là où AutoMapper fait passer chaque élément par le pipeline de mapping complet — renommages, transformers, &lt;code&gt;#[MapTo]&lt;/code&gt;, propriétés privées, discriminateurs… C’est le prix de la cohérence entre les trois portes d’entrée, et il nous paraît raisonnable.&lt;/p&gt;
&lt;p&gt;La lecture, en revanche, passe de 1.112 s à 152.6 ms avec l’extension, soit &lt;strong&gt;7.3× de gain&lt;/strong&gt; : c’est elle qui fait basculer le streamer d’AutoMapper de « à peine plus rapide » à « un ordre de grandeur plus rapide » que celui de Symfony. Dès que vous lisez du JSON avec le streamer, installez-la.&lt;/p&gt;
&lt;p&gt;Côté mémoire, les deux streamers gardent un pic plat quelle que soit la taille de la collection — environ 10 MB pour Symfony, 21 MB pour AutoMapper avec l’extension en lecture, 7.2 MB pour les deux en écriture — c’est tout l’intérêt. Encore faut-il demander le bon type à Symfony : avec &lt;code&gt;Type::list(...)&lt;/code&gt; au lieu de &lt;code&gt;Type::iterable(...)&lt;/code&gt;, le reader matérialise tout et le pic monte à &lt;strong&gt;682 MB&lt;/strong&gt; sur les mêmes 20 000 objets.&lt;/p&gt;
&lt;p&gt;Enfin, la colonne « opti. (sans attribute checking) » parle d’elle-même : c’est de loin le levier le plus rentable côté AutoMapper, avec 2 à 3× sur les scénarios unitaires, 1.7× en lecture streamée et 1.8× en écriture streamée. Et c’est une fonctionnalité rarement utilisée.&lt;/p&gt;
&lt;p&gt;La fonctionnalité est encore jeune : &lt;strong&gt;testez-la sur vos gros JSON et faites-nous vos retours !&lt;/strong&gt;&lt;/p&gt;

        </content>
    </entry>    <entry>
        <id>https://jolicode.com/blog/dotai-2026-de-l-illusion-d-autonomie-a-la-realite-du-terrain-reprendre-le-controle-sur-nos-agents</id>
        <published>2026-09-25T15:42:00+02:00</published>
        <updated>2026-09-25T15:42:00+02:00</updated>
        <link type="text/html" rel="alternate" href="https://jolicode.com/blog/dotai-2026-de-l-illusion-d-autonomie-a-la-realite-du-terrain-reprendre-le-controle-sur-nos-agents"/>
        <title>dotAI 2026 : De l’illusion d’autonomie à la réalité du terrain, reprendre le contrôle sur nos agents</title>
        <author>
            <name>JoliCode Team</name>
            <uri>https://jolicode.com/</uri>
        </author>            <category term="ia" />            <category term="ai" />            <reactions:summary total="10">                <reactions:reaction emoji="❤️" shortname="heart" count="5"/>                <reactions:reaction emoji="🚀" shortname="rocket" count="2"/>                <reactions:reaction emoji="👍" shortname="plus1" count="2"/>                <reactions:reaction emoji="👏" shortname="clapclap" count="1"/>            </reactions:summary>
        <summary><![CDATA[
Nous étions à la dotAI 2026. Et comme il est de coutume, voici notre retour sur ce qu’on a aimé, ce qui s&#039;y est dit et ce qu’on y a appris. Bonne lecture !
L’année écoulée a été marquée par l’essor des…]]></summary>
        <content type="html">
            &lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/dot-ai/dotai_2026_intro.png&quot; data-original-width=&quot;1681&quot; data-original-height=&quot;936&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/dot-ai/dotai_2026_intro.a13ea522.webp&quot; /&gt;&lt;source type=&quot;image/png&quot; srcset=&quot;/media/cache/content/2026/dot-ai/dotai_2026_intro.png&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(1681 / 936)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/dot-ai/dotai_2026_intro.png&quot; alt=&quot;intro&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;Nous étions à la &lt;strong&gt;dotAI 2026&lt;/strong&gt;. Et comme il est de coutume, voici notre retour sur ce qu’on a aimé, ce qui s&#039;y est dit et ce qu’on y a appris. Bonne lecture !&lt;/p&gt;
&lt;p&gt;L’année écoulée a été marquée par l’essor des architectures multi-agents et des &lt;em&gt;harnesses&lt;/em&gt;, ces surcouches qui entourent un &lt;abbr title=&quot;Large Language Model&quot;&gt;LLM&lt;/abbr&gt; pour le transformer en travailleur autonome. Peu à peu, nous délaissons nos &lt;abbr title=&quot;Integrated Development Environment&quot;&gt;IDE&lt;/abbr&gt; au profit des &lt;abbr title=&quot;Agentic Development Environment&quot;&gt;ADE&lt;/abbr&gt;, et passons désormais l&#039;essentiel de notre temps à planifier et à relire du code plutôt qu&#039;à en écrire.&lt;/p&gt;
&lt;p&gt;Cette évolution rapide transforme nos métiers au quotidien, et c&#039;était précisément l&#039;enjeu de cette édition : choix d&#039;architecture, mise en place de garde-fous, anatomie des modèles, souveraineté ainsi que cas d’usage concrets. Retour sur les grandes idées qui ont rythmé la journée.&lt;/p&gt;
&lt;h2&gt;L&#039;IA dans le workflow dev : Reprendre le contrôle sur la boucle de revue&lt;/h2&gt;
&lt;p&gt;L&#039;arrivée massive des agents dans le quotidien des équipes produit un volume inédit de code et de Pull Requests, déplaçant le véritable goulot d&#039;étranglement de la production de code vers la capacité humaine de relecture. &lt;strong&gt;Guillaume Vernade&lt;/strong&gt; (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://deepmind.google/&quot;&gt;Google DeepMind&lt;/a&gt;) et &lt;strong&gt;Greg Qualls&lt;/strong&gt; comparent ce phénomène au comportement d&#039;un stagiaire junior hyperactif ou d&#039;un cerveau &lt;abbr title=&quot;Trouble Déficit de l&#039;Attention avec ou sans Hyperactivité&quot;&gt;TDAH&lt;/abbr&gt;. Les agents manquent intrinsèquement de mémoire de travail à long terme, saturent leur fenêtre de contexte et interrompent en permanence les développeurs pour valider des micro-décisions ou faire relire du code non testé qui échoue aux CI.&lt;/p&gt;
&lt;p&gt;Face à cette saturation, la tentation de se réfugier dans des &amp;quot;usines logicielles autonomes&amp;quot; (&lt;em&gt;dark software factories&lt;/em&gt;, l&#039;idée d&#039;une chaîne où l&#039;IA fait tout, toute seule) ou des spécifications purement formelles est une impasse (c&#039;est l&#039;idée d&#039;écrire un cahier des charges ultra-exhaustif pour contrôler l&#039;IA au mot près). Comme l&#039;explique &lt;strong&gt;Stanislas Polu&lt;/strong&gt; (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://dust.tt/&quot;&gt;Dust&lt;/a&gt;), rédiger et maintenir des spécifications formelles exhaustives devient aussi complexe que d&#039;écrire le code lui-même. Pire encore, lorsqu&#039;un bug survient en production à 4 heures du matin, personne ne peut réparer un système construit comme une boîte noire que plus aucun humain ne comprend. Le code reste le meilleur niveau d&#039;abstraction pour maintenir la compréhension d&#039;une équipe. Pour reprendre le contrôle, la solution réside dans le &lt;em&gt;&lt;strong&gt;loop engineering&lt;/strong&gt;&lt;/em&gt; : externaliser les fonctions exécutives de l&#039;agent via des listes de tâches externes persistant hors du contexte, imposer des budgets d&#039;exécution stricts, mettre en silo l&#039;architecture applicative pour isoler l&#039;impact des PRs et exiger l&#039;exécution de tests automatisés complets par l&#039;agent avant toute relecture humaine.&lt;/p&gt;
&lt;p&gt;Lorsque ces garde-fous sont en place, les gains de productivité deviennent massifs : chez &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.anthropic.com/&quot;&gt;Anthropic&lt;/a&gt;, &lt;strong&gt;Ian Massingham&lt;/strong&gt; indique que Claude rédige désormais plus de 80 % du code mergé avec une productivité multipliée par 8. Cependant, atteindre cette maturité nécessite d&#039;adopter un &lt;em&gt;&lt;strong&gt;reaper mindset&lt;/strong&gt;&lt;/em&gt; : la capacité d&#039;une équipe à supprimer sans regret ses anciens outils, &lt;abbr title=&quot;Retrieval Augmented Generation&quot;&gt;RAG&lt;/abbr&gt; complexe ou briques de prompt engineering dès qu&#039;une nouvelle génération de modèles les rend obsolètes.&lt;/p&gt;
&lt;h2&gt;Sous le capot : interprétabilité, espace latent, post-training et optimisation&lt;/h2&gt;
&lt;p&gt;Pour comprendre ce qui se passe dans la tête d&#039;une IA, &lt;strong&gt;David Louapre&lt;/strong&gt; (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://huggingface.co/&quot;&gt;Hugging Face&lt;/a&gt; / &lt;em&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.youtube.com/@ScienceEtonnante&quot;&gt;Science Étonnante&lt;/a&gt;&lt;/em&gt;) et &lt;strong&gt;Aygalic Jara&lt;/strong&gt; nous font visiter son &amp;quot;cerveau&amp;quot; vectoriel. L&#039;interprétabilité mécanistique cherche à repérer quel concept s&#039;allume dans les réseaux de neurones. En modifiant les vecteurs d&#039;activation internes (le &lt;em&gt;steering&lt;/em&gt;), &lt;strong&gt;David Louapre&lt;/strong&gt; a montré en direct &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.youtube.com/watch?v=G85qi0_17YE&quot;&gt;(voir le replay de son talk)&lt;/a&gt; comment forcer un modèle à devenir obsédé par la Tour Eiffel ! C&#039;est une technique calquée sur la fameuse expérience du &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.anthropic.com/news/golden-gate-claude&quot;&gt;Golden Gate Claude d&#039;Anthropic&lt;/a&gt;, que vous pouvez d&#039;ailleurs reproduire chez vous via des librairies d&#039;exploration comme &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/TransformerLensOrg/TransformerLens&quot;&gt;TransformerLens&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;De son côté, &lt;strong&gt;Aygalic Jara&lt;/strong&gt; &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.youtube.com/watch?v=dFsws_PfGUk&quot;&gt;(replay de sa présentation ici)&lt;/a&gt; a rendu la détection d&#039;hallucinations beaucoup moins abstraite. Au lieu d&#039;analyser le texte final généré par l&#039;IA, son approche consiste à mesurer la &amp;quot;température d&#039;incertitude&amp;quot; directement dans les couches cachées du modèle (l&#039;espace latent) avant même la fin de la phrase. Une méthode qui fait d&#039;ailleurs écho aux récentes avancées majeures sur la &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.nature.com/articles/s41586-024-07421-0&quot;&gt;détection des hallucinations par entropie sémantique (Nature, 2024)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/dot-ai/dotai_2026_2_aygalic_jara_llm_hallucinations.jpg&quot; data-original-width=&quot;4096&quot; data-original-height=&quot;2302&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/dot-ai/dotai_2026_2_aygalic_jara_llm_hallucinations.e4bb2d2c.webp&quot; /&gt;&lt;source type=&quot;image/jpeg&quot; srcset=&quot;/media/cache/content/2026/dot-ai/dotai_2026_2_aygalic_jara_llm_hallucinations.jpg&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(4096 / 2302)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/dot-ai/dotai_2026_2_aygalic_jara_llm_hallucinations.jpg&quot; alt=&quot;halucinations&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;Lorsque le prompt ne suffit plus, il faut modifier les poids du modèle par le &lt;strong&gt;Post-Training&lt;/strong&gt;. &lt;strong&gt;Ziv Ilan&lt;/strong&gt; (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.nvidia.com/fr-fr/solutions/ai/&quot;&gt;Nvidia&lt;/a&gt;) détaille la combinaison du &lt;em&gt;Supervised Fine-Tuning&lt;/em&gt; (SFT) sur des jeux de données et du &lt;em&gt;Reinforcement Learning&lt;/em&gt; (RL) où l&#039;IA apprend par récompense dans des environnements de test (compilateurs, exécution de code). Mais pour les données structurées, les LLMs classiques échouent car ils lisent les tables mot à mot comme un roman. &lt;strong&gt;Kevin Scaman&lt;/strong&gt; illustre ce problème avec la prédiction de la &lt;strong&gt;résiliation client (&lt;em&gt;churn&lt;/em&gt;)&lt;/strong&gt; : face à un tableau de milliers de colonnes désordonnées, un LLM s&#039;emmêle les pinceaux, alors qu&#039;un Large Tabular Model (LTM) regarde la table dans sa totalité (lignes et colonnes) pour extraire instantanément les signaux statistiques.
💡 &lt;strong&gt;Ce qu&#039;il faut en retenir &amp;amp; Pour aller plus loin :&lt;/strong&gt;
&lt;strong&gt;Le Post-Training en pratique :&lt;/strong&gt; Si vous souhaitez comprendre comment aligner un modèle avec du RL et du SFT, la documentation de la librairie TRL (Transformer Reinforcement Learning) est un excellent point de départ.
&lt;strong&gt;Arrêtez d&#039;utiliser des LLMs pour vos fichiers Excel/CSV :&lt;/strong&gt; Les LLMs sont faits pour le langage naturel. Pour les données tabulaires, les LTMs sont la nouvelle norme.
&lt;strong&gt;Testez par vous-même :&lt;/strong&gt; Le dépôt GitHub de TabPFN (PriorLabs) propose des notebooks prêts à l&#039;emploi pour tester la classification sur des données tabulaires en quelques lignes de code Python.&lt;/p&gt;
&lt;p&gt;Au niveau du moteur d&#039;exécution, &lt;strong&gt;Xuan-Son Nguyen&lt;/strong&gt; présente les optimisations du projet open source &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/ggerganov/llama.cpp&quot;&gt;llama.cpp&lt;/a&gt;. Pour éliminer la lenteur du &amp;quot;token par token&amp;quot;, il s&#039;appuie sur le &lt;em&gt;speculative decoding&lt;/em&gt;. Initiée et popularisée notamment par DeepSeek avec des approches comme &lt;strong&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/z-lab/dflash&quot;&gt;DFlash&lt;/a&gt;&lt;/strong&gt;. Cette technique consiste à faire prédire plusieurs tokens futurs en parallèle par un petit modèle rapide avant de les valider en un seul passage, ce qui permet de plus que doubler la vitesse d&#039;inférence en local.&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/dot-ai/dotai_2026_2_xuan_son_nguyen_llama.jpg&quot; data-original-width=&quot;6144&quot; data-original-height=&quot;4080&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/dot-ai/dotai_2026_2_xuan_son_nguyen_llama.99eb0fdd.webp&quot; /&gt;&lt;source type=&quot;image/jpeg&quot; srcset=&quot;/media/cache/content/2026/dot-ai/dotai_2026_2_xuan_son_nguyen_llama.jpg&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(6144 / 4080)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/dot-ai/dotai_2026_2_xuan_son_nguyen_llama.jpg&quot; alt=&quot;DFlash&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;h2&gt;Souveraineté, on-device et sobriété : Où et comment faire tourner ses agents ?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Joffrey Thomas&lt;/strong&gt; et &lt;strong&gt;Henry Lagarde&lt;/strong&gt; (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://mistral.ai/fr/&quot;&gt;Mistral AI&lt;/a&gt;) rappellent les risques stratégiques des API propriétaires SaaS : fuites de données internes, coûts cachés à chaque boucle d&#039;agent et ruptures de production dès qu&#039;un fournisseur modifie son API. L&#039;écart entre modèles ouverts et propriétaires s&#039;étant réduit à quelques mois, ils plaident pour le déploiement de stacks souveraines et auto-hébergées. Ils rappellent également un principe de sobriété essentiel : &lt;strong&gt;toutes les tâches ne nécessitent pas un agent LLM&lt;/strong&gt;. Utiliser de l&#039;OCR traditionnel ou de l&#039;algorithmique classique pour extraire du texte est souvent 100 fois plus rapide, sobre et économique que de lancer un agent gourmand en tokens.&lt;/p&gt;
&lt;p&gt;Cette quête de sobriété se retrouve sur les appareils mobiles et objets connectés avec &lt;strong&gt;Christian Keller&lt;/strong&gt; (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.meta.ai/&quot;&gt;Meta&lt;/a&gt;). Un VLM (&lt;em&gt;Vision-Language Model&lt;/em&gt;) est un modèle d&#039;IA capable de comprendre et de raisonner simultanément sur du texte et sur des images. Sur un smartphone ou des lunettes connectées, la contrainte principale n&#039;est pas seulement la mémoire, mais la batterie. Via le framework open source &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://pytorch.org/executorch/&quot;&gt;ExecuTorch&lt;/a&gt;, Christian Keller prône une architecture en pyramide : faire tourner de tout petits modèles de perception ultra-spécialisés (détection de contours, reconnaissance vocale) directement sur l&#039;appareil, et ne faire appel au cloud ou à un gros LLM généraliste que si la tâche l&#039;exige vraiment.&lt;/p&gt;
&lt;p&gt;Faire tourner des modèles géants sur internet, c&#039;est comme essayer de faire tenir un énorme dictionnaire dans la mémoire d&#039;un petit serveur local. Pour y arriver sans faire ramer le réseau, &lt;strong&gt;Leo Arsenin&lt;/strong&gt; (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.cloudflare.com/solutions/ai/&quot;&gt;Cloudflare&lt;/a&gt;) explique qu&#039;on compresse le dictionnaire (la quantification du cache &lt;abbr title=&quot;Key Value&quot;&gt;KV&lt;/abbr&gt;) pour qu&#039;il prenne deux fois moins de place sans perdre ses informations importantes. Et surtout, quand un utilisateur pose plusieurs questions d&#039;affilée, le réseau s&#039;assure de le renvoyer exactement vers le même serveur GPU qui se souvient déjà du début de la discussion, au lieu de tout réexpliquer à un nouveau serveur à chaque fois.&lt;/p&gt;
&lt;h2&gt;Au-delà du Chatbot : Nouvelles interfaces et cas d&#039;usage métiers&lt;/h2&gt;
&lt;p&gt;Pour mesurer l&#039;impact de l&#039;IA sur des domaines critiques, &lt;strong&gt;Hélène Philippe&lt;/strong&gt; présente le cas de la radiologie médicale. L&#039;évaluation de l&#039;évolution des tumeurs entre deux scanners nécessite une précision chirurgicale que les VLMs généralistes ne peuvent pas offrir en raison du risque d&#039;hallucinations cliniques. Son équipe a conçu un pipeline d&#039;agents autonomes pilotant des outils de mesure spécialisés, atteignant 67 % de rappel sur le benchmark &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://arxiv.org/abs/2609.01470&quot;&gt;RADMatch&lt;/a&gt;. Cela montre que dans les métiers complexes, l&#039;IA ne remplace pas l&#039;expertise mais orchestre des outils métiers sous un contrôle strict.&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/dot-ai/dotai_2026_4_helene_philippe_radiological_agi_2.jpg&quot; data-original-width=&quot;4080&quot; data-original-height=&quot;2295&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/dot-ai/dotai_2026_4_helene_philippe_radiological_agi_2.13ea4aaa.webp&quot; /&gt;&lt;source type=&quot;image/jpeg&quot; srcset=&quot;/media/cache/content/2026/dot-ai/dotai_2026_4_helene_philippe_radiological_agi_2.jpg&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(4080 / 2295)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/dot-ai/dotai_2026_4_helene_philippe_radiological_agi_2.jpg&quot; alt=&quot;radiologie&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;Côté web et développement, &lt;strong&gt;Patrick Brosset&lt;/strong&gt; (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.microsoft.com&quot;&gt;Microsoft&lt;/a&gt;) s&#039;attaque à la fragilité du scraping web. Aujourd&#039;hui, lorsqu&#039;un agent navigue sur un site avec des outils comme &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://playwright.dev/&quot;&gt;Playwright&lt;/a&gt;, il clique à l&#039;aveugle et consomme énormément de tokens pour comprendre le DOM. Le nouveau standard W3C &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/webmachinelearning/webmcp&quot;&gt;WebMCP&lt;/a&gt; permet aux développeurs d&#039;exposer directement des fonctions JavaScript exécutables par l&#039;agent. En quelques lignes de code côté client, le site devient nativement accessible aux agents :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;// Exemple d&#039;exposition d&#039;un outil WebMCP en JS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;document.modelContext.&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;registerTool&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;  name: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&quot;commander_pizza&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;  description: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&quot;Commande directement une pizza pour l&#039;utilisateur&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;  parameters: { type: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&quot;object&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, properties: { taille: { type: &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&quot;string&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; }}},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;  execute&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; (&lt;/span&gt;&lt;span class=&quot;syntax-12&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;) &lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;=&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; { &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; await&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; api.&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(params); }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cette approche divise par deux la consommation de tokens, élimine l&#039;instabilité des sélecteurs CSS et accélère drastiquement l&#039;exécution.&lt;/p&gt;
&lt;p&gt;Enfin, comment tester un assistant virtuel comme &lt;em&gt;Dr. Doctolib&lt;/em&gt; avant de le mettre entre les mains de vrais patients ? &lt;strong&gt;Gaëtan Brison&lt;/strong&gt; (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.doctolib.fr/&quot;&gt;Doctolib&lt;/a&gt;) explique que poser des questions isolées ne suffit pas. Pour valider le système, Doctolib crée de faux patients virtuels (des simulateurs) dotés de profils psychologiques et d&#039;historiques médicaux spécifiques. Ces patients virtuels discutent sur plusieurs sessions avec l&#039;IA pour vérifier si elle se souvient bien des allergies mentionnées trois jours plus tôt, si elle réagit correctement en cas d&#039;urgence et si elle maintient une sécurité médicale absolue à 100 % dans le temps.&lt;/p&gt;
&lt;h2&gt;Accompagner la révolution IA dans les agences tech&lt;/h2&gt;
&lt;p&gt;Au-delà des conférences, l&#039;accélération de l&#039;IA pose une question centrale à toutes les structures tech : comment accompagner cette transformation sans subir la vague ? L&#039;IA n&#039;est plus un sujet de R&amp;amp;D distant, mais une réalité qui réinvente les métiers du développement, du design et du conseil.&lt;/p&gt;
&lt;p&gt;Face à ce changement brutal, la clé réside dans l&#039;accompagnement des équipes. Cela implique de fournir des moyens techniques (crédits de jetons, accès aux modèles), d&#039;aménager du temps effectif dédié à la veille et aux tests, et de renforcer les échanges collectifs (pair-programming augmenté, ateliers pratiques). Il s&#039;agit également d&#039;instaurer une gouvernance transparente avec les clients : définir des chartes d&#039;usage claires sur la confidentialité et s&#039;aligner dès le départ sur le &lt;em&gt;comment&lt;/em&gt; et le &lt;em&gt;pourquoi&lt;/em&gt; l&#039;IA est intégrée aux projets.&lt;/p&gt;
&lt;p&gt;Pour prolonger ces réflexions et suivre l&#039;évolution des pratiques agentiques, la conférence en ligne &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://dev.events/ON/ai&quot;&gt;All Day AI&lt;/a&gt; se tiendra le &lt;strong&gt;22 octobre 2026&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Enfin même si l’IA solutionne beaucoup de problèmes, rappelez-vous que &lt;strong&gt;toutes les tâches ne nécessitent pas un agent LLM&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;picture class=&quot;js-dialog-target&quot; data-original-url=&quot;/media/original/2026/dot-ai/dotai_2026_outro.png&quot; data-original-width=&quot;1681&quot; data-original-height=&quot;936&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/media/cache/content-webp/2026/dot-ai/dotai_2026_outro.30e79292.webp&quot; /&gt;&lt;source type=&quot;image/png&quot; srcset=&quot;/media/cache/content/2026/dot-ai/dotai_2026_outro.png&quot; /&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; style=&quot;width: 996px; ; aspect-ratio: calc(1681 / 936)&quot; src=&quot;https://jolicode.com//media/cache/content/2026/dot-ai/dotai_2026_outro.png&quot; alt=&quot;outro&quot; /&gt;&lt;/picture&gt;&lt;/p&gt;

        </content>
    </entry>    <entry>
        <id>https://jolicode.com/blog/d-un-ade-a-un-orchestrator-la-construction-de-pablo</id>
        <published>2026-09-25T11:42:00+02:00</published>
        <updated>2026-09-25T11:42:00+02:00</updated>
        <link type="text/html" rel="alternate" href="https://jolicode.com/blog/d-un-ade-a-un-orchestrator-la-construction-de-pablo"/>
        <title>D&#039;un ADE à un orchestrator : la construction de PABLO</title>
        <author>
            <name>JoliCode Team</name>
            <uri>https://jolicode.com/</uri>
        </author>            <category term="ia" />            <category term="ai" />
        <summary><![CDATA[Mes agents sont devenus plus rapides. Mon cerveau, non.
Où nous en étions
Dans mon article précédent, je décrivais mon environnement de travail : un Agent Development Environment, non pas un IDE avec…]]></summary>
        <content type="html">
            &lt;p&gt;&lt;em&gt;Mes agents sont devenus plus rapides. Mon cerveau, non.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Où nous en étions&lt;/h2&gt;
&lt;p&gt;Dans &lt;a href=&quot;https://jolicode.com//blog/the-agent-development-environment-a-new-unit-of-work&quot;&gt;mon article précédent&lt;/a&gt;, je décrivais mon environnement de travail : un Agent Development Environment, non pas un IDE avec un panneau de conversation greffé, mais un outil construit autour de tâches, de worktrees et d&#039;agents. Je prends une issue, l&#039;ADE ouvre un worktree isolé avec un agent déjà en cours d&#039;exécution, et je dirige cet agent au lieu de taper du code. Par-dessus se trouvent les agents que j&#039;ai affinés pendant des mois, tous en lecture seule par construction ; &lt;code&gt;build&lt;/code&gt; est le seul autorisé à modifier le code.&lt;/p&gt;
&lt;p&gt;Les gains de ces agents se concentrent en un point : la compréhension. À mon travail, nous n&#039;avons pas d&#039;équipes spécialisées, donc n&#039;importe qui peut se voir confier n&#039;importe quelle tâche : un bug de synchronisation de stock le matin, une fonctionnalité dans une partie du code que je n&#039;ai jamais ouvert l&#039;après-midi, le prochain ticket dans l’application retail. Chaque tâche pourrait être un domaine différent avec ses propres règles métier, et je bascule entre elles trois ou quatre fois par jour. L&#039;agent &lt;code&gt;task-analyst&lt;/code&gt; lit le ticket, ses parents et le code associé, puis me livre l&#039;ensemble en une seule lecture.&lt;/p&gt;
&lt;p&gt;Comprendre un ticket est une chose, mais une fonctionnalité n&#039;est pas terminée quand la branche est poussée. Entre le code et la production se trouve un second métier fait d&#039;attente et de vérifications : le statut de la CI, les reviews, la QA. Tout cela vit dans GitHub et Jira, en dehors de mes worktrees. J&#039;avais automatisé la réflexion et gardé l&#039;attente.&lt;/p&gt;
&lt;p&gt;Cet article porte sur l&#039;outil que j&#039;ai construit pour combler ce fossé : PABLO, une application Symfony. En son cœur se trouve une machine à états, quelque chose que les développeurs PHP livrent depuis une décennie sous un nom moins à la mode que celui qu&#039;utilise l&#039;écosystème IA aujourd&#039;hui.&lt;/p&gt;
&lt;h2&gt;Les corvées que personne n&#039;a automatisées&lt;/h2&gt;
&lt;p&gt;Voici à quoi ressemblait réellement mon matin : avant d&#039;écrire la moindre ligne, je devais traiter une checklist mentale sur 5 ou 6 pull requests ouvertes et deux ou trois projets.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;La CI est-elle verte ? L&#039;ADE n&#039;affiche le statut que pour la PR du worktree courant ; les autres vivent dans des onglets de navigateur.&lt;/li&gt;
&lt;li&gt;Quelqu&#039;un les a-t-il reviewées, et est-il temps de redemander sans devenir la personne qui demande toutes les 90 minutes ?&lt;/li&gt;
&lt;li&gt;La QA les a-t-elle planifiées, ou cassées ?&lt;/li&gt;
&lt;li&gt;Du feedback est-il arrivé sur le ticket ? Le trouver, recréer un worktree pour une branche supprimée la semaine dernière.&lt;/li&gt;
&lt;li&gt;La CI est-elle rouge ? Alors tout ce que les agents font pour moi est inutile tant que je ne relance pas les choses moi-même : remarquer l&#039;échec, créer un worktree, choisir l&#039;agent, le lancer, attendre.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Rien de tout cela n&#039;est difficile, et c&#039;est exactement le problème : chaque point coûte un changement de contexte, la chose que j&#039;avais passée un an à éliminer. Ce ne sont jamais les minutes qui faisaient mal ; ce qui faisait mal, c&#039;était l&#039;entrelacement : vérifier la CI, revenir à une tâche, se rappeler que personne n&#039;a reviewé, revenir encore.&lt;/p&gt;
&lt;p&gt;Mes agents avaient éliminé le bruit, rendant le travail facile à comprendre. Mais le coût du suivi de toutes ces tâches restait le mien. Une douzaine de pièces mobiles à travers trois outils, et dans ce système, quelque chose doit poller. C&#039;était moi.&lt;/p&gt;
&lt;h2&gt;PABLO&lt;/h2&gt;
&lt;p&gt;Alors j&#039;ai fait : PABLO, pour &lt;em&gt;Personal Assistant for Boring Logic &amp;amp; Operations&lt;/em&gt;. L&#039;acronyme est venu après le nom, mais « boring » (ennuyeux) est le mot honnête dedans. Rien de ce que fait PABLO n&#039;est malin : il regarde les pull requests, lit les dates, les compare avec 10 minutes auparavant, et conclut que quelque chose a changé (ou pas).&lt;/p&gt;
&lt;p&gt;L&#039;ADE reste l&#039;endroit où je travaille, et PABLO reste un niveau au-dessus, répondant en boucle à une seule question : étant donné l&#039;état de cette pull request, y a-t-il quelque chose qu&#039;un agent devrait faire, et si oui, lequel ? Quand la réponse est oui, PABLO lance automatiquement cet agent via le binaire de l&#039;ADE, dans le bon worktree, exactement comme je l&#039;aurais fait.&lt;/p&gt;
&lt;p&gt;Sous le capot se trouve une application console Symfony avec trois points d&#039;entrée :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;un binaire &lt;code&gt;pablo&lt;/code&gt; ;&lt;/li&gt;
&lt;li&gt;la console Symfony ;&lt;/li&gt;
&lt;li&gt;un petit dashboard.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Il y a une exception à ce tableau : &lt;code&gt;/pablo-commit-and-pr&lt;/code&gt; est une commande OpenCode, pas une commande PABLO. L&#039;agent écrit le message de commit et la description de la pull request (la seule partie du flux où un agent bat du simple code), puis rend la tâche à PABLO, qui déplace la tâche vers l&#039;état &lt;code&gt;draft&lt;/code&gt; et prend le relais.&lt;/p&gt;
&lt;p&gt;Et enfin, un scheduler en arrière-plan (systemd sur Linux ou launchd sur macOS) met à jour les informations sur les pull requests toutes les cinq minutes.&lt;/p&gt;
&lt;p&gt;Cette séparation compte plus qu&#039;il n&#039;y paraît. PABLO ne demande jamais qu&#039;à lancer un agent dans un worktree et à être prévenu quand le run se termine, donc tout ce que PABLO sait de l&#039;ADE tient derrière une seule interface : &lt;code&gt;AgentLauncherInterface&lt;/code&gt;. L&#039;interface rend l&#039;ADE remplaçable : si un meilleur arrive le mois prochain, je réécris une classe. Le remplacement a déjà eu lieu une fois : je travaillais avec &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://www.onorca.dev/&quot;&gt;Orca&lt;/a&gt; avant, et je travaille avec &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://openchamber.dev/&quot;&gt;OpenChamber&lt;/a&gt; aujourd&#039;hui. Un couplage va plus loin : quand l&#039;ADE refuse un worktree, la porte de secours est un &lt;code&gt;opencode run&lt;/code&gt; headless. PABLO ne dépend vraiment que d&#039;OpenCode.&lt;/p&gt;
&lt;p&gt;Pourquoi PHP pour un daemon en arrière-plan en 2026 ? C&#039;est le langage dans lequel je pense le plus vite, et le seul utilisateur, c&#039;est moi.&lt;/p&gt;
&lt;p&gt;Une dernière décision : PABLO ne stocke aucun token et ne parle à aucune API. Tout passe par des CLIs déjà authentifiés sur ma machine (&lt;code&gt;gh&lt;/code&gt;, &lt;code&gt;acli&lt;/code&gt;, &lt;code&gt;linear&lt;/code&gt;, &lt;code&gt;orca&lt;/code&gt;, &lt;code&gt;openchamber&lt;/code&gt;), donc il n&#039;y a rien à faire tourner ou à fuiter. Quand quelque chose manque, &lt;code&gt;pablo system:doctor&lt;/code&gt; le dit, avant qu&#039;un cron n&#039;échoue silencieusement à 3 heures du matin.&lt;/p&gt;
&lt;p&gt;L&#039;intelligence a toujours été dans les agents. Ce qui manquait, c&#039;était quelque chose d&#039;assez bête pour tourner toutes les cinq minutes pour toujours sans s&#039;ennuyer.&lt;/p&gt;
&lt;h2&gt;Graph engineering, ou : une machine à états avec un meilleur nom&lt;/h2&gt;
&lt;p&gt;Si vous avez lu sur les agents IA récemment, vous avez vu le terme « graph engineering » : modéliser le travail en nœuds et en arêtes au lieu d&#039;un seul énorme prompt. Enlevez le vocabulaire à la mode, et ce n&#039;est qu&#039;une machine à états. Parce que le développement logiciel est brouillon, la machine à états de PABLO doit être flexible. Plusieurs états doivent facilement retomber sur &lt;code&gt;draft&lt;/code&gt;, et une commande manuelle peut extraire une tâche d&#039;un état à tout moment. Les frameworks de machines à états lourds exigent de déclarer à l&#039;avance chaque transition autorisée et bloquent tout le reste. C&#039;est trop rigide pour mon workflow, alors j&#039;ai sauté les frameworks et construit un moteur simple : des états, des transitions, et une règle souple sur ce qui est autorisé depuis où.&lt;/p&gt;
&lt;p&gt;Dans la plupart des frameworks d&#039;agents, les nœuds sont des étapes de raisonnement (plan, search, summarize, critique), et le graphe vit à l&#039;intérieur de la tâche. Dans PABLO, les nœuds sont les états qu&#039;une pull request traverse dans une vraie équipe : drafted, CI en échec, attente de review, changes requested, attente de QA. Le graphe n&#039;est pas l&#039;agent : c&#039;est le processus dans lequel je travaille déjà. C&#039;est ce qui garde le graphe stable après la prochaine sortie de modèle, les prompts et les modèles vivant à l&#039;intérieur des nœuds.&lt;/p&gt;
&lt;p&gt;Donc la machine à états est une table. Littéralement une table, dans une classe :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-5&quot;&gt;State&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;Draft&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;value &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;emoji&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;📝&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;label&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;draft&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-1&quot;&gt;                        &#039;onEnter&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::class&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;enterDraft&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;], &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;polled&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; true&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-5&quot;&gt;State&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;CiRed&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;value &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;emoji&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;🔴&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;label&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &#039;ci-red&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-1&quot;&gt;                        &#039;onEnter&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::class&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;enterCiRed&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;], &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;polled&#039;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&gt;&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; true&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;],&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Chaque ligne de la table déclare comment afficher l&#039;état, ce qui s&#039;exécute à l&#039;entrée, et si le poller le surveille. À côté de la première table, une seconde dit ce que chaque état peut vérifier :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; const&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; POLL_CHECKS&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-5&quot;&gt;    State&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;Draft&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;value         &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;checkCiRed&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;checkCiGreen&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-5&quot;&gt;    State&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;CiRed&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;value         &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;checkCiGreen&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-5&quot;&gt;    State&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;ReadyToReview&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;value &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;checkCiRed&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;checkReviews&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-5&quot;&gt;    State&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;WaitingReview&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;value &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;checkCiRed&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;checkReviews&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-5&quot;&gt;    State&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;NeedsTesting&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;value  &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;=&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;checkFailureSignal&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;];&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;C&#039;est tout le moteur. Ajouter une étape est une ligne et une méthode, pas un refactoring. Le handler on-enter unique est partagé par le poller, les commandes et les overrides manuels, donc les transitions ne divergent jamais. Même idée pour les trackers : une interface de provider, et la machine à états n&#039;a aucune idée de quel tracker elle parle.&lt;/p&gt;
&lt;h2&gt;Les états, et ce qui les réveille&lt;/h2&gt;
&lt;p&gt;Il y a neuf états. Pas de &lt;code&gt;todo&lt;/code&gt;, pas d&#039;&lt;code&gt;init&lt;/code&gt;, exprès : une issue que je n&#039;ai pas commencée n&#039;a pas de tâche et apparaît simplement dans la liste de ce qui m&#039;est assigné. Entrer dans &lt;code&gt;in-progress&lt;/code&gt; crée la tâche, la branche, le worktree et le premier run d&#039;agent ; un merge ferme la tâche depuis n&#039;importe où et supprime le worktree.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;État&lt;/th&gt;
&lt;th&gt;Entré par&lt;/th&gt;
&lt;th&gt;Ce qui se passe à l&#039;entrée&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;🔨 &lt;code&gt;in-progress&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pablo task:start &amp;lt;issue-url&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;crée la branche et le worktree, lance &lt;code&gt;task-analyst&lt;/code&gt; une fois, plus le script de démarrage du projet s&#039;il en a un&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🥱 &lt;code&gt;waiting&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pablo task:waiting&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;rien, et le polling s&#039;arrête. Revenir en arrière restaure l&#039;état précédent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;📝 &lt;code&gt;draft&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/pablo-commit-and-pr&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;commit, push, draft pull request ouverte&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🔴 &lt;code&gt;ci-red&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;poller : la CI échoue&lt;/td&gt;
&lt;td&gt;lance &lt;code&gt;ci-analyst&lt;/code&gt; sur les checks en échec et leurs logs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;👀 &lt;code&gt;ready-to-review&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;poller : la CI est verte&lt;/td&gt;
&lt;td&gt;marque la pull request prête sur GitHub, puis bascule immédiatement vers l&#039;état suivant&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;👀 &lt;code&gt;waiting-review&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;atteint depuis le précédent&lt;/td&gt;
&lt;td&gt;rien, c&#039;est ici qu&#039;une tâche attend des humains&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🧪 &lt;code&gt;needs-testing&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;poller : une review approbatrice est arrivée&lt;/td&gt;
&lt;td&gt;enregistre le timestamp qui devient la baseline QA&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🔁 &lt;code&gt;request-changes&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;poller : changes requested&lt;/td&gt;
&lt;td&gt;repasse la pull request en draft, lance &lt;code&gt;pr-feedback&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🚨 &lt;code&gt;testing-failed&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;poller : le signal d&#039;échec QA s&#039;est déclenché&lt;/td&gt;
&lt;td&gt;repasse la pull request en draft, lance &lt;code&gt;task-feedback&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;La forme de la chose, en graphe :&lt;/p&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://jolicode.com//media/cache/content/2026/pablo-orchestrator/mermaid-diagram-2026-09-21-100259.png&quot; alt=&quot;Graph Mermaid&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Regardez les flèches, pas les boîtes : chaque flèche vers &lt;code&gt;draft&lt;/code&gt; est une commande que j&#039;ai tapée ; chaque autre flèche est le poller. Je décide quand le travail quitte mes mains ; la machine gère le reste.&lt;/p&gt;
&lt;p&gt;Trois détails ont demandé bien plus d&#039;itérations que prévu.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Le premier : ce qui compte comme une review.&lt;/strong&gt; Mes propres reviews sont exclues : répondre à un commentaire sur ma propre pull request crée une review à mon nom, ce qui me renverrait sinon en draft juste pour avoir répondu à une question. Les reviews de bots sont ignorées sauf whitelist. Seules les reviews postérieures au dernier événement timeline &lt;code&gt;ready_for_review&lt;/code&gt; de GitHub comptent (un vrai timestamp, contrairement au verdict du summary), donc une approbation périmée ne peut pas fuiter dans ce tour. La dernière review par reviewer gagne, et tout ce qui n&#039;est pas une approbation bat toutes les approbations : si quelqu&#039;un a pris la peine d&#039;écrire, je lis le feedback avant que la QA ne le fasse.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Le deuxième : exactement un seul chemin de retour vers &lt;code&gt;draft&lt;/code&gt;, et c&#039;est une commande.&lt;/strong&gt; Pas de détection de push : un &lt;code&gt;git push&lt;/code&gt; brut ne déplace rien. Cela semble restrictif jusqu&#039;à ce qu&#039;on considère que je pousse des dizaines de fois par jour, souvent juste pour lancer la CI. Une commande explicite est un signal. Un push est du bruit.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Le troisième : ce que j&#039;ai délibérément choisi de ne pas traiter comme des événements.&lt;/strong&gt; CI pending ne déclenche rien. CI rouge dans &lt;code&gt;needs-testing&lt;/code&gt; ne déclenche rien non plus : un build cassé apparaîtra au moment du merge, et interrompre la QA n&#039;aide personne. La moitié de la conception d&#039;une machine à états, c&#039;est choisir ce qui n&#039;est pas un événement, et cette moitié ne reçoit presque aucune attention.&lt;/p&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://jolicode.com//media/cache/content/2026/pablo-orchestrator/pablo-dashboard.png&quot; alt=&quot;Dashboard web PABLO&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Ce que « vert » veut réellement dire&lt;/h2&gt;
&lt;p&gt;Deux de ces transitions pendent à une question : la CI est-elle verte ? Cela ressemble à un fait qu&#039;on vérifie. Ça n&#039;en est pas un.&lt;/p&gt;
&lt;p&gt;Ma première version : rouge en échec, vert quand tout passe, en attente sinon. Cette règle fonctionnait partout sauf sur le projet où j&#039;avais le plus besoin de PABLO.&lt;/p&gt;
&lt;p&gt;Ce projet tourne sous CircleCI, qui publie ses deployment gates sur GitHub comme status contexts : &lt;code&gt;deploy-code-approval-ppr&lt;/code&gt;, &lt;code&gt;deploy-code-approval-qlf&lt;/code&gt;. Ce sont des gates manuelles sur chaque pipeline, y compris les branches de feature où personne ne clique dessus (nous ne déployons pas en qualification à chaque commit). Elles restent à &lt;code&gt;PENDING&lt;/code&gt; pour toujours, ou arrivent en &lt;code&gt;ACTION_REQUIRED&lt;/code&gt;, que ma règle comptait comme échec, donc « La CI est-elle verte ? » n&#039;était jamais oui.&lt;/p&gt;
&lt;p&gt;Le correctif est une ligne de configuration dans PABLO :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;ci&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;  ignore_checks&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;: [&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&quot;approval&quot;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Tout check dont le nom, le workflow ou le status context contient cette sous-chaîne est retiré de la question entièrement : il ne peut ni rendre le verdict rouge, ni le retenir en attente pour toujours. Deux gates, un mot.&lt;/p&gt;
&lt;p&gt;Cette unique clé de configuration m&#039;a forcé à réaliser quelque chose : une CI verte est une règle, pas un fait. Ce que GitHub appelle un « CI check » est en réalité un tas bruyant de tests unitaires, de gates de déploiement manuelles et de bots bavards. Comme aucun outil ne peut deviner magiquement lesquels comptent réellement pour une branche donnée, PABLO pousse cette décision vers le fichier YAML du projet. Pour garder le moteur simple, j&#039;ai ajouté deux autres règles brutales : un dépôt avec zéro check est considéré comme vert, et le matching par sous-chaîne reste volontairement bête.&lt;/p&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://jolicode.com//media/cache/content/2026/pablo-orchestrator/github-approval-gates.png&quot; alt=&quot;Gates d&#039;approbation GitHub&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;La seule exception à mon propre dogme&lt;/h2&gt;
&lt;p&gt;Dans mon article précédent, j&#039;ai fait un point sur le fait que mes agents sont en lecture seule, pas par instruction mais par construction : le frontmatter (voir mon article précédent pour comprendre ce qu&#039;est un frontmatter) refuse &lt;code&gt;edit&lt;/code&gt; et &lt;code&gt;write&lt;/code&gt;. Les quatre analystes de PABLO suivent la même règle : modèle pas cher et rapide, interdit en écriture.&lt;/p&gt;
&lt;p&gt;Mais il y a cinq agents. Le cinquième agent est &lt;code&gt;rebase-conflict-resolver&lt;/code&gt;, le seul endroit où j&#039;ai cassé ma propre règle exprès. Toutes les douze heures, un job de sync rebase chaque worktree de mes tâche sur la branche primaire. En cas de conflit, git abandonne et réinitialise le worktree, et un agent est lancé pour refaire le rebase et résoudre chaque conflit. Son frontmatter montre le coût : &lt;code&gt;edit: allow&lt;/code&gt;, &lt;code&gt;write: allow&lt;/code&gt;, &lt;code&gt;git push*: allow&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Pourquoi le laisser entrer ? La sync est un dry run par défaut. Une clé de configuration transforme le rapport en action : &lt;code&gt;auto_apply: true&lt;/code&gt;, posé seulement là où je suis sur que j’ai le moins de risques possibles.&lt;/p&gt;
&lt;p&gt;Son rayon d&#039;action est borné comme tout le reste. Il peut écrire du code et pousser, mais toute commande agissant sur le processus plutôt que sur le code (merging, approving, commenting) est refusée. Il peut réécrire ma branche ; il ne peut ni l&#039;approuver, ni la merger, ni parler en mon nom. La permission dangereuse n&#039;a jamais été &lt;code&gt;edit&lt;/code&gt; ; c&#039;était agir en tant que moi devant d&#039;autres personnes. Deux garde-fous de plus : une branche sale (fichiers non commités restants) n&#039;est jamais rebasée, et quand l&#039;agent prend le relais d&#039;un rebase, PABLO affiche une commande claire et copiable pour voir la session de l&#039;agent dans OpenCode.&lt;/p&gt;
&lt;p&gt;Git fait le travail de sécurité restant. Le push est toujours &lt;code&gt;--force-with-lease&lt;/code&gt;, jamais un &lt;code&gt;--force&lt;/code&gt; nu. Si j&#039;ai poussé moi-même pendant que le cron tournait, la vérification de lease échoue, le worktree revient en arrière, et le job réessaie douze heures plus tard. Mon push gagne toujours. Quand un conflit nécessite vraiment un humain, l&#039;agent affiche &lt;code&gt;PABLO_CONFLICT_UNRESOLVABLE&lt;/code&gt; et ne pousse rien.&lt;/p&gt;
&lt;p&gt;La partie honnête : cet agent peut faire des dégâts, contrairement aux quatre autres. J&#039;accepte ce risque parce que tout ce qu&#039;il écrit atterrit dans une pull request que je review avant le merge. C&#039;est mon propre code. En échange, je n&#039;ai pas eu de pull request en conflit depuis un moment.&lt;/p&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://jolicode.com//media/cache/content/2026/pablo-orchestrator/pablo-rebase.png&quot; alt=&quot;Reporting rebase web PABLO&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Tout ne mérite pas un LLM&lt;/h2&gt;
&lt;p&gt;Dans mon article précédent, je décrivais deux de mes commandes d&#039;agent préférées : des prompts quotidiens qui appelaient le CLI &lt;code&gt;gh&lt;/code&gt;, lisaient mes pull requests ouvertes, et utilisaient un LLM pour écrire un message Slack demandant à l&#039;équipe des reviews et de la QA. Ça ressemblait à de la magie à l&#039;époque. Aucune des deux n&#039;a survécu. Elles sont maintenant simplement &lt;code&gt;pablo show:prs&lt;/code&gt; : un script PHP lisant depuis le cache du poller, affichant exactement le même markdown prêt pour Slack avec une file de review, un séparateur, et une file de QA. Aucun LLM impliqué.&lt;/p&gt;
&lt;p&gt;Le même instinct a façonné le dashboard web, rendu depuis le cache du poller, et cela mène à quelque chose à quoi je ne m&#039;attendais pas. Un outil construit pour orchestrer des agents IA s&#039;avère être des timestamps, des file locks, du CLI parsé et une table de transitions autorisées. L&#039;intelligence est dans cinq fichiers markdown ; tout le reste est de la plomberie sans éclat qui décide quand ouvrir le robinet.&lt;/p&gt;
&lt;h2&gt;Ce qui a réellement changé&lt;/h2&gt;
&lt;p&gt;La différence la plus claire : je n&#039;ai pas vérifié moins, j&#039;ai arrêté de vérifier moi-même.&lt;/p&gt;
&lt;p&gt;Plus de tour de mes pull requests pour des pipelines rouges, plus de chasse aux reviews. Une liste, &lt;code&gt;pablo tasks&lt;/code&gt; ou le dashboard web, me dit ce qui m&#039;attend ; tout le reste est le tour de quelqu&#039;un d&#039;autre.&lt;/p&gt;
&lt;p&gt;Le cas de la CI à lui seul a valu la construction de PABLO. La CI passe rouge à onze heures du soir, le poller le remarque en moins de dix minutes et lance &lt;code&gt;ci-analyst&lt;/code&gt; dans le bon worktree ; au matin, le diagnostic attend. L&#039;analyse était déjà automatisée par mes agents ; ce qui a changé, c&#039;est que le fait de remarquer et l&#039;attente sont automatisés aussi.&lt;/p&gt;
&lt;p&gt;Une tâche complète se passe maintenant ainsi : &lt;code&gt;pablo task:start&lt;/code&gt; sur un lien Jira, travailler avec l&#039;agent, &lt;code&gt;/pablo-commit-and-pr&lt;/code&gt;, et arrêter d&#039;y penser.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pablo task:start https://acme.atlassian.net/browse/XXX-123
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Le temps de cerveau est la ressource&lt;/h2&gt;
&lt;p&gt;Le coût caché du développement moderne, ce ne sont pas les trois minutes que prend la vérification d&#039;un pipeline CI ; c&#039;est la taxe cognitive de garder cet onglet ouvert à l&#039;arrière de votre tête. Le deep work exige de longues périodes d&#039;attention ininterrompues. Quand vous le fracturez avec un ping-pong administratif : rafraîchir GitHub, courir après des approbations, se demander si la QA a pris votre ticket. Vous ne perdez pas seulement du temps, vous brûlez l&#039;énergie mentale exacte dont vous avez besoin pour résoudre des problèmes difficiles. Je n&#039;ai pas construit PABLO juste pour taper moins de commandes bash, ni pour automatiser pour automatiser. Je l&#039;ai construit pour qu&#039;il serve de bouclier cognitif. En déléguant la bureaucratie de la mise en production à une boucle PHP bête et inlassable, j&#039;ai cessé d&#039;être un routeur humain pour mes propres tâches. Je peux de nouveau être simplement un ingénieur.&lt;/p&gt;
&lt;hr /&gt;
&lt;h2&gt;PABLO est public&lt;/h2&gt;
&lt;p&gt;PABLO est public : &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/korbeil/pablo&quot;&gt;github.com/korbeil/pablo&lt;/a&gt;. Il est construit pour exactement un utilisateur, le workflow de mon équipe, mes CLIs, ma tolérance à l&#039;attente ; rien de tout cela n&#039;est universel. Le publier revient à tendre à quelqu&#039;un un fichier de config bien tenu : quelque chose à lire, à emprunter et à casser. La machine à états est une table précisément pour que la vôtre remplace la mienne sans combat.&lt;/p&gt;
&lt;p&gt;Si vous voulez l&#039;essayer, la version courte :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;git clone https://github.com/korbeil/pablo &amp;amp;&amp;amp; cd pablo
./bin/install.sh        # deps, liens agents/commandes, démarre le scheduler,
                        # finit avec pablo system:doctor
pablo system:doctor     # quel CLI manque ou est déconnecté
pablo project:new       # ajouter un projet ; ou déposer un YAML dans ~/.pablo/projects/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Vous avez besoin de PHP 8.4+ et des CLIs (&lt;code&gt;gh&lt;/code&gt;, &lt;code&gt;acli&lt;/code&gt;, &lt;code&gt;linear&lt;/code&gt;, &lt;code&gt;opencode&lt;/code&gt;) chacun déjà authentifié. Puis &lt;code&gt;pablo task:start &amp;lt;issue-url&amp;gt;&lt;/code&gt; sur quelque chose de petit, &lt;code&gt;/pablo-commit-and-pr&lt;/code&gt;, et arrêtez d&#039;y penser. Si vous préférez un dashboard web au CLI, &lt;code&gt;pablo web&lt;/code&gt; le sert sur le port 8321.&lt;/p&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://jolicode.com//media/cache/content/2026/pablo-orchestrator/pablo-start.png&quot; alt=&quot;Démarrage PABLO&quot; /&gt;&lt;/p&gt;

        </content>
    </entry>    <entry>
        <id>https://jolicode.com/blog/castor-1-8-windows-self-update-et-des-binaires-verifiables</id>
        <published>2026-09-22T10:41:00+02:00</published>
        <updated>2026-09-22T10:41:00+02:00</updated>
        <link type="text/html" rel="alternate" href="https://jolicode.com/blog/castor-1-8-windows-self-update-et-des-binaires-verifiables"/>
        <title>Castor 1.8: Windows, self-update, et des binaires vérifiables</title>
        <author>
            <name>JoliCode Team</name>
            <uri>https://jolicode.com/</uri>
        </author>            <category term="open-source" />            <category term="castor" />            <reactions:summary total="15">                <reactions:reaction emoji="🚀" shortname="rocket" count="5"/>                <reactions:reaction emoji="🎉" shortname="party" count="4"/>                <reactions:reaction emoji="❤️" shortname="heart" count="3"/>                <reactions:reaction emoji="👏" shortname="clapclap" count="2"/>                <reactions:reaction emoji="👍" shortname="plus1" count="1"/>            </reactions:summary>
        <summary><![CDATA[La dernière fois que nous avons parlé de Castor sur ce blog, c&#039;était pour annoncer la sortie de la 1.0, en octobre 2025. Depuis, notre rongeur préféré a pris un rythme mensuel : une version mineure toutes…]]></summary>
        <content type="html">
            &lt;p&gt;La dernière fois que nous avons parlé de Castor sur ce blog, c&#039;était pour annoncer &lt;a href=&quot;https://jolicode.com//blog/le-task-runner-castor-est-maintenant-disponible-en-version-1&quot;&gt;la sortie de la 1.0&lt;/a&gt;, en octobre 2025. Depuis, notre rongeur préféré a pris un rythme mensuel : une version mineure toutes les quatre à cinq semaines, avec à chaque fois quelques helpers et quelques correctifs, parfois une dépréciation pour préparer la 2.0.&lt;/p&gt;
&lt;p&gt;La 1.8 casse un peu ce rythme : 81 commits et 33 pull requests depuis la 1.7.0 de début août, et presque aucun n&#039;ajoute de helper. Le travail est parti dans les recoins de Castor que vous ne regardez jamais : comment il arrive sur votre machine, comment il se met à jour, et ce qui prouve que le binaire que vous lancez est bien celui que notre CI a construit. Ah, et il tourne sous Windows maintenant 🪟.&lt;/p&gt;
&lt;h2&gt;Ce que vous avez peut-être raté depuis la 1.0.0&lt;/h2&gt;
&lt;p&gt;Sept versions mineures sont passées depuis l&#039;article sur la 1.0, et certaines méritent mieux qu&#039;une ligne dans le changelog. Au cas où vous en auriez sauté quelques-unes :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;PHP 8.4 est le minimum depuis la 1.6, et les binaires statiques embarquent PHP 8.5 depuis la 1.3. Si vous êtes coincés en 8.2 ou 8.3, Castor vous le dit et vous oriente vers le binaire statique ;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#[AsArgsAfterOptionEnd]&lt;/code&gt; (1.2) donne à une tâche tout ce qui est tapé après &lt;code&gt;--&lt;/code&gt;, tel quel. Pratique pour un &lt;code&gt;castor phpunit -- --filter foobar&lt;/code&gt; qui transmet le reste à une autre CLI ;&lt;/li&gt;
&lt;li&gt;Le contexte a appris deux choses en 1.4 : &lt;code&gt;input&lt;/code&gt;, pour alimenter le stdin d&#039;un process (un mot de passe, plutôt que de le mettre sur la ligne de commande), et &lt;code&gt;supportsInteraction()&lt;/code&gt;, pour savoir si vous êtes dans un TTY ou dans une CI avant d&#039;appeler &lt;code&gt;toInteractive()&lt;/code&gt; ;&lt;/li&gt;
&lt;li&gt;Un fichier &lt;code&gt;.castor.context&lt;/code&gt; à la racine du projet définit le contexte par défaut, derrière &lt;code&gt;--context&lt;/code&gt; et &lt;code&gt;CASTOR_CONTEXT&lt;/code&gt; (1.6). Commitez-le, ou gitignorez-le pour un défaut personnel ;&lt;/li&gt;
&lt;li&gt;L&#039;autocomplétion des chemins est devenue plus maligne : &lt;code&gt;#[AsPathArgument]&lt;/code&gt; et &lt;code&gt;#[AsPathOption]&lt;/code&gt; acceptent un &lt;code&gt;directory&lt;/code&gt; et un &lt;code&gt;filter&lt;/code&gt; (1.4) ;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dispatch()&lt;/code&gt; et &lt;code&gt;event_dispatcher()&lt;/code&gt; (1.7) laissent vos tâches dispatcher leurs propres événements, en plus de ceux que Castor émet déjà ;&lt;/li&gt;
&lt;li&gt;Le repack n&#039;a plus besoin de &lt;code&gt;jolicode/castor&lt;/code&gt; dans votre &lt;code&gt;composer.json&lt;/code&gt; (1.3), et &lt;code&gt;--castor-file&lt;/code&gt; pointe Castor vers un fichier racine qui ne s&#039;appelle pas &lt;code&gt;castor.php&lt;/code&gt; (1.1) ;&lt;/li&gt;
&lt;li&gt;Plus petits : &lt;code&gt;terminal()&lt;/code&gt; pour la taille du terminal, &lt;code&gt;slug()&lt;/code&gt; pour slugifier une chaîne, un lien vers la définition de la tâche dans &lt;code&gt;castor help&lt;/code&gt;, et un en-tête silencieux quand Castor tourne dans un agent IA (moins de tokens gachés !).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Le &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/castor/blob/main/CHANGELOG.md&quot;&gt;changelog&lt;/a&gt; contient le reste. Passons à la 1.8.&lt;/p&gt;
&lt;h2&gt;Castor sous Windows&lt;/h2&gt;
&lt;p&gt;Castor fournit un phar Windows depuis les premières releases. Mais un phar a besoin de PHP, et « installer PHP sous Windows » n&#039;est pas aussi fluide que sur les autres plateformes. Les binaires statiques, ceux qui embarquent PHP, n&#039;existaient que pour Linux et macOS.&lt;/p&gt;
&lt;p&gt;La 1.8 ajoute &lt;code&gt;castor.windows-amd64.exe&lt;/code&gt; à chaque release : un fichier, PHP 8.5 dedans, rien à installer. Déposez-le dans un dossier de votre &lt;code&gt;PATH&lt;/code&gt; et c&#039;est terminé :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-9&quot;&gt;curl.exe&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &quot;https://github.com/jolicode/castor/releases/latest/download/castor.windows-amd64.exe&quot;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;Lso C:\&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;un dossier de votre PATH&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;castor.exe&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;div class=&quot;c-alert c-alert--note&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 70 71&quot;&gt;&lt;path fill-rule=&quot;nonzero&quot; d=&quot;M35 .9c19.3 0 35 15.7 35 35s-15.7 35-35 35-35-15.7-35-35S15.7.9 35 .9m0 5c-16.552 0-30 13.449-30 30s13.448 30 30 30c16.552.103 30-13.448 30-30 0-16.551-13.448-30-30-30m0 24.9c1.7 0 3 1.3 3 3v15.3c0 1.7-1.3 3-3 3s-3-1.3-3-3V33.8c0-1.7 1.3-3 3-3m0-11c.8 0 1.6.3 2.3.9.6.5.9 1.3.9 2.1 0 .2-.1.4-.1.6-.1.2-.1.4-.2.6s-.2.3-.3.5-.3.4-.4.5c-1.1 1.1-3.1 1.1-4.2 0-.2-.2-.3-.3-.4-.5s-.2-.3-.3-.5-.2-.4-.2-.6c-.1-.2-.1-.4-.1-.6 0-.8.3-1.6.9-2.1.5-.6 1.3-.9 2.1-.9&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Info&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
Sous WSL, gardez le binaire statique Linux : même si ça fonctionne, le .exe tournerait comme un process Windows via l&#039;interop, ce qui n&#039;est pas ce que vous attendez d&#039;un shell Linux.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Si vous distribuez votre propre CLI construite sur Castor (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://castor.jolicode.com/going-further/extending-castor/repack/&quot;&gt;repack&lt;/a&gt;, puis &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://castor.jolicode.com/going-further/extending-castor/compile/&quot;&gt;compile&lt;/a&gt;), &lt;code&gt;castor:compile&lt;/code&gt; a gagné une option &lt;code&gt;--os=windows&lt;/code&gt; : vos tâches peuvent devenir un exécutable Windows elles aussi.&lt;/p&gt;
&lt;p&gt;La première tentative pour supporter les binaires Windows remonte à octobre 2025, juste après la 1.0, et il a fallu quelques impasses avant d&#039;aboutir à une solution fonctionnelle. Nous construisons les binaires statiques avec &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://static-php.dev/&quot;&gt;static-php-cli&lt;/a&gt;, un super outil sous Linux et macOS, mais moins évident sous Windows. Dans le désordre : le runner &lt;code&gt;windows-latest&lt;/code&gt; embarque un Visual Studio que static-php-cli ne reconnaît pas (il veut le 2019 ou le 2022), le &lt;code&gt;tar&lt;/code&gt; de git bash réécrit les chemins Windows dans votre dos, et MSVC abandonne sur les chemins de sources de plus de 260 caractères. Chacun de ces soucis se corrige en cinq minutes. Chacun coûte aussi un run de CI complet pour être découvert 😅. Si vous aimez ce genre d&#039;archéologie, toute l&#039;histoire est dans &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/castor/pull/879&quot;&gt;la pull request&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Installer et mettre à jour Castor&lt;/h2&gt;
&lt;h3&gt;&lt;code&gt;castor self-update&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Jusqu&#039;ici, mettre à jour Castor voulait dire relancer l&#039;installeur, ou aller chercher le nouveau phar à la main sur la page des releases. Castor se met maintenant à jour tout seul, comme le font Composer et PHPStan :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;castor&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; self-update&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Il retrouve comment il a été installé, télécharge le phar ou le binaire statique qui correspond à votre plateforme, et se remplace lui-même. La version précédente est conservée à côté : un &lt;code&gt;--rollback&lt;/code&gt; la remet en place si la nouvelle se comporte mal. Vous avez installé Castor globalement avec Composer ? La commande lance &lt;code&gt;composer global update&lt;/code&gt; pour vous.&lt;/p&gt;
&lt;p&gt;Castor vous disait « une nouvelle version est disponible » depuis deux ans. Il peut enfin y faire quelque chose.&lt;/p&gt;
&lt;h3&gt;Snapshots&lt;/h3&gt;
&lt;p&gt;Chaque push sur &lt;code&gt;main&lt;/code&gt; publie maintenant une pre-release &lt;code&gt;snapshot&lt;/code&gt;. C&#039;est le chemin le plus court pour essayer un correctif avant sa sortie :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;castor&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; self-update&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; --snapshot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;# ou, en partant de zéro&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;curl&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &quot;https://castor.jolicode.com/install&quot;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt; bash&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; -s&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; --&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; --version=snapshot&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Un snapshot affiche une version du type &lt;code&gt;v1.7.0-14-g4531440&lt;/code&gt; : la dernière release, le nombre de commits depuis, et le commit à partir duquel il a été construit. &lt;code&gt;castor self-update&lt;/code&gt; sans l&#039;option vous ramène sur la dernière stable.&lt;/p&gt;
&lt;p&gt;Égoïstement, c&#039;est aussi pour nous : « tu peux essayer le snapshot ? » se demande bien plus facilement dans une issue que « tu peux cloner le dépôt et construire le phar ? ».&lt;/p&gt;
&lt;h3&gt;Des binaires vérifiables&lt;/h3&gt;
&lt;p&gt;Un task runner tourne sur votre laptop et dans votre CI, et pour certains d&#039;entre vous sur des serveurs de production. Un task runner qui se met à jour tout seul télécharge du code et l&#039;exécute. Ça mérite mieux qu&#039;un &lt;code&gt;curl | bash&lt;/code&gt; et un acte de foi.&lt;/p&gt;
&lt;p&gt;Chaque phar et chaque binaire statique est maintenant publié avec une &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations&quot;&gt;attestation d&#039;artefact GitHub&lt;/a&gt; : une déclaration signée que ce fichier précis a été construit par le workflow GitHub Actions de Castor, à partir de ce commit. Chaque release contient aussi un fichier &lt;code&gt;SHA256SUMS&lt;/code&gt;, attesté lui aussi.&lt;/p&gt;
&lt;p&gt;Ensuite, tout ce qui télécharge Castor les vérifie :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;l&#039;installeur et &lt;code&gt;self-update&lt;/code&gt; comparent le checksum du binaire avec &lt;code&gt;SHA256SUMS&lt;/code&gt; ;&lt;/li&gt;
&lt;li&gt;si la &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://cli.github.com/&quot;&gt;CLI GitHub&lt;/a&gt; (2.49 ou plus) est installée et connectée, les deux lancent en plus &lt;code&gt;gh attestation verify&lt;/code&gt; dessus ;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;castor:repack&lt;/code&gt; refuse un phar Castor sans attestation (il existe un &lt;code&gt;--allow-unattested&lt;/code&gt; pour les releases publiées avant les attestations) ;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;castor:compile&lt;/code&gt; vérifie le checksum de l&#039;archive static-php-cli qu&#039;il télécharge.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Vous pouvez aussi le faire à la main, sur n&#039;importe quel fichier d&#039;une release :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;gh&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; attestation&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; verify&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; castor.linux-amd64&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; --repo&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; jolicode/castor&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;div class=&quot;c-alert c-alert--tip&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 46 72&quot;&gt;&lt;path fill-rule=&quot;nonzero&quot; d=&quot;M45.7 23.2C45.7 10.7 35.5.5 23 .5S.3 10.7.3 23.2c0 1.8.2 3.6.7 5.4.6 2.9 1.7 4.7 3.2 7.2.3.6.7 1.2 1.1 1.9.5.8.9 1.6 1.4 2.3 2 3.3 3.2 5.2 3.2 9.1v9.4c0 2.4 1.7 4.3 4 4.7 1 5.1 4 8.3 9.1 8.3s8.2-3.2 9.1-8.3c2.3-.4 4-2.4 4-4.7v-9.4c0-3.9 1.2-5.9 3.2-9.1.4-.7.9-1.5 1.4-2.3.4-.7.8-1.3 1.1-1.9 1.5-2.5 2.6-4.3 3.2-7.2.5-1.8.7-3.6.7-5.4M31.2 50.9H15.287v-1.917c0-.416 0-.75-.087-1.083h16c0 .333-.087.667-.087 1.083V50.9zm-1.016 7.5H15.603c-.44 0-.703-.308-.703-.615V55.4h15.986v2.385c.088.307-.263.615-.702.615m-7.124 8c-.87 0-3.089 0-3.96-3h8c-.871 3-3.168 3-4.04 3m17.091-38.664c-.468 2.072-1.216 3.484-2.526 5.65-.375.564-.655 1.129-1.03 1.788-.468.753-.842 1.506-1.216 2.071-1.123 1.883-2.153 3.578-2.808 5.555h-18.53c-.654-1.977-1.59-3.672-2.807-5.555-.374-.659-.842-1.318-1.216-2.071-.375-.659-.749-1.318-1.03-1.789-1.31-2.26-2.059-3.577-2.527-5.743a16.5 16.5 0 0 1-.561-4.236C5.9 13.708 13.761 5.8 23.4 5.8s17.5 7.908 17.5 17.606c-.187 1.412-.374 2.824-.749 4.33&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Astuce&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
Le script d&#039;installation a eu droit au même traitement : il télécharge dans un fichier temporaire privé, nettoie quoi qu&#039;il arrive, et se lit en entier avant d&#039;exécuter quoi que ce soit. Une connexion coupée en plein milieu ne peut plus lancer la moitié d&#039;un script.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;h2&gt;Dans vos tâches&lt;/h2&gt;
&lt;h3&gt;Des helpers plus sûrs&lt;/h3&gt;
&lt;p&gt;Tant que nous étions dans un mood sécurité, nous sommes repassé sur les helpers avec une seule question : et si cette valeur venait d&#039;une saisie utilisateur ? Une poignée de comportements ont changé. Aucun ne devrait casser une tâche existante, et ils sont tous dans le &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/castor/blob/main/CHANGELOG.md&quot;&gt;changelog&lt;/a&gt;, mais quelques-uns valent le coup d&#039;être mis en avant :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;http_download()&lt;/code&gt; ne garde que le dernier segment du nom de fichier envoyé par le serveur : un téléchargement atterrit toujours dans le dossier de votre projet, quoi qu&#039;en dise le serveur ;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ssh_run()&lt;/code&gt; échappe le chemin distant, et refuse un hôte, un utilisateur ou un chemin de clé contenant un métacaractère shell ;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;zip()&lt;/code&gt; avec un mot de passe préfère l&#039;extension PHP zip au binaire &lt;code&gt;zip&lt;/code&gt; : le binaire prend le mot de passe sur sa ligne de commande, lisible par tous les utilisateurs de la machine pendant la création de l&#039;archive. &lt;code&gt;zip_binary()&lt;/code&gt; le fait toujours, et prévient désormais ;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;run_php()&lt;/code&gt; passe son script au process enfant en argument, au lieu d&#039;une variable d&#039;environnement que n&#039;importe quel process Castor aurait ramassée sans se poser de question ;&lt;/li&gt;
&lt;li&gt;le dossier de cache est créé en &lt;code&gt;0700&lt;/code&gt;, respecte &lt;code&gt;XDG_CACHE_HOME&lt;/code&gt;, et le binaire du watcher derrière &lt;code&gt;watch()&lt;/code&gt; y est extrait plutôt que dans un chemin fixe de &lt;code&gt;/tmp&lt;/code&gt; partagé avec tous les utilisateurs de la machine ;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;encrypt_with_password()&lt;/code&gt; dérive sa clé avec les limites « moderate » de libsodium (Argon2id, 3 passes, 256 Mio) au lieu des « interactive ». Ce qui a été chiffré par un Castor plus ancien se déchiffre toujours. Ce qui est chiffré par la 1.8 demande la 1.8 ou plus.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Intercepter les signaux&lt;/h3&gt;
&lt;p&gt;Retour au quotidien. Un classique : une tâche démarre un serveur, et vous aimeriez que &lt;code&gt;CTRL+C&lt;/code&gt; arrête le serveur, pas la tâche. Jusqu&#039;ici, le &lt;code&gt;SIGINT&lt;/code&gt; arrêtait Castor lui-même, et ce que vous aviez prévu après le serveur ne s&#039;exécutait jamais.&lt;/p&gt;
&lt;p&gt;Le contexte a gagné &lt;code&gt;withTrappedSignals()&lt;/code&gt;, qui transmet le signal au process en cours à la place :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Castor\Attribute\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;AsTask&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; function&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Castor\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; function&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Castor\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;#[AsTask()]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-5&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt; serve&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; void&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;    // A CTRL+C stops the server, but not the task&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;    run&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;./my-server&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, context: &lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;withTrappedSignals&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;withAllowFailure&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;());&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;    run&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;echo &quot;the server has been stopped&quot;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Sans argument, il intercepte &lt;code&gt;SIGINT&lt;/code&gt; et &lt;code&gt;SIGTERM&lt;/code&gt;. Passez votre propre liste si besoin, &lt;code&gt;withTrappedSignals([\SIGINT, \SIGQUIT])&lt;/code&gt; par exemple. Les détails sont dans &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://castor.jolicode.com/going-further/interacting-with-castor/signals/#trapping-signals-sent-to-castor&quot;&gt;la documentation des signaux&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Monter un paquet distant&lt;/h3&gt;
&lt;p&gt;Castor a deux façons d&#039;amener des tâches externes dans un projet. &lt;code&gt;import()&lt;/code&gt; ajoute des fonctions et des tâches dans votre application. &lt;code&gt;mount()&lt;/code&gt; branche un sous-projet entier, avec son propre préfixe de namespace et son propre dossier de travail. Seul &lt;code&gt;import()&lt;/code&gt; connaissait les paquets Composer, &lt;code&gt;mount()&lt;/code&gt; ne fonctionnait qu&#039;avec des dossiers locaux. Ils partagent maintenant la même résolution :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; function&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Castor\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;mount&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;mount&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;composer://vendor/package&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;project:package&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Les tâches du paquet apparaissent sous &lt;code&gt;project:package:&lt;/code&gt; et s&#039;exécutent depuis le dossier du paquet installé, exactement comme un mount local. C&#039;est le montage que nous voulions pour une boîte à outils qu&#039;une équipe maintient dans son propre dépôt (un kit de déploiement, une stack Docker) et monte dans chaque projet.&lt;/p&gt;
&lt;p&gt;Un correctif est tombé de ce chantier : un &lt;code&gt;import()&lt;/code&gt; distant ne change plus le dossier de travail des tâches qu&#039;il définit. Il n&#039;aurait jamais dû. Seul un &lt;code&gt;mount()&lt;/code&gt; explicite fait ça.&lt;/p&gt;
&lt;h2&gt;Une dépréciation pour préparer la 2.0&lt;/h2&gt;
&lt;p&gt;Celle-ci mérite une minute, parce que vous dépendez peut-être de l&#039;ancien comportement sans le savoir.&lt;/p&gt;
&lt;p&gt;Aujourd&#039;hui, seul &lt;code&gt;run()&lt;/code&gt; s&#039;exécute dans le dossier de travail du contexte. Tout le reste, &lt;code&gt;fs()&lt;/code&gt;, &lt;code&gt;finder()&lt;/code&gt; et les fonctions PHP natives comme &lt;code&gt;mkdir()&lt;/code&gt; ou &lt;code&gt;file_get_contents()&lt;/code&gt;, résout les chemins relatifs depuis l&#039;endroit où vous avez tapé &lt;code&gt;castor&lt;/code&gt;. Lancez &lt;code&gt;castor build&lt;/code&gt; depuis un sous-dossier : &lt;code&gt;file_get_contents(&#039;composer.json&#039;)&lt;/code&gt; cherche au mauvais endroit alors que &lt;code&gt;run(&#039;cat composer.json&#039;)&lt;/code&gt; non. Pas terrible.&lt;/p&gt;
&lt;p&gt;Castor 2.0 changera son propre dossier courant pour le dossier de travail du contexte : un chemin relatif voudra dire la même chose partout. Il suit aussi les blocs &lt;code&gt;with(workingDirectory: ...)&lt;/code&gt;, et restaure le dossier précédent quand ils se terminent.&lt;/p&gt;
&lt;p&gt;Vous pouvez l&#039;activer dès aujourd&#039;hui avec une ligne en haut de votre &lt;code&gt;castor.php&lt;/code&gt; :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-9&quot;&gt;defined&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;CASTOR_USE_CHDIR&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;) &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt; define&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;CASTOR_USE_CHDIR&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Le&lt;code&gt;defined()&lt;/code&gt; n&#039;est pas décoratif : un projet monté ou un paquet importé peut définir la constante lui aussi, et un second &lt;code&gt;define()&lt;/code&gt; nu lève une erreur.&lt;/p&gt;
&lt;p&gt;Ne pas définir la constante est déprécié en 1.8, et le nouveau comportement devient le défaut en 2.0. Pour garder l&#039;ancien comportement encore un moment sans la dépréciation, définissez-la à &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;c-alert c-alert--warning&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 70 62&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;m41.198 3.519 27.854 47.924C71.752 56.135 68.377 62 62.806 62H7.098c-5.402 0-8.947-5.865-6.077-10.557L28.875 3.52c2.7-4.692 9.622-4.692 12.323 0Zm-8.586 2.944L5.427 52.936C4.274 54.725 5.592 57 7.734 57h54.37c2.306 0 3.624-2.275 2.471-4.063L37.39 6.464c-.988-1.95-3.79-1.95-4.778 0ZM33 45.9c1.1-1.1 3.1-1.1 4.2 0 .2.2.3.3.4.5s.2.3.3.5.2.4.2.6c.1.2.1.4.1.6 0 .8-.3 1.6-.9 2.1-.5.6-1.3.9-2.1.9s-1.6-.3-2.3-.9c-.6-.5-.9-1.3-.9-2.1 0-.2.1-.4.1-.6.1-.2.1-.4.2-.6s.2-.3.3-.5.3-.4.4-.5m2.2-27.1c1.7 0 3 1.3 3 3v15.3c0 1.7-1.3 3-3 3s-3-1.3-3-3V21.8c0-1.7 1.3-3 3-3&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Avertissement&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
Une fois activée, un chemin relatif donné en ligne de commande (&lt;code&gt;castor castor:compile foo.phar&lt;/code&gt;, un argument de tâche) se résout depuis la racine du projet, pas depuis le dossier où vous avez invoqué &lt;code&gt;castor&lt;/code&gt;. Ça ne compte que si vous lancez Castor depuis un sous-dossier, mais vérifiez vos tâches avant de basculer.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;h2&gt;Le mot de la fin&lt;/h2&gt;
&lt;p&gt;Si vous ne retenez qu&#039;une chose de la 1.8 : le binaire que vous lancez est le nôtre, preuve à l&#039;appui, et il se met à jour tout seul. Vos collègues sous Windows ont le même outil que tout le monde. En bonus, &lt;code&gt;CTRL+C&lt;/code&gt; fait enfin ce que vous attendez devant un serveur.&lt;/p&gt;
&lt;p&gt;La mise à jour tient désormais en une commande :&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;castor&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; self-update&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;La liste complète des changements est dans le &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/castor/blob/main/CHANGELOG.md&quot;&gt;changelog&lt;/a&gt;. Et si l&#039;histoire de static-php-cli vous a donné envie de savoir comment sont construits les binaires Linux, macOS et Windows, dites-le-nous : ça pourrait être le prochain article 🦫&lt;/p&gt;

        </content>
    </entry>    <entry>
        <id>https://jolicode.com/blog/castor-1-8-windows-self-update-and-binaries-you-can-verify</id>
        <published>2026-09-22T10:41:00+02:00</published>
        <updated>2026-09-22T10:41:00+02:00</updated>
        <link type="text/html" rel="alternate" href="https://jolicode.com/blog/castor-1-8-windows-self-update-and-binaries-you-can-verify"/>
        <title>Castor 1.8: Windows, self-update, and binaries you can verify</title>
        <author>
            <name>JoliCode Team</name>
            <uri>https://jolicode.com/</uri>
        </author>            <category term="open-source" />            <category term="castor" />            <reactions:summary total="6">                <reactions:reaction emoji="❤️" shortname="heart" count="2"/>                <reactions:reaction emoji="🚀" shortname="rocket" count="2"/>                <reactions:reaction emoji="🎉" shortname="party" count="2"/>            </reactions:summary>
        <summary><![CDATA[The last time we talked about Castor on this blog was to announce the 1.0 release, in October 2025. Since then, our favorite rodent has settled into a monthly rhythm: a minor version every four to five…]]></summary>
        <content type="html">
            &lt;p&gt;The last time we talked about Castor on this blog was to announce &lt;a href=&quot;https://jolicode.com//blog/the-castor-task-runner-is-now-stable&quot;&gt;the 1.0 release&lt;/a&gt;, in October 2025. Since then, our favorite rodent has settled into a monthly rhythm: a minor version every four to five weeks, with a few helpers and fixes each time, sometimes a deprecation to prepare 2.0.&lt;/p&gt;
&lt;p&gt;1.8 breaks the rhythm a bit: 81 commits and 33 pull requests since 1.7.0 in early August, and almost none of them add a helper. The work went into the parts of Castor you never look at: how it lands on your machine, how it updates, and what proves that the binary you run is the one our CI built. Oh, and it runs on Windows now 🪟.&lt;/p&gt;
&lt;h2&gt;What you may have missed since 1.0.0&lt;/h2&gt;
&lt;p&gt;Seven minor versions went by since the 1.0 article, and a few of them deserve more than a line in the changelog. In case you skipped some:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;PHP 8.4 is the minimum since 1.6, and the static binaries embed PHP 8.5 since 1.3. If you are stuck on 8.2 or 8.3, Castor tells you so and points you to the static binary;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#[AsArgsAfterOptionEnd]&lt;/code&gt; (1.2) gives a task everything typed after &lt;code&gt;--&lt;/code&gt;, untouched. Handy for a &lt;code&gt;castor phpunit -- --filter foobar&lt;/code&gt; that forwards the rest to another CLI;&lt;/li&gt;
&lt;li&gt;The context learned two things in 1.4: &lt;code&gt;input&lt;/code&gt;, to feed a process&#039;s stdin (a password, rather than putting it on the command line), and &lt;code&gt;supportsInteraction()&lt;/code&gt;, to tell whether you are in a TTY or in a CI before calling &lt;code&gt;toInteractive()&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;.castor.context&lt;/code&gt; file at the root of the project sets the default context, below &lt;code&gt;--context&lt;/code&gt; and &lt;code&gt;CASTOR_CONTEXT&lt;/code&gt; (1.6). Commit it, or gitignore it for a personal default;&lt;/li&gt;
&lt;li&gt;Path autocomplete got smarter: &lt;code&gt;#[AsPathArgument]&lt;/code&gt; and &lt;code&gt;#[AsPathOption]&lt;/code&gt; take a &lt;code&gt;directory&lt;/code&gt; and a &lt;code&gt;filter&lt;/code&gt; (1.4);&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dispatch()&lt;/code&gt; and &lt;code&gt;event_dispatcher()&lt;/code&gt; (1.7) let your tasks dispatch their own events, on top of the ones Castor already fires;&lt;/li&gt;
&lt;li&gt;Repack no longer needs &lt;code&gt;jolicode/castor&lt;/code&gt; in your &lt;code&gt;composer.json&lt;/code&gt; (1.3), and &lt;code&gt;--castor-file&lt;/code&gt; points Castor to a root file that is not named &lt;code&gt;castor.php&lt;/code&gt; (1.1);&lt;/li&gt;
&lt;li&gt;Smaller ones: &lt;code&gt;terminal()&lt;/code&gt; for the terminal size, &lt;code&gt;slug()&lt;/code&gt; to slugify a string, a link to the task definition in &lt;code&gt;castor help&lt;/code&gt;, and a silent header when Castor runs inside an AI agent (fewer tokens wasted!).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/castor/blob/main/CHANGELOG.md&quot;&gt;changelog&lt;/a&gt; has the rest. Now, 1.8.&lt;/p&gt;
&lt;h2&gt;Castor on Windows&lt;/h2&gt;
&lt;p&gt;Castor has shipped a Windows phar since the first releases. A phar needs PHP though, and &amp;quot;install PHP on Windows&amp;quot; is not something as smooth as other platforms. The static binaries, the ones with PHP baked in, only existed for Linux and macOS.&lt;/p&gt;
&lt;p&gt;1.8 adds &lt;code&gt;castor.windows-amd64.exe&lt;/code&gt; to every release: one file, PHP 8.5 inside, nothing to install. Drop it in a directory of your &lt;code&gt;PATH&lt;/code&gt; and you are done:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-9&quot;&gt;curl.exe&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &quot;https://github.com/jolicode/castor/releases/latest/download/castor.windows-amd64.exe&quot;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; -&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;Lso C:\&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;a directory &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; your PATH&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;&gt;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt;castor.exe&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;div class=&quot;c-alert c-alert--note&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 70 71&quot;&gt;&lt;path fill-rule=&quot;nonzero&quot; d=&quot;M35 .9c19.3 0 35 15.7 35 35s-15.7 35-35 35-35-15.7-35-35S15.7.9 35 .9m0 5c-16.552 0-30 13.449-30 30s13.448 30 30 30c16.552.103 30-13.448 30-30 0-16.551-13.448-30-30-30m0 24.9c1.7 0 3 1.3 3 3v15.3c0 1.7-1.3 3-3 3s-3-1.3-3-3V33.8c0-1.7 1.3-3 3-3m0-11c.8 0 1.6.3 2.3.9.6.5.9 1.3.9 2.1 0 .2-.1.4-.1.6-.1.2-.1.4-.2.6s-.2.3-.3.5-.3.4-.4.5c-1.1 1.1-3.1 1.1-4.2 0-.2-.2-.3-.3-.4-.5s-.2-.3-.3-.5-.2-.4-.2-.6c-.1-.2-.1-.4-.1-.6 0-.8.3-1.6.9-2.1.5-.6 1.3-.9 2.1-.9&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Info&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
Under WSL, keep the Linux static binary: even if it works, the .exe would run as a Windows process through interop, which is not what you want from a Linux shell.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;If you ship your own CLI built on Castor (&lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://castor.jolicode.com/going-further/extending-castor/repack/&quot;&gt;repack&lt;/a&gt;, then &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://castor.jolicode.com/going-further/extending-castor/compile/&quot;&gt;compile&lt;/a&gt;), &lt;code&gt;castor:compile&lt;/code&gt; gained a &lt;code&gt;--os=windows&lt;/code&gt; option, so your tasks can become a Windows executable as well.&lt;/p&gt;
&lt;p&gt;The first attempt to add support for Windows binaries dates back to October 2025, right after 1.0, and it took a couple of dead ends before landing. We build the static binaries with &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://static-php.dev/&quot;&gt;static-php-cli&lt;/a&gt;, a great tool on Linux and macOS, and a bumpier ride on Windows. In no particular order: the &lt;code&gt;windows-latest&lt;/code&gt; runner ships a Visual Studio that static-php-cli does not recognize (it wants 2019 or 2022), git bash&#039;s &lt;code&gt;tar&lt;/code&gt; rewrites Windows paths behind your back, and MSVC gives up on source paths longer than 260 characters. Each one is a five-minute fix. Each one also costs a full CI run to find out 😅. If you enjoy that kind of archaeology, the whole story is in &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/castor/pull/879&quot;&gt;the pull request&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Installing and updating Castor&lt;/h2&gt;
&lt;h3&gt;&lt;code&gt;castor self-update&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Until now, updating Castor meant running the installer again, or fetching the new phar by hand from the releases page. Castor now updates itself, like Composer and PHPStan do:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;castor&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; self-update&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It finds out how it was installed, downloads the phar or static binary matching your platform, and swaps itself out. The previous version is kept next to it: a &lt;code&gt;--rollback&lt;/code&gt; brings it back if the new one misbehaves. Installed globally with Composer? The command runs &lt;code&gt;composer global update&lt;/code&gt; for you.&lt;/p&gt;
&lt;p&gt;Castor had been telling you &amp;quot;a new version is available&amp;quot; for two years. It can finally do something about it.&lt;/p&gt;
&lt;h3&gt;Snapshots&lt;/h3&gt;
&lt;p&gt;Every push on &lt;code&gt;main&lt;/code&gt; now publishes a &lt;code&gt;snapshot&lt;/code&gt; pre-release. It is the shortest path to try a fix before it is released:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;castor&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; self-update&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; --snapshot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;# or, from scratch&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;curl&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; &quot;https://castor.jolicode.com/install&quot;&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt; bash&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; -s&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; --&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; --version=snapshot&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A snapshot reports a version like &lt;code&gt;v1.7.0-14-g4531440&lt;/code&gt;: the last release, the number of commits since, and the commit it was built from. &lt;code&gt;castor self-update&lt;/code&gt; without the option puts you back on the latest stable.&lt;/p&gt;
&lt;p&gt;Selfishly, this is also for us: &amp;quot;can you try the snapshot?&amp;quot; is a much easier thing to ask in an issue than &amp;quot;can you clone the repository and build the phar?&amp;quot;.&lt;/p&gt;
&lt;h3&gt;Binaries you can verify&lt;/h3&gt;
&lt;p&gt;A task runner runs on your laptop and in your CI, and for some of you on production servers. A self-updating one downloads code and runs it. That deserves better than &lt;code&gt;curl | bash&lt;/code&gt; and a leap of faith.&lt;/p&gt;
&lt;p&gt;Every phar and static binary is now published with a &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations&quot;&gt;GitHub artifact attestation&lt;/a&gt;: a signed statement that this exact file was built by Castor&#039;s own GitHub Actions workflow, from this commit. Each release also ships a &lt;code&gt;SHA256SUMS&lt;/code&gt; file, attested as well.&lt;/p&gt;
&lt;p&gt;Then everything that downloads Castor checks them:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the installer and &lt;code&gt;self-update&lt;/code&gt; compare the binary&#039;s checksum with &lt;code&gt;SHA256SUMS&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;if the &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://cli.github.com/&quot;&gt;GitHub CLI&lt;/a&gt; (2.49 or later) is installed and logged in, both also run &lt;code&gt;gh attestation verify&lt;/code&gt; on it;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;castor:repack&lt;/code&gt; refuses a Castor phar without attestation (there is an &lt;code&gt;--allow-unattested&lt;/code&gt; for releases published before attestations existed);&lt;/li&gt;
&lt;li&gt;&lt;code&gt;castor:compile&lt;/code&gt; checks the checksum of the static-php-cli archive it downloads.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can do it by hand too, on any file of a release:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;gh&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; attestation&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; verify&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; castor.linux-amd64&lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt; --repo&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; jolicode/castor&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;div class=&quot;c-alert c-alert--tip&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 46 72&quot;&gt;&lt;path fill-rule=&quot;nonzero&quot; d=&quot;M45.7 23.2C45.7 10.7 35.5.5 23 .5S.3 10.7.3 23.2c0 1.8.2 3.6.7 5.4.6 2.9 1.7 4.7 3.2 7.2.3.6.7 1.2 1.1 1.9.5.8.9 1.6 1.4 2.3 2 3.3 3.2 5.2 3.2 9.1v9.4c0 2.4 1.7 4.3 4 4.7 1 5.1 4 8.3 9.1 8.3s8.2-3.2 9.1-8.3c2.3-.4 4-2.4 4-4.7v-9.4c0-3.9 1.2-5.9 3.2-9.1.4-.7.9-1.5 1.4-2.3.4-.7.8-1.3 1.1-1.9 1.5-2.5 2.6-4.3 3.2-7.2.5-1.8.7-3.6.7-5.4M31.2 50.9H15.287v-1.917c0-.416 0-.75-.087-1.083h16c0 .333-.087.667-.087 1.083V50.9zm-1.016 7.5H15.603c-.44 0-.703-.308-.703-.615V55.4h15.986v2.385c.088.307-.263.615-.702.615m-7.124 8c-.87 0-3.089 0-3.96-3h8c-.871 3-3.168 3-4.04 3m17.091-38.664c-.468 2.072-1.216 3.484-2.526 5.65-.375.564-.655 1.129-1.03 1.788-.468.753-.842 1.506-1.216 2.071-1.123 1.883-2.153 3.578-2.808 5.555h-18.53c-.654-1.977-1.59-3.672-2.807-5.555-.374-.659-.842-1.318-1.216-2.071-.375-.659-.749-1.318-1.03-1.789-1.31-2.26-2.059-3.577-2.527-5.743a16.5 16.5 0 0 1-.561-4.236C5.9 13.708 13.761 5.8 23.4 5.8s17.5 7.908 17.5 17.606c-.187 1.412-.374 2.824-.749 4.33&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Astuce&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
The installer script got the same treatment: it downloads to a private temporary file, cleans up whatever happens, and reads itself entirely before executing anything. A connection dropped halfway through can no longer run half a script.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;h2&gt;Inside your tasks&lt;/h2&gt;
&lt;h3&gt;Safer helpers&lt;/h3&gt;
&lt;p&gt;While we were in a security mood, we went through the helpers with one question: what if this value comes from user input? A handful of behaviors changed. None should break an existing task, and they are all in the &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/castor/blob/main/CHANGELOG.md&quot;&gt;changelog&lt;/a&gt;, but a few are worth knowing:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;http_download()&lt;/code&gt; only keeps the last segment of the file name sent by the server, so a download always lands in your project directory, whatever the server says;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ssh_run()&lt;/code&gt; quotes the remote path, and refuses a host, user or key path containing a shell metacharacter;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;zip()&lt;/code&gt; with a password prefers the PHP zip extension to the &lt;code&gt;zip&lt;/code&gt; binary: the binary takes the password on its command line, readable by every user of the machine while the archive is built. &lt;code&gt;zip_binary()&lt;/code&gt; still does, and now warns about it;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;run_php()&lt;/code&gt; passes its script to the child process as an argument, instead of an environment variable that any Castor process would have happily picked up;&lt;/li&gt;
&lt;li&gt;the cache directory is created in &lt;code&gt;0700&lt;/code&gt;, honors &lt;code&gt;XDG_CACHE_HOME&lt;/code&gt;, and the watcher binary behind &lt;code&gt;watch()&lt;/code&gt; is extracted there rather than in a fixed path of &lt;code&gt;/tmp&lt;/code&gt; shared with every user of the machine;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;encrypt_with_password()&lt;/code&gt; derives its key with libsodium&#039;s &amp;quot;moderate&amp;quot; limits (Argon2id, 3 passes, 256 MiB) instead of the &amp;quot;interactive&amp;quot; ones. Anything encrypted by an older Castor still decrypts. Anything encrypted by 1.8 needs 1.8 or later.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Trapping signals&lt;/h3&gt;
&lt;p&gt;Back to daily life. A classic: a task starts a server, and you would like &lt;code&gt;CTRL+C&lt;/code&gt; to stop the server, not the task. Until now, the &lt;code&gt;SIGINT&lt;/code&gt; stopped Castor itself, and whatever you had planned after the server never ran.&lt;/p&gt;
&lt;p&gt;The context gained &lt;code&gt;withTrappedSignals()&lt;/code&gt;, which forwards the signal to the running process instead:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Castor\Attribute\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;AsTask&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; function&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Castor\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; function&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Castor\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;#[AsTask()]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-5&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt; serve&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt; void&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-10&quot;&gt;    // A CTRL+C stops the server, but not the task&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;    run&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;./my-server&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, context: &lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;withTrappedSignals&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;-&gt;&lt;/span&gt;&lt;span class=&quot;syntax-8&quot;&gt;withAllowFailure&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;());&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;    run&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;echo &quot;the server has been stopped&quot;&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-2&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Without arguments it traps &lt;code&gt;SIGINT&lt;/code&gt; and &lt;code&gt;SIGTERM&lt;/code&gt;. Pass your own list if you need to, &lt;code&gt;withTrappedSignals([\SIGINT, \SIGQUIT])&lt;/code&gt; for instance. The details are in &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://castor.jolicode.com/going-further/interacting-with-castor/signals/#trapping-signals-sent-to-castor&quot;&gt;the signals documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Mounting a remote package&lt;/h3&gt;
&lt;p&gt;Castor has two ways to bring external tasks into a project. &lt;code&gt;import()&lt;/code&gt; pulls functions and tasks into your application. &lt;code&gt;mount()&lt;/code&gt; plugs in a whole sub-project, with its own namespace prefix and its own working directory. Only &lt;code&gt;import()&lt;/code&gt; knew about Composer packages, &lt;code&gt;mount()&lt;/code&gt; wanted a local directory. They now share the same resolution:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-4&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt; function&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt; Castor\&lt;/span&gt;&lt;span class=&quot;syntax-5&quot;&gt;mount&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;mount&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;composer://vendor/package&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;project:package&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The tasks of the package show up under &lt;code&gt;project:package:&lt;/code&gt; and run from the directory of the installed package, exactly like a local mount. This is the setup we wanted for a toolkit a team maintains in its own repository (a deployment kit, a Docker stack) and mounts in every project.&lt;/p&gt;
&lt;p&gt;One fix fell out of the rework: a remote &lt;code&gt;import()&lt;/code&gt; no longer changes the working directory of the tasks it defines. It never should have. Only an explicit &lt;code&gt;mount()&lt;/code&gt; does that.&lt;/p&gt;
&lt;h2&gt;One deprecation to prepare 2.0&lt;/h2&gt;
&lt;p&gt;This one deserves a minute, because you may depend on the old behavior without knowing it.&lt;/p&gt;
&lt;p&gt;Today, only &lt;code&gt;run()&lt;/code&gt; executes in the working directory of the context. Everything else, &lt;code&gt;fs()&lt;/code&gt;, &lt;code&gt;finder()&lt;/code&gt; and plain PHP functions such as &lt;code&gt;mkdir()&lt;/code&gt; or &lt;code&gt;file_get_contents()&lt;/code&gt;, resolves relative paths from wherever you typed &lt;code&gt;castor&lt;/code&gt;. Run &lt;code&gt;castor build&lt;/code&gt; from a subdirectory: &lt;code&gt;file_get_contents(&#039;composer.json&#039;)&lt;/code&gt; looks in the wrong place while &lt;code&gt;run(&#039;cat composer.json&#039;)&lt;/code&gt; does not. Not great.&lt;/p&gt;
&lt;p&gt;Castor 2.0 will change its own current directory to the working directory of the context, so a relative path means the same thing everywhere. It follows &lt;code&gt;with(workingDirectory: ...)&lt;/code&gt; blocks too, and restores the previous directory when they end.&lt;/p&gt;
&lt;p&gt;You can opt in today with one line at the top of your &lt;code&gt;castor.php&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-9&quot;&gt;defined&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;CASTOR_USE_CHDIR&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;) &lt;/span&gt;&lt;span class=&quot;syntax-4&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;syntax-9&quot;&gt; define&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt;&#039;CASTOR_USE_CHDIR&#039;&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;syntax-3&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;syntax-2&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;defined()&lt;/code&gt; guard is not decorative: a mounted project or an imported package may define the constant too, and a second bare &lt;code&gt;define()&lt;/code&gt; throws.&lt;/p&gt;
&lt;p&gt;Not defining the constant is deprecated in 1.8, and the new behavior becomes the default in 2.0. To keep the old behavior a while longer without the deprecation, define it to &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;c-alert c-alert--warning&quot;&gt;
    &lt;p class=&quot;c-alert__title&quot;&gt;
                    &lt;span class=&quot;c-icon c-icon--monospace&quot;&gt;
                &lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; aria-hidden=&quot;true&quot; class=&quot;c-icon__svg&quot; focusable=&quot;false&quot; viewBox=&quot;0 0 70 62&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;m41.198 3.519 27.854 47.924C71.752 56.135 68.377 62 62.806 62H7.098c-5.402 0-8.947-5.865-6.077-10.557L28.875 3.52c2.7-4.692 9.622-4.692 12.323 0Zm-8.586 2.944L5.427 52.936C4.274 54.725 5.592 57 7.734 57h54.37c2.306 0 3.624-2.275 2.471-4.063L37.39 6.464c-.988-1.95-3.79-1.95-4.778 0ZM33 45.9c1.1-1.1 3.1-1.1 4.2 0 .2.2.3.3.4.5s.2.3.3.5.2.4.2.6c.1.2.1.4.1.6 0 .8-.3 1.6-.9 2.1-.5.6-1.3.9-2.1.9s-1.6-.3-2.3-.9c-.6-.5-.9-1.3-.9-2.1 0-.2.1-.4.1-.6.1-.2.1-.4.2-.6s.2-.3.3-.5.3-.4.4-.5m2.2-27.1c1.7 0 3 1.3 3 3v15.3c0 1.7-1.3 3-3 3s-3-1.3-3-3V21.8c0-1.7 1.3-3 3-3&quot;/&gt;&lt;/svg&gt;
            &lt;/span&gt;
                        &lt;strong&gt;Avertissement&lt;/strong&gt;
    &lt;/p&gt;
    &lt;div class=&quot;c-alert__content&quot;&gt;
                &lt;p&gt;
Once enabled, a relative path given on the command line (&lt;code&gt;castor castor:compile foo.phar&lt;/code&gt;, a task argument) resolves from the project root, not from the directory you invoked &lt;code&gt;castor&lt;/code&gt; in. It only matters when you run Castor from a subdirectory, but check your tasks before switching.&lt;/p&gt;
        &lt;/div&gt;
&lt;/div&gt;

&lt;h2&gt;A final word&lt;/h2&gt;
&lt;p&gt;If you remember one thing from 1.8: the binary you run is provably ours, and it keeps itself up to date. Your Windows colleagues get the same tool as everyone else. As a bonus, &lt;code&gt;CTRL+C&lt;/code&gt; finally does what you expect in front of a server.&lt;/p&gt;
&lt;p&gt;Updating takes one command from now on:&lt;/p&gt;
&lt;pre class=&quot;syntax-0&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;syntax-8&quot;&gt;castor&lt;/span&gt;&lt;span class=&quot;syntax-1&quot;&gt; self-update&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The complete list of changes is in the &lt;a rel=&quot;nofollow noopener noreferrer&quot; href=&quot;https://github.com/jolicode/castor/blob/main/CHANGELOG.md&quot;&gt;changelog&lt;/a&gt;. And if the static-php-cli story made you curious about how the Linux, macOS and Windows binaries are built, tell us: it could be the next article 🦫&lt;/p&gt;

        </content>
    </entry></feed>
