Repository navigation
Releases
v0.1.0
The first real evaluator: P1 slice 1, the pricing set. Verified against
fancy-conformance 0.39.0's Google Sheets goldens: all 482 rows in scope pass,
and 205 rows for slice-2 functions are skipped, each with a stated reason.
Coming from 0.0.1: StubEngine is unchanged; construct Engine instead for
real results (new Engine() works with defaults). A function outside the slice
reports FORMULA_UNKNOWN_FUNCTION at check; it is never silently wrong.
Added
Formula::parse($source, $maxBytes = 8192, $maxDepth = 64)with
->normalized(),->ast(),->references()and->spans(). The full
grammar of SPEC.md section 3: references with and without sheets, quoted
sheets, open ranges (B:B,1:1), array literals (references allowed
inside, H-21), empty arguments (INDEX(r,,1)), postfix%once, and LET,
LAMBDA and an immediate LAMBDA invocation as syntax nodes. Malformed input
throwsFormulaErrorwithFORMULA_SYNTAX,FORMULA_TOO_LONG(UTF-8 bytes,
before lexing) orFORMULA_TOO_DEEP(fancy-expr's depth definition, checked
on the way down and up) and a byte offset.- Confirmed by the partial first capture and pinned: unary minus binds before
^(=-2^0.5is#NUM!), and=10%%isFORMULA_SYNTAX. #NULL!and#ERROR!are error literals (the capture decided H-16).FancyFormula\Engine: the first real evaluator (SPEC.md section 15 lists
slice 1).check()returns aCheckReport,evaluate()anEvaluation;
both havetoArray(), andjson_encode()of either is the schema-valid JSON.
Engine::ENGINEisfancy-formula 0.1.0.- Typed, value-only inputs bound to names or cells; constraint validation of
the supplied values BEFORE any formula runs, in the canonical order with
the caps; topological evaluation with lazy IF, IFS, SWITCH, IFERROR, IFNA,
LET and CHOOSE; the step, range, text, cell and wall-clock budgets with
typed aborts; the float policy (one comparator, 15-digit decimal rounding,
half away from zero); date serials; traces atnone,lookupsandfull
with the lookupbracketandprobes; the fingerprint;
Engine::functions(). - check() diagnostics: unknown function (naming a later slice when it is
one) or name, circular references with the cycle path, arity, type,
refused, needs clock, needs seed, input invalid, dynamic reference, and
the declared shape of every constraint.
- Typed, value-only inputs bound to names or cells; constraint validation of
- Host construction, the contract Prism codes against (SPEC.md 1.1):
new Engine(new Options(limits:, clock:, random:, providers:, functions:)),
every argument optional. NewClockinterface withFixedClock,Seed,
FunctionPolicy(all(),only(),->deny()),ExternalProviderwith
ProviderContext,CheckReport,Evaluation. Provider calls are recorded in
the trace'sexternallist and folded into the fingerprint. StubEngineis kept, unchanged, for hosts built against 0.0.1.- The Google Sheets goldens run in CI. Dev dependency
particle-academy/fancy-conformancepinned EXACTLY at0.39.0(first party),
asserted by a test as in fancy-expr. All 13formula/*suites run: 482 rows
in slice 1 pass; 205 are skipped, each with a reason naming slice 2, decided
from the formula text and never from the engine's output. Four rows whose
golden is lossier than its declared tolerance (two 10-digit values, two tiny
values exported as 0) are still asserted, at the precision the export kept.
Changed
- SPEC.md section 13 records the capture's verdict on every hypothesis:
CONFIRMED, REFUTED, or OPEN (only where its rows need a slice-2 function).
Refuted, and the engine now follows Sheets:^is right-associative
(=2^3^2is 512); there is no near-zero snap in+and-; INDEX and
CHOOSE out of range are#NUM!(MOIC's case F is#NUM!, not#REF!); an
omitted IFERROR fallback is EMPTY; open ranges span the 1000 x 26 grid;
numbers from 1E+15 convert to text in full decimal, truncated past the 15th
digit; approximate lookups order raw doubles. SPEC.md section 2 names the two
deliberate divergences: a Sheets#ERROR!parse error is our
FORMULA_SYNTAX, a Sheets#N/Awrong argument count ourFORMULA_ARITY.
Fixed
- The trace schema's VLOOKUP and SUMIF examples had a
spanending one byte
past the end of their own formula ([1, 37]on a 36-byte formula). They are
now[1, 36]and[1, 29], and a test holds every example's spans inside
its formula. Examples only; no shape changed.
v0.0.1
A PREVIEW, NOT AN ENGINE. It computes nothing. Published so a tool layer
(Prism's doMath) can depend on the frozen contract from Packagist while the
real evaluator is built. StubEngine returns schema-valid output in which every
result is #N/A with a "stub" detail and the engine string is
fancy-formula 0.0.0-stub. Never price, total or report anything with this
version. The first real evaluator is 0.1.0.
This is phase P0: the contract and the oracle, with no evaluator.
Fixed
- The capture workbook is rebuilt with holy-sheet 2.11.3, and the dev
requirement is now^2.11.3. The first build wrote each row's cells in
column-letter order (A, AA, ..., B), and Google Sheets silently dropped 184
of its input cells on import, so the first capture computed over blanks and
was refused. Same cases and ids; only the workbook bytes and its digest in
request.jsonchanged.
Added
SPEC.md, spec version 1: grammar, value model, coercion, floating-point
policy, dates, input types and constraints, results, stable codes, trace,
security and limits. Every Google Sheets behaviour not yet verified is marked
as a hypothesis (H-01 to H-35) and names the capture rows that decide it.schema/request.schema.json,check-report.schema.json,
evaluation.schema.jsonandtrace.schema.json, each with examples that the
test suite validates. These are the contract Prism's doMath builds against.
The request schema refuses a clock, seed or provider, and any limit above its
hard ceiling.FancyFormula\FormulaErrorwith the stable codes, held by a test to the same
sets as the schemas and SPEC.md.FancyFormula\StubEngine: schema-validcheck()/evaluate()output that
computes nothing (every result is#N/Awith a "stub" detail, engine
fancy-formula 0.0.0-stub), plusStubEngine::example()for the schemas'
refusal and abort shapes.- The capture workbook v1 (
capture/v1/capture-v1.xlsx, 689 rows, every
formula written with no cached value) and itsrequest.json, built by
scripts/build-capture-workbook.phpwith holy-sheet. Not yet captured. - Dev dependency
particle-academy/holy-sheet(first party) for the capture
generator. No runtime dependencies. - Three ADDITIVE request-schema rules from MOIC's real pricing model
(2026-10-28). Every document the schemas accepted before still validates, and
no stable code was added. A host needs to do nothing unless it wants the
new rules.constraints.requiredWhen: {input, oneOf}on every input type: required
only when another input's supplied value is one ofoneOf. An absent
controller never triggers it. Noequalssugar; the schema refuses it.
Violations carryrule: "requiredWhen"andwhen: {input, value}.constraints.columnConstraintson range and table inputs: per-column
required,integer,min,max,oneOfand
oneOfColumn: {input?, column, where?: {column, oneOf}}, keyed by a
1-based index or a header text. Types stay incolumns, ordering and
uniqueness inkey. Violations carryrule: "column.*",row,column
andheader.- Array outputs:
outputs.<binding> = {type: "array", columns, maxRows?, currency?}.
The result is a{t: "array"}value with nodisplay. P1 refuses an array
output atcheck()withFORMULA_TYPE; P2 produces it. A scalar output
that receives a multi-cell array gets a#REF!value (SPEC.md 9.3). StubEnginereturns one row of stub#N/Acells, one per declared
column, for an array output.
- Violation order and caps for
FORMULA_INPUT_CONSTRAINTrefusals (SPEC.md
8.2.3, agreed with MOIC and Prism). One total order on values: input binding
by UTF-8 bytes (not declaration order, which JSON does not carry), then row,
column, a fixed rule rank, header and canonical JSON. At most 100 violations
per input and 500 per request. New refusal memberstruncatedViolations
(input -> how many of its violations were not reported) and
truncatedByRequestCap(how many the 500 cap cut);violationsnow has
maxItems: 500.FancyFormula\Violations::refusal()is the reference
implementation. A host needs to do nothing unless it relied on the order
ofviolations, which was unspecified until now. The evaluation schema's
own example was reordered to the canonical order.