{"id":2627,"date":"2026-06-02T03:25:31","date_gmt":"2026-06-02T03:25:31","guid":{"rendered":"https:\/\/tucumandevelopers.com\/index.php\/2026\/06\/02\/tests-verify-behavior-archmind-verifies-architecture\/"},"modified":"2026-06-02T03:25:31","modified_gmt":"2026-06-02T03:25:31","slug":"tests-verify-behavior-archmind-verifies-architecture","status":"publish","type":"post","link":"https:\/\/tucumandevelopers.com\/index.php\/2026\/06\/02\/tests-verify-behavior-archmind-verifies-architecture\/","title":{"rendered":"Tests Verify Behavior. ArchMind Verifies Architecture."},"content":{"rendered":"<div>\n<div><\/div>\n<p>The bigger the application becomes, the harder it is to understand this flow.<\/p>\n<p>Most tooling doesn&#8217;t help much.<\/p>\n<p>PHPStan verifies types.<\/p>\n<p>Tests verify behavior.<\/p>\n<p>Code review focuses on diffs.<\/p>\n<p>But none of them answer a simple question:<\/p>\n<blockquote>\n<p>Did the execution architecture of this route change?<\/p>\n<\/blockquote>\n<p>For example: <\/p>\n<div>\n<pre><code>POST \/orders Before: auth tenant middleware DB::transaction Order::create OrderCreated event After: auth tenant middleware Order::create OrderCreated event <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>The transaction disappeared.<\/p>\n<p>The code still compiles.<\/p>\n<p>The tests may still pass.<\/p>\n<p>But the architecture has changed.<\/p>\n<hr>\n<h2> <a name=\"i-wanted-architecture-to-become-testable\" href=\"#i-wanted-architecture-to-become-testable\"> <\/a> I wanted architecture to become testable <\/h2>\n<p>Frontend teams have snapshot testing.<\/p>\n<p>If a UI unexpectedly changes, CI catches it.<\/p>\n<p>I started wondering:<\/p>\n<blockquote>\n<p>What if we could do the same thing for execution architecture?<\/p>\n<\/blockquote>\n<p>That idea became ArchMind.<\/p>\n<p>Instead of treating a Laravel project as a collection of files, ArchMind builds an execution graph. <\/p>\n<div>\n<pre><code>Route \u2192 Middleware \u2192 Controller \u2192 Service \u2192 Transaction \u2192 Event <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>The graph becomes a baseline.<\/p>\n<p>Future commits are compared against it.<\/p>\n<p>If an important architectural component disappears, ArchMind reports a topology regression.<\/p>\n<p>Example: <\/p>\n<div>\n<pre><code>\u2718 TOPOLOGY REGRESSION: POST \/orders lost: transaction_boundary <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>CI fails before the change reaches production.<\/p>\n<hr>\n<h2> <a name=\"what-archmind-actually-does\" href=\"#what-archmind-actually-does\"> <\/a> What ArchMind actually does <\/h2>\n<h3> <a name=\"1-trace-execution-flow\" href=\"#1-trace-execution-flow\"> <\/a> 1. Trace execution flow <\/h3>\n<div>\n<pre><code>archmind trace <span>--project<\/span> <span>.<\/span> <span>\"POST \/orders\"<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>Output: <\/p>\n<div>\n<pre><code>POST \/orders \u2514\u2500 auth:sanctum \u2514\u2500 ResolveTenant \u2514\u2500 OrderController::store \u2514\u2500 OrderService::createOrder \u2514\u2500 DB::transaction \u251c\u2500 Order::create \u2514\u2500 OrderCreated <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>This provides a route-level view of the execution path.<\/p>\n<p>No digging through controllers, services, events, and listeners manually.<\/p>\n<hr>\n<h3> <a name=\"2-detect-topology-regressions\" href=\"#2-detect-topology-regressions\"> <\/a> 2. Detect topology regressions <\/h3>\n<div>\n<pre><code>archmind verify <span>--project<\/span> <span>.<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>Example: <\/p>\n<div>\n<pre><code>\u2718 TOPOLOGY REGRESSION Route: POST \/orders Lost: transaction_boundary <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>The goal is not to verify business logic.<\/p>\n<p>The goal is to verify architecture.<\/p>\n<hr>\n<h3> <a name=\"3-surface-architecture-findings\" href=\"#3-surface-architecture-findings\"> <\/a> 3. Surface architecture findings <\/h3>\n<div>\n<pre><code>archmind findings <span>--project<\/span> <span>.<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>Examples: <\/p>\n<div>\n<pre><code>missing_authorization Route is authenticated but no authorization layer was detected. <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>Or: <\/p>\n<div>\n<pre><code>transaction_escape Event dispatched from inside a transaction boundary. <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>These findings are intentionally conservative.<\/p>\n<p>The idea is to surface architectural risks for review rather than claim guaranteed vulnerabilities.<\/p>\n<hr>\n<h2> <a name=\"an-unexpected-side-effect-better-ai-context\" href=\"#an-unexpected-side-effect-better-ai-context\"> <\/a> An unexpected side effect: better AI context <\/h2>\n<p>Originally, ArchMind was not built as an AI tool.<\/p>\n<p>It started as a static analysis and architecture verification tool.<\/p>\n<p>But once an execution graph existed, it became useful for retrieval as well.<\/p>\n<p>Most AI coding tools work roughly like this: <\/p>\n<div>\n<pre><code>Question \u2193 Find similar files \u2193 Send files to LLM <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>ArchMind instead retrieves execution context: <\/p>\n<div>\n<pre><code>Question: Why does this payment endpoint sometimes double-charge customers? Relevant context: - transaction boundary - payment event dispatch - after-commit listener <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>In benchmark tests on real Laravel applications:<\/p>\n<div>\n<table>\n<thead>\n<tr>\n<th>Metric<\/th>\n<th>ArchMind<\/th>\n<th>File Dump<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Correct answers<\/td>\n<td>3\/3<\/td>\n<td>1\/3<\/td>\n<\/tr>\n<tr>\n<td>Average score<\/td>\n<td>76.7%<\/td>\n<td>61.7%<\/td>\n<\/tr>\n<tr>\n<td>Tokens per query<\/td>\n<td>~700<\/td>\n<td>~9000<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>The interesting result wasn&#8217;t just higher accuracy.<\/p>\n<p>It was that the execution graph compressed architecture knowledge into a much smaller context window.<\/p>\n<hr>\n<h2> <a name=\"how-it-works\" href=\"#how-it-works\"> <\/a> How it works <\/h2>\n<p>At a high level: <\/p>\n<div>\n<pre><code>PHP Source \u2193 Tree-sitter parsing \u2193 Laravel-aware analysis \u2193 Execution Graph \u2193 Topology Verification <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>No PHP runtime required.<\/p>\n<p>Current support includes:<\/p>\n<ul>\n<li>Laravel 10<\/li>\n<li>Laravel 11<\/li>\n<li>Laravel 12<\/li>\n<li>Middleware chains<\/li>\n<li>FormRequests<\/li>\n<li>Policies<\/li>\n<li>Transactions<\/li>\n<li>Events<\/li>\n<li>Route groups<\/li>\n<li>apiResource routes<\/li>\n<\/ul>\n<hr>\n<h2> <a name=\"what-archmind-does-not-do\" href=\"#what-archmind-does-not-do\"> <\/a> What ArchMind does not do <\/h2>\n<p>It&#8217;s important to be clear about limitations.<\/p>\n<p>ArchMind will not catch:<\/p>\n<ul>\n<li>Incorrect business logic<\/li>\n<li>Off-by-one errors<\/li>\n<li>Wrong comparison operators<\/li>\n<li>Runtime bugs caused by external services<\/li>\n<\/ul>\n<p>It focuses on structural and architectural changes.<\/p>\n<p>Think of it as:<\/p>\n<blockquote>\n<p>Snapshot testing for execution architecture.<\/p>\n<\/blockquote>\n<p>Not a replacement for tests.<\/p>\n<p>Not a replacement for static analysis.<\/p>\n<p>An additional layer that verifies architectural intent.<\/p>\n<hr>\n<h2> <a name=\"example-ci-setup\" href=\"#example-ci-setup\"> <\/a> Example CI setup <\/h2>\n<p>Save a baseline: <\/p>\n<div>\n<pre><code>archmind verify <span>--project<\/span> <span>.<\/span> <span>--update<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>Commit it: <\/p>\n<div>\n<pre><code>git add .archmind\/baselines git commit <span>-m<\/span> <span>\"chore: add topology baseline\"<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>Then run in CI: <\/p>\n<div>\n<pre><code><span>-<\/span> <span>run<\/span><span>:<\/span> <span>npm install -g @kidkender\/archmind<\/span> <span>-<\/span> <span>run<\/span><span>:<\/span> <span>archmind verify --project .<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>If a transaction boundary disappears, an auth middleware is removed, or a protected route loses part of its architecture, the build fails.<\/p>\n<hr>\n<h2> <a name=\"final-thoughts\" href=\"#final-thoughts\"> <\/a> Final thoughts <\/h2>\n<p>The most interesting realization from this project wasn&#8217;t about Laravel.<\/p>\n<p>It was this:<\/p>\n<p>Tests verify behavior.<\/p>\n<p>Architecture usually lives in people&#8217;s heads.<\/p>\n<p>When architecture becomes a graph, it becomes something we can version, compare, and verify.<\/p>\n<p>That&#8217;s the idea behind ArchMind.<\/p>\n<p>I&#8217;d love feedback from Laravel developers:<\/p>\n<ul>\n<li>Have architectural regressions caused incidents in your projects?<\/li>\n<li>How do you currently review execution flow changes?<\/li>\n<li>Would architecture-level verification be useful in your CI pipeline?<\/li>\n<\/ul>\n<p>GitHub: <a href=\"https:\/\/github.com\/Kidkender\/archMind\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/Kidkender\/archMind<\/a><\/p>\n<\/p><\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Fuente: <a href=\"https:\/\/dev.to\/kidkender\/tests-verify-behavior-archmind-verifies-architecture-lpi\">Art\u00edculo original<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The bigger the application becomes, the harder it is to understand this flow. Most tooling doesn&#8217;t help much. PHPStan verifies types. Tests verify behavior. Code review focuses on diffs. But none of them answer a simple question: Did the execution architecture of this route change? For example: POST \/orders Before: auth tenant middleware DB::transaction Order::create [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[41],"tags":[],"class_list":["post-2627","post","type-post","status-publish","format-standard","hentry","category-devto"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/posts\/2627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/comments?post=2627"}],"version-history":[{"count":0,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/posts\/2627\/revisions"}],"wp:attachment":[{"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/media?parent=2627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/categories?post=2627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/tags?post=2627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}