mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 02:36:01 -10:00
internal/ was 141 packages side by side, so nothing but a reader's memory
said which were foundations and which assembled the rest. Each now sits in a
layer directory, and the directory is the declaration:
base L0 foundation with no domain in it
contract L1 types and interfaces the layers above agree on
model, tools, safety, ext, state, platform
L2 subsystems, peers of one another
runtime L3 the turn engine
session L4 the controller
assembly L5 the composition root
frontend L6 cli, serve, acp and the host adapters
Only paths change: package names, code and behaviour do not. Imports,
repolint and coverage baselines, sensitive paths, CI package lists and docs
follow the new paths; release notes keep the paths they were written with,
and sample paths inside tests and fixtures keep theirs.
repolint gains layer-order: a package may import its own layer and those
below it, read from where it lives. The 47 imports that point upward today
are recorded as that rule's opening debt (-allow-widen, a new rule's first
baseline) and can only go down. Most of it is config, which still reaches
into eight subsystems and is the next thing to take apart; the rest is
event, history and a few tools reaching into runtime for types that belong
in contract.
46 lines
2.0 KiB
Go
46 lines
2.0 KiB
Go
package cli
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"reasonix/internal/contract/event"
|
|
)
|
|
|
|
// The compliance denominator is the point of this test: a child the provider
|
|
// killed never reached the point of closing, so it must leave the denominator
|
|
// rather than count as a refusal. Routing is asserted too — the audit is sent
|
|
// through a wrapper, not called on the sink directly, because a method that
|
|
// exists and is never reached is the bug this channel already had once.
|
|
func TestMetricsSinkCountsSubagentHandoffCompliance(t *testing.T) {
|
|
s := &metricsSink{inner: event.Discard}
|
|
chain := event.Sync(s)
|
|
|
|
event.RecordSubagentHandoff(chain, event.SubagentHandoffAudit{
|
|
Expected: true, Exit: "completed", ReadOnly: true,
|
|
})
|
|
event.RecordSubagentHandoff(chain, event.SubagentHandoffAudit{
|
|
Expected: true, Exit: "cancelled",
|
|
})
|
|
event.RecordSubagentHandoff(chain, event.SubagentHandoffAudit{
|
|
Expected: true, Exit: "completed",
|
|
Attempts: 1, Accepted: 1, ReportRound: 2, FinalRound: 2, LoweredClaims: 3,
|
|
})
|
|
|
|
m := s.m
|
|
if m.SubagentHandoffs != 3 || m.SubagentHandoffExpected != 3 || m.SubagentHandoffJudged != 2 {
|
|
t.Fatalf("totals = %d/%d/%d, want 3 observed, 3 expected, 2 judged",
|
|
m.SubagentHandoffs, m.SubagentHandoffExpected, m.SubagentHandoffJudged)
|
|
}
|
|
if m.SubagentHandoffNotTried != 1 || m.SubagentHandoffAttempted != 1 || m.SubagentHandoffAccepted != 1 {
|
|
t.Fatalf("never-attempted/attempted/accepted = %d/%d/%d, want 1/1/1 — the cancelled run must not be either",
|
|
m.SubagentHandoffNotTried, m.SubagentHandoffAttempted, m.SubagentHandoffAccepted)
|
|
}
|
|
if m.SubagentHandoffClosedWith != 1 || m.SubagentHandoffLowered != 3 || m.SubagentHandoffReadOnly != 1 {
|
|
t.Fatalf("closed/lowered/read-only = %d/%d/%d, want 1/3/1",
|
|
m.SubagentHandoffClosedWith, m.SubagentHandoffLowered, m.SubagentHandoffReadOnly)
|
|
}
|
|
if m.SubagentHandoffExits["completed"] != 2 || m.SubagentHandoffExits["cancelled"] != 1 {
|
|
t.Fatalf("exits = %v, want 2 completed and 1 cancelled", m.SubagentHandoffExits)
|
|
}
|
|
}
|