farseer-cli 1.19.0 → 1.20.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 +31 -8
- package/dist/commands/app.js +42 -3
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/cells.js +120 -85
- package/dist/commands/cells.js.map +1 -1
- package/dist/commands/dashboards.js +246 -12
- package/dist/commands/dashboards.js.map +1 -1
- package/dist/commands/dimensions.js +52 -27
- package/dist/commands/dimensions.js.map +1 -1
- package/dist/commands/docs.js +82 -0
- package/dist/commands/docs.js.map +6 -0
- package/dist/commands/files.js +49 -0
- package/dist/commands/files.js.map +2 -2
- package/dist/commands/folders.js +76 -0
- package/dist/commands/folders.js.map +6 -0
- package/dist/commands/formula.js +38 -30
- package/dist/commands/formula.js.map +1 -1
- package/dist/commands/install.js +32 -30
- package/dist/commands/install.js.map +2 -2
- package/dist/commands/model.js +30 -5
- package/dist/commands/model.js.map +2 -2
- package/dist/commands/push.js +5 -3
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/sheets.js +289 -52
- package/dist/commands/sheets.js.map +1 -1
- package/dist/commands/skills.js +157 -0
- package/dist/commands/skills.js.map +6 -0
- package/dist/commands/variables.js +246 -82
- package/dist/commands/variables.js.map +1 -1
- package/dist/index.js +93 -13
- package/dist/index.js.map +1 -1
- package/dist/mcp/resources/documentation.js +19 -12
- package/dist/mcp/resources/documentation.js.map +1 -1
- package/dist/mcp/tools/appTools.js +1 -7
- package/dist/mcp/tools/appTools.js.map +1 -1
- package/dist/mcp/tools/cellTools.js +6 -19
- package/dist/mcp/tools/cellTools.js.map +1 -1
- package/dist/mcp/tools/dashboardTools.js +30 -412
- package/dist/mcp/tools/dashboardTools.js.map +2 -2
- package/dist/mcp/tools/dataTools.js +15 -146
- package/dist/mcp/tools/dataTools.js.map +1 -1
- package/dist/mcp/tools/folderTools.js +12 -78
- package/dist/mcp/tools/folderTools.js.map +1 -1
- package/dist/mcp/tools/modelTools.js +23 -372
- package/dist/mcp/tools/modelTools.js.map +1 -1
- package/dist/mcp/tools/pipelineContract.js +5 -1
- package/dist/mcp/tools/pipelineContract.js.map +1 -1
- package/dist/mcp/tools/runTools.js +8 -69
- package/dist/mcp/tools/runTools.js.map +1 -1
- package/dist/mcp/tools/sheetTools.js +14 -264
- package/dist/mcp/tools/sheetTools.js.map +1 -1
- package/dist/mcp/tools/syncTools.js +5 -1
- package/dist/mcp/tools/syncTools.js.map +1 -1
- package/dist/mcp/utils/operationResponse.js +41 -0
- package/dist/mcp/utils/operationResponse.js.map +6 -0
- package/dist/operations/cells.js +444 -0
- package/dist/operations/cells.js.map +6 -0
- package/dist/operations/dashboards.js +357 -0
- package/dist/operations/dashboards.js.map +6 -0
- package/dist/operations/data.js +206 -0
- package/dist/operations/data.js.map +6 -0
- package/dist/operations/errors.js +64 -0
- package/dist/operations/errors.js.map +6 -0
- package/dist/operations/exportModel.js +59 -0
- package/dist/operations/exportModel.js.map +6 -0
- package/dist/operations/folderPath.js +128 -0
- package/dist/operations/folderPath.js.map +6 -0
- package/dist/operations/folders.js +80 -0
- package/dist/operations/folders.js.map +6 -0
- package/dist/operations/install.js +109 -0
- package/dist/operations/install.js.map +6 -0
- package/dist/operations/model.js +271 -0
- package/dist/operations/model.js.map +6 -0
- package/dist/operations/sheets.js +428 -0
- package/dist/operations/sheets.js.map +6 -0
- package/dist/pipeline/failStep.js +43 -0
- package/dist/pipeline/failStep.js.map +6 -0
- package/dist/pipeline/generated-reference.json +10 -10
- package/dist/pipeline/queryWorker.js +3 -1
- package/dist/pipeline/queryWorker.js.map +1 -1
- package/dist/pipeline/requests.js +3 -32
- package/dist/pipeline/requests.js.map +1 -1
- package/dist/pipeline/service.js +46 -2
- package/dist/pipeline/service.js.map +1 -1
- package/dist/services/appSyncService.js +59 -9
- package/dist/services/appSyncService.js.map +1 -1
- package/dist/services/apps.js +10 -0
- package/dist/services/apps.js.map +1 -1
- package/dist/services/farseerService.js +28 -6
- package/dist/services/farseerService.js.map +1 -1
- package/dist/skills/bundled.js +106 -0
- package/dist/skills/bundled.js.map +6 -0
- package/dist/skills/install.js +257 -0
- package/dist/skills/install.js.map +6 -0
- package/dist/skills/pipeline.js +10 -18
- package/dist/skills/pipeline.js.map +1 -1
- package/dist/utils/agentSandbox.js +1 -1
- package/dist/utils/entityResolver.js +72 -25
- package/dist/utils/entityResolver.js.map +1 -1
- package/dist/utils/errorFormatter.js +13 -0
- package/dist/utils/errorFormatter.js.map +1 -1
- package/dist/utils/formulaFilters.js +11 -2
- package/dist/utils/formulaFilters.js.map +1 -1
- package/dist/utils/operationCli.js +102 -0
- package/dist/utils/operationCli.js.map +6 -0
- package/docs/cli-guide.md +181 -1
- package/docs/pipeline-reference.md +13 -7
- package/docs/troubleshooting.md +18 -0
- package/package.json +1 -1
- package/skills/farseer-app-dev/SKILL.md +131 -0
- package/skills/farseer-app-dev/assignments.md +185 -0
- package/skills/farseer-app-dev/farseer-client-api-guide.md +907 -0
- package/skills/farseer-app-dev/farseer-client-release-notes.md +212 -0
- package/skills/farseer-app-dev/working-patterns.md +876 -0
- package/skills/farseer-authenticate-to-tenant/SKILL.md +60 -0
- package/skills/farseer-authenticate-to-tenant/app-authentication.md +91 -0
- package/skills/farseer-author-import-job/SKILL.md +114 -0
- package/skills/farseer-author-import-job/cell-writes.md +530 -0
- package/skills/farseer-author-import-job/deploying-a-farseer-app.md +383 -0
- package/skills/farseer-author-import-job/import-job-pattern.md +232 -0
- package/skills/farseer-build-model/SKILL.md +122 -0
- package/skills/farseer-build-model/formula-grain-alignment.md +612 -0
- package/skills/farseer-build-model/naming-conventions.md +435 -0
- package/skills/farseer-build-model/sparse-formulas-pattern.md +330 -0
- package/skills/farseer-build-pipeline/SKILL.md +190 -0
- package/skills/farseer-build-pipeline/erp-sales/README.md +108 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/bronze/erp_sales_invoice_lines.yaml +23 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/bronze/erp_sales_invoice_lines_raw.yaml +23 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/bronze/erp_sales_item_product_map.yaml +17 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/bronze/erp_sales_item_product_map_raw.yaml +11 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/gold/erp_sales_cells.yaml +40 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/silver/erp_sales_lines.yaml +35 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/silver/erp_sales_recon.yaml +43 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/Models/silver/erp_sales_unmapped_items.yaml +28 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-etl/main.py +49 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-load/Models/in/erp_sales_cells.yaml +17 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-load/Models/in/erp_sales_cells_raw.yaml +14 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-load/Models/load/erp_sales_to_model.yaml +47 -0
- package/skills/farseer-build-pipeline/erp-sales/erp-sales-load/main.py +44 -0
- package/skills/farseer-build-pipeline/erp-sales/item_to_product.csv +5 -0
- package/skills/farseer-build-pipeline/pipeline-app-failure-report-pattern.md +103 -0
- package/skills/farseer-build-pipeline/pipeline-source-encoding.md +68 -0
- package/skills/farseer-dashboards/SKILL.md +1 -1
- package/skills/farseer-help-center/SKILL.md +66 -0
- package/skills/farseer-modify-model/SKILL.md +158 -0
- package/skills/farseer-modify-model/model-validation-pattern.md +251 -0
- package/skills/farseer-optimize-model/SKILL.md +314 -0
- package/skills/farseer-optimize-model/stats-dump.ts +139 -0
- package/skills/farseer-pnl/SKILL.md +220 -0
- package/skills/farseer-review-model/SKILL.md +172 -0
- package/skills/farseer-run-apps/SKILL.md +102 -0
- package/skills/pipeline-authoring/SKILL.md +4 -4
- package/skills/pipeline-authoring/practices.md +15 -3
- package/dist/services/agentApprovalFetch.js +0 -90
- package/dist/services/agentApprovalFetch.js.map +0 -6
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
# Naming Conventions
|
|
2
|
+
|
|
3
|
+
These are recommended conventions for naming variables, folders and tables, not platform rules: the platform enforces only `readonly`. A review checks the core conventions and mentions the suggestions as advice.
|
|
4
|
+
|
|
5
|
+
Examples write a variable as `"Name" [Table, …] = formula`: its name, its tables in brackets (a fixed member as `Table = Member`), then its formula; properties such as `readonly`, `folder:` and `notes:` go on the lines below.
|
|
6
|
+
|
|
7
|
+
## Core conventions
|
|
8
|
+
|
|
9
|
+
The conventions below are written in the space-separated style (` IN`, ` OUT`, `"IMPORT …"`). A project that uses underscores writes the same markers as `_IN`, `_OUT`, `IMPORT_` — both styles are accepted, one per project, never mixed ([Word-separator style](#word-separator-style--pick-one-per-project-never-mix)).
|
|
10
|
+
|
|
11
|
+
### 1. `IMPORT` prefix for imported variables
|
|
12
|
+
|
|
13
|
+
All variables loaded from source systems carry the `IMPORT` prefix and live in a folder named `IMPORT`:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
"IMPORT Contracted Gross Salary" [Position_Actual, Years, Months]
|
|
17
|
+
folder: IMPORT
|
|
18
|
+
readonly
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The folder is named in capitals on purpose: `IMPORT` is a classifier, and the
|
|
22
|
+
capitals make the import layer stand out in the tree. It is the one exception to
|
|
23
|
+
the PascalCase folder rule below. A project that already uses `Import` keeps it —
|
|
24
|
+
it is not a defect, and is not worth a rename.
|
|
25
|
+
|
|
26
|
+
### 2. ` IN` suffix for planner-writable variables
|
|
27
|
+
|
|
28
|
+
Variables that planners enter values into end with a space-separated ` IN`. Because of the space, they must be quoted in formulas:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
"Sales Volume IN" [Product, Versions, Years, Months]
|
|
32
|
+
notes: "Planner input: monthly sales volume"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
> **Variable text goes in the notes, not the description.** See §2a below — this is a
|
|
36
|
+
> change from the earlier rule, and it applies to every creation path.
|
|
37
|
+
|
|
38
|
+
**Anti-pattern — a formula-driven variable keeping the ` IN` suffix.** ` IN` denotes a
|
|
39
|
+
*stored, planner-writable* cell with **no formula**. A variable that has a formula — even a
|
|
40
|
+
trivial pass-through of an `IMPORT` variable — but keeps the ` IN` suffix is convention drift:
|
|
41
|
+
the suffix has quietly shifted meaning from "the planner writes here" to "this is the input
|
|
42
|
+
layer of the engine", and a reader (human or AI agent) will treat it as safe to blank-and-reseed
|
|
43
|
+
the way a real input is, which corrupts a value that actually gets recomputed on every run. If a
|
|
44
|
+
planner needs to be able to override a value that's otherwise computed, don't attach ` IN` to the
|
|
45
|
+
computed variable — use the dedicated override pattern in rule #5 below, which generalizes past
|
|
46
|
+
the ETL case this rule was first written for.
|
|
47
|
+
|
|
48
|
+
**The one exception — a formula confined to the slice the planner does NOT own.**
|
|
49
|
+
"Has a formula" is a convenient test, not the real rule, and taken literally it
|
|
50
|
+
condemns a recommended pattern. An ` IN` may carry a formula
|
|
51
|
+
**when that formula writes only where the planner must not**, which in practice
|
|
52
|
+
means the Actual / FC-gated history slice:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
"<measure> IN" = if(eq("FC PASS BY INPUT", 1), "<measure> upstream")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
History months then show actuals in the input row, while the FC=0 cells stay
|
|
59
|
+
planner-owned and empty.
|
|
60
|
+
|
|
61
|
+
**The discriminator is ownership, not syntax: who owns the cells the planner is
|
|
62
|
+
allowed to write?**
|
|
63
|
+
|
|
64
|
+
| Shape | Planner owns | Verdict |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| `X IN = "IMPORT …"` — pass-through, every cell computed | **nothing** | drift. It is an output with an input's name. Drop the ` IN`. |
|
|
67
|
+
| `X IN = if(eq("FC PASS BY INPUT", 1), …)` — Actual-seed | the FC=0 cells | a genuine input. Keep the ` IN`. |
|
|
68
|
+
|
|
69
|
+
So the test is not "does it have a formula" but "**is the formula fenced out of
|
|
70
|
+
the planner's own cells**". A formula that can write into a cell the planner is
|
|
71
|
+
expected to type in is the anti-pattern above, whatever it is named.
|
|
72
|
+
|
|
73
|
+
**Consequence for seeding and rebaseline tooling.** The convenient shortcut
|
|
74
|
+
"the seed set is every ` IN`" does not hold, and the fix is not to ban the
|
|
75
|
+
exception — it is to seed by CELL rather than by variable: the seed set is the
|
|
76
|
+
` IN` cells the planner owns (FC=0 / non-Actual), never the fenced slice. A tool
|
|
77
|
+
that reseeds a whole Actual-seed ` IN` will overwrite history the formula is
|
|
78
|
+
supposed to own.
|
|
79
|
+
|
|
80
|
+
### 2a. Variable text lives in the notes, never the description
|
|
81
|
+
|
|
82
|
+
A Farseer variable carries **two** text fields, and only one of them is safe
|
|
83
|
+
to put prose in:
|
|
84
|
+
|
|
85
|
+
| Field | API field | Where it shows up |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| description | `meta.description` | **next to the row name** on any sheet or tile using the "Name + Description" column |
|
|
88
|
+
| notes | `variable.notes` | the variable's detail view only |
|
|
89
|
+
|
|
90
|
+
**The rule: business meaning, source, owner and decision references go in
|
|
91
|
+
the notes. Leave the description empty on variables.**
|
|
92
|
+
|
|
93
|
+
**Why it is not a preference.** A sheet or tile must often show
|
|
94
|
+
"Name + Description", because otherwise dimension members render as bare
|
|
95
|
+
codes. In that column every row that is a variable prints its whole
|
|
96
|
+
description as the row label, so a real description — *"bare; seeded from …
|
|
97
|
+
(ADR-006)"* — becomes the row name and blows the column out. On the platform
|
|
98
|
+
there is no way around it: the tile-sheet column cannot be switched to "Name"
|
|
99
|
+
through the API, there is no text wrap, and shortening the description just
|
|
100
|
+
destroys the documentation. Confirmed with Farseer (2026-09-29): there is no
|
|
101
|
+
other fix.
|
|
102
|
+
|
|
103
|
+
Applies to **every** creation path — the API (`POST /entities/mutate`: `variable.notes`, **not**
|
|
104
|
+
`meta.description`), the CLI and the UI. `farseer variables create --description` sets the
|
|
105
|
+
description, so set notes through the API or the UI.
|
|
106
|
+
|
|
107
|
+
**A dimension MEMBER's description is a different thing** — it is the
|
|
108
|
+
member's display name — and stays exactly as it is.
|
|
109
|
+
|
|
110
|
+
> ⚠ **Clearing a description takes an explicit empty value — leaving the
|
|
111
|
+
> field out does nothing.** A write that sends `description: null` leaves the
|
|
112
|
+
> description as is (measured on a sandbox tenant). So moving prose to the
|
|
113
|
+
> notes by leaving the description out lands the notes and keeps the old
|
|
114
|
+
> description — the row label does not change and it looks as if the write
|
|
115
|
+
> failed. Send an empty description in the same change; once cleared,
|
|
116
|
+
> `farseer model --variable "<Name>"` prints no `Description:` line.
|
|
117
|
+
> Migrating a model: move `meta.description` → `variable.notes` (append below
|
|
118
|
+
> any existing notes rather than overwriting), clear the description on those
|
|
119
|
+
> variables, and prove nothing else moved with a `farseer model --json`
|
|
120
|
+
> snapshot taken before and after, diffed.
|
|
121
|
+
|
|
122
|
+
**No exception for control variables.** A control's message lives in the
|
|
123
|
+
check's **name** (the name is what a planner reads on the controls sheet);
|
|
124
|
+
its explanation goes in the notes like any other variable.
|
|
125
|
+
|
|
126
|
+
A review flags any description **with text** on a variable; an empty
|
|
127
|
+
description is the cleared form and is not a finding.
|
|
128
|
+
|
|
129
|
+
### 2b. Declare the CLASS, the input owner and the output consumer — at creation
|
|
130
|
+
|
|
131
|
+
Variables drift from their class — an ` OUT` on an intermediate step, an ` IN`
|
|
132
|
+
nothing writes to, a calculation nothing reads — because **nobody recorded who
|
|
133
|
+
fills the variable and who reads it**. Finding out afterwards is expensive —
|
|
134
|
+
names come from script configuration, the consumer may be on another tenant,
|
|
135
|
+
and manual channels are invisible in code. It is far cheaper to require it at
|
|
136
|
+
the point of creation.
|
|
137
|
+
|
|
138
|
+
**At creation — in a model file, on a sheet, or directly on the tenant — state three
|
|
139
|
+
things.**
|
|
140
|
+
|
|
141
|
+
**1. The class, and let the name follow it:**
|
|
142
|
+
|
|
143
|
+
| Class | Name | Formula | `readonly` |
|
|
144
|
+
|---|---|---|---|
|
|
145
|
+
| IMPORT | `IMPORT` prefix, `IMPORT` folder | never | yes |
|
|
146
|
+
| IN | ` IN` suffix, **at the very end** | see below | no |
|
|
147
|
+
| CALC | `CALC` — **recommended, not a gate** | yes | yes |
|
|
148
|
+
| OUT | ` OUT` suffix, **at the very end** | yes | yes |
|
|
149
|
+
|
|
150
|
+
` OUT` or ` IN` **in the middle** of a name (`… OUT EUR`, `… IN OVERRIDE`) is
|
|
151
|
+
not allowed: name the variant `… EUR OUT`, or it is a CALC. Reserve ` OUT` for
|
|
152
|
+
the real end of a chain toward the business — a report, a dashboard, another
|
|
153
|
+
tenant, something signed off — never for intermediate steps.
|
|
154
|
+
|
|
155
|
+
> **`CALC` is a recommendation, not a hard gate.** It reads well and makes the
|
|
156
|
+
> class visible, but an unmarked computed variable is not a convention
|
|
157
|
+
> violation the way a mislabelled ` OUT` is. Don't fail a review over it.
|
|
158
|
+
|
|
159
|
+
**2. The input owner — who writes it** (a script, an app, a planner on a named
|
|
160
|
+
sheet, a manual channel). Record it in the notes (§2a), not the description.
|
|
161
|
+
|
|
162
|
+
**3. The output consumer — who reads it.** A variable nothing reads is either
|
|
163
|
+
dead or undocumented, and you cannot tell which later.
|
|
164
|
+
|
|
165
|
+
> **An ` IN` may carry a formula beyond the Actual/forecast seed — but it owes
|
|
166
|
+
> a reason.** §2's exception covers a formula fenced out of the planner's own
|
|
167
|
+
> cells. Other cases do come up legitimately; when one does, the justification
|
|
168
|
+
> goes in the notes, and in a written design decision if the choice shapes the
|
|
169
|
+
> model rather than one variable. What is NOT acceptable is an unexplained
|
|
170
|
+
> formula on an ` IN`, because the next reader cannot tell a deliberate design
|
|
171
|
+
> from drift — which is exactly how naming drift starts.
|
|
172
|
+
|
|
173
|
+
### 3. ` OUT` suffix — reserved for the model's final outputs
|
|
174
|
+
|
|
175
|
+
Space-separated ` OUT` suffix, quoted in formulas, applied **only** to the final outputs delivered to the business — not to every intermediate helper variable. A typical model has a handful to a few dozen `OUT`-suffixed variables.
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
"PL TOTAL COST FINAL OUTPUT OUT" [Cost_Center, Versions, Years, Months] = ...
|
|
179
|
+
folder: HR Plan OUTPUT
|
|
180
|
+
readonly
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 4. Read-only rule — `readonly` on everything without ` IN`
|
|
184
|
+
|
|
185
|
+
Every variable **not** suffixed with ` IN` must carry `readonly`. This is what actually locks the variable against user writes in the Farseer platform — the naming convention signals intent, `readonly` enforces it.
|
|
186
|
+
|
|
187
|
+
- `IMPORT` variables → `readonly`
|
|
188
|
+
- Any derived / intermediate / calculated variable → `readonly`
|
|
189
|
+
- ` OUT` variables → `readonly`
|
|
190
|
+
- Only ` IN`-suffixed variables skip `readonly` (they are the writable ones).
|
|
191
|
+
|
|
192
|
+
### 5. `ADJUSTMENT_IN` / `_ADJUSTED` suffix for planner-correction overlays
|
|
193
|
+
|
|
194
|
+
When a planner needs to correct an imported value without re-running ETL, use the **overlay triplet** pattern: source / correction / adjusted. The three ROLES are mandatory; the spelling follows the project's word-separator style (see "Word-separator style" below). The examples here are in Style B (underscores) because that is how the reference implementation was written — in a Style A project the same triplet is `"IMPORT X"`, `"IMPORT X ADJUSTMENT IN"`, `"IMPORT X ADJUSTED"`. **Do not read `_IN` as the convention** — rule 2 is the convention, and in a Style A model a review flags `_IN`.
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
IMPORT_X # source — read-only, ETL target
|
|
198
|
+
IMPORT_X_ADJUSTMENT_IN # planner input — same grain as source
|
|
199
|
+
IMPORT_X_ADJUSTED = IMPORT_X + IMPORT_X_ADJUSTMENT_IN
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Rules:
|
|
203
|
+
|
|
204
|
+
- **Same grain across the triplet.** `_ADJUSTMENT_IN` and `_ADJUSTED` match the source IMPORT's grain exactly. This avoids mixed-grain `+` in the ADJUSTED formula.
|
|
205
|
+
- **The ` IN` role marker on the planner-writable** — combines with rule #2: the adjustment variable carries the planner-writable semantics (no `readonly`), spelled in the project's style.
|
|
206
|
+
- **`_ADJUSTED` on the consumer-facing var** — read-only (`readonly`), formula = `source + ADJUSTMENT_IN`. Bare `+` — null on either operand is treated as 0 (Farseer sparse semantics; never wrap in `if(hasValue, X, 0)`).
|
|
207
|
+
- **Wherever the source IMPORT was consumed, switch to `_ADJUSTED`** — that's the whole point of the triplet. The source remains in the model (preserved as audit trail), only downstream consumers point at the adjusted variant.
|
|
208
|
+
- **Adjustment layer is opt-in per measure.** Adjustment on Period activity is the common case (correcting Actual flow). Opening balance / Initial state rarely needs adjustment (one-time t=0 anchor); add the triplet only when a use case demands it.
|
|
209
|
+
|
|
210
|
+
**This override-via-`hasValue()` shape generalizes beyond the ETL `ADJUSTMENT_IN`/`_ADJUSTED`
|
|
211
|
+
triplet.** Any time a planner needs to override a value that is otherwise produced by a
|
|
212
|
+
formula — not only an ETL-imported one — the fix has the same shape: a dedicated, no-formula
|
|
213
|
+
` IN` override variable, joined via `if(hasValue(<override IN>), <override IN>, <computed
|
|
214
|
+
value>)`. Do **not** put the override capability on the computed variable itself by tacking
|
|
215
|
+
` IN` onto its name (that's exactly the convention-drift anti-pattern in rule #2 above). Two
|
|
216
|
+
synthetic examples of the same shape outside the ETL case:
|
|
217
|
+
|
|
218
|
+
```text
|
|
219
|
+
"FC_gate_effective" [...] =
|
|
220
|
+
if(hasValue("FC_gate_override_IN"), "FC_gate_override_IN", "FC_gate_default_CALC")
|
|
221
|
+
|
|
222
|
+
"Cost_allocation_factor_effective" [...] =
|
|
223
|
+
if(hasValue("Cost_allocation_factor_override_IN"), "Cost_allocation_factor_override_IN", "Cost_allocation_factor_CALC")
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
The computed variable (`FC_gate_default_CALC`, `Cost_allocation_factor_CALC`) stays
|
|
227
|
+
`readonly` and carries no ` IN` suffix; only the override variable carries ` IN` and skips
|
|
228
|
+
`readonly`. Keeping this boundary strict also pays off for any tooling that treats
|
|
229
|
+
"every ` IN` variable" as the seed set for a baseline/rebaseline operation — that shortcut only
|
|
230
|
+
holds when the convention is applied without exception; a formula-driven ` IN` variable breaks
|
|
231
|
+
it and forces manual per-variable triage instead.
|
|
232
|
+
|
|
233
|
+
### 6. Dimension table names — **retired:** `S_` / `D_` prefix no longer recommended
|
|
234
|
+
|
|
235
|
+
> **Status (2026-W23):** the previous mandatory rule (*"static dimension
|
|
236
|
+
> tables start with `S_`; dynamic tables start with `D_`"*) is **retired**.
|
|
237
|
+
> Name dimension tables by their business meaning — `Cost_Center`,
|
|
238
|
+
> `Product_Line`, `Sales_Region`, `Warehouse`, `Customer_Segment` —
|
|
239
|
+
> not `S_Cost_Center` / `D_Sales_Region`.
|
|
240
|
+
|
|
241
|
+
**How to apply:**
|
|
242
|
+
|
|
243
|
+
- New dimension tables: business name only (`Cost_Center`, not
|
|
244
|
+
`S_Cost_Center`).
|
|
245
|
+
- Existing models still using `S_…`: leave alone (renaming
|
|
246
|
+
dimensions is a structural change — only refactor if there's a
|
|
247
|
+
separate reason to touch that dim).
|
|
248
|
+
- "User must not edit manually" is communicated by who owns the maintaining
|
|
249
|
+
script + `readonly` on consuming variables, not by the table name.
|
|
250
|
+
|
|
251
|
+
A review never asks for the `S_` prefix.
|
|
252
|
+
|
|
253
|
+
## Suggestions
|
|
254
|
+
|
|
255
|
+
Good idioms to follow; a review mentions them as advice, never as a defect.
|
|
256
|
+
|
|
257
|
+
### Functional prefixes
|
|
258
|
+
|
|
259
|
+
Group variables by their **functional role**, not by folder name. Common patterns seen in production:
|
|
260
|
+
|
|
261
|
+
| Prefix | Meaning |
|
|
262
|
+
|---|---|
|
|
263
|
+
| `PL ` | Plan / calculated variable |
|
|
264
|
+
| `EL01x`, `EL02x`, … | Coded element variables (see *Coded element IDs* below for the block-numbering rule) |
|
|
265
|
+
| `ASS ` / `ASSG ` | Assumption / assumption by grade |
|
|
266
|
+
| `IMPORT ` | Imported from source — **this one is a core convention**, see above |
|
|
267
|
+
| `BS ` | Balance Sheet line variable |
|
|
268
|
+
| `FC ` | Forecast / version-routing flag |
|
|
269
|
+
|
|
270
|
+
### Coded element IDs (`EL###`) — block by category, code is the primary key
|
|
271
|
+
|
|
272
|
+
When a coded business taxonomy is replicated 1:1 into the model (members of an
|
|
273
|
+
`<Thing>_Elements` table and the variables keyed to them):
|
|
274
|
+
|
|
275
|
+
1. **Number in semantic blocks, not in a flat sequence.** The leading digit(s)
|
|
276
|
+
encode the element's *class*; trailing digits enumerate within the class;
|
|
277
|
+
leave gaps for future members — e.g. `EL01x` freight, `EL02x` warehousing,
|
|
278
|
+
`EL09x` derived allocations. Cell history keys on these IDs, so renumbering
|
|
279
|
+
is expensive; the gaps absorb growth.
|
|
280
|
+
2. **The code is the primary key; the descriptive name is an alias.** The label
|
|
281
|
+
rides along in the notes or a secondary column (never the description — §2a),
|
|
282
|
+
and pickers render `EL010 — Inbound freight` so both surfaces show. A stable
|
|
283
|
+
code keeps the member, the variable and the import mapping pointing at the
|
|
284
|
+
same thing across every rename and translation.
|
|
285
|
+
|
|
286
|
+
### Folder names — PascalCase, single word per node where possible
|
|
287
|
+
|
|
288
|
+
Folder names follow PascalCase regardless of which word-separator style the variables use — except the `IMPORT` folder, which is written in capitals (§1). For example `Variables/Scaffold/BS/Collectors/`, not
|
|
289
|
+
`Variables/Scaffold/BS/collectors/`.
|
|
290
|
+
|
|
291
|
+
Rationale: folder names are visible to the planner in the UI's tree navigator and read like noun-phrase headings ("Setup", "Forecast", "Collectors"), not like identifiers. Mixing PascalCase and lowercase in the same path looks like a typo and trains people to ignore folder structure as a meaningful signal.
|
|
292
|
+
|
|
293
|
+
Variable role markers (`_IN`, `_OUT`, the `IMPORT_` prefix) are **UPPERCASE**;
|
|
294
|
+
descriptive position markers (`_upstream`, `_override`, `_base`, `_change`,
|
|
295
|
+
`_state`) are **lowercase** noun fragments inside a snake_case body —
|
|
296
|
+
`BS_Closing_state_override_IN` lives in `Variables/Scaffold/BS/Plan/`.
|
|
297
|
+
|
|
298
|
+
### Folder name in the variable name — keep them in sync
|
|
299
|
+
|
|
300
|
+
When a variable lives in `Variables/<Domain>/<Subfolder>`, its name should start with the domain prefix:
|
|
301
|
+
|
|
302
|
+
```text
|
|
303
|
+
Variables/BS/Collectors → BS_Changes_Submodel_Collector
|
|
304
|
+
Variables/Setup/Forecast → FC_ONE_PASS_BY_INPUT
|
|
305
|
+
Variables/IMPORT → IMPORT_GL_Balances
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
The mapping isn't always one-to-one (sub-domains can share a prefix), but the rule is: looking at a name in isolation, you should be able to predict the folder. Looking at a folder, every variable inside should share the prefix. Any divergence is a refactor signal.
|
|
309
|
+
|
|
310
|
+
### `IMPORT_` prefix — reserved for direct ETL targets only
|
|
311
|
+
|
|
312
|
+
The `IMPORT_` prefix is reserved for variables where data **actually lands** from a source system. It's not a folder marker — it's a semantic marker for "this is the wire-format target of an ETL job; if cells exist here, an ETL run put them there".
|
|
313
|
+
|
|
314
|
+
Helpers and aggregators that *consume* an `IMPORT_` variable to feed downstream calculations are **not** themselves IMPORT variables — even if they live in or near the Import folder. They are calculations, and their name should reflect that.
|
|
315
|
+
|
|
316
|
+
**Wrong:**
|
|
317
|
+
|
|
318
|
+
```text
|
|
319
|
+
# Looks like an import, but it's actually a sum() of an import.
|
|
320
|
+
"IMPORT_GL_Actual_total" [GL_Analytics, ...] = sum("IMPORT_GL_Balances")
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**Right:**
|
|
324
|
+
|
|
325
|
+
```text
|
|
326
|
+
# Same calculation, name doesn't pretend it's an ETL target.
|
|
327
|
+
"GL_Actual_total_upstream" [GL_Analytics, ...] = sum("IMPORT_GL_Balances")
|
|
328
|
+
folder: Import/upstream
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### `_upstream` vs `_collector` — direction of data flow decides folder
|
|
332
|
+
|
|
333
|
+
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
|
+
| Suffix | Semantic | Folder |
|
|
336
|
+
| --- | --- | --- |
|
|
337
|
+
| `_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/`). |
|
|
338
|
+
| `_collector` | "I collect from upstream sources into myself." A variable that aggregates inputs from one or more submodels / manual entries / multiple feeders. The variable IS a destination. | Inside the statement's machinery folder — e.g. `Scaffold/BS/Plan/` for `BS_Changes_collector`. Sits where it's consumed, not under Import. |
|
|
339
|
+
|
|
340
|
+
### Descriptive names are fine
|
|
341
|
+
|
|
342
|
+
Variable names can be long and descriptive; brevity isn't a virtue. `"PL HC Ones For Period Of Work OUT"` is perfectly legitimate if that's what the variable computes.
|
|
343
|
+
|
|
344
|
+
### Notes on every non-trivial variable — recommended, NOT enforced
|
|
345
|
+
|
|
346
|
+
Every non-trivial variable should carry notes stating its **business
|
|
347
|
+
meaning**, not its mechanics — the formula already shows the mechanics.
|
|
348
|
+
`notes: "Planner input: monthly sales volume"` earns its keep; `notes: "sum of
|
|
349
|
+
PL_Rev by month"` does not. Record the input owner and output consumer here too
|
|
350
|
+
(§2b).
|
|
351
|
+
|
|
352
|
+
It is a **recommendation**. A review does not require it, nothing fails on its
|
|
353
|
+
absence, and missing notes are **not a defect** — surface it as advice, the
|
|
354
|
+
way *Constrained Light Top Down* is surfaced. Don't report a model as failing
|
|
355
|
+
review because variables lack notes, and don't bulk-add filler to clear a
|
|
356
|
+
checklist: a note that restates the name is worse than none, because it looks
|
|
357
|
+
like documentation while carrying no information.
|
|
358
|
+
|
|
359
|
+
Where it earns a reviewer's push: ` IN` variables (what is the planner being
|
|
360
|
+
asked for?), ` OUT` variables (what does this number mean to whoever reads the
|
|
361
|
+
statement?), and anything whose name is a coded ID (`EL0142`) rather than a
|
|
362
|
+
phrase.
|
|
363
|
+
|
|
364
|
+
**A description with text on a variable IS a defect**, unlike a missing note — see
|
|
365
|
+
§2a. That asymmetry is deliberate: an empty field costs documentation, a filled
|
|
366
|
+
one breaks a planner's sheet.
|
|
367
|
+
|
|
368
|
+
## Word-separator style — pick one per project, never mix
|
|
369
|
+
|
|
370
|
+
There are **two valid ways** to write multi-word identifiers in Farseer. Both are valid names, but they form two different conventions. The core convention: **a project commits to one style for the whole model and never mixes them.**
|
|
371
|
+
|
|
372
|
+
### Style A — spaces, quoted
|
|
373
|
+
|
|
374
|
+
Dim, variable, and member names use spaces. Anywhere the name appears in a formula it must be quoted:
|
|
375
|
+
|
|
376
|
+
```text
|
|
377
|
+
"BS Analytics" # table
|
|
378
|
+
"IMPORT GL Balances" # variable, IMPORT prefix
|
|
379
|
+
"BS Closing state OUT" # variable, OUT suffix
|
|
380
|
+
"PL Bonus IN" # variable, IN suffix
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
This is the more common style in production models.
|
|
384
|
+
|
|
385
|
+
### Style B — underscores, unquoted
|
|
386
|
+
|
|
387
|
+
Same names with `_` instead of space. No quotes needed anywhere:
|
|
388
|
+
|
|
389
|
+
```text
|
|
390
|
+
BS_Analytics # table
|
|
391
|
+
IMPORT_GL_Balances # variable, IMPORT prefix
|
|
392
|
+
BS_Closing_state_OUT # variable, OUT suffix
|
|
393
|
+
PL_Bonus_IN # variable, IN suffix
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
This style reads cleaner in code editors that don't render bold-quoted strings well, plays nicer with grep / IDE rename, and is preferred by teams coming from a software-engineering background.
|
|
397
|
+
|
|
398
|
+
### Pick one — and apply it everywhere
|
|
399
|
+
|
|
400
|
+
The choice is project-wide and includes:
|
|
401
|
+
|
|
402
|
+
- **Dimension names** (`BS_Analytics` vs `"BS Analytics"`)
|
|
403
|
+
- **Variable names** (`BS_Closing_state_OUT` vs `"BS Closing state OUT"`)
|
|
404
|
+
- **Dimension-table names** (`Cost_Center` vs `"Cost Center"`) — the `S_` / `D_` prefix itself is retired, §6; only the separator style is a choice here
|
|
405
|
+
- **`IMPORT` prefix** (`IMPORT_GL_Balances` vs `"IMPORT GL Balances"`)
|
|
406
|
+
- **` IN` / ` OUT` suffix** — write as `_IN` / `_OUT` if the rest of the variable uses underscores; write as space-separated ` IN` / ` OUT` (quoted) if the rest uses spaces. **Don't combine** `BS_Closing_state OUT` (mixed) — that's the violation this rule explicitly forbids.
|
|
407
|
+
- **Folder paths** — same style as the variable names (`BS / Core` for Style A; `BS/Core` for Style B).
|
|
408
|
+
|
|
409
|
+
### Why mixing is bad
|
|
410
|
+
|
|
411
|
+
A project that has dim `BS_Analytics` (underscore) and variable `"BS Closing state OUT"` (space) creates three concrete problems:
|
|
412
|
+
|
|
413
|
+
1. **Cognitive load** — readers can't predict whether they need quotes or not.
|
|
414
|
+
2. **Refactoring fragility** — `grep BS_Analytics` won't find `"BS Analytics"` references, and vice versa, making rename / find-usages incomplete.
|
|
415
|
+
3. **Cross-reference drift** — over time, formulas added by different authors pick different style, and the model develops permanent style debt that's painful to unify.
|
|
416
|
+
|
|
417
|
+
### Pre-existing tenant — match the tenant, don't introduce a third style
|
|
418
|
+
|
|
419
|
+
When a tenant already exists, its names show the style it uses. **Match that style for new variables and dims you add.** Don't introduce Style B in a Style A model just because you prefer it. If a project genuinely wants to migrate styles, do it as a single deliberate refactor (delete + recreate variables and dims under the new names), record why, and complete it before changing anything else.
|
|
420
|
+
|
|
421
|
+
## What a review checks vs suggests
|
|
422
|
+
|
|
423
|
+
| Check | Review |
|
|
424
|
+
|---|---|
|
|
425
|
+
| IMPORT variables in IMPORT folder | **Core** |
|
|
426
|
+
| ` IN` / ` OUT` suffix in the project's one style, at the very end of the name | **Core** |
|
|
427
|
+
| `readonly` on every non-` IN` variable | **Core** — `readonly` is what the platform enforces |
|
|
428
|
+
| A description with text on a variable | **Core** (§2a) |
|
|
429
|
+
| Functional prefix present (PL / EL / ASS …) | Suggestion |
|
|
430
|
+
| A folder set | Suggestion |
|
|
431
|
+
| Folder-prefix in variable name | Suggestion |
|
|
432
|
+
|
|
433
|
+
## Non-compliance
|
|
434
|
+
|
|
435
|
+
If a variable must break a core convention (rare — legacy integration name, vendor-imposed identifier), record the reason in its notes, so a review reads it as deliberate.
|