Run artifact

workspace/targets/CsvStat/blueprint/FEATURE-SumMean.md

FEATURE: Sum and Mean

FieldValue
Version20261025 V1
DescriptionCompute the exact sum and mean of integer and number columns.
Depends OnFEATURE-BooleanTextTypes.md
Providesprofile.SumMean
Consumesprofile.InferType

Purpose

Numeric columns report sum and mean. Exactness matters because the output is rounded once, at write time, from the exact value. This story computes the exact values; formatting belongs to the decimal formatting story.

Interface

// SumMean takes the column type and the trimmed non-null values of the column. ok is false when
// the type is not integer or number, or when there are no values.
func SumMean(typ string, values []string) (sum, mean *big.Rat, ok bool)

Behavior

ok is false.

at any step, so 0.1 plus 0.2 is exactly three tenths.

counted.

Required Tests

The project suite in internal/profile includes these tests by exact name:

Programmatic Acceptance

=== AC summean-integer-sum ===
Intent: Integer sums are exact, including negative values.
Requires: executable=go; scope=test

from drydock_go import run_test

result = run_test("./internal/profile", "TestSumIntegerExact") print(result.stdout) print(result.stderr) assert result.passed, (result.status, result.stdout, result.stderr) === END AC summean-integer-sum ===

=== AC summean-number-no-drift ===
Intent: Decimal sums carry no floating-point drift.
Requires: executable=go; scope=test

from drydock_go import run_test

result = run_test("./internal/profile", "TestSumNumberNoFloatDrift") print(result.stdout) print(result.stderr) assert result.passed, (result.status, result.stdout, result.stderr) === END AC summean-number-no-drift ===

=== AC summean-mean-exact ===
Intent: The mean is the exact total divided by the non-null count.
Requires: executable=go; scope=test

from drydock_go import run_test

result = run_test("./internal/profile", "TestMeanExactRational") print(result.stdout) print(result.stderr) assert result.passed, (result.status, result.stdout, result.stderr) === END AC summean-mean-exact ===

=== AC summean-ignores-nulls ===
Intent: The mean divisor is the non-null count.
Requires: executable=go; scope=test

from drydock_go import run_test

result = run_test("./internal/profile", "TestSumMeanIgnoresNulls") print(result.stdout) print(result.stderr) assert result.passed, (result.status, result.stdout, result.stderr) === END AC summean-ignores-nulls ===

=== AC summean-non-numeric ===
Intent: Non-numeric column types have no sum or mean.
Requires: executable=go; scope=test

from drydock_go import run_test

result = run_test("./internal/profile", "TestSumMeanNonNumeric") print(result.stdout) print(result.stderr) assert result.passed, (result.status, result.stdout, result.stderr) === END AC summean-non-numeric ===

User Acceptance

Guardrails