mostlyright/experimental
Classes
Section titled “Classes”ContributorFirewallError
Section titled “ContributorFirewallError”Raised at compose time when a contributor emits a column that violates the
labels-only firewall — a non-prefixed column, or a forbidden
label/obs_*/cli_* column. Mirrors Python _assert_columns_clean in
_contributors.py: a firewall breach is a correctness bug, so it throws
immediately and is never downgraded to the NaN/null failure block. That
block is reserved for a contributor’s own runtime exception.
Extends
Section titled “Extends”ContractError
Constructors
Section titled “Constructors”new ContributorFirewallError()
Section titled “new ContributorFirewallError()”new ContributorFirewallError(
message):ContributorFirewallError
Parameters
Section titled “Parameters”message
Section titled “message”string
Returns
Section titled “Returns”Overrides
Section titled “Overrides”ContractError.constructor
ContributorRegistrationError
Section titled “ContributorRegistrationError”Raised when a contributor spec violates a registration guard (bad prefix, missing or out-of-namespace columns, duplicate name, built-in-prefix claim). A loud, typed error — never a silent no-op.
Extends
Section titled “Extends”ContractError
Constructors
Section titled “Constructors”new ContributorRegistrationError()
Section titled “new ContributorRegistrationError()”new ContributorRegistrationError(
message):ContributorRegistrationError
Parameters
Section titled “Parameters”message
Section titled “message”string
Returns
Section titled “Returns”Overrides
Section titled “Overrides”ContractError.constructor
Interfaces
Section titled “Interfaces”ContributorSpec
Section titled “ContributorSpec”Properties
Section titled “Properties”archiveClass?
Section titled “archiveClass?”
readonlyoptionalarchiveClass:ArchiveClass
Archive class. Default "refetchable".
builtin?
Section titled “builtin?”
readonlyoptionalbuiltin:boolean
Built-ins are exempt from the experimental warning. Default false.
columns?
Section titled “columns?”
readonlyoptionalcolumns: readonlystring[]
The prefixed column set this contributor emits. Required for third-party
(non-builtin) contributors, and every column must carry prefix — mirrors
Python _contributors.py, which requires the set and seeds the all-null
column universe from it. That is what makes the failure contract
load-bearing: if contribute() throws or covers zero days, the declared
columns still materialize as an all-null block instead of silently
vanishing. Built-ins may omit it (they derive their columns from the
composed output); a third-party registration without columns raises
ContributorRegistrationError.
contribute
Section titled “contribute”
readonlycontribute:ContributeFn
The contribute() implementation.
injectionPoint?
Section titled “injectionPoint?”
readonlyoptionalinjectionPoint:InjectionPoint
Injection point. Default "post_join", where third-party columns are appended.
readonlykey:string
Unique registry key (the Python key tuple, flattened to a string).
nativeGrain?
Section titled “nativeGrain?”
readonlyoptionalnativeGrain:"daily"|"observation"
Native grain the contributor computes at. Default "daily".
prefix
Section titled “prefix”
readonlyprefix:string
The column prefix this contributor emits (e.g. "sat_"). Validated against
the firewall at registration; every emitted column must start with it.
Type Aliases
Section titled “Type Aliases”ArchiveClass
Section titled “ArchiveClass”ArchiveClass:
"ledger"|"refetchable"
Archival durability class of the contributor’s underlying data. Closed enum
(mirrors Python: ledger = capture-or-lose; refetchable = re-derivable).
ContributeFn()
Section titled “ContributeFn()”ContributeFn: (
args) =>ReadonlyMap<string,Readonly<Record<string,unknown>>>
The contribute(entity, window, grain) protocol. Returns a map of
prefixed_col -> value for the given key. Mirrors the neutralized Python
contribute(entity, window, grain) -> {key: {prefixed_col: value}}. In TS
we key the per-day contributions by the daily date string.
Parameters
Section titled “Parameters”entity
Section titled “entity”string
"daily" | "observation"
window
Section titled “window”{ fromDate: string; toDate: string; }
window.fromDate
Section titled “window.fromDate”string
window.toDate
Section titled “window.toDate”string
Returns
Section titled “Returns”ReadonlyMap<string, Readonly<Record<string, unknown>>>
InjectionPoint
Section titled “InjectionPoint”InjectionPoint:
"pre_aggregation"|"post_join"
Where a contributor injects its columns. Closed enum (mirrors Python).
Functions
Section titled “Functions”_resetContributorFailureWarning()
Section titled “_resetContributorFailureWarning()”_resetContributorFailureWarning():
void
Reset the one-time contributor-failure-warning latch — test use only.
Returns
Section titled “Returns”void
_resetExperimentalWarning()
Section titled “_resetExperimentalWarning()”_resetExperimentalWarning():
void
Reset the one-time experimental-warning latch — test use only.
Returns
Section titled “Returns”void
_resetRegistry()
Section titled “_resetRegistry()”_resetRegistry():
void
Reset the registry — test use only (mirrors the Python clean_registry fixture).
Returns
Section titled “Returns”void
composePostJoinContributors()
Section titled “composePostJoinContributors()”composePostJoinContributors(
rows,args):object
Compose post-join third-party contributors onto the daily rows. Runs strictly
after the built-in composition, so built-in output stays byte-identical and
only additive third-party columns are appended (mirrors _contributors.py’s
compose_post_join_contributors).
Failure semantics, matching Python — the three kinds of contributor problem are treated differently:
- A contributor whose
contribute()throws an ordinary runtime error (a data or runtime failure) yields an all-null prefix block on every row plus an entry pushed toerrors, and composition continues — thedataset()call succeeds, and a one-time console.warn (the equivalent of Python’sRuntimeWarning) reports it. A data failure is a null block plus a warning. - A contributor whose
contribute()throws an availability or config error — SourceUnavailableError (a missing optional extra) or DataAvailabilityError (fetched, nothing usable) — is re-raised, never downgraded to the null block. Python re-raisesSourceUnavailableError; TS splits that case across the two typed errors, so both propagate. A configuration error must fail loudly rather than silently null-fill. - A contributor that emits a firewall-violating column (a non-prefixed
column, or a forbidden
label/obs_*/cli_*column) throws a typed ContributorFirewallError immediately. That is a correctness bug, never converted to a null failure block: a contributor must not shadow a label, silently or otherwise.
Parameters
Section titled “Parameters”readonly Record<string, unknown>[]
entity
Section titled “entity”string
"daily" | "observation"
keyColumn?
Section titled “keyColumn?”string
The key column each row carries to join contributions by.
window
Section titled “window”{ fromDate: string; toDate: string; }
window.fromDate
Section titled “window.fromDate”string
window.toDate
Section titled “window.toDate”string
Returns
Section titled “Returns”object
contributorErrors
Section titled “contributorErrors”contributorErrors:
Readonly<Record<string,string>>
errors
Section titled “errors”errors: readonly
string[]
rows: readonly
Record<string,unknown>[]
registerContributor()
Section titled “registerContributor()”registerContributor(
spec):void
Register a contributor. The first non-builtin registration fires a one-time
ExperimentalFeatureWarning. The declared prefix is checked against the
labels-only firewall and throws on violation. Registration validation mirrors
Python _contributors.py _validate_prefix + _register:
prefixnon-empty, ends with_, and not a reserved label prefix/name — including after stripping the trailing_, solabel_/date_/station_reject, because they namespace into the label set;archiveClass∈ {refetchable,ledger} andinjectionPoint∈ {pre_aggregation,post_join} are runtime-validated before the duplicate, built-in-prefix, and columns guards, as in Python;- a third-party contributor may not claim a built-in prefix
(
fcst_/trade_/sat_/cwop_) — it would shadow a built-in’s columns; - a duplicate
key(the contributor name) is rejected rather than overwritten. Names are unique; a re-registration is a programming error, not an update.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
registeredContributorPrefixes()
Section titled “registeredContributorPrefixes()”registeredContributorPrefixes(): readonly
string[]
The registered contributor prefixes — the union the BYO label collision guard checks.
Returns
Section titled “Returns”readonly string[]
registeredContributors()
Section titled “registeredContributors()”registeredContributors(): readonly
string[]
The registered contributor keys (registration order not promised).
Returns
Section titled “Returns”readonly string[]
unregisterContributor()
Section titled “unregisterContributor()”unregisterContributor(
key):boolean
Remove a registered contributor by key. Returns true if one was removed.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean