Skip to content
SheetForge

IR model and errors

This page lists the Core types that hold imported data and report problems. It covers the read model of the intermediate representation (IR), errors and results, key indices and utilities, and the plan for a Push.

Namespaces

SectionsNamespace
Tables and schema, type tokens, cell valuesSheetForge.Core.Model
Errors and results, error code familiesSheetForge.Core.Model / .Reporting
Indices and utilitiesSheetForge.Core.Validation / .Model / .Parsing / .Unparse
Push planSheetForge.Core.Unparse

The first three sections together form the IR read model.

Tables and schema

TypeRole
SheetTableOne tab's parse output
SheetSchemaThe fields of one tab
SheetStyleThe @style row's value
LocaleColumn (struct)One locale column of a localization sheet
SheetRecordOne row of values
FieldSchemaOne column of the schema

SheetTable

  • SheetSchema Schema
  • IReadOnlyList<SheetRecord> Records

SheetSchema

  • string TabName
  • Fields
  • TryGetField(name, out FieldSchema)
  • SheetStyle Style is the sheet's @style display metadata.
  • bool IsLocalizationSheet says that the @loc marker is present.
  • IReadOnlyList<LocaleColumn> LocaleColumns holds the locale columns in original column order.
  • TryGetLocaleColumn(localeCode, out LocaleColumn) looks a column up by code, case-insensitive.
  • TryGetSourceLocale(out LocaleColumn) gives the first locale column. It returns false when there is none.

On a sheet that is not a localization sheet, LocaleColumns is empty, never null.

SheetStyle

SheetStyle is display metadata for one sheet.

  • string Title is the sidebar group label.
  • string ColorHex is #RRGGBB as written.
  • bool HasColor
  • static None means no styling.

Codegen, baking and the schema fingerprint never read it.

LocaleColumn

A LocaleColumn holds what the @loc row wrote on that column.

  • string Code is the code exactly as written.
  • string FieldName
  • int ColumnNumber is 1-based.
  • bool IsSource marks the first locale column.

The Core validates the spelling shape of Code, never whether the locale exists.

The source column is the one inline previews read and minting writes to.

SheetRecord

  • int RowNumber is the original row, 1-based.
  • Values maps a field to its CellValue.
  • TryGet
  • An indexer

FieldSchema

  • Name
  • TypeToken Type
  • Description
  • ColumnNumber
  • DefaultValue
  • AllowOverlap
  • IReadOnlyDictionary<string,string> MarkerValues maps a custom-marker name to this column's cell text.

Type tokens

A TypeToken is a parsed @type cell.

  • RawText
  • TypeName
  • TypeArgument
  • TargetName
  • IsList
  • IsOptional
  • HasExplicitDefault
  • DefaultValueText
  • AllowsEmptyCell
  • IsSelfKey
  • IsIntId
  • TypeToken InnerToken / IsWrapper serve wrapper types. The inner token is recursive.
  • IsCustomReference
  • AssetTypeName

References on a token

IsIntId marks this tab's self integer key only. The IntId@Tab reference form is read through TargetName and ReferenceScanner.GetReferencedTab, the same as RecordId@Tab.

IsCustomReference says that this column is MyType@Tab and that the parser implements IReferencingCellType. ReferenceScanner.GetReferencedTab is the single predicate that reads it. Every consumer therefore picks it up without a signature change.

For the predicate, see Validation and edges.

Asset type name

AssetTypeName is the <Type> of AssetRef@Group<Type> as written. It is null when the column is unrestricted.

The Core stores the name only. Resolving it is IAssetTypeResolver's job.

The name is stamped on the AssetRef token inside a list or a wrapper too.

Constructors

The constructor's three trailing parameters (innerToken, isCustomReference, assetTypeName) are defaulted, so existing calls compile.

The 8- and 10-argument constructors remain as overloads. Already-compiled plugin assemblies keep working without a rebuild.

Cell values

TypeRole
CellValue (struct)One typed cell value
RecordId (struct)A key value
RecordRefValue (struct)A RecordId@Tab cell's value
IntRefValue (struct)An IntId@Tab cell's value
LocRefValue (struct)A LocRef@Tab cell's value
AssetRefValue (struct)An AssetRef@Group cell's value
EnumValue (struct)An Enum<T> cell's value

CellValue

A CellValue holds no nulls. IsDefaulted marks materialized defaults.

  • object Value
  • IsDefaulted
  • AsList
  • static Of / Defaulted

RecordId

A RecordId compares with Ordinal equality.

  • string Value
  • IsEmpty

RecordRefValue

  • TargetTab
  • Id

IntRefValue

IntRefValue is the integer-key twin of RecordRefValue.

  • string TargetTab
  • int Id
  • bool IsEmpty
  • static Empty(tab) is an optional IntId@Tab? that points at nothing.

LocRefValue

LocRefValue is the localization twin of RecordRefValue. It is kept a separate type so a consumer knows from the value alone that it points at a string table.

  • string TargetTab
  • string Key
  • bool IsEmpty
  • static Empty(tab)
  • ReferencedKeys

It implements IRefBearingValue, so the reference scanner treats it exactly like a core reference.

AssetRefValue

  • Group
  • Key

A sub-asset key is parent[sub].

EnumValue

An EnumValue is a string pair. CLR conversion is bake's job.

  • EnumName
  • MemberName

Errors and results

TypeRole
ImportErrorStructured, locale-neutral error
ImportErrorCode (enum)The complete catalog of reasons
ImportSeverity (enum)How severe a diagnostic is
CellCoordinate (struct)Where a diagnostic points
ErrorCollectorCollect-everything sink
ImportResultPipeline output
ImportReportReport renderers' input
ImportReportText (static)Renders a report to a string

ImportReport and ImportReportText live in .Reporting, in the assembly SheetForge.Core.Tooling.

ImportError

  • Code
  • Severity
  • Coordinate
  • ActualValue
  • Expected
  • Suggestion

ImportSeverity

  • Error blocks output.
  • Warning

CellCoordinate

A coordinate holds the tab, the 1-based row, the 1-based column and the field. It computes the spreadsheet column letter.

ForTab / ForRow are its factories.

ErrorCollector

  • All
  • HasErrors
  • ErrorCount
  • Add

ImportResult

The invariant is Success == false ⇔ Registry == null.

  • Success
  • Registry
  • Diagnostics
  • SkippedTabs
  • EnumTabs
  • static Succeeded / Failed

Skipped tabs and enum tabs

EnumTabs holds the tabs read as enum definition sheets, so never parsed as data tables. SkippedTabs means "no table written yet". The two are kept apart so the report's skipped count stays true.

Both are preservation sets. They keep generated code, baked assets and addresses for those tabs.

ImportReport

  • Timestamp
  • SourceDescription
  • TabCount
  • RecordCount
  • Success
  • Diagnostics
  • ErrorCount
  • WarningCount
  • SkippedTabCount

SkippedTabCount says how many of TabCount were empty sheets skipped rather than imported. The header prints it so a tab count is not mistaken for "all imported".

ImportReportText

ImportReportText renders a report to the product's own human-readable string.

  • string Render(ImportReport report, IReadOnlyDictionary<string,string> languageTable = null, string operationName = null)

Nothing is written to the console. No jump link or machine-coordinate line is appended. Those belong to the console's own convention.

Report language

Omit the table for English. When the operation name is omitted, it is read from the same table, so the sentence never mixes two languages.

Editor-side callers usually want SheetForgeActions.RenderReportText(report), which fills in the current editor language. A pure assembly cannot read EditorPrefs.

Error code families

ImportErrorCode is append-only, because renderer tables key off the member values.

The catalog covers these families:

  • Markers, schema, types, cells, keys/references and asset keys
  • Sources/files, csv/xlsx, codegen identifiers, addressables, baseline/export, Google/auth/Push and templates
  • @overlap and DomainRuleViolation
  • DropdownNotSupportedByFormat, which is a warning rather than an error

The remaining families are listed below with their codes.

Plugin codes

  • PluginRegistrationConflict
  • PluginIncompatible

PluginIncompatible is raised when an assembly's compatibility declaration falls outside what this host reads.

IntId codes

  • DuplicateIntId
  • UnresolvedIntId
  • TargetTabHasNoIntId

UnresolvedIntId and TargetTabHasNoIntId are for IntId@Tab references.

Enum definition sheet codes

  • EnumSheetMarkerConflict
  • DuplicateEnumName
  • EnumSheetEmptyColumn
  • InvalidEnumIdentifier
  • InvalidEnumUnderlyingType
  • InvalidEnumMemberValue

Typed asset reference codes

CodeReported
UnknownAssetTypeOnce per column, on the @type row
AmbiguousAssetTypeOnce per column, on the @type row
AssetTypeNotReferenceableOnce per column, on the @type row
AssetTypeMismatchPer cell
AssetTypeUnresolvedFallbackBy codegen, as a warning

Asset delivery codes

  • TypeTokenGroupNotAllowed
  • DirectRefPathMustStartWithAssets
  • ResourcePathOutsideResources
  • UnknownResourcePath
  • DuplicateResourcePath, a warning
  • UnknownAssetPath
  • UnknownAssetGuid
  • AssetCellTypeNotAllowedInDeliveryMode
  • BakeOutputFolderNotUnderResources
  • DeliveryCatalogMissing
  • DeliveryModeConflict, retired
  • DeliveryStrategyUnknown

