<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Accor - Tech &amp; Digital - Medium]]></title>
        <description><![CDATA[Accor’s exceptional hospitality is not only driven by its staff, but also by our Tech &amp; Digital teams. Discover how we innovate and enhance the customer experience with technology, from optimized delivery to personalized services. Follow here their journey. - Medium]]></description>
        <link>https://medium.com/accor-digital-and-tech?source=rss----9bee72310bac---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Accor - Tech &amp;amp; Digital - Medium</title>
            <link>https://medium.com/accor-digital-and-tech?source=rss----9bee72310bac---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 23:13:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/accor-digital-and-tech" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Coding Dojos: The Underrated Workshop That Actually Transforms Development Teams]]></title>
            <link>https://medium.com/accor-digital-and-tech/coding-dojos-the-underrated-workshop-that-actually-transforms-development-teams-8cf8b91c7188?source=rss----9bee72310bac---4</link>
            <guid isPermaLink="false">https://medium.com/p/8cf8b91c7188</guid>
            <category><![CDATA[teamwork]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[n8n]]></category>
            <category><![CDATA[coding-dojo]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Bertrand Magnien]]></dc:creator>
            <pubDate>Wed, 17 Dec 2025 13:31:20 GMT</pubDate>
            <atom:updated>2025-12-17T13:31:19.314Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A year and a half ago, we reintroduced a practice largely abandoned in the corporate world. Result: a more efficient team, better shared skills, and an enriched work environment.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K2iIafDc2Kvtu0mccIWu1Q.png" /><figcaption>Real picture of our team, comparing different ways to list items on an Android App</figcaption></figure><h3>Coding dojo vs crowd programming: two different point of view</h3><p>Before diving into our experience, it’s worth clarifying the distinction between coding dojos and crowd programming terms that are sometimes mixed, but serve different purposes.</p><p>In my interpretation, crowd programming is more general concept: it’s about tackling a problem by connecting multiple minds to move forward efficiently. The primary goal is productivity and problem-solving through collective intelligence.</p><p>Coding dojos, on the other hand, are fundamentally learning-oriented exercises. Two key differences define them:</p><ul><li>First, the presence of a pre-defined topic defined by the expert who guides the session and can intervene when the team gets stuck.</li><li>Second, the explicit educational framework. It is designed as a structured exercise with clear learning objectives rather than just collaborative problem-solving.</li></ul><p>While both practices involve group programming, the intent and structure make all the difference.</p><p>Our approach clearly falls into the coding dojo category, since our goal is to share and improve our development skills together.</p><h3>A forgotten practice in enterprise</h3><p>Coding Dojos are one of those practices well-known to developers in their early training or mentoring years, but tend to disappear once in the corporate environment. Between delivery constraints, meetings, and daily priorities, few teams take the time to maintain these collaborative development moments.</p><p>Our team of 15 senior Android developers decided to reintroduce this practice. This decision proved to be one of the most beneficial for our team dynamics and collective skill development.</p><h3>Our approach to coding dojos</h3><p>The format we adopted is relatively simple but effective:</p><p><strong>Organization</strong> : A subject matter expert “leads” the exercise by preparing an objective and intermediate steps. The rest of the team collaborates to solve the problem, with a shared screen and keyboard rotation.</p><p><strong>Timed rotation</strong> : Every 2–3 minutes, a signal indicates the developer change at the keyboard. This time constraint maintains a sustained pace and ensures everyone’s participation.</p><p><strong>Active collaboration</strong> : When the team encounters difficulties, mutual help naturally emerges. If the blockage persists, the leader intervenes to unblock the situation.</p><p>This approach works particularly well in person, where spontaneous exchanges and parallel discussions enrich the collective experience.</p><h3>Genesis and evolution of our practice</h3><p>The initiative was born from a pragmatic need: one team member mastered Jetpack Compose significantly better than others. Rather than organizing individual training sessions, we opted for collective sessions we called “Compose Workshops.”</p><p>We established a rhythm of 1.5 hours every 4 weeks. This frequency allows adequate preparation for the leader while avoiding the fatigue that could occur with sessions too close together.</p><p>Autonomy was a key factor: we self-allocated this time slot without requiring hierarchical approval, and shared our experience on internal communication channels.</p><h3>Subject diversification</h3><p>Quickly, we extended the concept beyond Jetpack Compose. Topics evolved toward accessibility, automation with N8N, and other technical domains relevant to the team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zu209RtBF422yfpMYVoPww.jpeg" /><figcaption>We’re extending the workshops to any idea, classic coding or workflow creation on N8N.</figcaption></figure><p>A striking example: during a session where we had completed the main exercise faster than expected, we pivoted to a “hot topic” : automating translation modifications by connecting our translation management tool’s API to our codebase. This flexibility allows responding to the team’s immediate needs.</p><h3>Observed benefits</h3><h4>Evaluation and integration of new developers</h4><p>In a largely remote work context, coding dojos offer a unique opportunity to observe developers in their natural work environment. We can assess their comfort with tools, their IDE velocity, and their mastery of shortcuts and best practices.</p><p>These sessions also facilitate sharing technical tips (“Do you know this shortcut to reopen the last closed file? It’s Cmd+E on IntelliJ”), creating collective skill improvement on often forgotten aspects of daily development.</p><h4>Distributed leadership</h4><p>A particularly rewarding aspect is the natural rotation of the leader role. Anyone can propose a topic on our dedicated Slack channel, and generally, a volunteer emerges to facilitate it. This approach democratizes knowledge sharing and allows less extroverted profiles to take leadership in their area of expertise.</p><h4>Production code</h4><p>Our most recent evolution consists of setting ourselves the goal of having potentially “mergeable” code at the end of each session. While this complicates topic selection (they must be both educational and aligned with our roadmap), it maximizes the added value of invested time.</p><p>This approach proves particularly effective when introducing new architectural principles or new development rules: the entire team masters the subject and we can integrate the result directly.</p><h4>Scalability with a large team</h4><p>With 15 developers, the scalability question legitimately arises. In practice, 2–3 minutes per person represents about 30–45 minutes of pure exercise. Over 1.5 hours total, including explanation and debriefing phases, each participant takes the keyboard at least once, some twice.</p><p>Occasional absences due to project priorities don’t pose structural problems, although they’re usually regretted by participants.</p><h3>Practical implementation guide</h3><p>For teams wishing to adopt this practice, we recommend:</p><ol><li><strong>Needs identification</strong> : Collect topics the team wants to develop skills in</li><li><strong>Expert designation</strong> : Identify someone comfortable with the subject, capable of preparing an objective and intermediate steps (about 1 hour of preparation)</li><li><strong>Feedback collection</strong> : Gather feedback after the first session to optimize the format</li></ol><p><strong>Mistake to avoid</strong> : We initially allocated 5 minutes per person, which proved too long. The dynamic works better with rotations of 2–3 minutes maximum. The developer taking the keyboard starts the timer themselves, which creates accountability and avoids oversights. At the end of his/her coding session, we activate the list randomiser, and so the dojo continues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HeKa9qkPWytiY7m32L1qFQ.png" /><figcaption>Screenshot of the list randomiser (pretty fun one for French people) and the Google stopwatch side by side.</figcaption></figure><h3>Argument for skeptical teams</h3><p>To convince reluctant teams: “Do you remember those exercises practiced during your early development years, in training or mentoring? On the field and with an established team, this approach retains all its relevance and effectiveness.”</p><p>This practice doesn’t reinvent anything: it simply honors a proven method, often abandoned in the professional environment.</p><h3>Evolution perspectives</h3><p>After fifteen workshops over a year and a half, we’re considering improving our upstream preparation to maximize concrete deliverable production. We’re also considering documenting sessions and their results, while ensuring we don’t bureaucratize the practice.</p><h3>Conclusion</h3><p>Coding dojos represent a valuable opportunity to bring the team together in person around the shared passion of development. In a professional context where remote work predominates, these moments of authentic sharing and collective skill development constitute a particularly profitable investment for team performance and cohesion.</p><p>Adopting this practice requires few resources but generates long term benefits for technical skills, new member integration, and team collaboration.</p><p>Take this idea and adapt it to your team’s needs, experiment with different formats. There are many other Medium articles about coding dojos worth exploring. While writing this article, I discovered that other teams are also practicing coding dojos with different constraints and rules that are truly worth trying.</p><p>One final piece of advice: don’t do it too often. It’s precisely the fact that it’s not too frequent that creates these special moments. After all, who hasn’t listened to a great song too many times and ended up not appreciating it at its true value anymore?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8cf8b91c7188" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accor-digital-and-tech/coding-dojos-the-underrated-workshop-that-actually-transforms-development-teams-8cf8b91c7188">Coding Dojos: The Underrated Workshop That Actually Transforms Development Teams</a> was originally published in <a href="https://medium.com/accor-digital-and-tech">Accor - Tech &amp; Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Mutation Testing in Vue.js with StrykerJS]]></title>
            <link>https://medium.com/accor-digital-and-tech/introducing-mutation-testing-in-vue-js-with-strykerjs-e1083afe7326?source=rss----9bee72310bac---4</link>
            <guid isPermaLink="false">https://medium.com/p/e1083afe7326</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nicolas Dos Santos]]></dc:creator>
            <pubDate>Thu, 27 Nov 2025 06:53:47 GMT</pubDate>
            <atom:updated>2025-11-27T06:53:47.002Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Level: Beginner to Intermediate<br>Sample Repository: <a href="https://github.com/Kobee1203/vue-stryker-example">https://github.com/Kobee1203/vue-stryker-example</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fuAgGLjR-w23nOQxpmfjOA.png" /></figure><p><strong>Mutation testing</strong> may sound intimidating, but it’s a transformative technique every developer should have in their toolbox. In this article, you’ll learn:</p><ul><li><em>What </em>mutation testing is and <em>why </em>it matters;</li><li><em>How </em>it surpasses traditional code coverage tools like Sonar;</li><li><em>Exact steps </em>to implement StrykerJS in your Vue.js project, covering configuration, running reports, and automating quality with GitLab CI.</li></ul><p>By the end, you’ll understand mutation testing’s real benefits and be ready to integrate it into your own work.</p><h3>What is Mutation Testing?</h3><h4>Purpose &amp; Definition</h4><p><strong>Mutation testing</strong> is a robust software testing technique designed to assess the <em>effectiveness </em>of your test suite. It works by automatically applying small changes (mutations) to your code (such as changing a &gt; to &lt; or replacing a + with a -), then reruns your tests to see if they fail.</p><ul><li><strong>If the tests fail as expected</strong> → Your tests caught the mutation: test suite is good!</li><li><strong>If the tests pass</strong> → Your tests didn’t catch the problem: a gap in verification!</li></ul><h3>Why Is This Important?</h3><p>Traditional coverage tools like SonarQube or Istanbul (nyc) only tell you <em>which lines </em>of code your tests touch, not if they truly verify correct behavior. A single expect() for a function could tell coverage tools that “100% is reached,” while leaving corner cases (or even main logic!) untested.</p><p><strong><em>In summary: Mutation testing measures how well your tests detect bugs, not just how much code they execute.</em></strong></p><h3>Mutation Testing vs. Traditional Code Coverage</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*EzzdftPuTylfE9FynuG9VA.png" /></figure><p><strong>Example:</strong><br>You may test this function:</p><pre>// sum.js<br>export function sum(a, b) {<br>  return a + b;<br>}</pre><pre>// sum.test.js<br>import { sum } from &#39;./sum&#39;<br><br>test(&#39;sum adds numbers&#39;, () =&gt; {<br>  expect(sum(1, 2)).toBe(3)<br>})</pre><p><em>Code coverage </em>will report 100%.<br><em>Mutation testing </em>will create a mutant (change + to -). If your test doesn&#39;t catch it (which it doesn&#39;t, unless you have negative/zero/other edge cases), you&#39;ll see your test suite isn&#39;t as strong as you thought!</p><h3>Setting Up: Sample Vue.js Project</h3><p>To follow along, clone this demo repo:</p><p>👉 <a href="https://github.com/Kobee1203/vue-stryker-example">https://github.com/Kobee1203/vue-stryker-example</a></p><p><strong>Directory structure:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*yqbvZrv49CtH_j2C8ofJOw.png" /></figure><h3>Example Component: AppCounter.vue</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*lUXX0BvzDEAkVJIeoQmRsQ.png" /><figcaption>AppCounter.vue</figcaption></figure><h3>Example Composable: useCounter.ts</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*lHBAqlLTA3GuruEuWf6kKQ.png" /><figcaption>useCounter.ts</figcaption></figure><h3>What is Stryker?</h3><p>Stryker is a popular open-source mutation testing tool which helps you test your code written in JavaScript and TypeScript. It can really help you validate that your Vue.js/Svelte/React/NodeJS app have properly written tests.</p><p>It is designed to be easy to use, highly configurable and compatible with a wide range of testing frameworks.</p><p>Stryker also offers mutation testing for :</p><ul><li><a href="https://stryker-mutator.io/docs/stryker-net/introduction/">.NET Core and .NET Framework projects</a></li><li><a href="https://stryker-mutator.io/docs/stryker4s/getting-started/">Scala</a></li></ul><p>In this article, I’ll walk you through the process of setting up Stryker and running mutation tests on a sample <a href="https://vuejs.org/guide/quick-start.html">Vue.js</a> application and I’ll use <a href="https://vitest.dev/guide/">vitest</a> as testing framework.</p><h3>Installing StrykerJS</h3><p>The easiest way to get started with Stryker is by using the npm init stryker command.</p><pre>npm init stryker</pre><p>This command will first install Stryker and then run the Stryker initializer. During the initialization, you’ll be asked a series of questions to help set up Stryker for your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*X_w4vnV2wbAhD7WtDkpdxA.png" /></figure><p>After the init is done, inspect the stryker.config.mjs file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*e5J-kUpA00oa_00y7owzTw.png" /></figure><p><em>We can see that is already configured with vitest because “Vue” was chosen as framework during the initialization.</em></p><p>Add the following script to package.json to run stryker:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*yDvvoqoFoxRwfDZ6Dp9VXQ.png" /></figure><p>Let’s run the command:</p><pre>&gt; vue-stryker-example@0.0.0 test:mutation<br>&gt; stryker run<br><br>10:48:43 (94573) INFO ProjectReader Found 4 of 37 file(s) to be mutated.<br>10:48:43 (94573) INFO Instrumenter Instrumented 4 source file(s) with 24 mutant(s)<br>10:48:43 (94573) INFO ConcurrencyTokenProvider Creating 10 test runner process(es).<br>10:48:43 (94573) INFO DryRunExecutor Starting initial test run (vitest test runner with &quot;perTest&quot; coverage analysis). This may take a while.<br>10:48:44 (94573) INFO DryRunExecutor Initial test run succeeded. Ran 17 tests in 0 seconds (net 24.60820900000033 ms, overhead 782.3917909999997 ms).<br>Mutation testing  [==================================================] 100% (elapsed: &lt;1m, remaining: n/a) 24/24 Mutants tested (0 survived, 0 timed out)<br><br>All tests<br>  components/__tests__/AppCounter.spec.ts<br>    ✓ AppCounter renders properly (killed 4)<br>    ✓ AppCounter renders the text in green when the count value is less or equal than 5 (killed 1)<br>    ✓ AppCounter renders the text in red when the count value is greater than 5 (killed 2)<br>  composables/__tests__/useCounter.spec.ts<br>    ✓ useCounter initializes to 0 (killed 2)<br>    ✓ useCounter increments the value from 1 to 1 (killed 5)<br>    ✓ useCounter increments the value to 10 maximum (killed 2)<br>    ✓ useCounter decrements the value to 0 maximum (killed 3)<br>    ✓ useCounter decrements the value from 1 to 1 (killed 4)<br><br>[NoCoverage] StringLiteral<br>src/main.ts:6:22<br>-   createApp(App).mount(&#39;#app&#39;)<br>+   createApp(App).mount(&quot;&quot;)<br><br>Ran 1.67 tests per mutant on average.<br>-----------------|------------------|----------|-----------|------------|----------|----------|<br>                 | % Mutation score |          |           |            |          |          |<br>File             |  total | covered | # killed | # timeout | # survived | # no cov | # errors |<br>-----------------|--------|---------|----------|-----------|------------|----------|----------|<br>All files        |  95.83 |  100.00 |       23 |         0 |          0 |        1 |        0 |<br> components      | 100.00 |  100.00 |        7 |         0 |          0 |        0 |        0 |<br>  AppCounter.vue | 100.00 |  100.00 |        7 |         0 |          0 |        0 |        0 |<br> composables     | 100.00 |  100.00 |       16 |         0 |          0 |        0 |        0 |<br>  useCounter.ts  | 100.00 |  100.00 |       16 |         0 |          0 |        0 |        0 |<br> main.ts         |   0.00 |    0.00 |        0 |         0 |          0 |        1 |        0 |<br>-----------------|--------|---------|----------|-----------|------------|----------|----------|<br>10:48:46 (94573) INFO HtmlReporter Your report can be found at: file:///Users/.../workspaces/vue-stryker-example/reports/mutation/mutation.html<br>10:48:46 (94573) INFO MutationTestExecutor Done in 3 seconds.</pre><p>Stryker displays in the console the number of mutants killed per test, and a table summarizing for each file the number of mutants killed and the number who survived. If mutants have survived, it means we left a breach to generating bugs.</p><p>We see that for the <em>main.ts</em> file, one mutant has survived:</p><pre>[NoCoverage] StringLiteral<br>src/main.ts:6:22<br>-   createApp(App).mount(&#39;#app&#39;)<br>+   createApp(App).mount(&quot;&quot;)</pre><p>Let’s create the main.spec.ts to add the missing unit test.</p><pre>import { describe, expect, it, vi } from &#39;vitest&#39;<br>import { createApp } from &#39;vue&#39;<br><br>vi.mock(&#39;vue&#39;, () =&gt; ({<br>  createApp: vi.fn()<br>}))<br><br>const AppMock = vi.fn()<br>vi.mock(&#39;../App.vue&#39;, () =&gt; ({<br>  default: AppMock<br>}))<br><br>describe(&#39;main file&#39;, () =&gt; {<br>  it(&#39;mounts the Vue app&#39;, async () =&gt; {<br>    const mountMock = vi.fn()<br>    vi.mocked(createApp, { partial: true }).mockReturnValue({<br>      mount: mountMock<br>    })<br><br>    await import(&#39;../main&#39;)<br><br>    expect(createApp).toHaveBeenCalledWith(AppMock)<br>    expect(mountMock).toHaveBeenCalledWith(&#39;#app&#39;)<br>  })<br>})</pre><p>When I run Stryker again, I get the following report showing that all the mutants have indeed been killed:</p><pre>Ran 1.71 tests per mutant on average.<br>-----------------|------------------|----------|-----------|------------|----------|----------|<br>                 | % Mutation score |          |           |            |          |          |<br>File             |  total | covered | # killed | # timeout | # survived | # no cov | # errors |<br>-----------------|--------|---------|----------|-----------|------------|----------|----------|<br>All files        | 100.00 |  100.00 |       24 |         0 |          0 |        0 |        0 |<br> components      | 100.00 |  100.00 |        7 |         0 |          0 |        0 |        0 |<br>  AppCounter.vue | 100.00 |  100.00 |        7 |         0 |          0 |        0 |        0 |<br> composables     | 100.00 |  100.00 |       16 |         0 |          0 |        0 |        0 |<br>  useCounter.ts  | 100.00 |  100.00 |       16 |         0 |          0 |        0 |        0 |<br> main.ts         | 100.00 |  100.00 |        1 |         0 |          0 |        0 |        0 |<br>-----------------|--------|---------|----------|-----------|------------|----------|----------|<br>13:52:25 (957) INFO HtmlReporter Your report can be found at: file:///Users/.../workspaces/vue-stryker-example/reports/mutation/mutation.html</pre><p>You can see in the console that an HTML report has been generated.<br>For more information about this report, go to the section <a href="#fdb5">Generating and Reading the Reports</a></p><h3>Configuring StrykerJS</h3><p>Stryker offers a wide range of <a href="https://stryker-mutator.io/docs/stryker-js/configuration/">configuration options</a>.</p><p>Let me introduce you to a few of them:</p><h4><a href="https://stryker-mutator.io/docs/stryker-js/configuration/#packagemanager-string">packageManager</a></h4><p>The package manager Stryker can use to install missing dependencies.</p><ul><li>Values: “pnpm” | “npm” | “yarn” | undefined</li><li>Default: “npm”</li></ul><h4><a href="https://stryker-mutator.io/docs/stryker-js/configuration/#fileloglevel-string">fileLogLevel</a></h4><p>Set the log level that Stryker uses to write to the “stryker.log” file. Possible values: off, fatal, error, warn, info, debug and trace</p><p>This is useful when there’s an error with Stryker and you need to find the cause.</p><h4><a href="https://stryker-mutator.io/docs/stryker-js/configuration/#tempdirname-string">tempDirName</a> and <a href="https://stryker-mutator.io/docs/stryker-js/configuration/#htmlreporter-object">htmlReporter</a></h4><p>It’s a personal choice, but I like to have all my Stryker files and folders in one common folder.<br>But some can’t currently be moved, like the log file stryker.log.<br>It organizes our project tree better, and it can simplify the exposure of some files or folders via my <a href="#5c1e">pipeline jobs</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*QXz3aA9iZLvX6bBC9PSnvw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/272/1*Bycjj0rnczcaqB_nJOU8uw.png" /></figure><h4><a href="https://stryker-mutator.io/docs/stryker-js/configuration/#ignorepatterns-string">ignorePatterns</a></h4><p><a href="https://stryker-mutator.io/docs/stryker-js/configuration/#tempdirname-string">tempDirName</a> will contain copies of your source code during a mutation test run, in a sandbox directory. It is <strong>entirely deleted</strong> after a successful run</p><p><a href="https://stryker-mutator.io/docs/stryker-js/configuration/#ignorepatterns-string">ignorePatterns</a> specifies the patterns to all files or directories that are not used to run your tests and thus should <em>not be copied</em> to the sandbox directory for mutation testing.</p><p>It’s useful when you experience a slow Stryker startup, because too many (or too large) files are copied to the sandbox that are not needed to run the tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*p9o6H8FMVl4eFxhdf20DaQ.png" /><figcaption>Ignore the copy of some files in the sandbox</figcaption></figure><h4><a href="https://stryker-mutator.io/docs/stryker-js/configuration/#mutate-string">mutate</a></h4><p>With <a href="https://stryker-mutator.io/docs/stryker-js/configuration/#mutate-string">mutate</a> you configure the subset of files or just one specific file to be mutated. These should be your <em>production code files</em>, and definitely not your test files.</p><p>The default will try to guess your production code files based on sane defaults. It reads like this:</p><ul><li>Include all js-like files inside the src or lib dir</li><li>Except files inside __tests__ directories and file names ending with test or spec.</li></ul><p>It is possible to specify exactly which code blocks to mutate by means of a <em>mutation range</em>. This can be done postfixing your file with :startLine[:startColumn]-endLine[:endColumn]. Some examples:</p><ul><li>&quot;src/app.js:1-11&quot; will mutate lines 1 through 11 inside app.js.</li><li>&quot;src/app.js:5:4-6:4&quot; will mutate from line 5, column 4 through line 6 column 4 inside app.js (columns 4 are included).</li><li>&quot;src/app.js:5-6:4&quot; will mutate from line 5, column 0 through line 6 column 4 inside app.js (column 4 is included).</li></ul><h4><a href="https://stryker-mutator.io/docs/stryker-js/configuration/#appendplugins-string">appendPlugins</a> and <a href="https://stryker-mutator.io/docs/stryker-js/configuration/#ignorers-string">ignorers</a></h4><p>Stryker supports various types of plugins:</p><ul><li><a href="https://stryker-mutator.io/docs/stryker-js/plugins/#reporters">Reporter</a>: A reporter plugin can act on events that happen during the mutation testing process. They should be used to, well, report results, or progress.</li><li><a href="https://stryker-mutator.io/docs/stryker-js/plugins/#checkers">Checkers</a>: A checker plugin can <em>check</em> a mutant before it is mutation tested. The check can <em>fail</em> or <em>pass</em>; when a check fails, the mutant is not mutation tested.</li><li><a href="https://stryker-mutator.io/docs/stryker-js/plugins/#ignorers">Ignorers</a>: With an ignore-plugin, you can ignore all mutants in a specific a code pattern. See <a href="https://stryker-mutator.io/docs/stryker-js/disable-mutants/#using-an-ignore-plugin">using an ignore-plugin</a> for more information.</li></ul><p>You can write your own plugins for Stryker by following the <a href="https://stryker-mutator.io/docs/stryker-js/guides/create-a-plugin/">guide to creating a plugin</a>.</p><p>Here’s an example of a <a href="https://stryker-mutator.io/docs/stryker-js/disable-mutants/#using-an-ignore-plugin">ignore-plugin</a> that ignores mutations on Vue.js methods that may have static values and that you don’t want to mutate.</p><pre>// stryker-vue-ignore-plugin.js<br><br>import { declareValuePlugin, PluginKind } from &#39;@stryker-mutator/api/plugin&#39;;<br><br>const IGNORED_FUNCTIONS = new Set([&#39;defineOptions&#39;, &#39;defineModel&#39;, &#39;defineProps&#39;, &#39;defineEmits&#39;, &#39;withDefaults&#39;]);<br><br>export const strykerPlugins = [<br>  declareValuePlugin(PluginKind.Ignore, &#39;vue&#39;, {<br>    shouldIgnore(path) {<br>      if (<br>        path.isExpressionStatement() &amp;&amp;<br>        path.node.expression.type === &#39;CallExpression&#39; &amp;&amp;<br>        path.node.expression.callee.type === &#39;Identifier&#39; &amp;&amp;<br>        IGNORED_FUNCTIONS.has(path.node.expression.callee.name)<br>      ) {<br>        return `Ignore &quot;${path.node.expression.callee.name}&quot; method.`;<br>      }<br><br>      if (<br>        path.isCallExpression() &amp;&amp;<br>        path.node.callee.type === &#39;Identifier&#39; &amp;&amp;<br>        IGNORED_FUNCTIONS.has(path.node.callee.name)<br>      ) {<br>        return `Ignore &quot;${path.node.callee.name}&quot; method and its arguments`;<br>      }<br><br>      if (<br>        path.isObjectExpression() &amp;&amp;<br>        path.parentPath.isCallExpression() &amp;&amp;<br>        path.parentPath.node.callee.type === &#39;Identifier&#39; &amp;&amp;<br>        IGNORED_FUNCTIONS.has(path.parentPath.node.callee.name)<br>      ) {<br>        return `Ignore &quot;${path.parentPath.node.callee.name}&quot; method arguments`;<br>      }<br>    },<br>  }),<br>];</pre><p>The name of the above ignore-plugin is <strong>vue</strong> and is declared as <em>PluginKind.Ignore (Ignorer)</em>. An <em>Ignorer</em> is an object with a <em>shouldIgnore(path)</em> method. Stryker will execute this method on each node of the abstract syntax tree (AST).</p><p>Then you have to configure this plugin in the file <em>stryker.config.mjs</em>:</p><pre>// stryker.config.mjs<br><br>{<br>  appendPlugins: [&#39;./stryker/plugins/stryker-vue-ignore-plugin.js&#39;],<br>  ignorers: [&#39;vue&#39;],<br>}</pre><p>After rerunning Stryker, your report will look like this on ignored Vue methods:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aM0FtHcIJCVr2VJ8ifXYmw.png" /></figure><h4><a href="https://stryker-mutator.io/docs/stryker-js/configuration/#ignorestatic-boolean">ignoreStatic</a></h4><p>Static mutants are mutants which are only executed during the loading of a file. Testing these mutants come with a big performance penalty. Therefore, it might make sense to ignore static mutants altogether.</p><p>For example:</p><pre>const hi = &#39;👋&#39;; // Mutant 👽 StringLiteral<br><br>export function greet(name) {<br>  return `${hi} ${name}`;<br>}</pre><p>In this example, &#39;👋&#39; on line 1 would be mutated to an empty string by the StringLiteral mutator. However, the mutant is only executed <em>when the file is loaded</em>, making it a static mutant. It is impossible to measure the exact code coverage per test for the mutant. Therefore, Stryker would default to running all tests.</p><h4><a href="https://stryker-mutator.io/docs/stryker-js/configuration/#thresholds-object">thresholds</a></h4><p>Specify the thresholds for mutation score.</p><ul><li><strong>mutation score &gt;= high</strong>: Awesome! Reporters should color this green and happy.</li><li><strong>high &gt; mutation score &gt;= low</strong>: Warning! Reporters should color this orange/yellow. Watch yourself!</li><li><strong>mutation score &lt; low</strong>: Danger! Reporters should color this in red. You&#39;re in danger!</li><li><strong>mutation score &lt; break</strong>: Error! Stryker will exit with exit code 1, indicating a build failure. No consequence for reporters, though.</li></ul><p>It’s useful to define <strong>break</strong> when you add <a href="#5c1e">a job for Stryker to your pipeline</a> and it fails if the mutation score is below the expected threshold.</p><h4><a href="https://stryker-mutator.io/docs/stryker-js/configuration/#incremental-boolean">incremental</a></h4><p>Enable ‘incremental mode’. Stryker will store results in a file and use that file to speed up the next --incremental run. See <a href="https://stryker-mutator.io/docs/stryker-js/incremental/">incremental</a> for more details.</p><h3>Generating and Reading the Reports</h3><p>Stryker can generate different types of reports:</p><ul><li>A clear-text report: this is the report that can be viewed in the console.<br>It is possible to customize the output of this report with the <a href="https://stryker-mutator.io/docs/stryker-js/configuration/#cleartextreporter-cleartextoptions">clearTextReporter</a> option</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*M9lJ3CjlaVRP_7d9sorWsw.png" /></figure><ul><li>An <a href="https://stryker-mutator.io/docs/stryker-js/configuration/#reporters-string">HTML report</a></li><li>A <a href="https://stryker-mutator.io/docs/stryker-js/configuration/#jsonreporter-object">JSON report</a></li><li>A Stryker dashboard accessible from anywhere: visit <a href="https://stryker-mutator.io/docs/General/dashboard/">this page</a> for more details.</li></ul><p>The <a href="https://stryker-mutator.io/docs/stryker-js/configuration/#reporters-string">reporters</a> option allows configuring the reporters to enable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*XhsvamGpiLFYyVfTQUKT7w.png" /><figcaption>Configuring reporters</figcaption></figure><p>If the HTML report is enabled, Stryker provides the path to the HTML report file in the console</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*aMJ5N0ZOfUIzVuRrK2eAfw.png" /><figcaption>Path of the HTML report</figcaption></figure><p>The HTML page lists all the files that have been tested and can be viewed individually to see the mutants that survived.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yxAgHUVaqhd464ClBOn62Q.gif" /><figcaption>The HTML Report</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*RxblD4bjwkuhkggBwNW1mw.gif" /><figcaption>Analyzing the survived mutants</figcaption></figure><h3>Configuring CI to Enforce Mutation Coverage</h3><p>Integrating StrykerJS into your GitLab CI/CD pipeline ensures that mutation testing becomes an integral part of your quality assurance process. By automating mutation testing, you can catch potential gaps in your test suite before code reaches production.</p><h4>Understanding Thresholds</h4><p>As mentioned earlier in this article, Stryker allows you to configure <a href="https://stryker-mutator.io/docs/stryker-js/configuration/#thresholds-object">thresholds</a> to define acceptable mutation score levels:</p><ul><li><strong>high threshold</strong>: Mutation scores at or above this value are considered excellent (typically displayed in green)</li><li><strong>low threshold</strong>: Scores between low and high indicate areas needing attention (typically displayed in yellow/orange)</li><li><strong>break threshold</strong>: If the mutation score falls below this value, Stryker exits with a non-zero exit code, causing your CI pipeline to fail</li></ul><p>This <strong>break</strong> threshold is particularly valuable in CI/CD environments, as it enforces a minimum quality standard and prevents merging code with inadequate test coverage.</p><h4>Example GitLab CI Configuration</h4><p>Here’s a complete example of how to configure a GitLab CI job for mutation testing:</p><pre>default:<br>  image: node:22 # Use your preferred Node.js version<br>  before_script:<br>    - npm install -g pnpm  # If using pnpm<br>    - pnpm install --frozen-lockfile<br>  interruptible: true<br><br># The other steps in your GitLab configuration<br># ...<br><br>mutation-testing:<br>  needs: []<br>  stage: test<br>  script:<br>    - pnpm test:mutation<br><br>  # Store mutation reports and logs as artifacts<br>  artifacts:<br>    paths:<br>      - &#39;apps/**/stryker/reports/&#39;<br>      - &#39;apps/**/stryker.log&#39;<br>    expire_in: 1 week<br><br>  # Cache incremental results to speed up subsequent runs<br>  cache:<br>    - key:<br>        files:<br>          - &#39;stryker/reports/stryker-incremental.json&#39;<br>        prefix: &#39;stryker-develop&#39;<br>      paths:<br>        - &#39;stryker/reports/stryker-incremental.json&#39;<br>      policy: pull<br>      unprotect: true<br>    - key:<br>        files:<br>          - &#39;stryker/reports/stryker-incremental.json&#39;<br>        prefix: &#39;stryker-${CI_COMMIT_REF_SLUG}&#39;<br>      paths:<br>        - &#39;stryker/reports/stryker-incremental.json&#39;<br>      policy: pull-push<br>      unprotect: true<br><br>  # Run on main branch, merge requests, and develop<br>  rules:<br>    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH<br>    - if: $CI_COMMIT_BRANCH == &quot;main&quot;<br>    - if: $CI_PIPELINE_SOURCE == &quot;merge_request_event&quot;</pre><h4>Key Configuration Elements</h4><p><strong><em>Artifacts</em></strong></p><p>The artifacts section preserves mutation testing results for later review:</p><ul><li><strong>HTML reports</strong> are stored for visual inspection in the GitLab interface</li><li><strong>HTML reports</strong> are stored for visual inspection in the GitLab interface</li><li><strong>stryker.log</strong> helps troubleshoot issues when mutation testing fails</li></ul><p><strong><em>Caching Strategy</em></strong></p><p>The cache configuration implements a two-tier strategy to optimize performance:</p><ol><li><strong>Pull-only cache from develop</strong>: Reuses incremental results from the main development branch</li><li><strong>Pull-push cache per branch</strong>: Each branch maintains its own incremental cache, updated after each run</li></ol><p>This approach leverages Stryker’s <a href="https://stryker-mutator.io/docs/stryker-js/incremental/">incremental mode</a> to skip mutants that haven’t changed since the last run, significantly reducing execution time on subsequent runs.</p><p><strong><em>Rules for Execution</em></strong></p><p>The rules section defines when mutation testing should run:</p><ul><li>On the default branch (main/master) to maintain baseline quality</li><li>On merge requests to validate changes before merging</li><li>Optionally on development branches for continuous validation</li></ul><p><strong><em>Viewing Results in GitLab</em></strong></p><p>After the pipeline runs, you can:</p><ol><li>View the HTML report directly in GitLab by browsing the artifacts</li><li>Check the console output in the job logs for a quick summary</li><li>Download the JSON report for further analysis or integration with other tools</li></ol><p>By integrating mutation testing into your CI/CD pipeline, you create a safety net that continuously validates the effectiveness of your tests, ensuring that your code quality remains high throughout the development lifecycle.</p><h4>Example GitLab CI Configuration</h4><pre>name: CI<br><br>on:<br>  push:<br>    branches:<br>      - main<br>      - develop<br>  pull_request:<br>    branches:<br>      - main<br>      - develop<br><br>jobs:<br>  build-and-test:<br>    runs-on: ubuntu-latest<br><br>    strategy:<br>      matrix:<br>        node-version: [ 20, 22 ]<br><br>    steps:<br>      - name: Checkout code<br>        uses: actions/checkout@v4<br><br>      - name: Setup Node.js ${{ matrix.node-version }}<br>        uses: actions/setup-node@v4<br>        with:<br>          node-version: ${{ matrix.node-version }}<br>          cache: &#39;npm&#39;<br><br>      - name: Install dependencies<br>        run: npm install<br><br>      - name: Build project<br>        run: npm run build<br><br>      - name: Run linter<br>        run: npm run lint<br><br>      - name: Run unit tests<br>        run: npm run test:unit<br><br>      - name: Run mutation tests<br>        run: npm run test:mutation<br>        continue-on-error: false<br><br>      - name: Upload Stryker reports<br>        uses: actions/upload-artifact@v4<br>        if: always()<br>        with:<br>          name: stryker-reports-node-${{ matrix.node-version }}<br>          path: |<br>            stryker/reports/<br>            stryker.log<br>          retention-days: 7</pre><p>You can find this configuration example in the repository <a href="https://github.com/Kobee1203/vue-stryker-example">https://github.com/Kobee1203/vue-stryker-example</a>.<br>This configuration allows you to run mutation tests and stores Stryker reports.<br>You can use this example to configure mutation tests in your repository and adapt it to your needs.</p><h3><strong>Conclusion</strong></h3><p>Mutation testing with StrykerJS significantly enhances the robustness of your Vue.js applications. Unlike traditional code coverage that simply measures line execution, it answers the essential question: <em>Do your tests actually catch bugs?</em></p><p>StrykerJS introduces controlled mutations into your code to verify whether your test suite detects them, transforming testing into a meaningful quality assurance practice that validates their real effectiveness.</p><p><strong>Key Takeaways</strong></p><p>By implementing mutation testing in your Vue.js projects, you gain:</p><ul><li><strong>Confidence in test quality</strong>: Moving beyond superficial coverage metrics to measure your tests’ actual bug-detection capabilities</li><li><strong>Early bug detection</strong>: Identifying weak spots in your test suite before they become production issues</li><li><strong>Continuous improvement</strong>: Creating a feedback loop that drives better testing practices across your development team</li><li><strong>Automated quality gates</strong>: Enforcing minimum quality standards through CI/CD integration with configurable thresholds</li></ul><p><strong>Moving Forward</strong></p><p>Starting with mutation testing doesn’t require a complete overhaul of your existing workflow. Begin by:</p><ol><li>Implementing StrykerJS on a small, well-tested component or module</li><li>Analyzing the results to understand where your tests excel and where they fall short</li><li>Gradually expanding coverage to critical parts of your application</li><li>Integrating mutation testing into your CI/CD pipeline to maintain quality standards over time</li></ol><p>Focus on covering critical logic rather than achieving 100% mutation score. Use configuration options to ignore static values and optimize performance.</p><p><strong>The Path to Better Software</strong></p><p>Mutation testing represents a mindset shift: prioritizing test quality over quantity. By measuring actual bug detection, you invest in the long-term maintainability of your code.</p><p>StrykerJS not only improves your tests but deepens your understanding of your code’s behavior, naturally leading to more thoughtful and comprehensive test suites.</p><p>Start small, iterate often, and transform your test suite into a true safety net for your users and business.</p><p><strong>Resources</strong></p><ul><li><strong>StrykerJS Documentation</strong>: <a href="https://stryker-mutator.io/docs/stryker-js/introduction/">https://stryker-mutator.io/docs/stryker-js/introduction/</a></li><li><strong>Sample Vue.js Project</strong>: <a href="https://github.com/Kobee1203/vue-stryker-example">https://github.com/Kobee1203/vue-stryker-example</a></li><li><strong>Testing differently: Alternative Techniques to Challenge Your Applications</strong>: <a href="https://medium.com/accor-digital-and-tech/testing-differently-alternative-techniques-to-challenge-your-applications-c63f85350461">https://medium.com/accor-digital-and-tech/testing-differently-alternative-techniques-to-challenge-your-applications-c63f85350461</a></li></ul><p>Happy mutation testing! 👋🏼</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1083afe7326" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accor-digital-and-tech/introducing-mutation-testing-in-vue-js-with-strykerjs-e1083afe7326">Introducing Mutation Testing in Vue.js with StrykerJS</a> was originally published in <a href="https://medium.com/accor-digital-and-tech">Accor - Tech &amp; Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I used AI to enhance Architectural Reviews]]></title>
            <link>https://medium.com/accor-digital-and-tech/how-i-used-ai-to-enhance-architectural-reviews-e51abd8e6317?source=rss----9bee72310bac---4</link>
            <guid isPermaLink="false">https://medium.com/p/e51abd8e6317</guid>
            <category><![CDATA[draw-io]]></category>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[writing-prompts]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Nicolas Riviere]]></dc:creator>
            <pubDate>Thu, 04 Sep 2025 14:18:09 GMT</pubDate>
            <atom:updated>2025-09-04T14:15:46.923Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently had to conduct an architecture review on a particularly complex legacy component within our codebase.<br>My goal was to create both <strong>sequence and component diagrams</strong> to better understand this part of the system and identify clear <strong>starting points for refactoring</strong>.</p><p>The problem? This component weighs in at nearly <strong>1,000 lines of code</strong> and juggles <strong>45 imported modules</strong>. Untangling it manually, without any tooling or assistance, would be a serious drain on both time and mental energy.</p><p>And to make matters worse, the responsibilities within this component are quite mixed.<br>It’s a classic example of a “God object” — or at the very least, a seriously overloaded module.</p><p>This led me to wonder: <strong>Can AI actually assist with architectural reviews like this?</strong></p><h3>The AI, Claude</h3><p>I opted for <strong>Claude</strong> (Claude-sonnet-4) right from the start, as it currently stands out as the most advanced model for development and code-related tasks. I also tested <strong>GPT-4.1</strong>, but its initial outputs fell short of Claude’s; for this kind of architectural analysis, it just couldn’t compete — so I set it aside for now.</p><p><strong>Note:</strong><em> Other models might be better suited for this work, but my company only gives access to Claude and GPT-4.1 — and most importantly, both support secure, compliant processing of confidential data.</em></p><p>For all attempts and because I analyzed only one file, I copy/pasted the content of the file right after prompt.</p><h3>First Attempt: Incremental Approach</h3><h4>Prompt</h4><p>I began with a simple prompt and asked the model to specify what information it needed to tackle the task.</p><pre>I want to perform a software architecture review, including sequence diagrams <br>and component diagrams.<br><br>Ask me any questions you need in order to complete the task.  <br>I&#39;ll provide the file to analyze.  <br>Start the analysis only when I tell you to, and once I’ve answered all <br>your questions.</pre><p>This initiated a multi-step dialogue to refine the context and set clear expectations. The model typically asked about fifteen questions to fully grasp the context and defined its deliverables.</p><p>✨ I triggered the analysis and received:</p><ul><li><strong>High-Level Component Diagram</strong></li><li><strong>Detailed Component Diagram</strong></li><li><strong>Sequence Diagram — App Startup</strong></li><li><strong>Sequence Diagram — Cookie Management</strong></li><li><strong>Critical Observations Paragraph</strong></li></ul><p>Unfortunately, the first four diagrams generated in draw.io format were invalid. I asked the model to repair them.</p><h4>Results &amp; Analysis</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8bf5938d1c4317a7021441e61f51af5/href">https://medium.com/media/a8bf5938d1c4317a7021441e61f51af5/href</a></iframe><p>The first results from the model weren’t ideal, but they were already valuable. Tasks that don’t require much detail were handled correctly; others were inaccurate.</p><h3>Second Attempt: All-In-One</h3><p>Building on my previous attempt, I asked the model to generate a reusable prompt, then reran the experiment to evaluate its performance. ✨</p><pre>You are a senior software architect. I&#39;m going to provide you with source <br>code from an iOS application.<br><br>Context:<br>- iOS app for Accor (hotel booking)<br>- Legacy codebase with tight coupling and complex state management<br>- Objective: conduct an audit in preparation for a staged refactoring<br>- Constraint: maintain functional parity (ISO functional scope)<br><br>Tasks:<br>1.Analyze the code and identify:<br>- Main components and their responsibilities<br>- Data flows between components<br>- Architectural patterns in use<br>- Problematic coupling points<br>2.Produce diagrams compatible with draw.io:<br>- High-level component diagram (macro view)<br>- Detailed component diagram (classes/interfaces)<br>- Sequence diagrams for key flows<br>3.Focus specifically on:<br>- Data flow<br>- Architectural patterns<br><br>Wait for me to provide the code before starting the analysis.<br>Diagram output format: draw.io</pre><p>✨ I triggered the analysis and received:</p><ul><li><strong>High-Level Component Diagram</strong></li><li><strong>Detailed Component Diagram</strong></li><li><strong>Sequence Diagram — App Startup</strong></li></ul><p>Again, the diagrams were invalid, so I asked the model to fix them.</p><h4>Results &amp; Analysis</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1060830be3d5f0a2a835208317df9b96/href">https://medium.com/media/1060830be3d5f0a2a835208317df9b96/href</a></iframe><p>Despite using a much more refined prompt based on insights from the first attempt, the results were still less detailed and less accurate than expected.</p><h3>Third and final attempt: Hand-in-Hand</h3><p>For this final approach, I reused a variation of my earlier prompt, but this time introduced the context and expectations from the outset. I also asked the model to work step by step, confirming each major output before moving forward.</p><pre>You are a senior software architect... // Identical to the second attempt<br>...<br>...<br><br>/* Added content */<br><br>We will proceed step by step.<br>Each step corresponds to an element you want to produce.<br>Before starting each step, ask me all the questions necessary to produce<br>the best possible result.<br>If you have any doubts, ask for clarification—I will answer you.<br><br>For each diagram or analysis you plan to produce, ask the required questions <br>in advance.<br>The goal is to get the most accurate and relevant result for each stage.</pre><p>✨After the initial prompt, the model asked around ten detailed questions, then followed up with another set of similar queries. Once everything is clarified, it generated:</p><p><strong>Responsibilities and Components analysis</strong></p><ul><li><strong>High-Level Component Diagram</strong></li><li><strong>A summary paragraph</strong></li></ul><p>✨Following this, new questions led to the next outputs:</p><ul><li><strong>Detailed Component Diagram</strong></li><li><strong>Summary paragraph</strong></li></ul><p>✨Again, questions preceded:</p><ul><li><strong>Sequence Diagram — App Startup</strong></li><li><strong>Summary paragraph</strong></li></ul><p>✨Finally, after more questions, the model produced:</p><ul><li><strong>Sequence Diagram — Deeplink Initialization Flow</strong></li><li><strong>Sequence Diagram — Error Handling Flow</strong></li><li><strong>Summary paragraph</strong></li></ul><p>No diagrams were broken this time, and the output included substantial content for analysis.</p><h4>Results &amp; Analysis</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d25bfcebc60d1d40d8a3effe2914b7e1/href">https://medium.com/media/d25bfcebc60d1d40d8a3effe2914b7e1/href</a></iframe><p><strong>These were the strongest results yet</strong>. The sequence diagrams were nearly complete, with only minor gaps. The additional insights were just as compelling as those from the first attempt, but this time noticeably more precise.</p><h4>Diagrams quick peek</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GSnq9epAS-pvY5Wv0kF2kg.jpeg" /><figcaption>High-Level Component Diagram</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*pxK4ccO26e79_EcEjLtuyA.jpeg" /><figcaption>Sequence Diagram — App Startup</figcaption></figure><p>As demonstrated, the draw.io diagrams are high quality: elements are accurately represented and clearly labeled. The model even enhanced them with blocks and color coding, highlighting categories and emphasizing key information.</p><h3>Overall conclusion</h3><p>Results depend greatly on how you use AI. For the highest accuracy, a guided or assisted workflow is most effective. For simpler components, though, combining a well-designed prompt with a Q&amp;A phase is often enough.</p><p><strong>Can AI actually assist with architecture reviews like this?<br></strong> Absolutely. The promising results so far clearly show that AI can enhance and streamline the review process.</p><p>I hope sharing this experience inspires you and supports your future architecture reviews.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e51abd8e6317" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accor-digital-and-tech/how-i-used-ai-to-enhance-architectural-reviews-e51abd8e6317">How I used AI to enhance Architectural Reviews</a> was originally published in <a href="https://medium.com/accor-digital-and-tech">Accor - Tech &amp; Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Testing differently: Alternative Techniques to Challenge Your Applications]]></title>
            <link>https://medium.com/accor-digital-and-tech/testing-differently-alternative-techniques-to-challenge-your-applications-c63f85350461?source=rss----9bee72310bac---4</link>
            <guid isPermaLink="false">https://medium.com/p/c63f85350461</guid>
            <category><![CDATA[test]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <dc:creator><![CDATA[Catherine Kong ]]></dc:creator>
            <pubDate>Thu, 22 May 2025 07:49:45 GMT</pubDate>
            <atom:updated>2025-05-22T07:49:45.393Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Testing Differently" src="https://cdn-images-1.medium.com/max/1024/1*U4cj_G8bYeWebtpGAS-zDw.png" /></figure><p>Software testing is essential to ensure that our applications perform as expected. However, traditional tests (unit, integration, functional, and-to-end) do not always address all perspectives. Some issues may persist, and our perception of quality can be inaccurate. There are other approaches, often less commonly used but highly effective, that allow us to test our systems from different perspectives, improve their robustness, and detect errors that traditional tests might miss.</p><p>This article explores some alternatives testing techniques:</p><ul><li>Mutation Testing</li><li>Chaos Engineering</li><li>Contract Testing</li></ul><h3>1. Mutation Testing: Testing the robustness of the tests themselves</h3><figure><img alt="Mutation Testing" src="https://cdn-images-1.medium.com/max/1024/1*YGgDVHqjoMlq0Xj_R8IZow.png" /></figure><h3>Principle</h3><p><strong>Mutation Testing</strong> 🧬 involves deliberately modifying the source code (mutants) to check whether the existing test can detect these errors. For example, replacing &gt; with &lt;, or + with -, then running the automated tests:</p><ul><li>✅ If the tests fail: the mutant is killed! This is a good sign; the tests can detect errors.</li><li>❌ If the tests pas: the mutant survived! The tests did not detect any errors and are likely incomplete.</li></ul><p>This helps to validate the actual quality and coverage of existing tests, beyond just simple coverage.</p><h3>🖼️ Illustration</h3><pre>Initial source code :       if (a &gt; b)<br>Generated mutant :          if (a &lt; b)<br>                                 ↓<br>→ Run the tests<br>    ↳ Tests fail     ✅ Mutant killed (effective tests)<br>    ↳ Tests pass     ❌ Mutant survived (insufficient tests)</pre><h3>Benefits</h3><ul><li>✅ <strong>Evaluates the actual quality of tests<br></strong>It doesn’t just say “this code is tested,” it checks if the tests truly detect errors.</li><li>🧠 <strong>Highlights weak or missing tests<br></strong>It helps identify tests that pass even when the code is wrong, making them not very useful.</li><li>🔍 <strong>Improves the rigor of the tested code<br></strong>By forcing tests to detect real errors, it encourages better testing of edge cases and business logic.</li><li>📈 <strong>Completes code coverage<br></strong>A high code coverage rate does not guarantee effective tests. Mutation testing goes further.</li><li>🔧 <strong>Promotes better test design<br></strong>It encourages writing more precise, targeted, and expressive tests.</li></ul><h3>Limitations</h3><ul><li>⏱️ <strong>Can be time and resource-intensive</strong></li><li>🧩 <strong>Not always relevant on the frontends/UI where business logic is delegated to APIs</strong></li><li>🧠 <strong>Interpreting the results can be tricky<br></strong>Mutation testing generates “mutants” (code modifications) and indicates whether they were “killed” by the tests. However, analyzing these results requires critical thinking, as not all surviving mutants necessarily reveal a real issue.</li></ul><h3>Examples of Tools</h3><ul><li><strong>StrykerJS<br></strong>Supported languages: JavaScript and TypeScript</li><li><strong>PIT (Pitest)<br></strong>Supported languages: Java, Kotlin</li><li><strong>Muter<br></strong>Supported languages: Swift</li></ul><h3>2. Chaos Engineering: Testing resilience to failures</h3><figure><img alt="Chaos Engineering" src="https://cdn-images-1.medium.com/max/1024/1*0p8S1auwHgIrkcEUkf6nCg.png" /></figure><h3>Principle</h3><p><strong>Chaos Engineering</strong> involves testing an application’s resilience by simulating unexpected failures (e.g., server crashes, network latency) to observe how it responds.</p><h3>Benefits</h3><ul><li><strong>🧐 Early identification of failure points<br></strong>Helps detect weaknesses that remain hidden under normal conditions.</li><li><strong>🛡️ Improved resilience<br></strong>Strengthens the application’s ability to tolerate failures and continue operating normally.</li><li><strong>🔔 Monitoring and alert validation<br></strong>Ensures that monitoring and alerting systems respond correctly in case of incidents.</li><li><strong>🔄 Improve recovery capability<br></strong>Tests how quickly and effectively the system recovers from failures, checking failover and recovery mechanisms.</li></ul><h3>Limitations</h3><ul><li><strong>⚙️ Implementation complexity<br></strong>Requires a robust infrastructure and appropriate tools.</li><li><strong>⏳ Time and resource requirements<br></strong>These tests can require significant resources in terms of time, infrastructure, and expertise.</li></ul><h3>Examples of Tools</h3><ul><li><strong>Chaos Monkey (Netflix)<br></strong>A Chaos Engineering tool that simulates failures by randomly shutting down server instances to test the fault tolerance of distributed systems.</li><li><strong>Gremlin<br></strong>A Chaos Engineering platform that simulates failures at various levels (servers, networks) to test the resilience of production systems.</li></ul><h3>3. Contract Testing: Ensuring Aligment of Service Interactions</h3><figure><img alt="Contract Testing" src="https://cdn-images-1.medium.com/max/1024/1*SZhukOXq-rX_BX90rk4wbA.png" /></figure><h3>Principle</h3><p>Contract Testing is a testing practice aimed at ensuring that interactions between services, particularly APIs, conform to a predefined contract (data structure, types, formats, etc.). This ensures consistent and reliable exchanges, reducing errors caused by mismatches. Mocks are often used to simulate external services and test these interactions in isolation, without relying on the actual services.</p><h3>Benefits</h3><ul><li><strong>🛡️ Reduced Integration Risks<br></strong>Validates the compliance of exchanges before actual integration, reducing errors.</li><li><strong>⚡ Faster and More Targeted Tests<br></strong>Simulates services with mocks, speeding up test execution.</li><li><strong>🔁 Better Version Management<br></strong>Ensures compatibility between service versions throughout their evolution.</li><li><strong>🤝 Improved Communication Between Teams<br></strong>Formalizing the contract ensures a shared understanding of expectations, facilitating collaboration between teams.</li></ul><h3>Limitations</h3><ul><li><strong>🧩 Contract Complexity<br></strong>Defining a detailed and precise contract can be complex, especially when multiple teams are involved with different needs.</li><li><strong>🪢 Maintaining Consistency<br></strong>As time goes on, maintaining the integrity of contracts between different versions of services can become difficult, especially with frequent changes.</li><li><strong>🧪 Complementary to Other Tests<br></strong>Should be complemented with functional and performance tests to validate the overall behavior of the system under real-world conditions.</li><li><strong>🧷 Limited Mocks<br></strong>Although mocks facilitates testing in isolation, it’s necessary to test the actual service at some point to ensure interactions work correctly in real conditions.</li></ul><h3>Examples of Tools</h3><ul><li><strong>Pact<br></strong>A tool based on “pacts” (contracts) for testing service interactions, ensuring the compliance of data exchanges.</li><li><strong>GraphQL Codegen<br></strong>A tool that generates code (types, queries, etc.) from GraphQL schemas. Useful for verifying that exchanges between GraphQL services conform to the defined contract.</li></ul><h3>Conclusion</h3><p>Exploring other testing techniques means trying new methods to cover areas that traditional approaches might skip. These methods do not replace traditional tests, but they support them by encouraging deeper thought on quality:</p><ul><li>By questioning the relevance of assertions (mutation testing),</li><li>By testing resilience to the unexpected (chaos engineering),</li><li>By validating implicit contracts between services (contract testing).</li></ul><p>Embracing these approaches, even at a small level, brings us closer to a more proactive and rigorous quality culture.</p><p>It’s not the quantity of tests that defines quality, but the accuracy of what we choose to cover, and our ability to challenge our habits.</p><p><em>Coming up: real-world feedback will help illustrate these approaches in future posts.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c63f85350461" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accor-digital-and-tech/testing-differently-alternative-techniques-to-challenge-your-applications-c63f85350461">Testing differently: Alternative Techniques to Challenge Your Applications</a> was originally published in <a href="https://medium.com/accor-digital-and-tech">Accor - Tech &amp; Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discover the Speculation Rules API: Optimize your website’s performance]]></title>
            <link>https://medium.com/accor-digital-and-tech/discover-the-speculation-rules-api-optimize-your-websites-performance-fe85b736bae8?source=rss----9bee72310bac---4</link>
            <guid isPermaLink="false">https://medium.com/p/fe85b736bae8</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[seo]]></category>
            <category><![CDATA[core-web-vitals]]></category>
            <dc:creator><![CDATA[Grégory Barrion]]></dc:creator>
            <pubDate>Mon, 03 Feb 2025 20:03:56 GMT</pubDate>
            <atom:updated>2025-02-03T20:03:56.019Z</atom:updated>
            <content:encoded><![CDATA[<p>In a world where every millisecond counts, user expectations for speed have never been higher. The Speculation Rules API helps you anticipate navigation paths, preload or prerender critical resources, and drastically reduce perceived load time. If you’re aiming to improve key metrics like TTFB, LCP, and overall user satisfaction, this API is worth exploring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4yYzgOAIQRBoo3CcNiGj4Q.jpeg" /></figure><h3>Context and problem</h3><p>Today’s web faces considerable performance challenges. Users expect almost instant loading times, particularly on mobile where network conditions can be less favorable. Traditional preloading techniques, although useful, have often shown their limitations, either by being too resource-intensive or lacking in precision.</p><p>This is where the <strong>Speculation Rules API</strong> comes in. By offering a smarter and more efficient approach to anticipating user needs, it addresses these challenges head-on, paving the way for faster, smoother, and more responsive web experiences.</p><h3>Detailed functioning of the Speculation Rules API</h3><p>The Speculation Rules API allows developers to define precise rules to guide the browser’s behavior in terms of preloading and pre-rendering. Let’s explore its main parameters and options in detail.</p><h4>Basic Structure</h4><p>Speculation Rules are defined in a JSON object, typically included in a &lt;script&gt; tag with the type=&quot;speculationrules&quot;. The basic structure looks like this:</p><pre>&lt;script type=&quot;speculationrules&quot;&gt;<br>{<br>  &quot;prerender&quot;: [...],<br>  &quot;prefetch&quot;: [...]<br>}<br>&lt;/script&gt;</pre><p>Alternatively, you can serve a JSON file containing the rules via a custom header:</p><pre>Speculation-Rules: &quot;/speculation.json&quot;</pre><blockquote><strong>Note:</strong> The JSON file must be served with the application/speculationrules+json MIME type.</blockquote><h3>Main parameters</h3><h4>Type of preloading</h4><p>The API supports two types of preloading:</p><ul><li><strong>prefetch:</strong> A lightweight mode that downloads and caches the HTML of the next page. This improves <strong>Time to First Byte (TTFB)</strong> but has limited impact on metrics like <strong>Largest Contentful Paint (LCP)</strong> or <strong>First Contentful Paint (FCP)</strong>.</li><li><strong>prerender:</strong> A more powerful but resource-intensive mode that downloads the HTML, all related assets (CSS, JS, images), and renders the page in an invisible tab. This ensures near-instant loading when the user navigates to the page. It significantly improves metrics like <strong>LCP</strong>, <strong>FCP</strong>, and <strong>Cumulative Layout Shift (CLS)</strong>.</li></ul><figure><img alt="After a clic on the link the next page load instantly and the LCP is at 0s" src="https://cdn-images-1.medium.com/max/747/1*Xj2tDnt-clTQRX8X3FfNBQ.gif" /><figcaption>Example of prerender mode with a LCP of 0</figcaption></figure><p><strong>Why not always use </strong><strong>prerender?</strong></p><ul><li><strong>Data consumption:</strong> Prerendering downloads all assets, which can be costly for users with limited bandwidth or older devices.</li><li><strong>Server costs:</strong> Preloading multiple pages can increase server load if users don’t end up visiting them all.</li><li><strong>Side effects:</strong> Prerendering executes all JavaScript on the page, which may trigger unintended behaviors (e.g., analytics tracking).</li></ul><p>Here’s an example of handling analytics during prerendering:</p><pre>if (document.prerendering) {<br>  document.addEventListener(&quot;prerenderingchange&quot;, initAnalytics, {<br>    once: true,<br>  });<br>} else {<br>  initAnalytics();<br>}<br><br>initAnalytics() {<br>  // Place your analytics code here<br>}</pre><h4><strong>eagerness</strong></h4><p>Controls when and how the browser should apply the rule. Possible values are:</p><ul><li><strong>immediate:</strong> Applies the rule as soon as the Speculation Rules appear.</li><li><strong>eager:</strong> Actually acts as immediate but will be between immediate and moderate.</li><li><strong>moderate:</strong> Applies the rule when the pointer hovers over a link for 200ms (on desktop) or on pointer/touch down.</li><li><strong>conservative:</strong> Applies the rule only on pointer or touch down.</li></ul><p>Example:</p><pre>&quot;eagerness&quot;: &quot;moderate&quot;</pre><p>Depending on the eagerness value, the browser limits cached pages as follows:</p><ul><li><strong>Immediate/Eager:</strong> Up to 50 prefetches or 10 prerenders.</li><li><strong>Moderate/Conservative:</strong> A maximum of 2 pages (First In First Out mode).</li></ul><p><strong>Why Preloading on Click Still Helps?</strong></p><p>You might be wondering: if the page only starts preloading when the user clicks in conservative mode (and sometimes in moderate mode), what’s the actual benefit? After all, the browser would download the resource on click anyway, right?<br>The key difference is that speculation-based preloading kicks in as soon as the user presses down on the link (mouse down or touch down). There’s usually a 100–200 ms gap between pressing and releasing (the full ‘click’). That head start is often enough to fetch part of the resource in the background, effectively shaving off precious milliseconds from the Time to First Byte (TTFB).</p><h4><strong>source</strong></h4><p>This is an optional parameter because it can be inferred by the browser:</p><ul><li><strong>list:</strong> A predefined list of URLs.</li><li><strong>document:</strong> Extracts URLs from links in the current page (e.g., &lt;a&gt; tags).</li></ul><h4><strong>urls</strong></h4><p>For source: &quot;list&quot;, provides a list of URLs to prefetch or prerender:</p><pre>&quot;urls&quot;: [&quot;https://example.com/page1&quot;, &quot;https://example.com/page2&quot;]</pre><h4><strong>where</strong></h4><p>For source: &quot;document&quot;, specifies conditions for applying the rule. Example:</p><pre>&quot;where&quot;: {<br>  &quot;and&quot;: [<br>    { &quot;href_matches&quot;: [&quot;https://example.com/blog/*&quot;, &quot;https://example.com/account/*&quot;] },<br>    { &quot;not&quot;: { &quot;href_matches&quot;: &quot;https://example.com/account/logout&quot; }},<br>    { &quot;not&quot;: { &quot;selector_matches&quot;: &quot;[rel~=nofollow]&quot; } }<br>  ]<br>}</pre><h4>href_matches</h4><p>Defines a regex (or list of regex) to find in the links on the page :</p><pre>&quot;href_matches&quot;: &quot;https://example.com/*&quot;</pre><h4>selector_matches</h4><p>Indicates on which element the Speculation Rules needs to search links</p><pre>&quot;selector_matches&quot;: &quot;.prerender&quot;</pre><h3>Advantages of using the Speculation Rules API</h3><p>The benefits of this API are multiple and significant:</p><ol><li><strong>Improved loading times</strong>: By anticipating user actions, pages load faster or even almost instantly with prerender. This can lead to better Core Web Vitals and higher SEO rankings.</li><li><strong>Optimization of user experience</strong>: Page transitions become smoother, reducing frustration associated with waiting.</li><li><strong>Efficient use of resources</strong>: Unlike “blind” preloading, this API allows more precise targeting, reducing unnecessary bandwidth and CPU usage.</li></ol><h3>Use cases and concrete examples</h3><p>The Speculation Rules API particularly shines in some scenarios:</p><ul><li><strong>E-commerce</strong>: Preloading frequently visited pages, it’s especially useful for top-selling products or high-traffic pages.</li><li><strong>Complex web applications</strong>: Speeding up frequently accessed sections or dashboards.</li><li><strong>News/Blogs sites</strong>: Anticipating articles that the user is likely to read next.</li></ul><p>Let’s take the example of an e-commerce site. You could implement a rule like this:</p><pre>&lt;script type=&quot;speculationrules&quot;&gt;<br>{<br>  &quot;prerender&quot;: [<br>    {<br>      &quot;urls&quot;: [&quot;/popular-product&quot;, &quot;/cart&quot;, &quot;/checkout&quot;],<br>      &quot;eagerness&quot;: &quot;moderate&quot;,<br>    }<br>  ]<br>}<br>&lt;/script&gt;</pre><p>This setup prerenders the most likely next pages once the user hovers the link or touches down, resulting in near-instant loading.</p><p>On the other hand, you can use a simple rule:</p><pre>&lt;script type=&quot;speculationrules&quot;&gt;<br>{<br>  &quot;prefetch&quot;: [<br>    {<br>      &quot;where&quot;: &quot;https://example.com/*&quot;,<br>      &quot;eagerness&quot;: &quot;moderate&quot;,<br>    }<br>  ]<br>}<br>&lt;/script&gt;</pre><p>This rule is simple and can optimize the navigation for your customer without impacting performance (it only prefetches the next page when the mouse hovers over the link). It’s especially powerful if your next page is server-generated because it offloads rendering to the server without heavily impacting the user’s device.</p><h3>How to test</h3><p>You can inspect all Speculation Rules in <strong>Chrome DevTools</strong> under the <strong>Application</strong> tab, in the <strong>Speculative loads</strong> section. From there, you can see:</p><ul><li>Which rules have been recognized</li><li>Which URLs are being preloaded or prerendered</li><li>Their status (Not triggered, Running, Ready, or Failure)</li></ul><p>Here is an example of how it works:</p><figure><img alt="Hover the links the url preload in the speculation menu of DevTools" src="https://cdn-images-1.medium.com/max/800/1*PSDCoNiV8e09KO8gAHi9Bw.gif" /><figcaption>Informations on Chrome DevTools for the Speculation API</figcaption></figure><p>As you can see the test is done with a prefetch mode and in moderate eagerness. In this case you can see at the third link that the first one is expired (FIFO mode). You can also retrieve here details from status and other errors like cross domain or redirect.</p><h3>Limitations</h3><h4>Cross site</h4><p>Cross-site prefetching or prerendering is disabled by default to prevent potential security and privacy issues. The browser will not send preloading requests if the URL is on a different domain.</p><h4>Redirect</h4><p>If a link returns an HTTP 30x redirect, the speculation process will not follow or cache that redirect.</p><h4>New tab</h4><p>Officially, the documentation states that preloaded pages can’t benefit from the cache cache in a new tab, though some tests suggest partial functionality. Expect this to evolve as Chrome continues development.</p><h3>Best practices and considerations</h3><p>To get the most out of the Speculation Rules API:</p><h4>User behavior analysis</h4><ul><li>Conduct thorough analytics on user navigation patterns.</li><li>Use heat maps and click tracking to identify the most common user paths.</li><li>Analyze session duration and depth to understand how users typically move through your site.</li></ul><h4>Performance Monitoring</h4><ul><li>Implement robust performance monitoring tools to measure the impact of Speculation Rules.</li><li>Track key metrics like Time to First Byte (TTFB), Largest Contentful Paint (LCP), and First Input Delay (FID) before and after implementation.</li><li>Use tools like Lighthouse or WebPageTest to get comprehensive performance reports.</li></ul><h4>Gradual Implementation</h4><ul><li>Start with a small subset of pages or a specific user journey.</li><li>A/B test different speculation strategies to find the most effective approach.</li><li>Gradually expand to more pages as you gather data and refine your strategy.</li></ul><h4>Mobile Optimization</h4><ul><li>Pay special attention to mobile users, who often have more limited resources.</li><li>Use more conservative speculation strategies on mobile devices.</li><li>Consider network conditions and device capabilities in your mobile Speculation Rules.</li></ul><h4>Cross-Browser Testing</h4><ul><li>While currently limited to Chromium-based browsers, test your implementation across different versions and devices.</li><li>Implement fallback strategies for browsers that don’t support the Speculation Rules API.</li><li>Stay informed about potential future support in other browsers like Firefox and Safari.</li></ul><h3>The future of the Speculation Rules API</h3><p>As of now, the Speculation Rules API is only available in Chromium-based browsers (version 121 and above) and Samsung Internet (version 25+). This accounts for roughly 68% of visitors based on certain usage metrics. There’s hope that Safari and Firefox may add compatibility in the future.</p><p>Additionally, current usage is limited, but more features and parameters will arrive in the future.</p><h3>Conclusion</h3><p>The Speculation Rules API marks a significant leap in web performance optimization. By preloading or prerendering likely next pages, you can deliver near-instant navigation and elevate your Core Web Vitals. While it’s currently limited to Chromium-based browsers, there’s good reason to believe wider adoption will follow.</p><p>To get the most out of it, analyze your users’ navigation patterns, roll out changes gradually, and maintain fallback strategies for unsupported browsers. Remember that each millisecond you save in load time can enhance both user satisfaction and search rankings. In a competitive digital landscape, the Speculation Rules API could be your key to delivering a genuinely fast and seamless user experience.</p><h4>Links:</h4><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API">https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API</a><br><a href="https://developer.chrome.com/docs/web-platform/prerender-pages">https://developer.chrome.com/docs/web-platform/prerender-pages</a><br><a href="https://caniuse.com/mdn-html_elements_script_type_speculationrules">https://caniuse.com/mdn-html_elements_script_type_speculationrules</a><br><a href="https://issues.chromium.org/issues/40234240">https://issues.chromium.org/issues/40234240</a></p><p><em>That’s it! Experiment with the Speculation Rules API in your own projects and discover just how valuable those saved milliseconds can be.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe85b736bae8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accor-digital-and-tech/discover-the-speculation-rules-api-optimize-your-websites-performance-fe85b736bae8">Discover the Speculation Rules API: Optimize your website’s performance</a> was originally published in <a href="https://medium.com/accor-digital-and-tech">Accor - Tech &amp; Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using GraphQL with Vue.js 3]]></title>
            <link>https://medium.com/accor-digital-and-tech/using-graphql-with-vue-js-3-909ccb60fc82?source=rss----9bee72310bac---4</link>
            <guid isPermaLink="false">https://medium.com/p/909ccb60fc82</guid>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[vue-3]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[apollo]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Nicolas Dos Santos]]></dc:creator>
            <pubDate>Wed, 09 Oct 2024 07:52:07 GMT</pubDate>
            <atom:updated>2024-10-09T07:52:06.943Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>At Accor, we launched a project almost a year ago to improve the user experience on our mobile and web applications.<br>The aim is to homogenize the mobile and web user experience, and display the same data with the same business rules.</p><p>Until now, mobile applications consumed data from a graphql server, which exposed data from multiple APIs via multiple resolvers. These resolvers only met the needs of mobile applications, applying specific business rules and exposing only the data required for mobile applications.</p><p>On the web side, there were several server-side applications exposing data from multiple APIs, with web application-specific business rules.</p><p>The aim was therefore to expose data via a single provider that would consume all the APIs required for mobile and web, and apply the same business rules for mobile and web.</p><p>We chose to use a GraphQL server to expose common mobile and web resolvers. On the mobile side, the implementation already existed. All we had to do was consume the new common resolvers. On the web side, however, everything had to be set up to work with Vue.js 3.x.</p><p>This article describes how to set up a Vue.js 3 application with a GraphQL Apollo server.</p><h3>What is GraphQL?</h3><p><a href="https://graphql.org/">GraphQL</a> is a specification that aims at easing the communication between frontends and backends. It mainly consists of a Schema Language for the server and a Query Language for the client.</p><h3>What is Vue.js?</h3><p><a href="https://vuejs.org/">Vue.js</a> is a JavaScript framework for building user interfaces. It builds on top of standard HTML, CSS, and JavaScript and provides a declarative, component-based programming model that helps you efficiently develop user interfaces of any complexity.</p><h3>Creating the Vue.js project</h3><ul><li>Install <a href="https://nodejs.org/">Node.js</a> 18.3 or higher</li><li>Create a new <a href="https://fr.vuejs.org/guide/quick-start#creating-a-vue-application">Vue application</a>:</li></ul><pre>npm create vue@latest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KcQIkOLzJa01vDFnxZgMyg.png" /></figure><ul><li>Run the following commands to complete the installation and start the application:</li></ul><pre>npm install<br>npm run dev</pre><p>If the commands have run successfully, you should see the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*8avBo7NbaLp4tHhXFWpy6A.png" /></figure><ul><li>Go to the URL <a href="http://localhost:5173/">http://localhost:5173/</a>, as shown in the console.<br>If you see the following page, the application has been successfully installed!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*UdQTpqVy7F5E0O-81YY0FQ.png" /></figure><h3>Using Apollo</h3><h4>What is Apollo?</h4><p><a href="https://www.apollographql.com/">Apollo</a> is a set of tools and community effort to help you use GraphQL in your apps. It’s well known for its <a href="https://www.apollographql.com/client">client</a> and its <a href="https://www.apollographql.com/docs/apollo-server">server</a>.</p><h4>Using an Apollo Server</h4><p><strong>Apollo Server</strong> is an <a href="https://github.com/apollographql/apollo-server">open-source</a> spec-compliant GraphQL server that’s compatible with any GraphQL client, including <a href="https://www.apollographql.com/docs/react">Apollo Client</a>.</p><p>This article provides examples and configurations based on the following Github repository:<br><a href="https://github.com/Kobee1203/apollo-server-example">https://github.com/Kobee1203/apollo-server-example</a><br>This repository implements a GraphQL API that includes a schema and resolution implementation for a simple book catalog (with a dummy in-memory database).</p><h4>Installing Apollo Client</h4><p><strong>Apollo Client</strong> is a comprehensive state management library for JavaScript. It enables you to manage both local and remote data with GraphQL.</p><ul><li>Run the following command to install it in the Vue.js application:</li></ul><pre>npm install --save graphql graphql-tag @apollo/client</pre><p>We can now create our Apollo client, which will connect to the Apollo server.</p><ul><li>Create an <em>apollo.ts</em> file in the <em>graphql</em> directory</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*FTAk4lxrIdxC0vrSqc8uDQ.png" /></figure><ul><li>Add the following content to the previously created file:</li></ul><pre>import {<br>  ApolloClient,<br>  type ApolloClientOptions,<br>  HttpLink,<br>  InMemoryCache,<br>  type NormalizedCacheObject<br>} from &#39;@apollo/client/core&#39;<br>import type { App } from &#39;vue&#39;<br><br>// HTTP connection to the API<br>const createHttpLink = () =&gt;<br>  new HttpLink({<br>    // URI to use when fetching operations.<br>    uri: &#39;http://localhost:4000&#39;,<br>    // Headers to be sent on each request.<br>    headers: {<br>      apiKey: &#39;c0944e06-4965-49fa-b049-773466b2608a&#39;,<br>      &#39;app-id&#39;: &#39;vue-graphql&#39;<br>    }<br>  })<br><br>// Create the apollo client<br>const createApolloClient = (app: App) =&gt; {<br>  // Cache implementation<br>  const cache = new InMemoryCache()<br><br>  const link = createHttpLink()<br><br>  // Apollo client options<br>  const apolloConfig: ApolloClientOptions&lt;NormalizedCacheObject&gt; = { link, cache }<br><br>  return new ApolloClient(apolloConfig)<br>}</pre><p>We’ve created an Apollo client that connects to our Apollo server at <a href="http://localhost:4000/">http://localhost:4000</a>.<br>And we add headers to each request. In our example, it’s not mandatory to add them, but it’s useful when we’re using a GraphQL API that requires certain headers to be passed to each request executed.<a href="https://v4.apollo.vuejs.org/guide/#what-is-apollo">​</a></p><p>Apollo client provides many features that we won’t go into in detail in this article, but here are some links to useful features :</p><ul><li><a href="https://www.apollographql.com/docs/react/api/link/introduction">The Apollo Link library</a></li><li><a href="https://www.apollographql.com/docs/react/data/error-handling">Handling operation errors</a></li><li><a href="https://www.apollographql.com/docs/react/caching/overview">Caching</a></li><li><a href="https://www.apollographql.com/docs/react/pagination/overview">Pagination</a></li></ul><p>We’ve just created our Apollo client. Now we need to access it in our Vue.js application.<br>Instead of directly exposing our Apollo client, for example with <a href="https://vuejs.org/guide/components/provide-inject">provide/inject</a>, we’ll use <a href="https://v4.apollo.vuejs.org/">@vue/apollo-composable</a>.</p><h4>Install @vue/apollo-composable</h4><p>This library integrates <a href="https://www.apollographql.com/"><strong>Apollo</strong></a> in your <a href="http://vuejs.org/"><strong>Vue</strong></a><strong> </strong>components with declarative queries.<br>The library provides composables to ease GraphQL operations:</p><ul><li><a href="https://v4.apollo.vuejs.org/guide-composable/query.html">useQuery</a></li><li><a href="https://v4.apollo.vuejs.org/guide-composable/mutation.html">useMutations</a></li><li><a href="https://v4.apollo.vuejs.org/guide-composable/subscription.html">useSubscriptions</a></li></ul><p>Run the following command to install <a href="https://v4.apollo.vuejs.org/">@vue/apollo-composable</a>:</p><pre>npm install --save @vue/apollo-composable</pre><p>We can now update our previously created <em>apollo.ts</em> file to add a Vue plugin to <a href="https://vuejs.org/guide/components/provide-inject">provide</a> our Apollo client to our Vue application:</p><pre>…<br>import type { App, Plugin } from &#39;vue&#39;<br>import { DefaultApolloClient } from &quot;@vue/apollo-composable&quot;;<br><br>// Previous code to create Apollo client<br>…<br><br>// Create a Vue plugin to &quot;provide&quot; an Apollo client to app<br>const createPlugin = () =&gt; {<br>  const plugin: Plugin = {<br>    install: (app: App) =&gt; {<br>      const apolloClient = createApolloClient(app)<br>      app.provide(DefaultApolloClient, apolloClient)<br>    }<br>  }<br><br>  return plugin<br>}<br><br>const apolloPlugin = createPlugin()<br><br>export { apolloPlugin }</pre><p>And in <em>main.ts</em>, update to register our plugin:</p><pre>import &#39;./assets/main.css&#39;<br><br>import { createApp } from &#39;vue&#39;<br>import App from &#39;./App.vue&#39;<br>import { apolloPlugin } from &#39;./graphql/apollo&#39;<br><br>const app = createApp(App)<br><br>app.use(apolloPlugin)<br><br>app.mount(&#39;#app&#39;)</pre><h3>Testing our configuration</h3><p>To check that everything’s set up correctly, we’ll make a request to our Apollo server and display the result in the browser console.</p><ul><li>Check that the Apollo server is running<br>If you use <a href="https://github.com/Kobee1203/apollo-server-example">apollo-server-example</a>, run the following command to start it:</li></ul><pre>npm start</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*aVrZqJjVqRbx42HBeEuWMw.png" /></figure><p>Then go to <a href="http://localhost:4000/">http://localhost:4000/</a><br>You should see the following page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*P08eshLcx_khEHQjgpKb_w.png" /></figure><p>In “Query”, select the “books” field and all the fields below it recursively.<br>Then click on the button to execute the query.<br>You should see the query response on the right:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pwliV-kbkBkGjpaJ1-62hw.gif" /></figure><ul><li>Copy the content of the “Operation” section</li><li>Go back to the Vue.js application project</li><li>Create a <em>useBooksQuery.ts</em> file in a new <em>composables</em> folder</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*bSZucBe4i7O4nl5BKcPonA.png" /></figure><ul><li>Add the following content to the previously created file:</li></ul><pre>import { useQuery } from &#39;@vue/apollo-composable&#39;<br>import gql from &#39;graphql-tag&#39;<br><br>export const useBooksQuery = () =&gt; {<br>  const query = gql`<br>    query Books {<br>      books {<br>        id<br>        title<br>        author {<br>          id<br>          name<br>          dateOfBirth <br>          photoUrl<br>        }<br>        publicationDate<br>        coverUrl<br>      }<br>    }<br>  `<br><br>  const { result, loading, error } = useQuery(query)<br><br>  return { result, loading, error }<br>}</pre><ul><li>In the <em>App.vue</em> file, update the content of <em>&lt;script&gt;</em> to call the composable and execute the request:</li></ul><pre>&lt;script setup lang=&quot;ts&quot;&gt;<br>…<br>import { watch } from &quot;vue&quot;;<br>import { useBooksQuery } from &quot;@/composables/useBooksQuery&quot;;<br><br>const { result, loading, error } = useBooksQuery()<br><br>watch(result, value =&gt; {<br>  console.log(&#39;books:&#39;, value)<br>})<br>&lt;/script&gt;</pre><ul><li>Start the application by running the following command:</li></ul><pre>npm run dev</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*XrMDyuHSapu9FtSCJqm1HQ.png" /></figure><ul><li>Then go to <a href="http://localhost:5173/">http://localhost:5173/</a></li><li>Open the browser console (<em>F12</em> key, then <em>console</em> tab)</li></ul><p>➡️ You should see a log containing the request response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*g6NHh9OQur-2o6fSUcEQxQ.png" /></figure><h3>Generating TypeScript types</h3><p>We have already seen how to make a GraphQL request to the Apollo server.<br>However, we don’t have front-end typing.<br>We could manually define all the types we use on the front end, but this can be a problem when the GraphQL API evolves and we need to synchronize with changes on the front end.</p><p>Fortunately, it is possible to automate the generation of :</p><ul><li>Typed Queries, Mutations and, Subscriptions</li><li>Typed GraphQL resolvers</li></ul><p>The useBooksQuery composable contains the following line:</p><pre>const { result, loading, error } = useQuery(query)</pre><p><em>result</em> has no specific typing, so we get a <em>Ref&lt;any&gt;</em> for <em>result</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*g-rELzOq-JmV9DuOXs4cSw.png" /></figure><h4>Installing @graphql-codegen</h4><ul><li>Run the following command to install <a href="https://the-guild.dev/graphql/codegen">@graphql-codegen</a> in the Vue.js application:</li></ul><pre>npm i graphql<br>npm i -D typescript @graphql-codegen/cli</pre><p>Once installed, GraphQL Code Generator CLI can help you configure your project based on some popular flows.</p><p>Run the following command to guide you through the whole process of setting up a schema, selecting and installing plugins, picking a destination to where your files are generated, and a lot more:</p><pre>npx graphql-code-generator init</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*0blYNMBnpn2FJiAk2uaxLA.png" /></figure><h4>Generating GraphQL types</h4><p>Run the commands shown in the console :</p><pre>npm install<br>npm run codegen</pre><p>You should then get the following error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*U4JTJkKgCWZH5Eox3IeHVw.png" /></figure><p>This error is normal because we have defined the <em>src/**/*.vue</em> path for the <em>documents</em> property. This property is <a href="https://github.com/dotansimha/graphql-code-generator/blob/d3dc84d821a43c61ea741e98d089d3753e398c15/packages/utils/plugins-helpers/src/types.ts#L283"><em>a pointer(s) to your GraphQL documents: query, mutation, subscription and fragment</em></a>. But our Query is present in our <em>useBooksQuery</em> composable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*Y7JSxFLaq_laLkEgxp4Oeg.png" /></figure><p>To generate GraphQL types successfully, update the <em>codegen.ts</em> file by replacing <em>src/**/*.vue</em> with <em>src/**/*.ts</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*sSiBc1MgAnDRlgUtRVfJUw.png" /></figure><p>Run the following command again:</p><pre>npm run codegen</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*B6MwxugC6m6_wUt6pP6VEw.png" /></figure><p>The generation runs successfully and you get the following result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*jZadIsrhK2hwFVd_9vHP3g.png" /></figure><p>We can now correctly type our Query in our composable :</p><pre>const { result, loading, error } = useQuery&lt;BooksQuery, BooksQueryVariables&gt;(query)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*V9uj1G5sXgPhxxr2vzPjxg.png" /></figure><p>And in App.vue, we can check that the typing is correct:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*5greevK9wF3gX1RuBSe4PQ.gif" /></figure><p>💡<strong>Tips: </strong>To simplify installation of the project for other developers, add the following script to package.json :</p><pre>&quot;prepare&quot;: &quot;npm run codegen&quot;,</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*rZQn3AS839RPWbKK1aBxuQ.png" /></figure><p><em>prepare</em> is special life cycle script that runs on local <a href="https://docs.npmjs.com/cli/v10/using-npm/scripts#npm-install">npm install</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*VjtOr3lZMWqMxXSIqW0cxQ.png" /></figure><p>This way, when you run <em>npm install</em>, it will automatically execute the <em>prepare</em> script, which will automatically generate GraphQL types.</p><p>After generating GraphQL types, when you build your application (<em>npm run build</em>), you’ll get errors like the one below:</p><blockquote>TS1484: ‘TypedDocumentNode’ is a type and must be imported using a type-only import when ‘verbatimModuleSyntax’ is enabled.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*03S5EpD4oA7BBLx58NR3jA.png" /></figure><p>To correct these errors, codegen must be configured to use <em>import type {}</em> rather than <em>import {}</em> when importing only types.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*6Ctm77ipYGlXj5PX-cDqCQ.png" /></figure><p>Run the following commands:</p><pre>npm install<br>npm run build</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*lbvwPX6O2nOrKTkVI9CPQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*I2OYb9flVz01u2TuleIOiQ.png" /></figure><h4>Externalize documents</h4><p>To simplify document maintenance and reusability (queries, mutations, subscriptions, fragments), it is preferable to :</p><ul><li>use Fragment Masking</li><li>Put documents in separate files.</li><li>Or use both 🙂</li></ul><p>We won’t be using Fragment Masking in this article. But you can consult the following web pages for more details:</p><ul><li><a href="https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#fragment-masking">Fragment Masking with GraphQL codegen</a></li><li><a href="https://the-guild.dev/blog/unleash-the-power-of-fragments-with-graphql-codegen">Unleash the power of Fragments with GraphQL Codegen</a></li></ul><h4>Using a dedicated file for GraphQL documents</h4><p>We’re going to move our document for the <em>Books</em> query into a dedicated file.</p><ul><li>Create the <em>src/graphql/documents</em> directory</li><li>Create the file <em>books.query.graphql</em></li><li>Copy the document in the <em>useBookQuery</em> composable into the file</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*3IKJOTpX6emW5AEVCzHSnQ.png" /></figure><ul><li>Update <em>codegen.ts</em> file to point to .<em>graphql</em> files in <em>src/graphql/documents</em> folder.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*czTGLAA00pGSRgk9LU5AqQ.png" /></figure><ul><li>Update the <em>useBooksQuery.ts</em> file to use the document from the <em>books.query.graphql</em> file</li></ul><pre>import { useQuery } from &#39;@vue/apollo-composable&#39;<br>import type { BooksQuery, BooksQueryVariables } from &#39;@/gql/graphql&#39;<br>import BooksDocument from &#39;@/graphql/documents/books.query.graphql&#39;<br><br>export const useBooksQuery = () =&gt; {<br>  const { result, loading, error } = useQuery&lt;BooksQuery, BooksQueryVariables&gt;(BooksDocument)<br><br>  return { result, loading, error }<br><br>...</pre><ul><li>Run the following commands:</li></ul><pre>npm install --&gt; runs graphql type generation from the /src/graphql/documents folder<br>npm run build</pre><p>This last command displays the following error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*uaFdFmXMTe8rsvXfAyqY8A.png" /></figure><p>This error is normal because the <em>books.query.graphql</em> file is not a valid JavaScript file.<br>We need a plugin to convert our <em>.graphql</em> file into ES6 modules.</p><h4>Installing @rollup/plugin-graphql</h4><ul><li>Run the following command to install <a href="http://twitter.com/rollup/plugin-graphql">@rollup/plugin-graphql</a>:</li></ul><pre>npm install -D @rollup/plugin-graphql</pre><ul><li>Update the <em>vite.config.ts</em> file to add the plugin :</li></ul><pre>import { fileURLToPath, URL } from &#39;node:url&#39;<br>import { defineConfig } from &#39;vite&#39;<br>import vue from &#39;@vitejs/plugin-vue&#39;<br>import graphql from &#39;@rollup/plugin-graphql&#39;<br><br>// https://vitejs.dev/config/<br>export default defineConfig({<br>  plugins: [vue(), graphql()],<br>  resolve: {<br>    alias: {<br>      &#39;@&#39;: fileURLToPath(new URL(&#39;./src&#39;, import.meta.url))<br>    }<br>  }<br>})</pre><h4>Last step</h4><p>There’s just one last thing to do to get the application build working.</p><p>At this stage, the TypeScript compiler (<em>tsc</em>) does not recognize the import of the <em>.graphql</em> file. You need to tell it that a <em>.graphql</em> file is a module exporting a <em>DocumentNode</em> (the type used by <em>graphql.js</em> and <em>Apollo</em>).</p><ul><li>Create the file <em>src/graphql/graphql.d.ts</em></li><li>Copy the following content into it:</li></ul><pre>// When TypeScript encounters imports ending with .graphql, it treats them as modules exporting a DocumentNode.<br>declare module &#39;*.graphql&#39; {<br>  import type { DocumentNode } from &#39;graphql&#39;<br><br>  const value: DocumentNode<br>  export = value<br>}</pre><ul><li>Run the following commands:</li></ul><pre>npm install<br>npm run build</pre><p>Application build runs successfully:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*-7XgjtF_M2dC77i2AaU2Ng.png" /></figure><h4>Testing the application</h4><p>To check that the application works properly once built:</p><ul><li>Check that the <a href="#282f">Apollo server is running</a></li><li>Run the following command:</li></ul><pre>npm run preview</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*vmvudisK5_uusWEuxTDRFQ.png" /></figure><ul><li>Then go to <a href="http://localhost:4173/">http://localhost:4173/</a></li><li>Open the browser console (<em>F12</em> key, then <em>console</em> tab)</li></ul><p>➡️ You should see a log containing the request response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*g6NHh9OQur-2o6fSUcEQxQ.png" /></figure><h3>Conclusion</h3><p>In this article, we covered how to use the basics of GraphQL integration with a Vue.js 3 Application, including how to set up an Apollo client, how to generate TypeScript types for use on queries, how to maintain Query documents in isolation, how to define a query and how to consume data from a Vue component.</p><p>The source code for this tutorial can be found on <a href="https://github.com/Kobee1203/apollo-client-example/tree/feature/basics">GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=909ccb60fc82" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accor-digital-and-tech/using-graphql-with-vue-js-3-909ccb60fc82">Using GraphQL with Vue.js 3</a> was originally published in <a href="https://medium.com/accor-digital-and-tech">Accor - Tech &amp; Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What makes a photo engaging in the context of hospitality?]]></title>
            <link>https://medium.com/accor-digital-and-tech/what-makes-a-photo-engaging-in-the-context-of-hospitality-14ad42e1cded?source=rss----9bee72310bac---4</link>
            <guid isPermaLink="false">https://medium.com/p/14ad42e1cded</guid>
            <category><![CDATA[engagement-estimation]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[hospitality]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Oprean Cristina]]></dc:creator>
            <pubDate>Wed, 24 Jul 2024 13:10:02 GMT</pubDate>
            <atom:updated>2024-07-24T13:10:02.846Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>1. CONTEXT &amp; OBJECTIVES</strong></h3><h4><strong>1.1</strong> <strong>Context</strong></h4><p>In today’s highly competitive hospitality industry, effective visual marketing strategies play a pivotal role in attracting, converting, and enrolling customers. As hotels strive to stand out amidst a sea of options, the engagement level of their photos has become a critical factor in capturing the attention and interest of potential guests. However, identifying the right visuals that resonate with the target audience and drive desired actions such as bookings and loyalty program enrollments remains a complex challenge. In light of this, there is a pressing need for advanced predictive models capable of accurately estimating the engagement level of hotel photos.</p><h4><strong>1.2</strong> <strong>Objectives</strong></h4><p>The problem at hand revolves around the challenge of accurately predicting the engagement level of hotel photos. In the era of social media dominance and digital marketing, visuals have become a vital tool for hotels to showcase their offerings and entice potential guests. However, determining which photos will effectively capture the attention and interest of the target audience is a complex task. Without a clear understanding of the factors that drive engagement, hotels may struggle to create visual content that resonates with their customers. This lack of insight can result in missed opportunities to attract, convert, and enroll customers. Therefore, robust predictive models that can evaluate the engagement potential of hotel photos, providing hoteliers with valuable guidance on selecting visuals that align with their branding, drive bookings, and highlight the benefits of loyalty programs have become increasingly valuable. By addressing this problem, the research aims to empower the hospitality industry with data-driven strategies to optimize visual marketing efforts and achieve higher customer engagement levels.</p><h3><strong>2.</strong> <strong>DATA</strong></h3><h4><strong>2.1</strong> <strong>Data Collection</strong></h4><p>To train our model, we gathered Instagram images from various hotels and relevant hashtags within and without Accor’s diverse brand portfolio. Spanning from January 1, 2020, to December 31, 2022, our training data consisted of approximately 18,000 images sourced from different Instagram accounts and hashtags. To ensure a diverse representation of images, we carefully selected a range of Instagram accounts. These included random accounts showcasing beautiful landscapes, Vacation Vibes (featuring people visiting scenic destinations), luxury world traveller, beautiful destinations, booking.com, all.com, and tripadvisor. We also incorporated relevant hashtags such as hotel life and prettyhotels.</p><p>To adequately represent all hospitality segments (luxury, midscale, and economy), specific accounts and hashtags that represented these segments were selected. For instance, the Novotel and Hilton brands were included to represent the midscale segment, Marriott, Hyatt, Sofitel, Fairmont, and Pullman hotel accounts were included for the luxury segment, and ibis for the economy segment.</p><h4><strong>2.2</strong> <strong>Engagement</strong></h4><p>Engagement, in the context of social media, has no formal definition. Here, we have decided to quantify it into a score by using a formula. Our approach focuses on measuring engagement as a composite metric derived from the number of likes and comments a photo receives, divided by the number of followers. By incorporating both quantitative indicators (likes) and qualitative indicators (comments), we aim to capture a more comprehensive measure of user engagement that considers both the reach and interaction level of the content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*--_Z-LGudn2orN2gTvOrGw.jpeg" /></figure><p><strong>Figure 1. Social Media Metrics by account/hashtags for the data collected</strong></p><h3><strong>3.</strong> <strong>ANALYTICS</strong></h3><h4><strong>3.1</strong> <strong>Model Framework</strong></h4><p>Given the multi-faceted nature of engagement, any attempt at predicting how engaging a picture is requires a holistic approach that takes visual appeal, emotional impact, and content into account. These major categories were approximated by using sub models to predict their most important components: visual appeal by aesthetics and memorability, emotional impact by latent interactions and sentiments, content of the photos by their captions and object identifications. These six components are then fed into the larger model to predict the final engagement score.</p><p>The purpose of each part can be summarized as follows:</p><ul><li><em>Visual Appeal and Retention</em></li></ul><p>Aesthetic and memorability features increase viewer attention and engagement with a photo. By providing a comprehensive understanding of its impact, it helps identify key elements for targeted improvements.</p><ul><li><em>Content</em></li></ul><p>Enable to better understand which elements and contexts are most likely to engage and resonate with the target audience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QzXind8vUP_ihYQFFEm3zQ.jpeg" /></figure><p><strong>Figure 2. Framework</strong></p><h4><strong>3.2</strong> <strong>Sub Models</strong></h4><h4><strong>Visual Appeal</strong></h4><p>We incorporated the model proposed by Gautam Malu in “Learning Photography Aesthetics with Deep CNNs” as a subcomponent of our global model. This model generates 8 aesthetic attributes and a global score which are then used in a later stage. By incorporating the aesthetic attributes generated by Gautam Malu’s model, our global model gained valuable insights into the appeal of photos, contributing to a more comprehensive understanding of engagement in social media photos.</p><h4><strong>Memorability</strong></h4><p>To incorporate the memorability component of images, we integrated the model proposed by Jiri Fajtl et al. in “AMNet: Memorability Estimation with Attention” as a subcomponent of our global model. This model generates a memorability score ranging from 0 to 1 which is used at a later stage.</p><h4><strong>Visual Sentiment Analysis</strong></h4><p>To extract sentiments from raw images, we incorporated the model proposed by Borth et al. in “SentiBank: Large-scale Ontology and Classifiers for Detecting Sentiment and Emotions in Visual Content’’ as a subcomponent of our global model. This model could classify images into Adjective Noun Pair (ANP) categories, which express a particular sentiment. The top 6 noun-pair sentimental attributes associated with the image are tokenized with the caption mode output before being passed to the textual branch of the global model. By incorporating the sentiment attributes generated by SentiBank, our global model gained valuable insights into the sentiments evoked by photos, contributing to a more nuanced understanding of engagement in photos.</p><h4><strong>Latent Interactions (VisE)</strong></h4><p>To predict how people would react to a photo, the model proposed by Jia et al. in “Exploring Visual Engagement Signals for Representation Learning” was incorporated as well. This model can map images to labels that were derived from engagement signals. The output labels were stored as vectors, which are an abstract representation of the reactions people would have on a social media platform. These labels were then fed to the global model as a parameter to account for emotional reaction.</p><h4><strong>Object Detection</strong></h4><p>The object detection submodel is able to accurately identify objects in photos. The information of which objects are present in a photo is stored in vectors, which are then passed on to the global model. This gives each photo important contextual information.</p><h4><strong>Image Captioning</strong></h4><p>Rather than a list of objects present in an image, image content can instead be expressed through a natural language description. This description is called a caption, which can contain physical descriptions of the objects, such as color, and relative positions, amongst other properties. The sub model ExpansionNetV2 can generate captions with a high level of fidelity and is incorporated to provide the global model with this information. The model outputs a caption associated with the image which is then tokenized with the output of the captioning model before being passed to the textual branch of the global model.</p><h4><strong>3.3</strong> <strong>Global Model Architecture</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMelKmwSdBqXJZOVtdAJpw.jpeg" /></figure><p><strong>Figure 3. Global Architecture</strong></p><p>The architecture presented is a multimodal model that incorporates information from multiple modalities, including images, text, and numeric inputs. It takes advantage of the rich visual information conveyed by images, the textual information expressed through sentiment analysis and captions, and the numerical values of aesthetic scores and memorability. By combining these different modalities, the model is able to capture a more comprehensive understanding of the input data, enabling a holistic analysis of the factors influencing the engagement created by a photo.</p><h4><strong>3.4</strong> <strong>Evaluation</strong></h4><h4><strong>Global Model Performance</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*_ko1JZ4SKEiQ80d0CFEWBw.png" /></figure><p><strong>Table 1. Global model metrics</strong></p><p>Based on the results, we can say that the model has a high performance in predicting the engagement of images. The average error between the actual and predicted engagement is very low, indicating that the model is accurate and precise. The rank correlation (Spearman) and the Kendall correlation are both very high and positive, indicating that the model is consistent and reliable in ranking the images according to their engagement. These metrics suggest that the model captures well the relationship between the image features and the engagement score.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Wp94OXgvzg7CGSNV6XCXQ.jpeg" /></figure><p><strong>Figure 4. Actual Rank vs predicted rank for Global Model</strong></p><h4><strong>Image Model Performance</strong></h4><p>The image model performs moderately well in predicting image engagement. In the heat map, we can observe that the model is much better at predicting the extremes than those in the middle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xBLGnPASIjluAY1W-tNeUg.jpeg" /></figure><p><strong>Figure 5. Actual Rank vs predicted rank for Image model</strong></p><h4><strong>Without Text Performance</strong></h4><p>When subtracting textual components from the model, we have a worse accuracy than in the two previous proposals. This suggests that the textual model adds more accuracy to the global model than if only the image model was considered.</p><h4><strong>3.5</strong> <strong>Analysis</strong></h4><h4><strong>Memorability</strong></h4><p>Images with low memorability displayed sparse and scattered attention maps with few minor peaks, whereas images with high memorability exhibited dense and concentrated attention maps with larger and more distinct peaks.</p><p>Analysis also shows that the main sources of memorability in images are regions containing human faces and figures. Furthermore, images with unusual or unexpected content had higher memorability than images with common or expected content.</p><p>On the other hand, it seems that images that do not show the elements mentioned above, such as landscapes or natural scenes, tend to be less memorable by showing less intense maps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8DJpXM-BNj2krul6VK74Dg.jpeg" /></figure><p><strong>Figure 6. Memorability heatmap</strong></p><h4><strong>Aesthetics</strong></h4><p>The model showed a preference for pictures with high color saturation and diverse content, where the objects were sharp and well-defined, and where there was a clear focal point in the center of the image. The model also favored pictures with human figures (especially when the skin was visible).</p><p>The images with the lowest scores were typically dark, with dull colors such as beige, black and white. They also included elements of rooms without any prominent subject (such as pictures of the background of the room, the bathroom or the facilities).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3irjrGTTIsYoKhaJUSCxbA.jpeg" /></figure><p><strong>Figure 7. Aesthetic heatmaps</strong></p><p>Interestingly, the predicted engagement rate did not appear to have a strong correlation with the aesthetic attributes.</p><h4><strong>Content Analysis</strong></h4><p>BERTopic modeling was used to conduct the text analysis and identify the most prevalent topics, based on the frequency of word usage in the generated captions. By applying caption analysis to the 20th percentile of the sample, we obtained the following results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cYUtXuX6OpqVmuoRB9qgCA.jpeg" /></figure><p><strong>Table 2. Topics related to the top scored images</strong></p><p>The highest engagement scores were associated with images pertaining to the theme of restaurants, food and people.</p><p>On the other hand, within the same sample we can see that the topics related to the images with the lowest predicted engagement are images with zoom, images of rooms and backgrounds.</p><h4><strong>Sentiment</strong></h4><p>The following sentiments were obtained for the best ranked images (top 20%). We can observe that the feeling of comfort and tranquility within familiar spaces such as rooms, houses, and boats are the most represented type of sentiment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yLbQlfDcuq1gT3AzCzsWEw.jpeg" /></figure><p><strong>Table 3. Sentiments related to the top scored images</strong></p><h4><strong>3.6</strong> <strong>Limitations</strong></h4><p>The limitations of the model can come from a variety of sources, but the main issues arise from the scraped Instagram images that the model is trained on:</p><p>● Irrelevant images on Instagram occasionally drive extremely high engagement rates. Some attempts to resolve this issue were performed, but perfect removal is not a realistic possibility.</p><p>● The scraped data is missing information that is extremely relevant, such as the number of followers an account had at the time a post is made. Engagement metrics had to be derived from the current number of followers, which leads to inaccurate engagement rates for older photos, as the number of followers an account may have changed drastically over time.</p><p>Outside of inherent issues with the dataset, some other limitations are also present for various reasons:</p><p>● Other potentially influential details about the posts, such as hashtags and the trending status of those hashtags, the time of day it was posted, were also not considered.</p><p>● Engagement from comments were also taken to be a flat positive, rather than looking deeper at the sentiment of those comments. As a result, controversy driven engagement is also accepted as a valid source of engagement by the model. This, however, may be a type of engagement that hospitality companies would want to avoid.</p><p>● Trends evolve, which may require that the model be retrained periodically on the latest data. If not, the model will be unable to adapt to emerging trends, which may have a huge impact on engagement rate.</p><p>Due to the limitations stated above, predicting exact engagement rates is difficult. Fortunately, in the context of the hospitality industry, predicting the ranking of the images is where the true value of the model lies, since what we are interested in is choosing the best photos to use to drive engagement. In this aspect the model is performing extremely well.</p><h3><strong>4.</strong> <strong>BUSINESS RECOMMENDATIONS &amp; CONCLUSION</strong></h3><p>Overall, we have observed the following key points that suggest that an image may be more likely to generate engagement:</p><p>● It is preferable that the picture contains people, faces and skin visible</p><p>● Well-centered images with “main character visible”, that are not out of focus and all the elements/objects are well defined</p><p>● Images with intense color (avoid dull colors like black &amp; white or beige combos)</p><p>● Pictures mostly related to food/restaurant</p><p>● They most evoke feelings such as calmness or quietness</p><p>It is worth mentioning that these recommendations are the result of the analysis of the images, their theme and the text attached to them. For this analysis we have not taken into account the time of day, nor the traffic of users within the social media platforms, which is well known to influence the number of interactions that a post receives.</p><p>Likewise, although the present study has been focused on the tourism sector, the range of applications of the model can be extended to various industries. However, we emphasize that the results obtained are limited to the hotel industry.</p><h3>5. ACKNOWLEDGEMENTS</h3><p>We extend our heartfelt gratitude to the ESSEC x Centrale Supélec students and the Data Science &amp; AI team at Accor who contributed to this work: Antoine Cloute, Annabelle Luo, Aiza Avila Canibe, Deepesh Dwivedi, Darius Chua, Siwar Abbes, Assitan Diarra. Their dedication, creativity, and teamwork were crucial to the success of this project. Special thanks are also due to the business team, represented by Christophe Pélé &amp; Asma Baillet, whose sponsorship and vision were the driving force behind this initiative. All the combined efforts have not only advanced our research but also set a high standard for future endeavors. Thank you for your invaluable contributions and hard work.</p><h3><strong>6.</strong> <strong>REFERENCES</strong></h3><p>[1] Aloufi, S., Zhu, S., &amp; El Saddik, A. “On the Prediction of Flickr Image Popularity by Analyzing Heterogeneous Social Sensory Data.” Sensors 17, no. 3 (2017): 631. <a href="https://doi.org/10.3390/s17030631">https://doi.org/10.3390/s17030631</a>.</p><p>[2] Borth, D., Ji, R., Chen, T., Breuel, T., &amp; Chang, S. “Large-Scale Visual Sentiment Ontology and Detectors Using Adjective Noun Pairs.” In Proceedings of the 21st ACM International Conference on Multimedia, 223–232. ACM, 2013.</p><p>[3] Bylinskii, Z., Isola, P., Bainbridge, C., Torralba, A., &amp; Oliva, A. “Intrinsic and Extrinsic Effects on Image Memorability.” Vision Research 116 (2015): 165–178. Elsevier.</p><p>[4] Cantero Priego, J. “Predicting the number of likes on Instagram with tensorflow.” Pàgina inicial de UPCommons. February 17, 2021. <a href="https://upcommons.upc.edu/handle/2117/339937">https://upcommons.upc.edu/handle/2117/339937</a>.</p><p>[5] Chen, T., Borth, D., Darrell, T., &amp; Chang, S. “DeepSentiBank: Visual Sentiment Concept Classification with Deep Convolutional Neural Networks.” arXiv preprint arXiv:1410.8586.</p><p>[6] Fajtl, J., Argyriou, V., Monekosso, D., &amp; Remagnino, P. “AMNet: Memorability Estimation with Attention.” arXiv preprint arXiv:1804.03115.</p><p>[7] Jia, M., Wu, Z., Reiter, A., Cardie, C., Belongie, S., &amp; Lim, S. “Exploring Visual Engagement Signals for Representation Learning.” arXiv preprint arXiv:2104.07767.</p><p>[8] Khosla, A., Raju, A. S., Torralba, A., &amp; Oliva, A. “Understanding and Predicting Image Memorability at a Large Scale.” In Proceedings of the International Conference on Computer Vision (ICCV).</p><p>[9] Lei Hou, Xue Pan. “Aesthetics of hotel photos and its impact on consumer engagement: A computer vision approach.” Tourism Management 94 (2023): 104653. <a href="https://doi.org/10.1016/j.tourman.2022.104653">https://doi.org/10.1016/j.tourman.2022.104653</a>.</p><p>[10] Lennan, C., &amp; Tran, D. “Deep Learning for Classifying Hotel Aesthetics Photos.” NVIDIA Developer Blog. October 30, 2018. Retrieved June 5, 2023, from <a href="https://developer.nvidia.com/blog/deep-learning-hotel-aesthetics-photos/">https://developer.nvidia.com/blog/deep-learning-hotel-aesthetics-photos/</a>.</p><p>[11] Malu, G., Bapi, R. S., &amp; Indurkhya, B. “Learning photography aesthetics with Deep Cnns.” arXiv.org. July 13, 2017. <a href="https://arxiv.org/abs/1707.03981">https://arxiv.org/abs/1707.03981</a>.</p><p>[12] Murray, N., Marchesotti, L., &amp; Perronnin, F. “AVA: A large-scale database for aesthetic visual analysis.” In 2012 IEEE Conference on Computer Vision and Pattern Recognition, 2408–2415. Providence, RI, USA, 2012. doi: 10.1109/CVPR.2012.6247954.</p><p>[13] Praveen, A., Noorwali, A., Samiayya, D., Zubair Khan, M., Vincent, P. M. D. R., Bashir, A. K., &amp; Alagupandi, V. “ResMem-Net: memory-based deep CNN for image memorability estimation.” PeerJ Comput Sci 7 (2021): e767. doi: 10.7717/peerj-cs.767.</p><p>[14] Talebi, H., &amp; Milanfar, P. “Nima: Neural Image Assessment.” arXiv.org. April 26, 2018. <a href="https://arxiv.org/abs/1709.05424">https://arxiv.org/abs/1709.05424</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14ad42e1cded" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accor-digital-and-tech/what-makes-a-photo-engaging-in-the-context-of-hospitality-14ad42e1cded">What makes a photo engaging in the context of hospitality?</a> was originally published in <a href="https://medium.com/accor-digital-and-tech">Accor - Tech &amp; Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[So we made a bot that does stuff for us]]></title>
            <link>https://medium.com/accor-digital-and-tech/so-we-made-a-bot-that-does-stuff-for-us-4f7fab7c744e?source=rss----9bee72310bac---4</link>
            <guid isPermaLink="false">https://medium.com/p/4f7fab7c744e</guid>
            <category><![CDATA[bitrise]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[release-automation]]></category>
            <category><![CDATA[risotto-recipe]]></category>
            <category><![CDATA[slack]]></category>
            <dc:creator><![CDATA[Bertrand Magnien]]></dc:creator>
            <pubDate>Fri, 10 Mar 2023 09:29:19 GMT</pubDate>
            <atom:updated>2023-03-10T09:29:19.445Z</atom:updated>
            <content:encoded><![CDATA[<p>Because every release used to take us too much effort, we made a bot that replaces us, and works for us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ie5f-Qoq5rGcxEl2nf_89g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@kensuarez?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Ken Suarez</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><blockquote>“Hey ! It’s RELEASE time, make sure everything is ok, and let’s deliver an awesome increment”</blockquote><p>No matter if you are working on an API, a website, or a mobile app, releasing your code is always a pain if you don’t have a good process and a good tool to make it.</p><p>At <a href="https://all.accor.com/">Accor</a>, in the Android app team, we used to spend more than 2 hours releasing each new version.</p><h4>So we made a bot that releases our code on our behalf</h4><p>Here comes “Risotto”, our “Release automation bot”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/215/1*GVD1POxowqjymbPmYvY-qQ.png" /><figcaption>Risotto in person</figcaption></figure><blockquote>The name Risotto comes from a french pun “Release auto” -&gt; “Risotto”</blockquote><h4>Prerequisites to understand what comes below:</h4><ul><li>You have previously been asked to “release” a code based software.</li><li>Knowledge of global programming concepts such as CI/CD, Pull requests, Git flow …</li></ul><h4>Why a bot? Is releasing an application so hard ?!</h4><p>Indeed, building and releasing an app is trivial. <br>Thousands of people have already faced this problem, and thousands of articles already exist on the web. <br>So why another publication about release automation? <br>Well, I hope you find something new here!</p><p>Here is what Risotto is capable of :</p><ul><li>Starting the release on his own, every two weeks. Always on time.</li><li>Respecting our (something confusing) gitflow and branch naming conventions</li><li>Allowing for a few manual steps, reviewed on Github by human developers</li><li>Communicating with us through Slack messages, just like anyone else in our team.</li><li>Never complaining about repetitive and boring tasks</li><li>Never being sick nor in holidays. <br>(Unless being under maintenances counts as being sick 🤔)</li></ul><h4>A few words about our technical stack</h4><ul><li>We use <a href="https://www.bitrise.io/"><strong>Bitrise</strong></a> for CI-CD</li><li>Our codebase is hosted on <a href="https://github.com/"><strong>Github</strong></a></li><li>We use <a href="https://www.atlassian.com/software/jira"><strong>Jira</strong></a> for issue tracking and visual management</li><li>The whole team uses <a href="https://slack.com/"><strong>Slack</strong></a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*jHMF3igmMTvvJtS5pe535w.png" /><figcaption>Risotto and its interactions with external tools</figcaption></figure><p>To release the code, the team only interacts with Risotto, thanks to a slack bot.</p><h3>Release start</h3><p>Every two weeks, the Android team receives this message from Risotto :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i6gz5VrxOVz-Bk8yY9RaVQ.png" /><figcaption>Release starting on public channels</figcaption></figure><p>This is triggered by a customizable <a href="https://api.slack.com/workflows">Slack Workflow</a>, scheduled every two weeks, on Thursdays at 4pm.</p><p>The workflow can easily be modified by anyone. Especially when Thursday is a holiday, we can re-schedule the release as we see fit. <br>No code needed, no cron table, no pain.</p><h3>Fail-proof configuration check</h3><p>Our Risotto bot works with outgoing / incoming webhooks from Github and Bitrise.</p><p>The Risotto bot and server are hosted on an EC2 Amazon virtual machine, with IP address filtering. We don’t want any IP in the world to trigger a release of our app 🙃</p><p>What happens if Github or Bitrise decides to change its IP address?<br>A stuck and burnt Risotto in the pan!</p><p>For example, Github’s IP addresses can change from time to time. Risotto checks them thanks to the <a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-githubs-ip-addresses">Github meta api</a>, and warns people about future malfunctions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H_MRG5pvl1GhFpyl9bqe1w.png" /><figcaption>⬅️ No issue | Some new IP ➡️</figcaption></figure><h3>Release preparation</h3><blockquote>“Prepare the ingredients for a good Risotto”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OPFrpXDKS_q0IIBI.jpg" /><figcaption>Yum! This Risotto will be tasty <a href="https://www.thelastfoodblog.com/creamy-mushroom-risotto/">source</a></figcaption></figure><p>Before releasing our app, the developer team must verify a few things :</p><ul><li>Check that every previous bugfix has been merged into the main branch</li><li>Pull and embed some configuration files (retrieved from <a href="https://firebase.google.com/docs/remote-config">Firebase Remote Config</a>)</li><li>Get the translations from <a href="https://phrase.com/fr/">Phrase</a> (for new features) and embed them in the app. Verify that those translations are “correct”, in english and in our native language.</li></ul><p>This is why Risotto creates a “preparation pull request”, validated by an appointed team member to read those messages.<br>Once merged, the recipe continues automatically, led by Risotto.</p><blockquote>Note : Every two weeks, someone in the team is appointed as “The Cook <em>🧑‍🍳</em>”, and is in charge of interacting with Risotto.</blockquote><h3>Build the app and release it (as a draft)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1DAyTmdpzhKm_jtC_Y-Zw.png" /><figcaption>Message from Risotto asking to merge a lot of code</figcaption></figure><p>Nothing phenomenal. <br>Risotto generates a Pull Request on Github, verified by a Bitrise check with :</p><ul><li>Unit tests</li><li>Lints</li></ul><p>Once merged, a Bitrise workflow is triggered.<br>The workflow :</p><ul><li>builds our app</li><li>drafts it on Google Play</li><li>creates a JIRA release, Github Release blah blah blah</li></ul><h3>Manual release verification / sanity checks</h3><p>Once the build has ended and the release is ready to be tested, the Cook 🧑‍🍳 is responsible for doing some quick checks, ensuring this build is worth testing by the QA team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xg0FkaANr2U6HemgahokOw.png" /><figcaption>Damn, I really need to change that button’s text</figcaption></figure><p>When the Cook gives his stamp of approval, the Risotto bot continues its tasks.</p><h3>Release ends with great fanfare</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*5tG6RCamZmBdcYIDAf7MHg.png" /><figcaption>When release ends on public channels</figcaption></figure><p>One of the most important things when releasing our app as a draft is communicating about it.</p><p>Risotto actually sends a lot of messages during the release:</p><ul><li>In developers’ channels it sends verification steps, logs and errors.</li><li>In public channels with the whole team it sends announcement messages. When the release starts and when it ends.</li></ul><h3>To conclude</h3><p>Since we adopted Risotto in our process, being the Cook 🧑‍🍳 for two weeks isn’t a chore anymore.</p><p>Here is the list of pain points solved by Risotto :</p><ul><li>Developers used to need a how-to-release training to master every release step.<br>=&gt; Not anymore, the bot knows the process for us.</li><li>The developer in charge was 100% focused on releasing for about 2 hours. He was hardly able to do anything else at the same time.<br>=&gt; Not anymore, he’s just interrupted twice when manual steps are required.</li><li>We often started releasing late in the day, making team members work during the evening to finish what we started.<br>=&gt; Not anymore, the release starts automatically, ignoring messages like “Wait, I want to merge that code before we release”</li><li>We sometimes forgot to warn the rest of the team about release completion.<br>=&gt; Not anymore, the bot automatically sends messages on Slack to everyone.</li></ul><p>Today we keep improving Risotto everytime we think something could be added to its scope of responsibilities.</p><h3>Why did I write this story ?</h3><p>You may have noticed that I haven’t detailed each of the 8 steps we need to perform in order to deliver a release, because this would probably be too specific to our team and processes.</p><p>I hope this story inspires you to create something new, something that suits your team perfectly.</p><p>From now on, if you see someone doing painful &amp; repetitive jobs you could think about how it can be automatized. The more free time the team has, the better it becomes.</p><p>Please take the time to get feedback from your team, and… see how to add a bot that does the dirty job for you, while acting as a team member.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f7fab7c744e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accor-digital-and-tech/so-we-made-a-bot-that-does-stuff-for-us-4f7fab7c744e">So we made a bot that does stuff for us</a> was originally published in <a href="https://medium.com/accor-digital-and-tech">Accor - Tech &amp; Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>