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
| Sections | Namespace |
|---|---|
| Tables and schema, type tokens, cell values | SheetForge.Core.Model |
| Errors and results, error code families | SheetForge.Core.Model / .Reporting |
| Indices and utilities | SheetForge.Core.Validation / .Model / .Parsing / .Unparse |
| Push plan | SheetForge.Core.Unparse |
The first three sections together form the IR read model.
Tables and schema
| Type | Role |
|---|---|
SheetTable | One tab's parse output |
SheetSchema | The fields of one tab |
SheetStyle | The @style row's value |
LocaleColumn (struct) | One locale column of a localization sheet |
SheetRecord | One row of values |
FieldSchema | One column of the schema |
SheetTable
SheetSchema SchemaIReadOnlyList<SheetRecord> Records
SheetSchema
string TabNameFieldsTryGetField(name, out FieldSchema)SheetStyle Styleis the sheet's@styledisplay metadata.bool IsLocalizationSheetsays that the@locmarker is present.IReadOnlyList<LocaleColumn> LocaleColumnsholds 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 returnsfalsewhen 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 Titleis the sidebar group label.string ColorHexis#RRGGBBas written.bool HasColor- static
Nonemeans no styling.
Codegen, baking and the schema fingerprint never read it.
LocaleColumn
A LocaleColumn holds what the @loc row wrote on that column.
string Codeis the code exactly as written.string FieldNameint ColumnNumberis 1-based.bool IsSourcemarks 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 RowNumberis the original row, 1-based.Valuesmaps a field to itsCellValue.TryGet- An indexer
FieldSchema
NameTypeToken TypeDescriptionColumnNumberDefaultValueAllowOverlapIReadOnlyDictionary<string,string> MarkerValuesmaps a custom-marker name to this column's cell text.
Type tokens
A TypeToken is a parsed @type cell.
RawTextTypeNameTypeArgumentTargetNameIsListIsOptionalHasExplicitDefaultDefaultValueTextAllowsEmptyCellIsSelfKeyIsIntIdTypeToken InnerToken/IsWrapperserve wrapper types. The inner token is recursive.IsCustomReferenceAssetTypeName
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
| Type | Role |
|---|---|
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 ValueIsDefaultedAsList- static
Of/Defaulted
RecordId
A RecordId compares with Ordinal equality.
string ValueIsEmpty
RecordRefValue
TargetTabId
IntRefValue
IntRefValue is the integer-key twin of RecordRefValue.
string TargetTabint Idbool IsEmpty- static
Empty(tab)is an optionalIntId@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 TargetTabstring Keybool IsEmpty- static
Empty(tab) ReferencedKeys
It implements IRefBearingValue, so the reference scanner treats it exactly like a core reference.
AssetRefValue
GroupKey
A sub-asset key is parent[sub].
EnumValue
An EnumValue is a string pair. CLR conversion is bake's job.
EnumNameMemberName
Errors and results
| Type | Role |
|---|---|
ImportError | Structured, locale-neutral error |
ImportErrorCode (enum) | The complete catalog of reasons |
ImportSeverity (enum) | How severe a diagnostic is |
CellCoordinate (struct) | Where a diagnostic points |
ErrorCollector | Collect-everything sink |
ImportResult | Pipeline output |
ImportReport | Report renderers' input |
ImportReportText (static) | Renders a report to a string |
ImportReport and ImportReportText live in .Reporting, in the assembly SheetForge.Core.Tooling.
ImportError
CodeSeverityCoordinateActualValueExpectedSuggestion
ImportSeverity
Errorblocks 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
AllHasErrorsErrorCountAdd
ImportResult
The invariant is Success == false ⇔ Registry == null.
SuccessRegistryDiagnosticsSkippedTabsEnumTabs- 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
TimestampSourceDescriptionTabCountRecordCountSuccessDiagnosticsErrorCountWarningCountSkippedTabCount
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
@overlapandDomainRuleViolationDropdownNotSupportedByFormat, which is a warning rather than an error
The remaining families are listed below with their codes.
Plugin codes
PluginRegistrationConflictPluginIncompatible
PluginIncompatible is raised when an assembly's compatibility declaration falls outside what this host reads.
IntId codes
DuplicateIntIdUnresolvedIntIdTargetTabHasNoIntId
UnresolvedIntId and TargetTabHasNoIntId are for IntId@Tab references.
Enum definition sheet codes
EnumSheetMarkerConflictDuplicateEnumNameEnumSheetEmptyColumnInvalidEnumIdentifierInvalidEnumUnderlyingTypeInvalidEnumMemberValue
Typed asset reference codes
| Code | Reported |
|---|---|
UnknownAssetType | Once per column, on the @type row |
AmbiguousAssetType | Once per column, on the @type row |
AssetTypeNotReferenceable | Once per column, on the @type row |
AssetTypeMismatch | Per cell |
AssetTypeUnresolvedFallback | By codegen, as a warning |
Asset delivery codes
TypeTokenGroupNotAllowedDirectRefPathMustStartWithAssetsResourcePathOutsideResourcesUnknownResourcePathDuplicateResourcePath, a warningUnknownAssetPathUnknownAssetGuidAssetCellTypeNotAllowedInDeliveryModeBakeOutputFolderNotUnderResourcesDeliveryCatalogMissingDeliveryModeConflict, retiredDeliveryStrategyUnknown
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 warningHeldByCoupledWorkbookEnumAssemblyCycleAcrossWorkbooks
ReferenceTabUnverified means that another workbook's last import could not be checked.
Staged projection codes
ProjectionFellBack, a warningKeyRenameDraft, 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
| Type | Role |
|---|---|
TabKeyIndex | One tab's key info |
KeyIndexBuilder (static) | Builds key indices and reports key errors |
AssetKeyIndex | Group → 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.
TabNameKeyFieldHasKeyColumnKeysContains(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)HasGroupHasKeyKeysOfGroupNames
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 Localeint TotalKeysint TranslatedKeysIReadOnlyList<string> MissingKeysis in sheet row order, never null.bool IsComplete
TextSuggestion
The suggestions use a bounded Levenshtein distance and are deterministic.
FindNearestDistanceDistanceWithin
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.
| Type | Role | Holds |
|---|---|---|
PushPlan | The whole send plan | Tabs, HasWork |
PushTabPlan | One tab | Writes, Appends, Deletes |
PlannedCellWrite | One cell write | Coordinates, baseline cell, new value/text, string-family flag |
PlannedRowAppend | One appended row | Full cell texts and string-family columns |
PlannedRowDelete | One deleted row | Tab 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
- Validation and edges
The reference scanner, edge contracts and the reference graph index.
- Types and grammar
Custom cell types, asset types and the sheet grammar constants.
- Editor assembly
Push approval and the editor-side entry points.
- Core concepts
Why the IR is immutable and validated as a whole.