<?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: Stanislav Zmiev</title>
    <description>The latest articles on DEV Community by Stanislav Zmiev (@zmievsa).</description>
    <link>https://dev.to/zmievsa</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%2F1186181%2F8b382fff-8769-4f73-889d-f3ed4580e43d.jpg</url>
      <title>DEV Community: Stanislav Zmiev</title>
      <link>https://dev.to/zmievsa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zmievsa"/>
    <language>en</language>
    <item>
      <title>The Bitter Lesson Ate Your AI Factory</title>
      <dc:creator>Stanislav Zmiev</dc:creator>
      <pubDate>Thu, 29 Oct 2026 14:02:37 +0000</pubDate>
      <link>https://dev.to/zmievsa/the-bitter-lesson-ate-your-ai-factory-50bh</link>
      <guid>https://dev.to/zmievsa/the-bitter-lesson-ate-your-ai-factory-50bh</guid>
      <description>&lt;p&gt;For every AI workflow we define, the next model makes it useless. &lt;/p&gt;

&lt;p&gt;What's worse: most of us keep clinging to the outdated workflows for months after they've outlived their usefulness.&lt;/p&gt;

&lt;p&gt;Remember how everyone was excited about AI code completion? How about prompt engineering? Harness engineering? Spec-driven development? Loop engineering? Software factory? Dark factory? They are all dead because of the &lt;a href="http://www.incompleteideas.net/IncIdeas/BitterLesson.html" rel="noopener noreferrer"&gt;bitter lesson&lt;/a&gt;. To summarize it: no matter what "domain knowledge", "harness", or "workflow" you try to integrate above your AI model, it will be outshone by just a larger, smarter model. This happened in chess when the program that beat Kasparov in 1997 won with massive, deep search, not with the human understanding of chess that most researchers had spent years encoding. And it keeps happening to us today.&lt;/p&gt;

&lt;p&gt;That's why whenever somebody tries to build yet another factory or a really constraining skill, I roll my eyes since modern models perform &lt;strong&gt;worse&lt;/strong&gt; with these tools. There are even benchmark runs showing that: &lt;a href="https://danluu.com/agentic-testing/" rel="noopener noreferrer"&gt;Dan Luu tried 26 testing instructions and a few popular testing skills on agents implementing Zstd&lt;/a&gt;, and plain "no additional instructions" did well above average while the popular skills underperformed; &lt;a href="https://x.com/kunchenguid/status/2064196342248030352" rel="noopener noreferrer"&gt;Kun Chen measured that asking agents to do TDD makes them worse&lt;/a&gt;. On DeepSWE, near-bare mini-swe-agent did as well as or better than Claude Code and Codex CLI.&lt;/p&gt;

&lt;p&gt;Every time I discuss outdated and over-engineered AI workflows, I find it useful to remember what problem the workflow is used to solve and what model made it unnecessary:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb2y78jh8i8bxb613f4vq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb2y78jh8i8bxb613f4vq.png" alt="Every workflow dies to the next model" width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OpenAI o1 made "few-shot", "chain-of-thought", etc. prompting irrelevant because of reasoning&lt;/li&gt;
&lt;li&gt;Sonnet 3.5 gave birth to vibe coding &lt;/li&gt;
&lt;li&gt;Sonnet 3.7 made meticulously crafted prompts irrelevant and moved many people from tab-complete to generating whole functions and modules&lt;/li&gt;
&lt;li&gt;Opus 4 with Claude Code made real agentic coding viable for weekend projects; Opus 4.5 made it viable for work. At that point many people from my bubble started writing 70-80% of code with it, which finished off any hope for AI tab-complete and "compact-your-codebase-into-one-prompt" tools&lt;/li&gt;
&lt;li&gt;GPT-5.4 kept track of a long-running list of tasks without the help of a plan mode, spec-driven development or a Ralph loop, making all three unnecessary. The only part of spec-driven that's still useful is getting requirements from a user, which is better accomplished by the &lt;code&gt;/grill-with-docs&lt;/code&gt; skill&lt;/li&gt;
&lt;li&gt;Fable 5 caught up in terms of not losing track of work and showed us that sufficiently smart models could make good decisions on their own, lowering our need for a variety of guardrails and checks. But it was still too expensive for most people to use as a driver, so "reviewer" workflows got popular: a cheaper model does the work and asks Fable for decisions&lt;/li&gt;
&lt;li&gt;GPT-5.6 Sol along with OpenAI's outstanding computer/browser use made it possible to delegate much larger and human-y tasks to agents, making MCPs optional for most websites and apps. I have almost forgotten what dashboards for all my infra look like because these days agents are more capable than me at taking actions there&lt;/li&gt;
&lt;li&gt;Opus 5.5 fixed the prose issue of the Claude family and could make good decisions like Fable at a fraction of the cost, removing the need for the "reviewer" workflow and for factories when using frontier models (though arguably factories were not necessary even at GPT 5.6 Sol stage)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice the orange curves: the workflows either became popular or kept being popular &lt;strong&gt;after&lt;/strong&gt; they got (mostly) useless for frontier models. And the time period between the introduction of the workflow and its death keeps shrinking.&lt;/p&gt;

