mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 10:45:59 -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.
87 lines
2.7 KiB
Go
87 lines
2.7 KiB
Go
package main
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"strings"
|
|
|
|
"reasonix/internal/contract/ablation"
|
|
)
|
|
|
|
// experimentAxes is the validated set of fixed axes one suite invocation runs
|
|
// on. They are resolved together so a second bad flag is reported alongside
|
|
// the first instead of being masked by an early exit.
|
|
type experimentAxes struct {
|
|
profile, cache, anchor string
|
|
arm ablation.Set
|
|
}
|
|
|
|
func resolveExperimentAxes(profile, ablate, cache, anchor, foldIndex string) (experimentAxes, error) {
|
|
p, perr := normalizeBenchmarkProfile(profile)
|
|
a, aerr := ablation.ParseArm(ablate, foldIndex)
|
|
c, cerr := normalizeCacheArm(cache)
|
|
an, anerr := normalizeAnchorArm(anchor)
|
|
return experimentAxes{profile: p, cache: c, anchor: an, arm: a}, errors.Join(perr, aerr, cerr, anerr)
|
|
}
|
|
|
|
const (
|
|
benchmarkProfileBaseline = "baseline"
|
|
benchmarkProfileEconomy = "economy"
|
|
benchmarkProfileBalanced = "balanced"
|
|
benchmarkProfileDelivery = "delivery"
|
|
)
|
|
|
|
// normalizeBenchmarkProfile validates the tool-surface arm. baseline stays
|
|
// distinct from balanced: it passes no --profile flag at all, preserving the
|
|
// byte-identical control command line older comparisons were recorded with.
|
|
func normalizeBenchmarkProfile(profile string) (string, error) {
|
|
switch strings.ToLower(strings.TrimSpace(profile)) {
|
|
case "", benchmarkProfileBaseline:
|
|
return benchmarkProfileBaseline, nil
|
|
case benchmarkProfileEconomy:
|
|
return benchmarkProfileEconomy, nil
|
|
case benchmarkProfileBalanced:
|
|
return benchmarkProfileBalanced, nil
|
|
case benchmarkProfileDelivery:
|
|
return benchmarkProfileDelivery, nil
|
|
default:
|
|
return "", fmt.Errorf("unknown benchmark profile %q (want baseline, economy, balanced, or delivery)", profile)
|
|
}
|
|
}
|
|
|
|
func appendBenchmarkProfileArgs(args []string, profile string) []string {
|
|
if profile == benchmarkProfileBaseline {
|
|
return args
|
|
}
|
|
return append(args, "--profile", profile)
|
|
}
|
|
|
|
const (
|
|
benchmarkCacheCold = "cold"
|
|
benchmarkCacheWarm = "warm"
|
|
)
|
|
|
|
func normalizeCacheArm(arm string) (string, error) {
|
|
switch strings.ToLower(strings.TrimSpace(arm)) {
|
|
case "", benchmarkCacheCold:
|
|
return benchmarkCacheCold, nil
|
|
case benchmarkCacheWarm:
|
|
return benchmarkCacheWarm, nil
|
|
default:
|
|
return "", fmt.Errorf("unknown cache arm %q (want cold or warm)", arm)
|
|
}
|
|
}
|
|
|
|
// appendArmArgs passes both axes of an arm to the child binary. The control arm
|
|
// adds nothing, so its command line stays byte-identical to the one older
|
|
// comparisons were recorded with.
|
|
func appendArmArgs(args []string, arm ablation.Set) []string {
|
|
if spec := arm.String(); spec != "none" {
|
|
args = append(args, "--ablate", spec)
|
|
}
|
|
if scale := arm.FoldIndex(); scale != ablation.FoldIndexDefault {
|
|
args = append(args, "--fold-index", string(scale))
|
|
}
|
|
return args
|
|
}
|