DeliveryModeConflict is marked [Obsolete] and is never raised, since workbooks may mix delivery modes. It stays because the catalog is append-only.

Several workbooks codes

  • ReferenceTabUnverified, a warning
  • HeldByCoupledWorkbook
  • EnumAssemblyCycleAcrossWorkbooks

ReferenceTabUnverified means that another workbook's last import could not be checked.

Staged projection codes

  • ProjectionFellBack, a warning
  • KeyRenameDraft, a warning

Both are raised while you author, by the Data Studio and the web app alike, under the same conditions and with the same sentences. ProjectionFellBack means that the staged changes to a sheet could not be applied, so the sheet was checked in its last valid state. KeyRenameDraft means that a key rename is staged, so the table and Problems still read the old name until the rename is reflected.

Indices and utilities

TypeRole
TabKeyIndexOne tab's key info
KeyIndexBuilder (static)Builds key indices and reports key errors
AssetKeyIndexGroup → valid-key set
LocalizationCoverage (static)Per-locale coverage and orphan keys for a localization sheet
LocaleCoverage (sealed class)One locale's coverage
TextSuggestion (static)Nearest-match suggestions
BuiltinCellParsers (static)The built-in parsers
CanonicalValueRenderer (static)Value → canonical cell string, for Export and Push

TabKeyIndex

The index holds the string key column plus the tab's IntId integer-key set. Both RecordId@Tab and IntId@Tab references resolve against it.

  • TabName
  • KeyField
  • HasKeyColumn
  • Keys
  • Contains(id)

KeyIndexBuilder

The builder builds the string keys and the IntId integer-key set in one pass. It reports key errors and validates IntId columns.

  • Build(SheetTable, ErrorCollector)
  • ValidateIntIdColumns

AssetKeyIndex

The Editor fills the index from the Addressables catalog, sub-asset keys included. Injecting null skips asset validation.

  • Register(group, keys)
  • HasGroup
  • HasKey
  • KeysOf
  • GroupNames

The type layer of AssetKeyIndex

AssetRef@Group<Type> uses the type layer.

  • RegisterTyped(group, key, satisfiedTypeFullNames)
  • HasTypeInfo(group, key)
  • SatisfiesType(group, key, typeFullName)

RegisterTyped registers the key and the closure of type full names it can be loaded as. The closure holds its own type, bases, interfaces and its sub-assets' types. Re-registering unions the closure.

A key registered with plain Register has no closure. It is exempt from the type check rather than failing it.

LocalizationCoverage

LocalizationCoverage is a pure calculation. It returns lists instead of collecting errors, because an untranslated cell and an unused key are normal states rather than reasons to block the exits.

  • IReadOnlyList<LocaleCoverage> Compute(SheetTable)
  • IReadOnlyList<string> FindOrphanKeys(locTabName, tables)

FindOrphanKeys returns the keys nothing points at. It is deliberately conservative. Every reference form the scanner knows counts as a use, so a live translation is never called an orphan.

LocaleCoverage

  • LocaleColumn Locale
  • int TotalKeys
  • int TranslatedKeys
  • IReadOnlyList<string> MissingKeys is in sheet row order, never null.
  • bool IsComplete

TextSuggestion

The suggestions use a bounded Levenshtein distance and are deterministic.

  • FindNearest
  • Distance
  • DistanceWithin

BuiltinCellParsers

CreateDefaultRegistry() creates the registry of the 14 built-in parsers: int, float, bool, string, Enum, RecordId, AssetRef, ResourceRef, DirectRef, IntId, LocRef, Color, AnimationCurve and Gradient.

CanonicalValueRenderer

  • TryRender(…)
  • RenderFloat(float) renders the shortest round-trip.

TryRender(…) delegates a ColorValue / CurveValue / GradientValue to its own Render(). A curve with no keys renders as the empty cell.

Push plan

These types are public because IPushApprover.Approve(PushPlan) exposes them. They are pure data. All five live in the assembly SheetForge.Core.Tooling.

TypeRoleHolds
PushPlanThe whole send planTabs, HasWork
PushTabPlanOne tabWrites, Appends, Deletes
PlannedCellWriteOne cell writeCoordinates, baseline cell, new value/text, string-family flag
PlannedRowAppendOne appended rowFull cell texts and string-family columns
PlannedRowDeleteOne deleted rowTab name, record key and baseline row number. The row is deleted only while the live row still matches

Deletes holds the key and the row number. DeleteNotices remains the key-only view.

Next steps