farseer-cli 1.22.0 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/commands/code.js +23 -0
- package/dist/commands/code.js.map +2 -2
- package/dist/commands/skills.js +110 -7
- package/dist/commands/skills.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/tools/dashboardTools.js +1 -1
- package/dist/pipeline/create.js +1 -1
- package/dist/pipeline/generated-reference.json +6 -6
- package/dist/services/codefirst/workflow.js +3 -3
- package/dist/services/codefirst/workflow.js.map +1 -1
- package/dist/services/farseerService.js +10 -1
- package/dist/services/farseerService.js.map +1 -1
- package/dist/services/httpError.js +2 -1
- package/dist/services/httpError.js.map +1 -1
- package/dist/skills/install.js +221 -8
- package/dist/skills/install.js.map +2 -2
- package/dist/skills/userSkills.js +206 -0
- package/dist/skills/userSkills.js.map +6 -0
- package/dist/skills/workspaceSkills.js +213 -0
- package/dist/skills/workspaceSkills.js.map +6 -0
- package/docs/cli-guide.md +6 -1
- package/docs/pipeline-reference.md +1 -1
- package/package.json +1 -1
- package/skills/farseer-app-dev/SKILL.md +2 -2
- package/skills/farseer-app-dev/assignments.md +1 -1
- package/skills/farseer-app-dev/farseer-client-release-notes.md +13 -1
- package/skills/farseer-app-dev/working-patterns.md +30 -5
- package/skills/farseer-author-import-job/SKILL.md +20 -3
- package/skills/farseer-author-import-job/cell-writes.md +26 -6
- package/skills/farseer-author-import-job/deploying-a-farseer-app.md +117 -12
- package/skills/farseer-author-import-job/import-job-pattern.md +111 -13
- package/skills/farseer-build-model/SKILL.md +3 -2
- package/skills/farseer-build-model/formula-grain-alignment.md +186 -31
- package/skills/farseer-build-model/naming-conventions.md +5 -2
- package/skills/farseer-build-model/sparse-formulas-pattern.md +30 -11
- package/skills/farseer-build-pipeline/SKILL.md +36 -1
- package/skills/farseer-build-pipeline/erp-sales/README.md +8 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/main.py +1 -1
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-load/main.py +1 -1
- package/skills/farseer-build-pipeline/pipeline-app-failure-report-pattern.md +9 -6
- package/skills/farseer-modify-model/SKILL.md +3 -2
- package/skills/farseer-modify-model/model-validation-pattern.md +11 -3
- package/skills/farseer-review-model/SKILL.md +39 -8
- package/skills/pipeline-authoring/SKILL.md +3 -3
- package/skills/pipeline-authoring/practices.md +5 -3
|
@@ -135,9 +135,10 @@ declares a dim no operand carries. The mirror case is OPERAND-side:
|
|
|
135
135
|
operands carry **different grains from each other**, and the formula
|
|
136
136
|
combines them with `if(...)`, `+`, `*`, or `sum(A, B)`.
|
|
137
137
|
|
|
138
|
-
Symptom is the same — wrong values, sometimes-null cells, slow execution
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
Symptom is the same — wrong values, sometimes-null cells, slow execution.
|
|
139
|
+
The null cells come from Optimize calculation: with it on, only operands at
|
|
140
|
+
the consumer's full grain place cells. On v7 it is off on every formula
|
|
141
|
+
variable ([the v7 rule](#optimize-calculation-v7)).
|
|
141
142
|
|
|
142
143
|
Common shapes:
|
|
143
144
|
|
|
@@ -145,7 +146,7 @@ Common shapes:
|
|
|
145
146
|
# WRONG — three different grains in one if expression
|
|
146
147
|
"PL_Plan_OUT" [PL_Analytics, CostCenter, Versions, Years, Months] =
|
|
147
148
|
if(eq("FC_ONE_PASS_BY_INPUT", 1), # grain: [Versions, Years, Months]
|
|
148
|
-
"PL_Actual_upstream", # grain: [PL_Analytics, CC,
|
|
149
|
+
"PL_Actual_upstream", # grain: [PL_Analytics, CC, Y, M] — version-less
|
|
149
150
|
sum("PL_Plan_IN")) # grain: [Account, CC, Versions, Y, M]
|
|
150
151
|
```
|
|
151
152
|
|
|
@@ -161,7 +162,7 @@ dimensionality.
|
|
|
161
162
|
|
|
162
163
|
"PL_Plan_OUT" [PL_Analytics, CostCenter, Versions, Years, Months] =
|
|
163
164
|
if(eq("FC_ONE_PASS_BY_INPUT", 1),
|
|
164
|
-
"PL_Actual_upstream", # broadcasts
|
|
165
|
+
"PL_Actual_upstream", # version-less: broadcasts into every version ✓
|
|
165
166
|
"PL_Plan_IN_at_PL_Analytics") # same grain as OUT ✓
|
|
166
167
|
```
|
|
167
168
|
|
|
@@ -172,12 +173,10 @@ chain is self-documenting at the call site.
|
|
|
172
173
|
|
|
173
174
|
**Properties on projections (the rule, stated once).** A projection
|
|
174
175
|
intermediate always carries `readonly` — it is derived, never
|
|
175
|
-
planner-editable
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
disabling Optimize calculation on the **consumer**, which remains the
|
|
180
|
-
discouraged anti-fix below.
|
|
176
|
+
planner-editable — and, like every formula variable,
|
|
177
|
+
Optimize calculation off (`optimizeCalculation: false`; [the v7 rule](#optimize-calculation-v7)). That
|
|
178
|
+
flag decides which cells exist, not whether they refresh: an import
|
|
179
|
+
recalculates its dependants with the flag on or off.
|
|
181
180
|
|
|
182
181
|
**Constraint on projection.** It only works when the source and target
|
|
183
182
|
dimensions are linked by FK relationships — the engine traverses the FK
|
|
@@ -196,23 +195,102 @@ new FK column on the dim before attempting the projection.
|
|
|
196
195
|
fine when there's a single operand (engine auto-rolls), risky when
|
|
197
196
|
combined with other operands of yet-different grain.
|
|
198
197
|
|
|
199
|
-
**
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
198
|
+
**Optimize calculation.** On v7 every formula variable has
|
|
199
|
+
Optimize calculation off ([the v7 rule](#optimize-calculation-v7)). With
|
|
200
|
+
the flag off a mixed-grain formula places cells from every operand, so the
|
|
201
|
+
projections above are no longer needed for the cells to exist; keep them
|
|
202
|
+
where they make the formula easier to read or the heavy part cheaper (the
|
|
203
|
+
named application below). On a delivered variable that still has the flag
|
|
204
|
+
on, they remain the fix.
|
|
205
205
|
|
|
206
206
|
Calculate on demand (`calculateOnDemand`) is a **different** switch and is
|
|
207
|
-
**not** a
|
|
207
|
+
**not** a substitute for either: it stops the variable from being computed at all until
|
|
208
208
|
a dedicated API call demands it, so it and every stored formula reading it go
|
|
209
209
|
null. Turn it on only when the user explicitly asks for it, variable by
|
|
210
210
|
variable.
|
|
211
211
|
|
|
212
|
-
|
|
213
|
-
combination at all. If a formula CAN be wrong on
|
|
214
|
-
WILL be wrong eventually — don't rely on the calculator
|
|
215
|
-
right axis.
|
|
212
|
+
With Optimize calculation on, the "match dimensionality" rule is HARD:
|
|
213
|
+
same-grain operands or no combination at all. If a formula CAN be wrong on
|
|
214
|
+
grain alignment, it WILL be wrong eventually — don't rely on the calculator
|
|
215
|
+
picking the right axis.
|
|
216
|
+
|
|
217
|
+
<a id="optimize-calculation-v7"></a>
|
|
218
|
+
|
|
219
|
+
### The v7 rule — Optimize calculation off on every formula variable
|
|
220
|
+
|
|
221
|
+
**Every variable with a formula has Optimize calculation off** (UI:
|
|
222
|
+
*Optimize calculation* unticked; API `variable.optimizeCalculation: false`) —
|
|
223
|
+
calculated OUTs and internal variables, and an IN with a seed formula. All
|
|
224
|
+
Farseer tenants run v7 since 2026-11, and on v7 Optimize calculation is not
|
|
225
|
+
used: which cells it keeps cannot be predicted from the formula. On an input
|
|
226
|
+
without a formula the flag has no effect. Confirmed by Farseer's system
|
|
227
|
+
engineering on 2026-11-16: Optimize calculation is always false. New
|
|
228
|
+
models carry it from the first write. `farseer variables create` creates a
|
|
229
|
+
variable with it on, the platform default, and neither `create` nor `update`
|
|
230
|
+
has an option for it: switch it off in the UI, or through the API (read the
|
|
231
|
+
variable with `GET /entities/{id}/VAR`, set `variable.optimizeCalculation` to
|
|
232
|
+
`false`, remove `variable.referencedBy`, which is read-only and answered with
|
|
233
|
+
400 `is read-only` when sent (the SDK's `entities.mutate` leaves it out), and
|
|
234
|
+
send the rest back through `POST /entities/mutate` as
|
|
235
|
+
`{"updated": [...]}`), and check
|
|
236
|
+
it in `farseer model --json` (`"optimizeCalculation": false`). Switch in
|
|
237
|
+
batches, never the whole model in one update, and check the tenant still
|
|
238
|
+
answers after each batch: one bulk toggle stopped a development tenant until
|
|
239
|
+
support undid it. A delivered model switches a variable when a change
|
|
240
|
+
touches it (`farseer-modify-model`).
|
|
241
|
+
|
|
242
|
+
**Why** (measured 2026-11-10 on a sandbox tenant, the same formula with the
|
|
243
|
+
flag on, then off):
|
|
244
|
+
|
|
245
|
+
| Formula | Flag on | Flag off |
|
|
246
|
+
|---|---|---|
|
|
247
|
+
| `if(<cond>, sum("Src", "Versions" > "Actual"), "Drv" * 2)` | 4 of 17 cells, only where `Drv` has data — actuals lost even in the Actual version | all 17, same values |
|
|
248
|
+
| `if(hasValue(<override>), <override>, "FC ONE ALWAYS")` | the Actual version has no cell outside the override months | Actual reads 1 in every month (60 of 60), plus the override cells |
|
|
249
|
+
| `if(hasDMember("Versions" > "Actual"), "Src", "Coarse")`, `Coarse [Item, Years]` | every non-Actual version empty | the coarse branch fills the months of every non-Actual version |
|
|
250
|
+
|
|
251
|
+
**What the flag does** (Farseer engine source; it is the flag's only use).
|
|
252
|
+
Either way an operand inside an `if()` condition places no cells unless it
|
|
253
|
+
is the formula's only operand. Off: every other operand places cells (a
|
|
254
|
+
union), and one that lacks a grain dimension places them on every member of
|
|
255
|
+
it. On: only operands that carry the variable's whole grain directly — as
|
|
256
|
+
their own dimension or a grain pin — place cells, and a member filter inside
|
|
257
|
+
`sum()` on a grain dimension disqualifies an operand; only when no operand
|
|
258
|
+
qualifies do they all place cells, as with the flag off. A cell still needs an
|
|
259
|
+
operand with data, and the value decides the rest (`x * null` stays empty, `null + x` is `x`).
|
|
260
|
+
Refresh is the same either way.
|
|
261
|
+
|
|
262
|
+
**A coarse summand fills the grain; a coarse factor does not.** Measured
|
|
263
|
+
2026-11-10 on a sandbox tenant (v7). A product with a coarser operand is safe
|
|
264
|
+
with the flag off: `"Qty" * "Rate"`, `Rate [Years]`, at
|
|
265
|
+
`[Customer, Item, Versions, Years, Months]` with 400 customers, 400 items
|
|
266
|
+
and 5 versions (9.6 million combinations a year) stored the same 100 cells
|
|
267
|
+
with the flag off as on (`x * null` stays empty); a one-cell write to `Rate`
|
|
268
|
+
returned in 103–211 ms with the flag off against 89–227 ms on, and creating
|
|
269
|
+
the variable took 264 against 268 ms. The engine-source prediction that the
|
|
270
|
+
coarse operand is evaluated on every member of the dimensions it lacks did
|
|
271
|
+
not show on v7. What the flag off does change is a coarser operand in a
|
|
272
|
+
**sum**, or alone in an `if()` branch: it places a cell on every member of
|
|
273
|
+
the dimensions it lacks, because `null + x` is `x`. `"Src" + "Rate"`
|
|
274
|
+
(`Rate [Years]`) stored 720 cells with the flag off against 4 with it on —
|
|
275
|
+
the rate on every item × version × month. The arithmetic is right, but it
|
|
276
|
+
creates cells (the class of
|
|
277
|
+
[§7 "Dense cell production"](#7--avoid-it-at-the-start-design-time-performance-rules))
|
|
278
|
+
and, on a delivered model, changes numbers: `Sales + Adjustment [Years]`
|
|
279
|
+
puts the adjustment on every item. Where filling the grain is not the
|
|
280
|
+
intent, gate the coarse term on the detail operand —
|
|
281
|
+
`if(hasValue("Src"), "Src" + "Rate")`: the condition places no cells, and
|
|
282
|
+
where `Src` has no value the `if` has no else-branch and stays empty.
|
|
283
|
+
Measured the same day with the flag off: 4 cells, `Src + Rate` each, the same
|
|
284
|
+
cells as the ungated sum with the flag on. On a
|
|
285
|
+
delivered model, comparing its cells per version before and after the switch
|
|
286
|
+
is what catches it: count a variable with a coarse summand before switching
|
|
287
|
+
it.
|
|
288
|
+
|
|
289
|
+
**Workarounds written for the flag on** — projecting each source to the full
|
|
290
|
+
grain, the ACT/PLAN split, lifting a coarse fallback to the consumer grain, a
|
|
291
|
+
helper that holds a cross-version reference — are required only while a
|
|
292
|
+
variable still has the flag on. With it off they are optional: keep them
|
|
293
|
+
where they make a formula clearer or cheaper.
|
|
216
294
|
|
|
217
295
|
### Named anti-pattern — `sum(A * Flag)` across grains aggregates-then-multiplies, not element-wise
|
|
218
296
|
|
|
@@ -312,11 +390,19 @@ Two findings from the same probe:
|
|
|
312
390
|
[`sparse-formulas-pattern.md`](sparse-formulas-pattern.md), "A bare literal
|
|
313
391
|
with no dense operand to anchor a grain returns null").
|
|
314
392
|
|
|
315
|
-
### Cross-grain addition — which operands place the cells (× inflates; + places cells only from full-grain operands)
|
|
393
|
+
### Cross-grain addition — which operands place the cells (× inflates; with the flag on, + places cells only from full-grain operands)
|
|
316
394
|
|
|
317
395
|
The multiplication case above produces a **silently inflated** number. Addition across grains
|
|
318
396
|
fails differently, and the failure is about **which cells exist**, not about the arithmetic.
|
|
319
|
-
What decides is which operands place cells
|
|
397
|
+
What decides is which operands place cells.
|
|
398
|
+
|
|
399
|
+
**Rules 1–3, the measured shapes, the diagnostic and the coarse-branch allocation below hold for
|
|
400
|
+
a variable with Optimize calculation on** — the platform default these measurements ran with,
|
|
401
|
+
and what a delivered model not yet switched still has. With the flag off
|
|
402
|
+
([the v7 rule](#optimize-calculation-v7)) every operand outside an `if()` condition places cells,
|
|
403
|
+
an operand that lacks a dimension on every member of it (rule 3 for all operands), so a
|
|
404
|
+
lower-grain term fills its own coordinates and the projections below are optional. Rule 4 holds
|
|
405
|
+
either way.
|
|
320
406
|
|
|
321
407
|
1. Cells come only from operands that carry the consumer's **whole grain directly** — every
|
|
322
408
|
grain dimension as their own dimension or a pin. An operand that reaches a dimension by
|
|
@@ -341,14 +427,15 @@ named intermediate, so that it places its own cells:
|
|
|
341
427
|
```text
|
|
342
428
|
"<Source>_at_<consumer grain>" [<consumer grain>] = "<Source>"
|
|
343
429
|
readonly
|
|
344
|
-
optimizeCalculation: false # source is import-fed — see the properties rule above
|
|
345
430
|
```
|
|
346
431
|
|
|
347
432
|
The properties follow the "Properties on projections" rule stated with the naming
|
|
348
|
-
convention above: `readonly`
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
433
|
+
convention above: `readonly` and Optimize calculation off. An import-fed source
|
|
434
|
+
changes nothing about either — the projection is current after a data load with the flag on
|
|
435
|
+
or off.
|
|
436
|
+
On a consumer that already has the flag off the projection is optional; switching the consumer
|
|
437
|
+
off is the other fix, on a delivered model through a change of its own
|
|
438
|
+
(`farseer-modify-model`).
|
|
352
439
|
|
|
353
440
|
**Scoping the sparse rule.** The rule "bare `A + B` treats null as 0 — never wrap in
|
|
354
441
|
`if(hasValue(B), B, 0)`" holds for the
|
|
@@ -368,6 +455,41 @@ cells, the suspect operand carries the full grain and has no cells at the missin
|
|
|
368
455
|
(rule 2). That tells you whose source to check — including whether the import job that feeds it
|
|
369
456
|
has run for those coordinates, since an import can change which cells exist.
|
|
370
457
|
|
|
458
|
+
<a id="coarse-branch-allocation"></a>
|
|
459
|
+
|
|
460
|
+
**With the flag on, a coarse branch next to a full-grain operand places no cells of its own.** In
|
|
461
|
+
`if(<cond>, "Shape" / "Shape total", "Key")` the then-branch computes only where `Key` has
|
|
462
|
+
cells (rule 2), for an IN and a calculated variable alike, and an inline `Base / Base` changes
|
|
463
|
+
nothing. With the flag off the coarse branch places its own cells (measured 2026-11-10 for a
|
|
464
|
+
coarse `if()` branch, [the v7 rule](#optimize-calculation-v7)) and the split below is optional.
|
|
465
|
+
On a variable that still has the flag on, split each allocation into its own variable and give
|
|
466
|
+
the coarse one an operand that carries the line grain:
|
|
467
|
+
|
|
468
|
+
```text
|
|
469
|
+
"Base by month" [<full grain>] = if(<cond>, "Base") # no full-grain operand: rule 3 spreads Base over the months
|
|
470
|
+
"Alloc B" [<full grain>] = "Shape" / "Shape total" * "Base by month"
|
|
471
|
+
"Alloc A" [<full grain>] = "Base" * "Key"
|
|
472
|
+
"Allocated" [<full grain>] = "Alloc A" + "Alloc B"
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
Avoid `"Base" * "Shape" / "Shape total"` with no full-grain operand: `null / x` writes `0` on
|
|
476
|
+
every line without a base, while `x * null` stays empty, so operand order changes the cell
|
|
477
|
+
count (measured 2026-11-09 on a sandbox tenant). `*` and `/` group from the left, so the operand
|
|
478
|
+
that can be null goes last, as in "Alloc B". Control: `"<Alloc>" - "Base"` at Base's grain
|
|
479
|
+
must be 0 for every line with a base.
|
|
480
|
+
|
|
481
|
+
**Never filter a composite by a member of a dimension only some of its parts carry.** A
|
|
482
|
+
composite — a sum of parts on different grains — does not pass such a filter to the part
|
|
483
|
+
without the dimension; sum the part that has it. Measured 2026-11-09 on a sandbox tenant with
|
|
484
|
+
stored variables, parts `A [E, K]` = 10 (k1), 20 (k2) and `B [E]` = 100:
|
|
485
|
+
|
|
486
|
+
| Read | Result |
|
|
487
|
+
|---|---|
|
|
488
|
+
| composite at `[E]`, filtered to `K > k1` | **130** — the filter is ignored |
|
|
489
|
+
| composite at `[E, K]`, filtered to `K > k1` | **110** — B leaks in whole |
|
|
490
|
+
| composite at `[E, K]`, unfiltered total | **230** — B counted once per member of K |
|
|
491
|
+
| `sum(A, K > k1)` | 10 — the part that has the dimension |
|
|
492
|
+
|
|
371
493
|
---
|
|
372
494
|
|
|
373
495
|
## §5 — Grain pins — operand broadcast and the "pin doesn't scope an inner `sum()`" trap
|
|
@@ -489,6 +611,18 @@ adding a null term changes nothing. The one tell in `formula eval`:
|
|
|
489
611
|
pins versions (`sum(V, Versions > FC) / sum(V, Versions > Plan)`) also
|
|
490
612
|
reads null when read with a version pin.
|
|
491
613
|
|
|
614
|
+
<a id="rollup-formula-no-time-functions"></a>
|
|
615
|
+
|
|
616
|
+
**A variable with rollup FORMULA (and a measure) cannot use date or timeline
|
|
617
|
+
functions (`cumsum`, `delay`, …).** The platform refuses such a formula on a
|
|
618
|
+
real load (a dry run passes it; measured 2026-11-09); an existing variable
|
|
619
|
+
switched to rollup FORMULA reads blank everywhere. Put the time function in a
|
|
620
|
+
helper with rollup LAST, never SUM (a SUM month counter reads 78 for a year,
|
|
621
|
+
not 12), and reference the helper; the helper's year value on LAST is null
|
|
622
|
+
while `M12` is empty. A rollup FORMULA ratio also needs every operand to carry, or
|
|
623
|
+
reach by FK, each dimension the sheet rows pin; otherwise its denominator is
|
|
624
|
+
the whole total.
|
|
625
|
+
|
|
492
626
|
---
|
|
493
627
|
|
|
494
628
|
## §6 — When the orphan is intentional
|
|
@@ -508,6 +642,18 @@ The distinguishing question: **"is the same value supposed to land in
|
|
|
508
642
|
every member of the orphan dim?"** If yes — broadcast is intentional,
|
|
509
643
|
leave it. If no — it's the antipattern, fix the grain.
|
|
510
644
|
|
|
645
|
+
**A date or attribute that is a one-off fact of an entity carries no time
|
|
646
|
+
dimension; a recurring event does (2026-11-09).** Contract start/end, asset
|
|
647
|
+
activation, loan maturity, lease start/end, acquisition date: the entity's
|
|
648
|
+
grain only, broadcast to the time grain by the formulas that read it. A copy
|
|
649
|
+
per year can disagree (field case: dozens of positions with two different start
|
|
650
|
+
dates) and a missing year silently zeroes that year's plan (hundreds of positions
|
|
651
|
+
without a next-year date, so no cost and no error). A recurring event (a
|
|
652
|
+
second leave episode in a year, a raise month, a yearly window) keeps
|
|
653
|
+
`Years`. Ask the same of any attribute: does its value really change
|
|
654
|
+
by year? Before re-graining, check that the stored values do not differ by
|
|
655
|
+
year; if they do, the owner decides.
|
|
656
|
+
|
|
511
657
|
**The reverse direction never works: an output that omits a dimension
|
|
512
658
|
cannot SELECT one member of it.** Broadcast (writing the same value into
|
|
513
659
|
every member of an absent dimension) is legitimate; selection (reading one
|
|
@@ -576,7 +722,12 @@ cross product spread over a detail grain × `Versions` × periods, or a `0 + x`
|
|
|
576
722
|
problem at tens of millions of cells as at hundreds of millions — calculation
|
|
577
723
|
time, storage and memory grow with every cell, and a large enough one can
|
|
578
724
|
make the instance unusable for everyone on it. Do not rely on the platform to
|
|
579
|
-
stop it
|
|
725
|
+
stop it. It refuses only the extremes: a variable that would add more than 100 million
|
|
726
|
+
rows fails with `Variable exceeded maximum size of 100000000 added rows`, and one
|
|
727
|
+
whose formula would generate more than 500 million rows with `Variable exceeded maximum size of
|
|
728
|
+
500000000 generated rows` (field report 2026-10-26: a coarse flag multiplied
|
|
729
|
+
into a full-grain expression; gate with `if(hasValue(flag), …)` instead).
|
|
730
|
+
Symptoms range from a very slow
|
|
580
731
|
recalculation to a variable that silently reads null downstream. (A large
|
|
581
732
|
grain on its own is not the problem: a variable whose member-count product
|
|
582
733
|
was in the hundreds of millions but which held one cell computed normally —
|
|
@@ -588,7 +739,11 @@ need; let operands roll coarser dimensions away before a product; return
|
|
|
588
739
|
null, not `0`, on slices without data; place cells with sparse carriers, not
|
|
589
740
|
with broadcasts over a full grain; split a broadcast and an FK hop into
|
|
590
741
|
stored steps; and estimate the cells a new formula will produce (operand
|
|
591
|
-
cells × the members it broadcasts over) before pushing it.
|
|
742
|
+
cells × the members it broadcasts over) before pushing it. With Optimize
|
|
743
|
+
calculation off ([the v7 rule](#optimize-calculation-v7)) that estimate covers
|
|
744
|
+
**every** operand of a sum, not only the full-grain ones: a coarse summand
|
|
745
|
+
fills the grain, while a sparse carrier still narrows a product (`x * null`
|
|
746
|
+
stays empty).
|
|
592
747
|
|
|
593
748
|
---
|
|
594
749
|
|
|
@@ -325,13 +325,16 @@ Helpers and aggregators that *consume* an `IMPORT_` variable to feed downstream
|
|
|
325
325
|
```text
|
|
326
326
|
# Same calculation, name doesn't pretend it's an ETL target.
|
|
327
327
|
"GL_Actual_total_upstream" [GL_Analytics, ...] = sum("IMPORT_GL_Balances")
|
|
328
|
-
folder: Import/
|
|
328
|
+
folder: Scaffold/Import/Upstream/BS
|
|
329
|
+
optimizeCalculation: false
|
|
329
330
|
```
|
|
330
331
|
|
|
331
332
|
### `_upstream` vs `_collector` — direction of data flow decides folder
|
|
332
333
|
|
|
333
334
|
Two related but distinct suffixes for "shaping data before/after the main calculation". The distinction is **direction of flow** — am I sending data downstream, or receiving it from upstream? Pick the right one and the folder choice follows automatically.
|
|
334
335
|
|
|
336
|
+
**The point of view of `_upstream` is the consumer's.** The feeder sits upstream of the OUT that reads it — in its own words, "I send data downstream to consumers". The suffix names that role in the flow, not the version axis: a feeder without `Versions` in its grain is called **version-less** in prose (every Actual-side feeder of a forecast-gated OUT must be version-less). Keep `_upstream`: a name such as "… all versions" says something else, because in dashboards "all versions" is a sum across versions.
|
|
337
|
+
|
|
335
338
|
| Suffix | Semantic | Folder |
|
|
336
339
|
| --- | --- | --- |
|
|
337
340
|
| `_upstream` | "I send data downstream to consumers." A passthrough or simple aggregator that **feeds** an OUT or another consumer. | `Scaffold/Import/Upstream/[<Statement>/]` — under the Import tree because upstream feeders are part of the import-side data flow, not business logic. Statement-specific feeders sit under a `<Statement>/` subfolder (e.g. `Import/Upstream/PL/`, `Import/Upstream/BS/`). |
|
|
@@ -367,7 +370,7 @@ one breaks a planner's sheet.
|
|
|
367
370
|
|
|
368
371
|
## Word-separator style — pick one per project, never mix
|
|
369
372
|
|
|
370
|
-
There are **two valid ways** to write multi-word identifiers in Farseer.
|
|
373
|
+
There are **two valid ways** to write multi-word identifiers in Farseer. They are two valid, **different** names — `BS_Analytics` and `"BS Analytics"` are two different dims on the platform (nothing turns `_` into a space; the CLI's name lookup ignores only case and surrounding spaces) — and they form two different conventions. The core convention: **a project commits to one style for the whole model and never mixes them.**
|
|
371
374
|
|
|
372
375
|
### Style A — spaces, quoted
|
|
373
376
|
|
|
@@ -24,6 +24,7 @@ Examples write a variable as `"Name" [Table, …] = formula`: its name, its tabl
|
|
|
24
24
|
| Stored? | No — sparse, costs nothing | Yes — materialized, costs a cell |
|
|
25
25
|
| In a SUM rollup | Treated as 0 (ignored) | Treated as 0 (counted as a populated cell) |
|
|
26
26
|
| In a `× multiply` | `value × null = null` (stays sparse) | `value × 0 = 0` (sows a 0) |
|
|
27
|
+
| As the numerator of a `÷` | `null / x = 0` — **a materialised cell**, unlike `x × null = null`; operand order changes the cell count (measured 2026-11-09, [`formula-grain-alignment.md` §4](formula-grain-alignment.md#coarse-branch-allocation)) | `0 / x = 0` |
|
|
27
28
|
| Meaning | "no data here" | "the value here is exactly zero" |
|
|
28
29
|
|
|
29
30
|
The arithmetic result of a SUM is identical either way — which is exactly why the
|
|
@@ -155,11 +156,14 @@ correct" reads as if the problem were the zero. It isn't — **the problem is
|
|
|
155
156
|
OPERAND POSITION**: a reference consulted only inside `hasValue()` contributes
|
|
156
157
|
no coordinates, whatever the default is. Restate the rule as: **never take a
|
|
157
158
|
default through `hasValue()`**. With a non-zero default the error is silent
|
|
158
|
-
and expensive — the missing cells null a downstream product, and
|
|
159
|
-
default is coarser than an operand carrying
|
|
160
|
-
cell of its own: it contributes its value
|
|
159
|
+
and expensive — the missing cells null a downstream product, and, with
|
|
160
|
+
Optimize calculation on, where the default is coarser than an operand carrying
|
|
161
|
+
the whole grain, it never gets a cell of its own: it contributes its value
|
|
162
|
+
only on that operand's cells
|
|
161
163
|
([`formula-grain-alignment.md` §4](formula-grain-alignment.md), measured
|
|
162
|
-
2026-10-03).
|
|
164
|
+
2026-10-03). The condition-position rule holds with the flag on or off; the
|
|
165
|
+
coarse-default part does not apply with it off
|
|
166
|
+
([the v7 rule](formula-grain-alignment.md#optimize-calculation-v7)).
|
|
163
167
|
|
|
164
168
|
**Measured:** a boundary-month weight moved to a sparse planner input, read
|
|
165
169
|
through `if(hasValue(fraction), fraction, 1)`, materialised the weight on about
|
|
@@ -215,8 +219,10 @@ purpose lift, which is where the phantom-zero cost shows up.
|
|
|
215
219
|
|
|
216
220
|
`cumsum("A" + "B" - "C")` computes **correctly** and still leaves **no cells**
|
|
217
221
|
on part of its grain. The balance reads empty at addresses where the inputs
|
|
218
|
-
plainly exist
|
|
219
|
-
|
|
222
|
+
plainly exist. You can't cross-check it ad hoc either: the evaluator refuses
|
|
223
|
+
`cumsum(…)` and `delay(…)` (HTTP 400 with code `Unknown` and the function's name as the message, measured 2026-11-09),
|
|
224
|
+
so compare against a stored scratch variable that takes the name form. Nothing
|
|
225
|
+
errors, nothing logs. To a reviewer it
|
|
220
226
|
looks like "the planner hasn't entered data yet"; to the client it looks like
|
|
221
227
|
the model is wrong.
|
|
222
228
|
|
|
@@ -249,11 +255,10 @@ import job can change these numbers without any model change.
|
|
|
249
255
|
|
|
250
256
|
Two consequences worth internalising:
|
|
251
257
|
|
|
252
|
-
- **Inline evaluation cannot confirm that a stored variable works.**
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
above, reached from a different direction.
|
|
258
|
+
- **Inline evaluation cannot confirm that a stored variable works.** For a
|
|
259
|
+
time-series function it can't run at all: the evaluator refuses `cumsum` and
|
|
260
|
+
`delay` (see above). Check the stored variable's own cells, with a
|
|
261
|
+
scoped `farseer variable export` or a scratch variable on a dev or test copy.
|
|
257
262
|
- **The same rule applies to `delay()`**, and on the available evidence to any
|
|
258
263
|
function that redistributes a value across periods. For the **shift**
|
|
259
264
|
argument it is measured (2026-10-15 on a sandbox tenant): `delay(Base,
|
|
@@ -300,6 +305,20 @@ Same build: a few hundred thousand cells, and the full recalc finished in tens o
|
|
|
300
305
|
and do it first on a **pinned probe** — one member, one version, one year, a few
|
|
301
306
|
thousand cells at worst — so a wrong hypothesis cannot take the tenant down.
|
|
302
307
|
|
|
308
|
+
⚠ **With Optimize calculation off the carrier still narrows the product — a
|
|
309
|
+
summand without it does not.** Measured 2026-11-10 on a sandbox tenant (v7): a
|
|
310
|
+
product with a coarse factor stored the full-grain factor's cells with the flag
|
|
311
|
+
off as with it on (`x * null` stays empty), in the same time — the engine-source
|
|
312
|
+
prediction that `Rate eff` and `Rate Factor` would land on the whole cross did
|
|
313
|
+
not show. What the flag off widens is a coarse **summand**: a term added
|
|
314
|
+
without the carrier, `… * "Qty Anchor" + "Surcharge"` with
|
|
315
|
+
`Surcharge [Customer, Years]`, puts the surcharge on every item-month
|
|
316
|
+
(`null + x` is `x`). Keep every term of a head on the carrier, and count a head
|
|
317
|
+
with a coarse summand on the pinned probe before it is pushed with the flag off
|
|
318
|
+
— the v7 rule,
|
|
319
|
+
[`formula-grain-alignment.md`](formula-grain-alignment.md#optimize-calculation-v7),
|
|
320
|
+
"A coarse summand fills the grain".
|
|
321
|
+
|
|
303
322
|
## Validation gotcha — you cannot eyeball this inline
|
|
304
323
|
|
|
305
324
|
An inline evaluation of `sum(gt(x, 0))` computes on the **aggregate** (it returns
|
|
@@ -3,7 +3,7 @@ name: farseer-build-pipeline
|
|
|
3
3
|
description: >-
|
|
4
4
|
Use when the user asks to build, design, extend, fix or review a recurring data pipeline into a Farseer model — an ETL / integration / data feed / scheduled import from an ERP, database, file drop, SharePoint, Drive, HubSpot or SAP, or anything described in bronze / silver / gold layers. All NEW recurring imports are Simple Pipelines (folders of dataset YAML run by `farseer pipeline`), even when TypeScript is asked for. Adds recommendations on top of the CLI's own pipeline-authoring guide — ETL and load as separate pipelines, period-keyed gold, reconciliation before load, locked `IMPORT_` targets, scope labels, sandbox first. Does NOT cover maintaining an existing TypeScript import app (use `farseer-app-dev` + `farseer-author-import-job`) or one-off test seeding. Triggers (match by MEANING, in ANY language): "build a pipeline", "set up the integration", "bronze silver gold", "import from the ERP every month", "the pipeline run failed".
|
|
5
5
|
metadata:
|
|
6
|
-
version: "
|
|
6
|
+
version: "2"
|
|
7
7
|
domain: modeling
|
|
8
8
|
minimum-cli: "1.14.2"
|
|
9
9
|
engine-profile: "3.3"
|
|
@@ -100,6 +100,41 @@ the month list is wrapped in `cartesian_product`.
|
|
|
100
100
|
| **gold** | One row per target cell; columns are exactly what the load maps. `custom__unique_composite` over the coordinates (the import sums duplicates), `not_null` on coordinates and values, `isin` on the period column. Send a known zero as `0`. |
|
|
101
101
|
| **load** | Thin. One `cells` entry per variable. Labels `[<subject>, <version>, <period>, <measure>]` — two entries with the same labels undo each other. `overwrite_cells: true` + `undo_previous: true`. Versions pinned with `fixed_dimension_members`. `create_missing_members: false` unless the client decided otherwise for that dimension; a created member is permanent. Never load into a formula variable. |
|
|
102
102
|
|
|
103
|
+
### 3a. Rule tables the users maintain — on dimension tables
|
|
104
|
+
|
|
105
|
+
A rule table (a flag per member, a sign, a number of days, an exception with
|
|
106
|
+
validity dates) can live on dimension tables: TEXT / NUMBER / DATE attribute
|
|
107
|
+
columns plus FK connections to small value tables (a dropdown in the sheet). A
|
|
108
|
+
Simple Pipelines dimension load creates the columns and fills them (so does
|
|
109
|
+
`POST /entities/mutate`, as the `farseer-model` skill shows), and the
|
|
110
|
+
pipeline reads them back with a `source: dimensions` extract.
|
|
111
|
+
Take the grammar from the CLI guide (`farseer pipeline guide --topic DimensionTablesConfig`,
|
|
112
|
+
`--topic FarseerDimensionsExtractConfig`), not from a YAML written for engine
|
|
113
|
+
3.0: the current CLI splits every extract into `<name>_raw` and a `type: parse`
|
|
114
|
+
step.
|
|
115
|
+
|
|
116
|
+
- **An FK cannot be empty on load** (`Connection column '…' contains N empty
|
|
117
|
+
value(s)`): map "no value" to one sentinel member per value table, named the
|
|
118
|
+
same way in every table (such as `NULL (<Table>)`), never an ad-hoc
|
|
119
|
+
"(empty)" member.
|
|
120
|
+
- **Add only new members, keep user edits:** anti-join the source list against
|
|
121
|
+
the extract and load the difference with `delete_missing: false`.
|
|
122
|
+
- **`delete_missing` applies to every table in that load step:** a table
|
|
123
|
+
replaced on every run (a warnings list) gets a step of its own.
|
|
124
|
+
|
|
125
|
+
### 3b. Periods on a financial year that does not start in January
|
|
126
|
+
|
|
127
|
+
Simple Pipelines always send `ignore_financial_year_offset=True` (the
|
|
128
|
+
loader, `farseer_simple_pipelines/load/farseer.py`), so a pipeline writes
|
|
129
|
+
every period **as named**. Read the tenant's starting month S (`GET
|
|
130
|
+
/settings` → `financial_year_starting_month`). With S ≠ 1, a source with
|
|
131
|
+
calendar dates is converted to fiscal periods in the pipeline, in silver,
|
|
132
|
+
before gold: fiscal month = calendar month − (S − 1), plus 12 and the year
|
|
133
|
+
minus one when that is 0 or less — for a month date, the date moved back
|
|
134
|
+
S − 1 months. Rows that already carry the tenant's own periods need nothing.
|
|
135
|
+
Platform fact and a probe:
|
|
136
|
+
[`import-job-pattern.md` §6](../farseer-author-import-job/import-job-pattern.md#6-financial-year-an-import-job-maps-calendar-periods-to-fiscal-ones).
|
|
137
|
+
|
|
103
138
|
### 4. Arguments and secrets
|
|
104
139
|
|
|
105
140
|
- `main.py` checks every argument and writes back one canonical spelling
|
|
@@ -12,6 +12,14 @@ name, code and number in it is made up.
|
|
|
12
12
|
| **Targets** | `IMPORT_Revenue`, `IMPORT_Quantity`, both `{ Product, Customer, Versions, Years, Months } @readonly` |
|
|
13
13
|
| **Arguments** | `FROM_MONTH`, `TO_MONTH` (`YYYY-MM`, inclusive; both empty = previous month), `ERP_DB_URL` (secret, ETL only) |
|
|
14
14
|
|
|
15
|
+
**Financial year.** The ETL maps calendar invoice dates to a month
|
|
16
|
+
(`date_trunc('month', invoice_date)` in silver), and Simple Pipelines write
|
|
17
|
+
every period as named (`ignore_financial_year_offset=True`). That is right on
|
|
18
|
+
a tenant whose financial year starts in January. On any other tenant,
|
|
19
|
+
convert first: move the month back by S − 1 months in silver, before gold,
|
|
20
|
+
where S is the tenant's starting month
|
|
21
|
+
([`import-job-pattern.md` §6](../../farseer-author-import-job/import-job-pattern.md#6-financial-year-an-import-job-maps-calendar-periods-to-fiscal-ones)).
|
|
22
|
+
|
|
15
23
|
## Two pipelines, one subject
|
|
16
24
|
|
|
17
25
|
```
|
|
@@ -46,4 +46,4 @@ if not (args.get("ERP_DB_URL") or "").strip():
|
|
|
46
46
|
sys.exit("ERP_DB_URL is not set: add it to the job as a secret argument")
|
|
47
47
|
os.environ["FARSEER_ARGS"] = json.dumps(args)
|
|
48
48
|
|
|
49
|
-
run_pipeline(store_type=StoreType.DATASETS, pipeline_policy=PipelinePolicy()
|
|
49
|
+
run_pipeline(store_type=StoreType.DATASETS, pipeline_policy=PipelinePolicy())
|
|
@@ -41,4 +41,4 @@ if args["TO_MONTH"] < args["FROM_MONTH"]:
|
|
|
41
41
|
sys.exit(f"TO_MONTH {args['TO_MONTH']} is before FROM_MONTH {args['FROM_MONTH']}")
|
|
42
42
|
os.environ["FARSEER_ARGS"] = json.dumps(args)
|
|
43
43
|
|
|
44
|
-
run_pipeline(store_type=StoreType.DATASETS, pipeline_policy=PipelinePolicy()
|
|
44
|
+
run_pipeline(store_type=StoreType.DATASETS, pipeline_policy=PipelinePolicy())
|
|
@@ -41,12 +41,15 @@ single printed line. **Test this rather than assuming it:** break the report
|
|
|
41
41
|
module at import time on purpose and confirm the job still ends `ERROR` with
|
|
42
42
|
its *original* message plus one `Error report unavailable (…)` line.
|
|
43
43
|
|
|
44
|
-
### 3. There is no PDF library in the runner image
|
|
45
|
-
|
|
46
|
-
No `reportlab`, `fpdf`, `weasyprint`, `PIL
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
### 3. There is no PDF library in the Python runner image
|
|
45
|
+
|
|
46
|
+
No `reportlab`, `fpdf`, `weasyprint`, `PIL`: the Python image carries the
|
|
47
|
+
Farseer client and little else. Write PDF 1.4 bytes directly over the base-14
|
|
48
|
+
fonts (objects + xref, Helvetica / Helvetica-Bold / Courier, `/WinAnsi`
|
|
49
|
+
encoding). It is less work than it sounds and it removes a dependency the
|
|
50
|
+
image will not give you. The **TypeScript** runner is different: it ships
|
|
51
|
+
`pdfkit` and `pdfmake`, so a TypeScript app uses those
|
|
52
|
+
([`deploying-a-farseer-app.md`](../farseer-author-import-job/deploying-a-farseer-app.md#what-the-runner-image-has)).
|
|
50
53
|
|
|
51
54
|
### 4. 🔐 `FARSEER_ARGS` is UNMASKED inside the app process
|
|
52
55
|
|
|
@@ -3,7 +3,7 @@ name: farseer-modify-model
|
|
|
3
3
|
description: >-
|
|
4
4
|
How to change a Farseer model that is already in use without breaking it: decide the risk tier, snapshot the model and resolve drift first, find what consumes the change (OUT variables, sheets, apps, other tenants), keep OUT interfaces stable, backtest against the snapshot, and promote dev → test → production with a rollback point. Use when the user asks to change, fix, refactor or extend an existing model or a variable's grain, formula or properties, or asks what a change would affect or how risky it is. The farseer-model skill covers how to write the change.
|
|
5
5
|
metadata:
|
|
6
|
-
version: "
|
|
6
|
+
version: "2"
|
|
7
7
|
domain: modeling
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -62,7 +62,7 @@ This snapshot is **both** the rollback point and the backtest baseline. Without
|
|
|
62
62
|
**What makes a snapshot a baseline:**
|
|
63
63
|
|
|
64
64
|
- **It includes formulas.** A read where every variable comes back without a formula is a failed read, not a baseline: the first model read on a cold tenant can return `formula: null` for every variable. Read again, and count the formulas before you trust the file.
|
|
65
|
-
- **It is a full read.** If the command prints `/model/export failed …; falling back to initTagMap`, the CLI read the model another way, without fixed members, notes, folder or `
|
|
65
|
+
- **It is a full read.** If the command prints `/model/export failed …; falling back to initTagMap`, the CLI read the model another way, without fixed members, notes, folder, `zConstraint` or `optimizeCalculation` (every `members` empty, no `zConstraint` or `optimizeCalculation` field): it is not a baseline. Read again.
|
|
66
66
|
- **Structure only — never cell data.** Values belong in the backtest (step 3), not in the snapshot.
|
|
67
67
|
- **Never overwrite a dated snapshot** with the same label — add a suffix (`-v2`) instead.
|
|
68
68
|
- **Diff it against the previous snapshot by category** when the diff is large: new variables, removed variables (flag these as potential breakage), changed formulas, new / removed / changed tables, and new / removed FK links (graph-shape changes — high impact).
|
|
@@ -110,6 +110,7 @@ Make the change on the **dev** tenant, through the `farseer-model` skill. Never
|
|
|
110
110
|
|
|
111
111
|
**Performance checklist before push** — quick self-check on any new/changed formula, not a full triage pass:
|
|
112
112
|
|
|
113
|
+
- Every new formula variable has Optimize calculation off (`optimizeCalculation: false`; [the v7 rule](../farseer-build-model/formula-grain-alignment.md#optimize-calculation-v7)). A delivered formula variable the change touches that still has the flag on (`"optimizeCalculation": true` in `farseer model --json`) is switched in the same change — count its cells per version before and after on dev, and have the user confirm the amounts that change. Switch in batches, never the whole model in one update, and check the tenant still answers after each batch: one bulk toggle stopped a development tenant until support undid it. Count a variable with a coarse summand on a pinned probe before switching it — with the flag off that summand lands on every member of the dimensions it lacks.
|
|
113
114
|
- Broadcasting onto `Versions`? Use a condition (`if(eq(carrier, 1), X)`), never a product (`X * carrier`) — a cost difference of tens of times (the two are equal only when the carrier holds `1` or null, never a stored `0`), [`formula-grain-alignment.md` §7](../farseer-build-model/formula-grain-alignment.md#7--avoid-it-at-the-start-design-time-performance-rules).
|
|
114
115
|
- Never combine a `Versions` broadcast and an FK hop in one product — split them.
|
|
115
116
|
- Lifting a coarse operand across an FK hop and the result must stay sparse? `if(hasValue(X), X)`, not `0 + X` (phantom zeros — [`sparse-formulas-pattern.md`](../farseer-build-model/sparse-formulas-pattern.md)).
|
|
@@ -241,9 +241,17 @@ answer three questions **in this order**.
|
|
|
241
241
|
member, the variable is read at a shared FK descendant and returns the
|
|
242
242
|
intersection (measured 2026-10-17) — read a one-sided roll-up there instead.
|
|
243
243
|
|
|
244
|
-
**A cross-version reference needs no special form
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
**A cross-version reference needs no special form — with Optimize
|
|
245
|
+
calculation off.** With the flag off, the v7 rule for every formula variable
|
|
246
|
+
([`formula-grain-alignment.md`](../farseer-build-model/formula-grain-alignment.md#optimize-calculation-v7)),
|
|
247
|
+
`sum(V, Versions > "Plan")` from inside another version works in any
|
|
248
|
+
position. With the flag on it places no cell next to an operand that carries
|
|
249
|
+
the variable's full grain: in `if(<cond>, sum("Src", "Versions" > "Actual"),
|
|
250
|
+
"Drv" * 2)` only `Drv`'s cells existed, 4 of 17, and two such pinned terms lost
|
|
251
|
+
the same cells; a helper holding only the pinned reference, read by the
|
|
252
|
+
consumer, gave all 17 (measured 2026-11-10 on a sandbox tenant). The earlier
|
|
253
|
+
probe (2026-10-15: sole term, inside `if()`, inside a sum) read values where
|
|
254
|
+
cells already existed, so it could not see the loss. The one null
|
|
247
255
|
measured: a variable with rollup FORMULA read at a single version — a
|
|
248
256
|
FORMULA-rollup ratio of two cross-version references returned its value
|
|
249
257
|
unpinned and `null` under `Versions > "Plan"` and under the forecast
|