Forma Sheet — Architecture (v0.1)
Status: STABLE
Authority: DURABLE DOWNSTREAM PRODUCT ARCHITECTURE OWNER
Promoted from: CAMPAIGN-FORMA-SHEET-v0.1 Phase A candidate
(docs/forma-sheet-campaign-v0.1/campaign/ARCHITECTURE-CANDIDATE.md
@ commit df25fc2e66f382679478110724c17dcaa89e2fd9, digest
3324a425b3e2d8a4d96b20c3ccd40f5e1ba0ca2ed042ec4f353d30825da412f8)
approved by H-GATE-01 with binding owner amendments OA-01..OA-06
(recorded verbatim in
docs/forma-sheet-campaign-v0.1/campaign/OWNER-AMENDMENTS-OA01-06.md).
This owner carries the effective approved architecture: approved candidate
- amendments, with the amendment-mandated corrections incorporated inline
(OA-01 justification; OA-04 vocabulary). The candidate text itself is
preserved unmodified as review evidence.
Implementation:
crates/fsheet-*+ thefsheetCLI (this repository). Errata (2026-10-02): §8 surface component corrected — the served grid is Tabulator 6.5.3 at/grid(jspreadsheet CE remains only as the legacy/classicpage); §12fsheet-interopdescription updated for the real XLSX/ODS importers (FSHEET-RM-01). Bounded corrections; no architecture change.
1. Identity and product thesis
Forma Sheet is a standalone spreadsheet product whose user-facing interaction remains spatial and familiar while the underlying document carries explicit, governed semantics through FormaSL.
HUMAN SPREADSHEET INTERACTION
+ MACHINE/LLM DIRECT AUTHORING
+ FORMASL SEMANTIC SUBSTRATE
+ SEMANTIC UI GOVERNED INTERACTION
= FORMA SHEET
Constitutive constraints (FS-D01..D52 remain frozen inputs; deviations are R3):
FSheet semantic substrate = existing FormaSL typed role-incidence metagraph
.fsl = semantic/source authority; .fsp = realization
.fsheet != new semantic authority category
Semantic UI = projection/interaction/authoring boundary
Position != SemanticIdentity; DocumentIdentity != SemanticIdentity
Computation != Assertion; Hypothetical != Baseline
LocalSnapshot != RemoteCurrentState; SaveFile != SourceIncorporation
2. Authority and trust boundaries
external Forma applications
▲ explicit effectuation (guarded; OA-02 scope)
│ projections/computations
Semantic UI (core/protocol/runtime/native)
│ SubjectRef routes; admission; authoring classes
.fsl source layer (verbatim in .fsheet or external; exact revisions)
│ formasl::check/inspect/run
FormaSL kernel (typed role-incidence metagraph)
.fsheet bytes: document authority for spreadsheet-domain semantics ONLY;
save = serialization; open = parse (side-effect free); refresh = explicit.
Nothing in the FSheet surface mints standing. Presence in the document or a cell never manufactures Claim/Truth/Observation/Assumption (FS-D04, FS-D08). The renderer/editor/CLI are presentation and transport (FS-D25).
3. Document architecture (.fsheet, layers L1–L8)
L1 header format version, document identity, workbook name
L2 source verbatim embedded .fsl modules + external exact references
L3 spatial sheets, cell occurrences (stable identities), tables, names
L4 computation authored formula definitions (text; engine parses)
L5 connectivity connections (exact source+revision), semantic anchors
(locus↔SubjectRef bindings), basis-stamped snapshot records
L6 scenario overlays (ordered identity-addressed delta lists)
L7 documentation comments (locus-anchored; Comment != Claim)
L8 presentation formatting entries, filter views, declarative charts
Canonical properties: textual UTF-8, deterministic formatting (identity-
ordered, LF, fixed section order), parse(format(x)) == x, byte-stable
round-trip, explicit versioning with fail-closed newer versions and explicit
migrations, opaque preservation + typed rejection for unknown constructs,
no secrets in canonical content. Derived/cache material has no
representation in the canonical document (D-DOC-1): caches live in the
engine only.
4. Spatial architecture
Sheets are ordered planes of cell occurrences. Addr is a selector;
CellId is the stable document identity of an occurrence; neither converts
into the other, and neither is a semantic referent.
- insert/delete rows/columns: shift occupancy with identities preserved;
same-sheet relative reference components and cross-sheet references into
the operated sheet shift; absolute markers never move; deletion retires
identities (OA-05) and breaks references into the deleted span as typed
#REF!(never silent address reuse); partially overlapped ranges clamp conventionally. - identity minting (RM-03): every creation path mints through the document
model (
Workbook::mint_cell_identities/mint_filter_identity) — the first freec-N/f-Ntoken, never coordinate- or operation-derived, batch-disjoint and unique within the document. Saving validates the model first; an invalid state refuses typed and the canonical file is untouched. - move: identity preserved; same-sheet pointing references follow with their
authored
$markers. Moving into an occupied destination refuses typed (no replacement operation exists in v0.1; silent overwrite would be an ACCIDENTALLY-LOST continuity defect). - copy: fresh identity minted; relative components rebase by the delta;
absolute stay; out-of-plane becomes
#REF!; semantic referents are never cloned. Copying FROM an anchored source reads the projection into new unanchored local content. - fill: per-target rebasing under document-unique minted identities.
- sort: stable whole-row reordering with identities; empty keys last in both directions; class order Error < Bool < Number < Text; pointing references are not rewritten (sorting reorders material, not authored intent).
- filter: presentation-layer views whose projection is computed by the
core predicate (
FilterOp::matches) and served as the hidden-row set; the UI renders that result (single filter semantics across core, API and DOM — RM04-D).remove-filterwithdraws a view so hidden rows reappear. The underlying material is PRESERVED-DIRECTLY throughout (OA-04). - bounded viewport (RM04-A): the served grid materializes a bounded window over the plane (default 40x14) with page navigation and go-to-address; document extent never equals DOM materialization extent, so a document holding distant valid loci (up to the 1.048.576 x 16.384 plane) opens promptly and every valid address remains reachable and editable.
- persistence (RM04-C): saving validates the model, writes a temporary sibling in the same directory (fsync) and renames it over the canonical path; a failed save leaves the previous canonical file untouched and no temporary behind.
- connected governance (RM-03): operations whose TARGET is anchored material
— content edit, move, delete of a span holding it, sort of a range
holding it, scenario deltas onto it — refuse typed through one central
boundary (
ops::governance), on every surface (app dispatcher, /op endpoint, CLI patch). No operation can silently persistanchor -> missing locus. Identity-preserving structural shifts (insert rows/columns) keep anchors valid and remain available.
5. Calculation architecture
fsheet-calc: familiar formula surface (A1/$-refs, ranges, cross-sheet,
names, function calls), typed exact evaluation (decimal-string arithmetic;
host floats unreachable), documented v0.1 function table (aggregations,
IF-lazy, text, date/time under explicit EvalContext, exact-only VLOOKUP),
typed errors (#DIV/0!, #REF!, #NAME?, #CYCLE!, #VALUE!, #NUM!,
#N/A, #UNRESOLVED!), derived dependency graph, cycle detection, and an
incremental engine (demand-driven memoized reads; dirty propagation over a
strict dependents graph; recalculation of exactly the dirty cone).
Volatility (FS-D43): date/time read only the explicit EvalContext basis
instant; no hidden environment dependency exists. Dependency edges are
derived runtime structures (FS-D44), never semantic relations.
6. Scenario architecture
Overlays are ordered identity-addressed delta lists (set-value / set-formula / introduce-with-minted-identity). Evaluation materializes a hypothetical workbook clone — the baseline document object is never mutated (FS-D38) and scenario-scoped results stay distinguishable. Promotion is explicit and category-aware (FS-D39): local apply (below), source-authoring prepare (never publish), remote governed effectuation. Local promotion preserves the modified loci’s DocumentIdentity and uses the overlay-minted identities for introduced loci; content revision is not identity replacement (OA-05).
7. Connectivity architecture (OA-02 scope)
- Generic read/projection: connections pin exact source+revision;
anchors resolve only through
FormaslNativeBridge(SubjectRef+NativeCorrespondenceauthorized routes); unknown tokens, unchecked bases and unsupported classes fail closed; equal labels never establish correspondence (FS-D35). Multi-source workbooks route resolution over connection candidates by typed failure variants (AnchorResolutionFailure), never by error-message text; each snapshot is attributed to the connection that actually resolved its anchor (RM-03), so per-source revisions survive (FS-D34). - Snapshots: basis-stamped local records with caller-supplied
recorded_at; never remote currency (FS-D33); refresh is explicit and preserves prior stamps (FS-D32); open performs nothing (FS-D31); offline never claims freshness. - Authoring: per-cell native write has no bridge and plans read-only; source-authoring prepares a candidate bound to the exact base revision and never publishes; effectuation executes only through the demonstrated SUI route (explicit commit-revision → optional activate-revision) wired at the surface, otherwise a typed refusal. New ActionClass/authorization/ effect semantics remain R3.
8. Surface architecture (OA-03)
FSheet interactive surface
= renderer/projection adapter (GridRenderer: presentation-only, no event
input, stateless)
+ editor/grid shell (EditorShell: local document generation +
engine + editor-only state)
+ local document-operation dispatcher (typed UserIntents; the only event
entry point)
Modern grid UI (v0.2, FSHEET-UI-01; erratum 2026-10-02 — surface
component corrected): the served grid page (/grid) embeds the vendored
Tabulator 6.5.3 bundle (MIT, digest-committed under ui/dist/ per
ui/UI-SUPPLY-CHAIN.md, included into the binary via include_str!) as a
pure view layer: it renders the /state projection (the server-computed
display), marks calculated, erroring, previewed and dependency cells,
offers a server-computed scenario selector (values come from
POST /scenario/preview, never from the browser) and highlights dependency
targets from /deps on cell click. Every edit is a typed intent POSTed
to /edit; the response state is the only thing rendered (D-G0: the grid
mutates nothing locally and never computes a formula). No document state
lives in the UI; the legacy jspreadsheet CE page remains at /classic
(vendored in crates/fsheet-app/ui/vendor/). User events never enter the renderer. Enter/save/apply are distinct: edit →
local document state; save → validated serialization (the model validates
before the canonical file is replaced); apply → explicit connectivity
action. Authored values may create new occurrences in empty loci under
freshly minted document identities (RM-03). The fsheet CLI
(check/fmt/new/retrieve/patch/scenario/import/export) is the direct textual
authoring surface for humans, conventional software and LLM agents (one
governed document model; bounded retrieval with context headers;
@<identity> patch loci — a cell identity, or an anchor identity resolving
to its bound occurrence — that survive movement, alongside spatial
sheet!addr selectors; check→fmt loop). Typed refusals remain visible on
the served page’s status line; the grid renders the full occupied extent;
grid event handlers bind through DOM data attributes, never interpolated
inline scripts.
9. Interoperability architecture
CSV import reconstructs values/geometry into a fresh document with zero
semantic anchors (FS-D45); formulas become text with a typed report; typed
numbers/booleans/errors stay typed. Export carries a typed LossReport
(formulas export as authored text; scenarios/anchors/comments/formatting
reported; leading = quoted). Enrichment proposals are inert until
governed acceptance (FS-D46).
XLSX import (real files, umya reader + calamine error/geometry pass;
reader panics are contained at the boundary and reported as typed
ImportErrors — a pathological or minimal-but-spec-valid file can never
crash the product, RM-03):
multiple sheets with names/order, cell geometry, typed
text/numbers/booleans/error tokens, formula definitions (relative and
$-absolute), and basic formatting (bold/italic/alignment). ODS import
(real files, calamine reader): multiple sheets, geometry, typed values, and
formula definitions translated from ODF to A1 syntax; ISO date-times import
as text. Both firewalls hold: a "Revenue" header stays text; an
imported UUID-looking value stays text; formulas import as definitions,
never claims; relationships never become NativeCorrespondence; imported
workbooks start with zero semantic anchors; anything not representable is
typed-reported, never silently discarded or invented.
Remediation history: the original Phase B closure declared XLSX/ODS “typed unsupported inputs” — that narrowing contradicted the acceptance contract and was falsified by independent audit; real importers replaced it under FSHEET-RM-01.
10. Semantic Continuity vocabulary (OA-04 correction incorporated)
The official classifications — and the only ones used anywhere in this product — are:
PRESERVED-DIRECTLY
PRESERVED-BY-REFERENCE
DERIVABLE
INTENTIONALLY-ERASED
ACCIDENTALLY-LOST
NOT-APPLICABLE
UNKNOWN
RESTRICT is not a classification of this vocabulary and appears nowhere in
the FSheet implementation, gates, or documentation. Filtering: underlying
material PRESERVED-DIRECTLY; filtered-out material still exists; presentation
omission is not semantic erasure. ACCIDENTALLY-LOST is a defect;
UNKNOWN is never pass.
11. Single-substrate statement (OA-01 correction incorporated)
RelationalContent != Claim
GraphMembership != Standing
The FSheet document model is not a second semantic kernel: domain semantic meaning elaborates to or references the existing FormaSL typed role-incidence metagraph. FSheet owns document, spatiality and calculation contracts per the campaign contracts; these do not constitute a second substrate for domain semantic meaning.
The grid is not promoted wholesale to .fsl source because that would
collapse:
spreadsheet document structure / semantic-source structure
spatial+document identity / semantic identity
local authored content / semantic standing
— not because a relation occurrence would imply a Claim (it would not;
representing structure in .fsl relations does not automatically create
standing).
12. Module decomposition (as implemented)
fsheet-core document model L1–L8, identity, values, spatial ops,
scenario ops (deps: none)
fsheet-format canonical .fsheet surface: parse/format/version (→ core)
fsheet-calc formula lane: parser, exact evaluation, engine (→ core)
fsheet-connect formasl facade + SUI bridge adapter (→ core, formasl,
formasl-semantic-ui-*, formasl-publication)
fsheet-interop CSV import/export + XLSX/ODS import + reports (→ core,
format; umya-spreadsheet/calamine readers per FSHEET-RM-01;
dev: calc/connect/surface for lane witnesses)
fsheet-surface renderer + shell + dispatcher (→ core, calc, format, connect,
SUI core/protocol)
fsheet-cli fsheet binary (→ core, format, calc, interop)
fsheet-app integrated application: browser grid UI + HTTP server +
connectivity lane materially reached (→ all of the above)
Dependency direction is strictly one-way: FormaSL and Semantic UI never depend on any fsheet crate.
13. Failure model
Unresolved anchors → #UNRESOLVED!/typed unresolved; ambiguous authoring →
typed disambiguation/read-only; unsupported formulas/imports → typed reports;
stale bases → snapshot currency marking + fail-closed dependent evaluation;
unknown constructs → opaque preserve or fail-closed; semantic-loss export →
mandatory loss report; mechanism failures → MechanismOutcome channel,
never laundered into semantic results.
14. Verification summary (Phase B execution record)
Serial FIOP WPs, all VERIFIED/CLOSED with workspace cargo nextest --profile ci green at each closure: FSHEET-DOC-01 (2786), FSHEET-SPATIAL-01 (2807),
FSHEET-CALC-01 (2832), FSHEET-SCENARIO-01 (2839), FSHEET-CONNECT-01 (2850),
FSHEET-SURFACE-01 (2856, incl. real-binary agent-loop E2E),
FSHEET-INTEROP-01 (2862, incl. CSV E2E), FSHEET-HARDENING-01 (2871, incl.
authority-firewall structural suite and 10k-cell baselines). Development
line: impl/forma-sheet-v0.1-phaseb (clean per OA-06).
Remediation history: the Phase B closure was falsified (XLSX/ODS/UI/product
gaps) and remediated under FSHEET-RM-01; the RM-01 re-accreditation was
falsified (UI/connectivity) and remediated under FSHEET-RM-02 at
049a8d00…; the RM-02 release candidate was falsified by the independent
pre-landing audit (empty-cell authoring, deterministic identity brickings,
connected-operation bypass, malformed /state JSON, move-overwrite,
multi-connection routing, unprojected filters, XLSX panic, agent claim
overclaims) and remediated under FSHEET-RM-03 on
impl/forma-sheet-v0.1-rm03, with every audit attack converted into a
permanent regression witness. All decisions above are incorporated into
this owner.