&lt;p&gt;These days a naive and concise prompt into Claude Code with Opus 5.5 will perform significantly better than every AI factory because &lt;a href="https://claude.com/resources/articles/building-agents-when-to-fold-subagents-into-your-main-agent-loop" rel="noopener noreferrer"&gt;factories needlessly constrain Opus&lt;/a&gt;. A default Opus 5.5 can make much better decisions by &lt;a href="https://en.wikipedia.org/wiki/Shuhari#Definition" rel="noopener noreferrer"&gt;going beyond the constraints and rules&lt;/a&gt; that factories commonly put on it since the written rules cannot foresee every situation and invariant.&lt;/p&gt;

&lt;p&gt;The rate of change is so fast that most AI courses and books are outdated by the time they come out. So I advise all readers to instead focus on the short articles the labs publish when they release new models. Except for Gemini, of course: they are too far from the frontier to matter in this discussion (&lt;a href="https://blog.google/innovation-and-ai/models-and-research/gemini-models/introducing-gemini-4-carbon/" rel="noopener noreferrer"&gt;or not&lt;/a&gt;, the race moves fast!).&lt;/p&gt;

&lt;p&gt;Whenever you are trying out or building yet-another-really-modern-AI-workflow, think about the bitter lesson: your workflow is likely already outdated.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;
  What about local models?
  &lt;p&gt;I am fully aware that my logic only applies to people using frontier models. Of course, many of these workflows are still valid in the Qwen world, especially if you are aiming at using 27b-sized LLMs. My concern is strictly with the people trying to apply said workflows to frontier, which is still a lot of people.&lt;/p&gt;



&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Follow me on X: &lt;a href="https://x.com/zmievsa" rel="noopener noreferrer"&gt;@zmievsa&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>llm</category>
    </item>
    <item>
      <title>API Versioning at Monite</title>
      <dc:creator>Stanislav Zmiev</dc:creator>
      <pubDate>Thu, 29 Aug 2024 11:49:59 +0000</pubDate>
      <link>https://dev.to/monite/api-versioning-at-monite-3ba3</link>
      <guid>https://dev.to/monite/api-versioning-at-monite-3ba3</guid>
      <description>&lt;p&gt;We all love to have shiny new tools but hate the chore of constantly updating them. This applies to anything: operating systems, apps, APIs, linux packages. It is painful when our code stops working because of an update and it is double the pain when the update was not even initiated by us.&lt;/p&gt;

&lt;p&gt;In web API development, you are constantly at risk of breaking your users' code with every new update. If your product is an API, then these updates will be terrifying every time. Monite's main products are our API and our white-label SDK. We are an API-first company so we take great care of keeping our API stable and easy to use. Hence the problem of &lt;a href="https://docs.monite.com/reference/versioning" rel="noopener noreferrer"&gt;breaking changes&lt;/a&gt; is near the top of our priority list.&lt;/p&gt;

&lt;p&gt;A common solution is to issue deprecation warnings to your clients and to release breaking changes rarely. Suddenly, your releases can now take months and some features have to stay hidden or even unmerged until each next release. This slows down your development and forces your users to update their integration every few months.&lt;/p&gt;

&lt;p&gt;If you make releases faster, your users are going to have to update their integration too often. If you lengthen the time between releases, you will move slower as a company. The more inconvenient you make it for users -- the more convenient it is going to be for you, and vice versa. This is certainly not an optimal scenario. We wanted to move at our own pace without breaking anything for existing clients which would be impossible with a regular deprecation approach. This is why we picked an alternative solution: &lt;strong&gt;API versioning&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It is quite a simple idea: release any breaking changes at any time but hide them under a new API version. It grants you the best of both worlds: The users will not have their integrations routinely broken and you will be able to move at any speed you like. The users will migrate whenever they want -- free of any pressure.&lt;/p&gt;

&lt;p&gt;Considering the simplicity of the idea, it feels perfect for any company. That is what you would expect to read in a typical engineering blog. Sadly, it is not so simple.&lt;/p&gt;

&lt;h2&gt;
  
  
  Beware of the price
&lt;/h2&gt;

&lt;p&gt;API versioning is hard, very hard. Its illusory simplicity quickly fades away once you begin implementing it. Sadly, the internet never really warns you as there are surprisingly few resources on the topic. The absolute majority of them argue about where to put the API version but only a few scarce articles attempt to answer: "How do we &lt;strong&gt;implement&lt;/strong&gt; it?". The most common ones are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;putting different versions of the same web application into separate deployments
&lt;/li&gt;
&lt;li&gt;copying single routes that have changed between versions
&lt;/li&gt;
&lt;li&gt;copying the entire versioned application for each version&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Separate deployments can get really expensive and hard to support, copying single routes does not scale very well to large changes, and copying the entire application creates so much extra code that you will start drowning in it after just a few versions.&lt;/p&gt;

&lt;p&gt;Even if you try to pick the cheapest one, the burden of versioning will catch up soon. At first, it will feel simple: add another schema here, another branch in business logic there, and duplicate a few routes at the end. But given enough versions your business logic will quickly become unmanageable, many of your developers will mistake application versions and API versions, and will start versioning the data within your database, and your application will become impossible to maintain.&lt;/p&gt;

&lt;p&gt;You might hope that you will never have more than two or three API versions at the same time; that you will be able to delete old versions every few months. It is true if you only support a small number of internal consumers. But clients outside of your organization will not enjoy the experience of being forced to upgrade every few months.&lt;/p&gt;

&lt;p&gt;API versioning can quickly become one of the most expensive parts of your infrastructure so it is critical to do diligent research beforehand. If you only support internal consumers, then you might have a simpler time with something like GraphQL but it can quickly get just as expensive as versioning.&lt;/p&gt;

&lt;p&gt;If you are a startup, it would be wise to postpone API versioning until the later stages of your development when you have resources to do it right. Until then, deprecations and &lt;a href="https://youtu.be/y6wXRMDtZd8" rel="noopener noreferrer"&gt;additive change strategy&lt;/a&gt; might suffice. Your API will not always look great but at least you will save a great deal of money by avoiding explicit versioning.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do we implement API versioning?
&lt;/h2&gt;

&lt;p&gt;After a few trials and many errors we were at the crossroads: our prior versioning approaches that we mentioned above were too expensive to maintain. As a result of our struggles, I devised the following list of requirements that would be required of a perfect versioning framework:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;"&lt;em&gt;Maintaining a large number of versions is easy&lt;/em&gt;" to make sure that versioning does not slow down our feature development
&lt;/li&gt;
&lt;li&gt;"&lt;em&gt;Deleting old versions is easy&lt;/em&gt;" to make sure that we can clean up our code base without efforts
&lt;/li&gt;
&lt;li&gt;"&lt;em&gt;Creating new versions is not too easy&lt;/em&gt;" to make sure that our developers are still incentivized to try to solve problems without versions.
&lt;/li&gt;
&lt;li&gt;"&lt;em&gt;Maintaining a changelog between versions is easy&lt;/em&gt;" to make sure that both we and our clients can always be sure about the real differences between versions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Sadly, there were little to no alternatives to our existing approaches. This is when a crazy idea came to my mind: what if we try and build something sophisticated, something perfect for the job -- something like &lt;a href="https://stripe.com/blog/api-versioning" rel="noopener noreferrer"&gt;Stripe's API versioning&lt;/a&gt;?&lt;/p&gt;

&lt;p&gt;As a result of countless experiments, we now have &lt;a href="https://github.com/zmievsa/cadwyn" rel="noopener noreferrer"&gt;Cadwyn&lt;/a&gt;: an open-source API versioning framework that not only implements Stripe's approach but significantly builds on top of it. We will be talking about its Fastapi and Pydantic implementation but the core principles are language and framework agnostic.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Cadwyn works
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Version Changes
&lt;/h4&gt;

&lt;p&gt;The problem of all other versioning approaches is that we are duplicating too much. Why would we duplicate the entire route, controller, or even application when only a tiny part of our contract got broken?&lt;/p&gt;

&lt;p&gt;With Cadwyn, whenever API maintainers need to create a new version, they apply the breaking changes to their latest schemas, models, and business logic. Then they create a version change -- a class that encapsulates all differences between the new version and a prior version.&lt;/p&gt;

&lt;p&gt;For example, let's say that previously our clients could create a user with an address but now we would like to allow them to specify multiple addresses instead of a single one. The version change would look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ChangeUserAddressToAList&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;VersionChange&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Renamed `User.address` to `User.addresses` and &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;changed its type to an array of strings&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;instructions_to_migrate_to_previous_version&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nf"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;addresses&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;didnt_exist&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nf"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;address&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;existed_as&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nd"&gt;@convert_request_to_next_version_for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;UserCreateRequest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;change_address_to_multiple_items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;addresses&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;address&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;

    &lt;span class="nd"&gt;@convert_response_to_previous_version_for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;UserResource&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;change_addresses_to_single_item&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;address&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;addresses&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;instructions_to_migrate_to_previous_version are used by Cadwyn to generate code for older API versions of schemas and the two converter functions are the trick that allows us to maintain as many versions as we would like. The process looks like the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Cadwyn converts all user requests from older API versions to the latest API version by using change_address_to_multiple_items converter, and pipes them to our business logic
&lt;/li&gt;
&lt;li&gt;Business logic, its API responses, and database models are always tailored to the latest API version (of course, it must still support old features even if they were dropped in new versions)
&lt;/li&gt;
&lt;li&gt;After business logic produces the response, Cadwyn converts it to the older API version that the client requester is currently on by using change_addresses_to_single_item converter.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After our API maintainers have created the version change, they need to add it to our VersionBundle to tell Cadwyn that this VersionChange will be included in some version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nc"&gt;VersionBundle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nc"&gt;Version&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2023&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;27&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="n"&gt;ChangeUserAddressToAList&lt;/span&gt;
    &lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nc"&gt;Version&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2023&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="n"&gt;CollapseUserAvatarInfoIntoAnID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;MakeUserSurnameRequired&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nc"&gt;Version&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2023&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;15&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;That's it: we have added a breaking change but our business logic only handles a single version -- latest. Even after we add dozens of API versions, our business logic will still be free from versioning logic, constant renaming, if's and data converters.&lt;/p&gt;

&lt;h4&gt;
  
  
  Version Chaining
&lt;/h4&gt;

&lt;p&gt;Version changes are dependent on the public interface of the API and we almost never add breaking changes into existing API versions. This means that once we have released the version – it will not be broken.&lt;/p&gt;

&lt;p&gt;Because version changes describe breaking changes within versions and there are no breaking changes within old versions, we can be sure that our version changes are completely immutable – they will never have a reason to change. Immutable entities are much easier to maintain than if they were a part of business logic because it is always evolving. Version changes are also applied one after another -- forming a chain of transformers between versions that can migrate any request to any newer version and any response to any older version.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F19kqf9nscbgxhyn44acw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F19kqf9nscbgxhyn44acw.png" alt="Diagram of how requests and responses flow through Cadwyn" width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Side effects
&lt;/h4&gt;

&lt;p&gt;API contracts are much more complex than just schemas and fields. They consist of all endpoints, status codes, errors, error &lt;strong&gt;messages&lt;/strong&gt;, and even business logic behaviors. Cadwyn uses the same DSL we described above to handle endpoints and status codes but errors and business logic behaviors are a different story: they are impossible to describe using a DSL, they need to be embedded into business logic.&lt;/p&gt;

&lt;p&gt;This makes such version changes much more expensive to maintain than all others because they affect business logic. We call this property a "side effect" and we try to avoid them at all costs because of their maintenance burden. All version changes that want to modify business logic will need to be marked as having side effects. It will serve as a way to know which version changes are "dangerous":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;RequireCompanyAttachedForPayment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;VersionChangeWithSideEffects&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User must now have a company_id in their account &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;if they want to make new payments&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It will also allow API maintainers to check that the client request uses an API version that includes this side effect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;RequireCompanyToBeAttachedForPayment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_applied&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;validate_company_id_is_attached&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  No silver bullets
&lt;/h2&gt;

&lt;p&gt;Cadwyn has many benefits: It greatly reduces the burden on our developers and can be integrated into our infrastructure to automatically generate the changelog and improve our API docs.&lt;/p&gt;

&lt;p&gt;However, the burden of versioning still exists and even a sophisticated framework is not a silver bullet. We do our best to only use API versioning when absolutely necessary. We also try to make our API correct on the first try by having a special "API Council". All significant API changes are reviewed there by our best developers, testers, and tech writers before any implementation gets moving.&lt;/p&gt;

&lt;p&gt;Special thanks to &lt;a href="https://twitter.com/brandur" rel="noopener noreferrer"&gt;Brandur Leach&lt;/a&gt; for his API versioning article at Stripe and for the help he extended to me when I implemented Cadwyn: it would not be possible without his help.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>python</category>
      <category>programming</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
