Documentation
¶
Overview ¶
Package coderunner executes model-authored analysis inside the sandbox (§12.1).
For the analyses SQL cannot express — regression, seasonality, anything needing row-level access. The boundary moves rather than opening: inside the container there is no model to protect the data from, so the script may read every row, and only a declared, numeric output envelope crosses back.
What constrains this is the container and the output contract, not the aggregation gate. A name the plan did not declare does not cross, and an undeclared key is counted rather than repeated — a key is text the script chose, and repeating it would make the key itself a channel.
The verdict on a statistical result is derived here, never taken from the script: a model reporting its own significance is a model grading its own work.
Index ¶
Constants ¶
const DefaultImage = "python:3.13-slim"
DefaultImage is the interpreter.
Pinned to a tag rather than a digest, because a tag is what a user will have pulled and a digest they do not have is an error message instead of a feature. `doctor` reports whether it is present.
const MountPath = "/data/connector.sqlite"
MountPath is where the connector's database appears inside the container.
Variables ¶
ErrUnavailable means no usable runtime, which is a normal state and not a failure: §12.2 says the sandbox is not the control for the SQL path, so local analysis works without this entirely.
Functions ¶
func DefaultCommand ¶
func DefaultCommand() []string
DefaultCommand reads the script from stdin.
A function, not a package-level slice: a mutable global holding the command that launches model-authored code is the wrong shape, and the repo's own precedent (academic.Kinds) returns a fresh copy.
Types ¶
type Contract ¶
type Contract struct {
// Metrics are named scalars.
Metrics []string `json:"metrics,omitempty"`
// Tests are named statistical results.
Tests []string `json:"tests,omitempty"`
}
Contract is what a plan declared it would emit, established before the script runs. Nothing outside it comes back.
type Finding ¶
type Finding struct {
Name string `json:"name"`
N int64 `json:"n"`
Statistic float64 `json:"statistic"`
P float64 `json:"p"`
EffectSize float64 `json:"effect_size"`
Verdict stats.Verdict `json:"verdict"`
}
Finding is one statistical result the script computed.
The script supplies the numbers; the VERDICT is derived here, using the same thresholds as the SQL path. A script reporting its own verdict would be a model deciding whether its own result was significant.
func (Finding) Summary ¶
Summary is the sentence a claim has to quote.
Built by stats.Sentence, so the two evidence paths cannot word the same verdict differently — they did, in the underpowered clause and in whether an effect size appeared at all, under a comment claiming a reader could not tell them apart.
type Output ¶
type Output struct {
Metrics map[string]float64 `json:"metrics,omitempty"`
Findings []Finding `json:"findings,omitempty"`
// Dropped names refused outputs the plan DID declare — mole's own strings,
// safe to repeat, and the case a model needs to see to fix its script.
Dropped []string `json:"dropped,omitempty"`
// Undeclared counts refused outputs the plan did not declare. A count and
// not a list: an undeclared key is text the script chose, and repeating it
// would make the key a channel out of the sandbox.
Undeclared int `json:"undeclared,omitempty"`
Notes []string `json:"notes,omitempty"`
}
Output is what came back and is allowed to cross.
type Request ¶
type Request struct {
// DBPath is the connector database, mounted read-only.
DBPath string
// Query is the statement the script is told to run. Already through
// sqlguard: the script could run anything against the mounted database, so
// this is guidance rather than a control — the container is the control.
Query string
Script string
Contract Contract
}
Request is one analysis.
type Runner ¶
Runner executes an analysis. Separate from the parsing so a caller can be tested without a container.