Assert a property rather than the loader against itself #1390

Merged
coilyco-ops merged 2 commits from aos/claude/ee98-loader into main 2026-08-29 08:54:49 +00:00
Owner

Closes #1180.

The tautology

for role, want := range document.DefaultAgents {
    got, err := standaloneDefaultAgentForRole(role)
    if got != want { t.Fatalf(...) }
}

want comes from loadConfiguredHarnessLaunchProfiles(), and so does got, through the same map lookup. The loop is x == x and could only fail if two consecutive loads disagreed.

Why the obvious repair is closed

The test's own comment names the constraint:

Resolution is the behavior under test, not the agent a role points at: the profiles own that tunable, so naming values here would restate config.

That is the house rule against tests encoding configuration, and it rules out hardcoding expected agents. So the fix is not "assert the real values", it is "assert something the loader can violate".

Every configured role must resolve without error and to a non-empty agent. Value resolution already has honest cover in the two sibling tests, which swap in a synthetic profile document and assert against fixture values (goose, opencode) rather than against real config.

Proved it can fail

The point of this milestone is checks that pass without binding, so an assertion added here has to earn it. Mutating the resolver's success return to an empty string:

--- FAIL: TestStandaloneDefaultAgentForRole
    standaloneDefaultAgentForRole(frontend) resolved to an empty agent

Reverted, green again. The old assertion survives that same mutation, which is the defect.

Scope

One test file, no production change. The len(document.DefaultAgents) == 0 guard and the three negative cases ("", bad/role, story-architect) are untouched and were always real.

Closes `#1180`. ## The tautology ```go for role, want := range document.DefaultAgents { got, err := standaloneDefaultAgentForRole(role) if got != want { t.Fatalf(...) } } ``` `want` comes from `loadConfiguredHarnessLaunchProfiles()`, and so does `got`, through the same map lookup. The loop is `x == x` and could only fail if two consecutive loads disagreed. ## Why the obvious repair is closed The test's own comment names the constraint: > Resolution is the behavior under test, not the agent a role points at: the profiles own that tunable, so naming values here would restate config. That is the house rule against tests encoding configuration, and it rules out hardcoding expected agents. So the fix is not "assert the real values", it is "assert something the loader can violate". Every configured role must resolve without error **and to a non-empty agent**. Value resolution already has honest cover in the two sibling tests, which swap in a synthetic profile document and assert against fixture values (`goose`, `opencode`) rather than against real config. ## Proved it can fail The point of this milestone is checks that pass without binding, so an assertion added here has to earn it. Mutating the resolver's success return to an empty string: ``` --- FAIL: TestStandaloneDefaultAgentForRole standaloneDefaultAgentForRole(frontend) resolved to an empty agent ``` Reverted, green again. The old assertion survives that same mutation, which is the defect. ## Scope One test file, no production change. The `len(document.DefaultAgents) == 0` guard and the three negative cases (`""`, `bad/role`, `story-architect`) are untouched and were always real.
test(aos-cli): assert a property rather than the loader against itself
All checks were successful
ci / aos-cli-tests (pull_request) Successful in 34s
ci / gate (pull_request) Successful in 1m4s
f30fc0671b
TestStandaloneDefaultAgentForRole's positive path compared
standaloneDefaultAgentForRole(role) with document.DefaultAgents[role]. Both
sides are the same map lookup through the same loader, so the loop reduced to
`x == x` and could only fail if two consecutive loads disagreed.

The test's own comment names the constraint that produced it: resolution is the
behavior under test, and naming agent values here would restate config. That
rules out the obvious repair.

It resolves by asserting a property the loader can actually violate. Every
configured role must resolve without error and to a non-empty agent. Value
resolution already has honest cover in the two sibling tests, which swap in a
synthetic profile document and assert against fixture values rather than real
config.

Proved the new assertion can fail rather than assuming it. Mutating the
resolver's success return to an empty string:

    --- FAIL: TestStandaloneDefaultAgentForRole
        standaloneDefaultAgentForRole(frontend) resolved to an empty agent

Reverted, green again. A test in this milestone earns its place by failing when
the thing it guards breaks, so it was worth spending the mutation to see it.

Refs coilyco-flight-deck/agentic-os#1180

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Kai Siren <coilysiren@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Agent-Role: platform
merge: bring main into the branch
All checks were successful
ci / aos-cli-tests (pull_request) Successful in 29s
ci / gate (pull_request) Successful in 55s
dev-base-pr / build (pull_request) Successful in 45s
c61594ec5a
coilyco-ops deleted branch aos/claude/ee98-loader 2026-08-29 08:54:50 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coilyco-flight-deck/agentic-os!1390
No description provided.