<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>code-agent on </title>
    <link>/tags/code-agent/</link>
    <description>Recent content in code-agent on </description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Tue, 21 Apr 2026 12:54:15 +0800</lastBuildDate><atom:link href="/tags/code-agent/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>ArchUnit 作为 Code Agent 时代的 Harness：微服务、Monorepo 与普通 Repo 的落地方式</title>
      <link>/posts/archunit-harness-microservices-monorepo/</link>
      <pubDate>Tue, 21 Apr 2026 12:54:15 +0800</pubDate>
      
      <guid>/posts/archunit-harness-microservices-monorepo/</guid>
      <description>📦 本文基于的完整项目源码：meirongdev/shop
背景：在 code agent 时代重新谈 ArchUnit 这两年很多团队都在引入 code agent。它们写代码的速度很快，能补样板、改依赖、重构包结构、批量修复低级问题，但也因此更容易把&amp;quot;本来只存在于文档和 review 习惯里的约束&amp;quot;绕过去。
下面这些问题，人在赶时间时会犯，agent 在缺少硬约束时也会犯：
为了省事直接加 @Autowired 字段注入 在 BFF 里偷偷落一个 @Entity Controller 直接访问 Repository Kafka consumer 没有幂等保护 契约模块慢慢混入 Spring Web / JPA 依赖 这些都不是&amp;quot;功能对不对&amp;quot;的问题，而是&amp;quot;代码还在不在团队允许的边界里&amp;quot;的问题。在我看来，ArchUnit 的价值就在这里：它把架构约束从口头约定变成可执行测试。
这个视角并不是孤立的观察。Birgitta Böckeler 在 2026 年 2 月的 Harness Engineering, First Thoughts 里把这种&amp;quot;给 agent 搭结构化反馈 harness&amp;quot;的工程学命名了出来，并明确问到：&amp;ldquo;Have you experimented with structural testing frameworks like ArchUnit?&amp;rdquo; 同一时期，Sasha Podlesniuk 在 2026 年 1 月的 From Prompts to Invariants: Re-architecting Systems with ArchUnit and LLMs 里具体写了怎么把 ArchUnit 的失败信息当作 agent 的反馈信号。更早的概念根源是 Neal Ford 在《Building Evolutionary Architectures》里提出的 fitness function——结构化测试就是最典型的、可执行的 fitness function。</description>
    </item>
    
  </channel>
</rss>
