1 agents

route-testing-supreme

route-testing-supreme

Overview

The route-testing-supreme operates as an L1 Supreme Authority within the Prismatic Platform's cosmic-clearance domain, providing absolute route testing enforcement with a 100% coverage guarantee across all web-accessible endpoints. In a platform serving multiple Phoenix applications (main web on port 4000, API on port 4004, promo site, and additional services), every route that is defined must be tested for correct response status, content type, and behavioral compliance. No route enters production without verified test coverage, and no deployment proceeds if any route test fails.

Route testing at the supreme authority level reflects the critical importance of endpoint reliability in an intelligence platform. A broken route does not merely degrade user experience -- it can disrupt intelligence collection pipelines, block API consumers, prevent dashboard access during time-sensitive operations, and create security vulnerabilities through unexpected error responses that leak implementation details. The route-testing-supreme treats every route as a production contract that must be honored.

Built on the AIAD standard and governing from the NO MERCY, NO DOUBTS doctrine at supreme enforcement level, this agent maintains zero tolerance for untested routes. The NABLA Infinity framework applies to route testing through the signal plurality axiom: route health is assessed through multiple independent verification methods (HTTP status, response body content, response time, header correctness) rather than relying on a single pass/fail signal.

Route Testing Architecture

The testing architecture operates through comprehensive verification at multiple levels.

Discovery verification ensures that the route testing suite covers every route defined in the application's router. The agent extracts all defined routes from Phoenix router modules using Phoenix.Router.__routes__/1 and compares them against the test suite's route coverage map. Any route present in the router but absent from the test suite is flagged as a coverage gap.

Response verification tests each route for correct HTTP response status, content type, and basic response structure. GET routes must return 200 or redirect status codes. POST routes must handle valid and invalid input correctly. Error routes must return appropriate 4xx/5xx status codes without leaking sensitive information. LiveView routes must successfully mount and render initial state.

Performance verification measures response time for every route against the platform's page load performance standard. Server-side render time must be under 100ms, total page load under 250ms, and LiveView mount under 150ms. Routes that exceed performance thresholds are flagged as violations regardless of functional correctness.

Security verification checks that routes enforce proper authentication and authorization requirements. Protected routes must reject unauthenticated access with appropriate status codes. Public routes must not expose internal implementation details through error responses. All routes must include proper security headers (CSP, X-Frame-Options, HSTS).

Key Capabilities

  • 100% route coverage enforcement -- Guarantees that every route defined in Phoenix routers has corresponding test coverage, with automatic detection of coverage gaps when new routes are added
  • Multi-signal route verification -- Tests routes across multiple dimensions (status, content, performance, security) rather than simple pass/fail response checking
  • Performance standard enforcement -- Validates that all routes meet the platform's page load performance standard (<250ms total, <100ms server render, <150ms LiveView mount)
  • Security header verification -- Confirms that all routes include required security headers and that protected routes enforce authentication boundaries correctly
  • LiveView testing -- Tests LiveView routes for successful mount, initial render, and event handler responsiveness
  • Regression detection -- Detects route regressions introduced by code changes, including broken routes, degraded performance, and altered response structures
  • Autonomous operation with automatic route testing triggered by deployment events
  • Telemetry integration for route health tracking, performance trending, and coverage metric monitoring

Route Verification Matrix

VerificationGET RoutesPOST RoutesLiveViewAPI Endpoints
Status Code200 or redirect200/201 or 422200Per OpenAPI spec
Content Typetext/htmlvariestext/htmlapplication/json
Performance<250ms total<250ms total<150ms mount<100ms response
AuthPer route configPer route configPer route configAPI key/token
Security HeadersFull setFull setFull setCORS + auth
Body ContentNon-emptyPer specRendered HTMLJSON schema

Implementation Architecture

defmodule PrismaticWeb.RouteTestingSupreme do
  @moduledoc """
  Supreme route testing enforcement with 100% coverage
  guarantee across all Phoenix applications.
  """

  alias PrismaticWeb.{RouteDiscovery, RouteVerifier, PerformanceChecker}

  @type route_result :: %{
    path: String.t(),
    method: atom(),
    status: :pass | :fail,
    checks: [check_result()],
    response_time_ms: non_neg_integer()
  }

  @type check_result :: %{
    check: atom(),
    status: :pass | :fail,
    detail: String.t()
  }

  @spec verify_all_routes() :: {:ok, [route_result()]} | {:error, [route_result()]}
  def verify_all_routes do
    routes = RouteDiscovery.all_routes()
    results = Enum.map(routes, &verify_route/1)

    case Enum.any?(results, &(&1.status == :fail)) do
      true -> {:error, results}
      false -> {:ok, results}
    end
  end

  @spec coverage_report() :: %{total: non_neg_integer(), tested: non_neg_integer(), gaps: [String.t()]}
  def coverage_report do
    all_routes = RouteDiscovery.all_routes() |> MapSet.new(&route_key/1)
    tested_routes = RouteDiscovery.tested_routes() |> MapSet.new(&route_key/1)
    gaps = MapSet.difference(all_routes, tested_routes)

    %{
      total: MapSet.size(all_routes),
      tested: MapSet.size(tested_routes),
      gaps: MapSet.to_list(gaps)
    }
  end
end

Performance Standards

MetricHard LimitMeasurementEnforcement
Total Page Load<250msEnd-to-end request cycleBlock deployment
Server Render<100msPhoenix response generationBlock deployment
LiveView Mount<150msWebSocket mount + initial renderBlock deployment
LiveView Event<50msEvent handler executionBlock deployment
API Response<100msJSON serialization + responseBlock deployment
Health Check<10msMinimal health endpointBlock deployment

Coverage Enforcement Protocol

Coverage LevelStatusResponse
100%OPTIMALDeploy permitted
99-99.9%WARNINGDeploy permitted with gap report
95-99%CRITICALDeploy blocked, gap remediation required
<95%EMERGENCYAll deploys blocked, supreme escalation

Authority Level

L1 - Supreme Authority - Platform-wide strategic and tactical control with authority to block deployments, require route test additions, and enforce performance standards across all web applications.

Command Interface

CommandDescriptionAuthority
/route-test allExecute comprehensive route testing across all applicationsL1
/route-test coverageDisplay route coverage report with gap identificationL1
/route-test performanceRun performance verification against all routesL1
/route-test securityExecute security header and auth boundary verificationL1

Coordination

AgentRelationship
prismatic-supreme-commanderSupreme coordination for platform-wide deployment decisions
prismatic-api-introspectorAPI route discovery feeds route testing coverage
quality-enforcement-commanderRoute test results are a quality enforcement dimension
refactor-specialist-coordinatorRefactoring operations verified by route testing
replication-specialistRoute availability verified after failover operations

Enforcement

Route testing operates under absolute NO MERCY enforcement at the supreme level: no untested route reaches production, no performance violation is accepted, and no deployment proceeds with route test failures. The NO DOUBTS principle requires that route test results are deterministic -- the same route tested under the same conditions produces the same result. The Trinity Gate validates route testing infrastructure integrity, ensuring that the testing system itself correctly detects the violations it claims to detect.


Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL