farseer-cli 1.18.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 +33 -10
- package/dist/commands/app.js +42 -3
- package/dist/commands/app.js.map +1 -2
- package/dist/commands/apps.js.map +0 -1
- package/dist/commands/cells.js +120 -85
- package/dist/commands/cells.js.map +1 -2
- package/dist/commands/code.js.map +0 -1
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/dashboards.js +246 -12
- package/dist/commands/dashboards.js.map +1 -2
- package/dist/commands/diff.js.map +0 -1
- package/dist/commands/dimensions.js +52 -27
- package/dist/commands/dimensions.js.map +1 -2
- 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 -3
- 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 -2
- package/dist/commands/install.js +32 -30
- package/dist/commands/install.js.map +2 -3
- package/dist/commands/list.js.map +0 -1
- package/dist/commands/login.js +3 -3
- package/dist/commands/login.js.map +1 -2
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/mcp-server.js.map +0 -1
- package/dist/commands/model.js +30 -5
- package/dist/commands/model.js.map +2 -3
- package/dist/commands/pipeline.js.map +0 -1
- package/dist/commands/pull.js +1 -1
- package/dist/commands/pull.js.map +1 -2
- package/dist/commands/push.js +6 -4
- package/dist/commands/push.js.map +1 -2
- package/dist/commands/refresh.js.map +0 -1
- package/dist/commands/run.js.map +0 -1
- package/dist/commands/sheets.js +289 -52
- package/dist/commands/sheets.js.map +1 -2
- package/dist/commands/skills.js +157 -0
- package/dist/commands/skills.js.map +6 -0
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/tool.js.map +0 -1
- package/dist/commands/variables.js +246 -82
- package/dist/commands/variables.js.map +1 -2
- package/dist/commands/whoami.js.map +0 -1
- package/dist/index.js +117 -23
- package/dist/index.js.map +1 -2
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/prompts/workflows.js.map +0 -1
- package/dist/mcp/resources/documentation.js +19 -12
- package/dist/mcp/resources/documentation.js.map +1 -2
- package/dist/mcp/server.js.map +0 -1
- package/dist/mcp/skills.js.map +0 -1
- package/dist/mcp/tools/appTools.js +1 -7
- package/dist/mcp/tools/appTools.js.map +1 -2
- package/dist/mcp/tools/authTools.js +1 -1
- package/dist/mcp/tools/authTools.js.map +1 -2
- package/dist/mcp/tools/cellTools.js +6 -19
- package/dist/mcp/tools/cellTools.js.map +1 -2
- package/dist/mcp/tools/dashboardTools.js +30 -412
- package/dist/mcp/tools/dashboardTools.js.map +2 -3
- package/dist/mcp/tools/dataTools.js +15 -146
- package/dist/mcp/tools/dataTools.js.map +1 -2
- package/dist/mcp/tools/folderTools.js +12 -78
- package/dist/mcp/tools/folderTools.js.map +1 -2
- package/dist/mcp/tools/modelTools.js +23 -372
- package/dist/mcp/tools/modelTools.js.map +1 -2
- package/dist/mcp/tools/pipelineContract.js +5 -1
- package/dist/mcp/tools/pipelineContract.js.map +1 -2
- package/dist/mcp/tools/pipelineTools.js.map +0 -1
- package/dist/mcp/tools/runTools.js +8 -69
- package/dist/mcp/tools/runTools.js.map +1 -2
- package/dist/mcp/tools/sheetTools.js +14 -264
- package/dist/mcp/tools/sheetTools.js.map +1 -2
- package/dist/mcp/tools/syncTools.js +7 -3
- package/dist/mcp/tools/syncTools.js.map +1 -2
- package/dist/mcp/utils/helpers.js.map +0 -1
- package/dist/mcp/utils/launchPin.js.map +0 -1
- package/dist/mcp/utils/operationResponse.js +41 -0
- package/dist/mcp/utils/operationResponse.js.map +6 -0
- package/dist/mcp/utils/registerTool.js.map +0 -1
- package/dist/mcp/utils/session.js.map +0 -1
- package/dist/mcp/utils/tenantPin.js.map +0 -1
- 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/compatibility.js.map +0 -1
- package/dist/pipeline/connect.js.map +0 -1
- package/dist/pipeline/create.js.map +0 -1
- package/dist/pipeline/errors.js.map +0 -1
- package/dist/pipeline/failStep.js +43 -0
- package/dist/pipeline/failStep.js.map +6 -0
- package/dist/pipeline/generated-reference.json +25 -13
- package/dist/pipeline/guide.js.map +0 -1
- package/dist/pipeline/init.js.map +0 -1
- package/dist/pipeline/operations.js.map +0 -1
- package/dist/pipeline/query.js.map +0 -1
- package/dist/pipeline/queryDownloads.js.map +0 -1
- package/dist/pipeline/queryWorker.js +3 -1
- package/dist/pipeline/queryWorker.js.map +1 -2
- package/dist/pipeline/readiness.js.map +0 -1
- package/dist/pipeline/reference.js.map +0 -1
- package/dist/pipeline/requests.js +3 -32
- package/dist/pipeline/requests.js.map +1 -2
- package/dist/pipeline/runArguments.js.map +0 -1
- package/dist/pipeline/runtime.js.map +0 -1
- package/dist/pipeline/service.js +46 -2
- package/dist/pipeline/service.js.map +1 -2
- package/dist/services/appSyncService.js +59 -9
- package/dist/services/appSyncService.js.map +1 -2
- package/dist/services/apps.js +10 -0
- package/dist/services/apps.js.map +1 -2
- package/dist/services/authErrors.js.map +0 -1
- package/dist/services/codefirst/api.js +38 -5
- package/dist/services/codefirst/api.js.map +1 -2
- package/dist/services/codefirst/binaryDisk.js.map +0 -1
- package/dist/services/codefirst/byteHashes.js +5 -0
- package/dist/services/codefirst/byteHashes.js.map +1 -2
- package/dist/services/codefirst/documents.js +41 -15
- package/dist/services/codefirst/documents.js.map +1 -2
- package/dist/services/codefirst/layoutBinaryProjection.js +24 -13
- package/dist/services/codefirst/layoutBinaryProjection.js.map +1 -2
- package/dist/services/codefirst/layoutCompose.js +44 -38
- package/dist/services/codefirst/layoutCompose.js.map +1 -2
- package/dist/services/codefirst/layoutCore.js +14 -1
- package/dist/services/codefirst/layoutCore.js.map +1 -2
- package/dist/services/codefirst/layoutPaths.js +80 -4
- package/dist/services/codefirst/layoutPaths.js.map +1 -2
- package/dist/services/codefirst/layoutProjection.js +73 -39
- package/dist/services/codefirst/layoutProjection.js.map +1 -2
- package/dist/services/codefirst/layoutReadback.js +357 -130
- package/dist/services/codefirst/layoutReadback.js.map +2 -3
- package/dist/services/codefirst/layoutReadbackPlacement.js +94 -57
- package/dist/services/codefirst/layoutReadbackPlacement.js.map +2 -3
- package/dist/services/codefirst/layoutReceipt.js +283 -243
- package/dist/services/codefirst/layoutReceipt.js.map +2 -3
- package/dist/services/codefirst/layoutScan.js +208 -110
- package/dist/services/codefirst/layoutScan.js.map +1 -2
- package/dist/services/codefirst/output.js +76 -10
- package/dist/services/codefirst/output.js.map +1 -2
- package/dist/services/codefirst/types.js.map +0 -1
- package/dist/services/codefirst/workflow.js +65 -29
- package/dist/services/codefirst/workflow.js.map +2 -3
- package/dist/services/codefirst/workspace.js.map +0 -1
- package/dist/services/codefirst/workspaceLock.js.map +0 -1
- package/dist/services/codefirst/workspaceRoot.js +2 -1
- package/dist/services/codefirst/workspaceRoot.js.map +1 -2
- package/dist/services/configService.js.map +0 -1
- package/dist/services/credentials.js.map +0 -1
- package/dist/services/farseerService.js +31 -7
- package/dist/services/farseerService.js.map +1 -2
- package/dist/services/httpError.js.map +0 -1
- package/dist/services/modelExport.js.map +0 -1
- package/dist/services/organisation.js.map +0 -1
- package/dist/services/preflight.js.map +0 -1
- package/dist/services/realms.js.map +0 -1
- package/dist/services/syncService.js +3 -3
- package/dist/services/syncService.js.map +1 -2
- 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 -2
- package/dist/utils/agentSandbox.js +1 -1
- package/dist/utils/agentSandbox.js.map +0 -1
- package/dist/utils/cliOptions.js.map +0 -1
- package/dist/utils/constants.js.map +0 -1
- package/dist/utils/entityResolver.js +72 -25
- package/dist/utils/entityResolver.js.map +1 -2
- package/dist/utils/errorFormatter.js +72 -11
- package/dist/utils/errorFormatter.js.map +1 -2
- package/dist/utils/fileLogger.js.map +0 -1
- package/dist/utils/fileValidation.js.map +0 -1
- package/dist/utils/folderMatch.js.map +0 -1
- package/dist/utils/formulaFilters.js +11 -2
- package/dist/utils/formulaFilters.js.map +1 -2
- package/dist/utils/helpers.js.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/nameResolver.js.map +0 -1
- package/dist/utils/operationCli.js +102 -0
- package/dist/utils/operationCli.js.map +6 -0
- package/dist/utils/packageManager.js.map +0 -1
- package/dist/utils/syncReporting.js.map +0 -1
- package/dist/utils/syncScope.js.map +0 -1
- package/dist/utils/updateCheck.js.map +0 -1
- package/dist/utils/variableValues.js.map +0 -1
- package/dist/utils/workspace.js.map +0 -1
- package/docs/cli-guide.md +182 -2
- package/docs/import-workflows.md +14 -14
- package/docs/new-app-template.md +1 -1
- package/docs/pipeline-client-guide.md +1 -1
- package/docs/pipeline-reference.md +304 -9
- package/docs/troubleshooting.md +18 -0
- package/package.json +2 -2
- package/skills/farseer-analysis/SKILL.md +132 -0
- 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 +40 -0
- package/skills/farseer-formulas/SKILL.md +165 -0
- package/skills/farseer-help-center/SKILL.md +66 -0
- package/skills/farseer-model/SKILL.md +119 -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 +7 -5
- package/skills/pipeline-authoring/practices.md +21 -8
- package/dist/services/agentApprovalFetch.js +0 -86
- package/dist/services/agentApprovalFetch.js.map +0 -7
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: farseer-formulas
|
|
3
|
+
description: Farseer's formula syntax, with its references, filters and functions, and how a formula is evaluated over versions, years and linked tables. Use before writing a formula not yet written in this conversation, such as a read of values for a comparison, a new variable's formula or the address of a cell write.
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Formula syntax
|
|
9
|
+
|
|
10
|
+
Evaluate one formula with `farseer formula eval 'EXPRESSION' --json`, or many in one request with `POST /api/v3/evaluate`. A cell write addresses its cells with the same `SUM(...)` filters (see the `farseer-model` skill).
|
|
11
|
+
|
|
12
|
+
Put filters inside the formula, as in `SUM("Revenue", "Years">"Y2025", "Versions">"Actual")`. The evaluate request's own `filters` field holds named filters a formula must reference, so filters passed there leave a plain formula unfiltered.
|
|
13
|
+
|
|
14
|
+
## Syntax Rules
|
|
15
|
+
|
|
16
|
+
* Wrap variable, table, and member names in double quotes: `"Revenue"`, `"Years">"2024"`
|
|
17
|
+
* `>` is the table→member accessor, **not** a comparison operator. For comparisons use `gt()`, `lt()`, etc.
|
|
18
|
+
* Operators: `+ - * /` (standard math precedence)
|
|
19
|
+
* Parentheses must be balanced.
|
|
20
|
+
* Functions: `FUNCTION(arg1, arg2, ...)`, which can be nested. Names are case-insensitive.
|
|
21
|
+
* Always generate a complete expression, never a list or comma-separated values.
|
|
22
|
+
|
|
23
|
+
## CRITICAL: Member Names in Formulas
|
|
24
|
+
|
|
25
|
+
* Every member has a **name** and an optional **description**.
|
|
26
|
+
* **Always use the `name` field in formulas. NEVER use the description.**
|
|
27
|
+
* Member names have no consistent format: they can be codes ("001"), abbreviations ("M1", "Y2025"), or readable text ("North America").
|
|
28
|
+
* **Never guess member names.** Always look up the actual names in the model using the available tools.
|
|
29
|
+
|
|
30
|
+
## Valid / Invalid Examples
|
|
31
|
+
|
|
32
|
+
Valid:
|
|
33
|
+
```
|
|
34
|
+
SUM("Revenue", "Years">"2024")
|
|
35
|
+
"Gross profit" + "Operating expenses"
|
|
36
|
+
IF(gt("Revenue", 1000), "High revenue", "Low revenue")
|
|
37
|
+
SUM("Revenue" - "Costs", "Years">"2025")
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Invalid (will crash the engine):
|
|
41
|
+
* Comma-separated values outside a function: `"Revenue", "Years">"2024"`
|
|
42
|
+
* Lists or numbered expressions: `1. "Revenue"; 2. "Costs"`
|
|
43
|
+
* Variable treated as function: `"Profit"("Years">"2025")`
|
|
44
|
+
* Standalone dimension access without expression: `"Table">"Member"`
|
|
45
|
+
|
|
46
|
+
## Built-in Functions
|
|
47
|
+
|
|
48
|
+
### Aggregation / Time
|
|
49
|
+
|
|
50
|
+
| Function | Meaning |
|
|
51
|
+
|-----------------------------------|-----------------------------------------------|
|
|
52
|
+
| `sum(var, filters)` | The variable at a slice, by its rollup; use `"Table">"Member"` for filters |
|
|
53
|
+
| `avg(var, months, skip_nulls)` | Moving average |
|
|
54
|
+
| `delay(var, months)` | Shift forward/back by N months |
|
|
55
|
+
| `spread(var, months, delay)` | Spread value across months (depreciation) |
|
|
56
|
+
| `spread_days(var, days, delay)` | Spread value across days |
|
|
57
|
+
| `cumsum(var, factor, resetVar)` | Cumulative sum (YTD, interest, growth), see below |
|
|
58
|
+
| `predictAverage()` | Fill with average of previous values |
|
|
59
|
+
|
|
60
|
+
**Running totals with `cumsum(var, factor, resetVar)`.** Each month is `var + previous * (1 + factor)`, carried across years, except where `resetVar` has a value: there the month returns that value and the total restarts from it. The total runs separately in every cell, such as each client and product, so a reset that is blank in one cell carries that cell's total over. A year-to-date variable is split like its source and restarts each January with the source's January value, or 0 where January has none. Save the reset as its own variable, split like the source, and pass it by name: a reset written inline, such as an `if(...)`, takes the engine's fallback path, which can get a month wrong.
|
|
61
|
+
|
|
62
|
+
- `Net sales YTD reset`: `if(hasDMember("Months">"M1"), if(hasValue("Net sales"), "Net sales", 0))`
|
|
63
|
+
- `Net sales YTD`: `cumsum("Net sales", 0, "Net sales YTD reset")`
|
|
64
|
+
|
|
65
|
+
Give `Net sales YTD` the CLOSING STATE rollup, so a quarter or a year shows its last month, and check it by month: January equals January's source value and each later month adds that month's.
|
|
66
|
+
|
|
67
|
+
### Math
|
|
68
|
+
|
|
69
|
+
| Function | Meaning |
|
|
70
|
+
|-----------------------------|--------------------|
|
|
71
|
+
| `round(var, decimals)` | Round (Excel-style)|
|
|
72
|
+
| `floor(var)` | Round down |
|
|
73
|
+
| `ceil(var)` | Round up |
|
|
74
|
+
| `abs(var)` | Absolute value |
|
|
75
|
+
| `power(x, z)` | Exponentiation |
|
|
76
|
+
| `max(a, b)` / `min(a, b)` | Bigger / smaller |
|
|
77
|
+
|
|
78
|
+
### Comparison (return logical value)
|
|
79
|
+
|
|
80
|
+
| Function | Meaning |
|
|
81
|
+
|-------------|------------------|
|
|
82
|
+
| `eq(a, b)` | Equals |
|
|
83
|
+
| `gt(a, b)` | Greater than |
|
|
84
|
+
| `gte(a, b)` | Greater or equal |
|
|
85
|
+
| `lt(a, b)` | Less than |
|
|
86
|
+
| `lte(a, b)` | Less or equal |
|
|
87
|
+
|
|
88
|
+
### Logical / Branching
|
|
89
|
+
|
|
90
|
+
| Function | Meaning |
|
|
91
|
+
|-------------------------------------|-------------------------------------------|
|
|
92
|
+
| `if(test, trueResult, falseResult)` | Conditional (like Excel IF). `falseResult` is optional (defaults to null). |
|
|
93
|
+
| `or(dim1, dim2)` | Logical OR / combine dimension filters |
|
|
94
|
+
| `and(dim1, dim2)` | Logical AND |
|
|
95
|
+
| `not(dim)` | Logical NOT |
|
|
96
|
+
|
|
97
|
+
### Dimension / Data Checks
|
|
98
|
+
|
|
99
|
+
| Function | Meaning |
|
|
100
|
+
|------------------------|--------------------------------------|
|
|
101
|
+
| `hasDMember(dimension)`| TRUE if dimension member is present (e.g., `hasDMember("Years">"Y2025")`) |
|
|
102
|
+
| `hasTags(dimension)` | Alias for `hasDMember` |
|
|
103
|
+
| `hasValue(variable)` | TRUE if variable has a value |
|
|
104
|
+
|
|
105
|
+
### Date / Time
|
|
106
|
+
|
|
107
|
+
Requires system dimensions **Years** and **Months**.
|
|
108
|
+
|
|
109
|
+
| Function |
|
|
110
|
+
|---------------------------------------------|
|
|
111
|
+
| `currentMonth()` |
|
|
112
|
+
| `currentDate()` |
|
|
113
|
+
| `daysInCurrentMonth()` |
|
|
114
|
+
| `date(year, month, day)` |
|
|
115
|
+
| `edate(date, months)` |
|
|
116
|
+
| `day(date)` / `month(date)` / `year(date)` |
|
|
117
|
+
|
|
118
|
+
### Growth
|
|
119
|
+
|
|
120
|
+
| Function | Meaning |
|
|
121
|
+
|-------------------|--------------------------------|
|
|
122
|
+
| `mom(percentage)` | Month-over-month growth |
|
|
123
|
+
| `qoq(percentage)` | Quarter-over-quarter growth |
|
|
124
|
+
| `yoy(percentage)` | Year-over-year growth |
|
|
125
|
+
|
|
126
|
+
## SUM and Dimension Filters
|
|
127
|
+
|
|
128
|
+
* Format: `SUM("Variable", "Table">"Member", ...)`; filters combine with AND.
|
|
129
|
+
* Use one member per dimension. To include several members of one dimension, prefer their common parent (e.g. a quarter over its months); use `OR(...)` only when there is no such parent.
|
|
130
|
+
* Omitting a connected dimension = include all its members, totalled by the variable's rollup (a sum only for a SUM rollup).
|
|
131
|
+
|
|
132
|
+
**OR helper:** Union multiple members of the **same** dimension: `OR("Months">"M1", "Months">"M2")`. Takes 2+ arguments.
|
|
133
|
+
|
|
134
|
+
* **Every argument must filter the same dimension.** Mixing dimensions in one `OR(...)`, for example `OR("Months">"M1", "Clients">"Acme")`, is not rejected but silently produces a wrong result.
|
|
135
|
+
* **Combining filters on different dimensions:**
|
|
136
|
+
* Both at once (M1 *and* Acme): put both filters in one `SUM`: `SUM("Revenue", "Months">"M1", "Clients">"Acme")`.
|
|
137
|
+
* Either one (M1 *or* Acme): adding `SUM("Revenue", "Months">"M1") + SUM("Revenue", "Clients">"Acme")` counts the overlap twice (Acme's M1 revenue is in both). Subtract it once: `SUM("Revenue", "Months">"M1") + SUM("Revenue", "Clients">"Acme") - SUM("Revenue", "Months">"M1", "Clients">"Acme")`. This holds only for a variable with a SUM rollup; for any other rollup, read the slices separately.
|
|
138
|
+
* Add separate sums only when the slices cannot overlap and the variable's rollup is SUM.
|
|
139
|
+
* **Prefer a parent dimension over OR-ing its children.** When the members you want roll up to a single parent member, filter by the parent: use `"Quarters">"Q1"` rather than `OR("Months">"M1", "Months">"M2", "Months">"M3")`. Both give the same total, but the parent form is shorter and avoids mis-listing a member.
|
|
140
|
+
|
|
141
|
+
**Dimensionality rules:**
|
|
142
|
+
* Use members only from tables connected (directly or indirectly) to the variable.
|
|
143
|
+
* If a dimension is fixed in the variable, you may only use that same fixed member.
|
|
144
|
+
* Skipping a connected table returns the variable over all its members by its rollup (a sum only for SUM).
|
|
145
|
+
|
|
146
|
+
**System dimensions:** Years, Half Years, Quarters, Months, Year To Date, Versions.
|
|
147
|
+
If connected to Months, you may filter by Quarters or Half Years instead (they expand to matching months).
|
|
148
|
+
|
|
149
|
+
## Inferring Versions
|
|
150
|
+
|
|
151
|
+
* If the variable is connected to "Versions", you **must** include exactly one version filter.
|
|
152
|
+
* Omitting the version sums across all versions, which is always wrong (critical error).
|
|
153
|
+
* Choose by intent: expected/projected → plan or forecast; realized/recorded → actual.
|
|
154
|
+
* When the user does not say, past periods use actuals and future periods the plan or forecast. State the version you used. When several versions fit, such as Budget and Forecast, evaluate each.
|
|
155
|
+
|
|
156
|
+
## Inferring Years
|
|
157
|
+
|
|
158
|
+
* If the variable is connected to "Years", include a specific year unless intentionally aggregating across years.
|
|
159
|
+
* Defaults when unspecified: a period named without a year is in the current year; "last year" is the previous year and "next year" the next.
|
|
160
|
+
* Use explicit years from the question when provided.
|
|
161
|
+
|
|
162
|
+
## Constraints
|
|
163
|
+
|
|
164
|
+
* Use **only** variables, tables, and members that exist in the model.
|
|
165
|
+
* Never invent names. If unsure, look them up with tools.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: farseer-help-center
|
|
3
|
+
description: Answer how-to questions about Farseer as a product from its help center at support.farseer.io. Topics include interface navigation, concepts such as variables, dimensions, sheets, dashboards and IBCS, setup, imports, permissions, sharing, audit logs and API access. Covers when to search, phrasing a query in product terms, which collection to look in, reading the full article and citing it. Use for "how do I…" questions about Farseer itself, not about the user's own data or formulas.
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Farseer help center
|
|
9
|
+
|
|
10
|
+
Farseer's help center (`support.farseer.io`) explains how to use Farseer as a product. How you reach it depends on your environment: a tool that searches it and one that reads an article, or, where your environment allows web access, a fetch limited to `support.farseer.io`. If you have neither, say you cannot check the help center and point the user to `support.farseer.io`.
|
|
11
|
+
|
|
12
|
+
## When to search
|
|
13
|
+
|
|
14
|
+
Search the help center when the user asks how to **use Farseer as a product**: interface navigation, concepts, setup steps, admin tasks, integrations. Examples that should start a search:
|
|
15
|
+
|
|
16
|
+
- "how do I create a dimension?"
|
|
17
|
+
- "what's the difference between a variable and a sheet?"
|
|
18
|
+
- "how do permissions work?"
|
|
19
|
+
- "how do I import a CSV?"
|
|
20
|
+
- "what is IBCS?"
|
|
21
|
+
|
|
22
|
+
Do **not** search for:
|
|
23
|
+
|
|
24
|
+
- Questions about the user's own data, model contents or formula results: answer those from the model.
|
|
25
|
+
- General finance, accounting or math questions that are not about Farseer.
|
|
26
|
+
- Small talk.
|
|
27
|
+
|
|
28
|
+
## How to phrase the query
|
|
29
|
+
|
|
30
|
+
The help center is organized into collections. Use their topics to phrase queries in the help center's own vocabulary:
|
|
31
|
+
|
|
32
|
+
| Collection | Topics |
|
|
33
|
+
|------------|--------|
|
|
34
|
+
| Getting Started | Farseer Basics, Navigating Interface, Signing In, Profile, Global Search, Farseer AI |
|
|
35
|
+
| Core Concepts | Formula Functions, Dimensions, Variables, Versions, Input Setup, Value Formatting |
|
|
36
|
+
| Advanced Modeling | Database Topology, Dimensional Model, Calculation Model, Performance, Glossary |
|
|
37
|
+
| Sheets & Data Entry | Sheet Basics, Data Entry, Rows, Columns, Comments, Filtering & Sorting, Sheet Toolbar, Cells |
|
|
38
|
+
| Dashboards & Visualization | Dashboards, Preparing Data, Table Tiles, Dashboard Tables, Export to Image, IBCS |
|
|
39
|
+
| Import & Apps | Import Module, Apps, Files & File Preview |
|
|
40
|
+
| Admin & Settings | Users & Permissions, Locks, Sharing, Backup & Restore, Audit Logs, Model Import & Export, Maintenance Mode |
|
|
41
|
+
| API & Integrations | API Access, API File Upload |
|
|
42
|
+
|
|
43
|
+
Keep queries short (2–5 words) and use Farseer's own vocabulary from the table above. If the first query returns no hits or only weak ones, try one rephrasing with a synonym from a related collection. Do not loop.
|
|
44
|
+
|
|
45
|
+
## How to answer
|
|
46
|
+
|
|
47
|
+
A search hit carries a title, a link and a short snippet. A snippet is a one-line summary, **not** instructions: never answer a "how do I…" question from a snippet alone, or you will give vague, made-up-sounding steps.
|
|
48
|
+
|
|
49
|
+
Two steps:
|
|
50
|
+
|
|
51
|
+
1. **Search.** Look at the hits and decide which single article best matches what the user actually asked about.
|
|
52
|
+
2. **Read the best hit** in full, and base your answer on its body. For a "how do I…" question you almost always need this step: the steps live in the body, not the snippet.
|
|
53
|
+
|
|
54
|
+
Then write the answer:
|
|
55
|
+
|
|
56
|
+
- Give the actual steps or explanation from the article body, in your own words and concisely. **Never paste the whole body**; summarize the part that matters.
|
|
57
|
+
- Always end with a citation: `Source: [<article title>](<article url>)`.
|
|
58
|
+
- If a couple of other articles are clearly relevant, add them under "See also:".
|
|
59
|
+
|
|
60
|
+
## When the help center has no good answer
|
|
61
|
+
|
|
62
|
+
Be strict about relevance. The search almost always returns hits, even when nothing actually matches: a non-empty result is **not** proof that the topic is covered.
|
|
63
|
+
|
|
64
|
+
If no hit clearly matches the specific thing the user asked about (for example, they named a feature that appears in no hit's title or body), do **not** stitch tangential articles into a confident-sounding answer. That is a fabrication and is not acceptable.
|
|
65
|
+
|
|
66
|
+
Instead, say you do not have specific information on that, neutrally, without implying that the feature does or does not exist and without blaming anyone. For example: *"I don't have specific information on that in the help center. Could you tell me a bit more about what you're trying to do?"* You may then offer a related article, but only if it is genuinely relevant and clearly labelled as related rather than a direct answer.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: farseer-model
|
|
3
|
+
description: How a Farseer model works, with its tables, members and links, variables, versions and the rollup types that total a variable over periods and members, and how to change it through tables, members and links, cell values and Farseer-as-code. Use when an answer depends on how a variable rolls up, and before creating or changing variables, tables, members, links or cell values.
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Farseer model
|
|
9
|
+
|
|
10
|
+
How a model is built, how its numbers total, and how to change it. Paths below are under `/api/v3`.
|
|
11
|
+
|
|
12
|
+
## Tables (Dimensions)
|
|
13
|
+
|
|
14
|
+
A table is a collection of dimension members (rows).
|
|
15
|
+
|
|
16
|
+
* Each member has a unique **name** and an optional **description**.
|
|
17
|
+
- **name** is the identifier used in formulas. **description** is for display only.
|
|
18
|
+
- Names have no consistent format: they can be codes ("001"), abbreviations ("M1", "Y2025"), or readable text ("North America"). Always look up actual names in the model.
|
|
19
|
+
* Column types:
|
|
20
|
+
- **NAME**: the member's unique name (primary key)
|
|
21
|
+
- **FOREIGN_KEY**: references another table, creating a connection (see below)
|
|
22
|
+
- **DESCRIPTION**: display label for the member
|
|
23
|
+
- **DATE / NUMBER / TEXT / FILE**: custom data columns
|
|
24
|
+
|
|
25
|
+
## Table Connections
|
|
26
|
+
|
|
27
|
+
Tables are connected through FOREIGN_KEY columns. A FK column in table A pointing to table B means each member of A is linked to one or more members of B.
|
|
28
|
+
|
|
29
|
+
* Example chain: **Months** FK→ **Quarters** FK→ **Half Years** FK→ **Years**. Each month belongs to a quarter, each quarter to a half year, etc.
|
|
30
|
+
* A **hierarchy table** has a FOREIGN_KEY referencing itself (tree structure within one table).
|
|
31
|
+
* FOREIGN_KEY defines relationships, **not aggregation**: aggregation depends on the variable's formula and rollup settings.
|
|
32
|
+
* A member's links are the values of its FOREIGN_KEY columns: `farseer model --table TABLE --json` lists every column of a table's members.
|
|
33
|
+
* For "other X in the same Y" questions, start from the member the user named, follow its link column to Y, and list the members linked to that Y, rather than matching names.
|
|
34
|
+
|
|
35
|
+
## Variables
|
|
36
|
+
|
|
37
|
+
A variable is a multi-dimensional dataset. Its dimensions are the tables it is connected to (`tableGids`).
|
|
38
|
+
|
|
39
|
+
**Types:**
|
|
40
|
+
* **Input variable**: no formula; values are entered or imported.
|
|
41
|
+
* **Calculated variable**: has a formula referencing other variables and functions.
|
|
42
|
+
* **Measure** (`measure: true`): no dimensions; holds a single scalar value.
|
|
43
|
+
* **On-demand variable** (`calculateOnDemand: true`): calculated only when explicitly requested, not on every model recalculation.
|
|
44
|
+
|
|
45
|
+
**Fixed dimensions:** When a variable has `members` entries, those dimensions are locked to specific member values. You cannot filter by other members of that table in formulas for this variable.
|
|
46
|
+
|
|
47
|
+
## How connections affect formulas
|
|
48
|
+
|
|
49
|
+
A variable can be filtered by members of any table that is **directly or indirectly connected** to it:
|
|
50
|
+
|
|
51
|
+
* **Direct**: tables listed in the variable's `tableGids`.
|
|
52
|
+
* **Indirect**: tables reachable via FOREIGN_KEY chains from directly connected tables.
|
|
53
|
+
|
|
54
|
+
Example: Suppose "Revenue" is directly connected to **Clients** and **Months**. The **Clients** table has a FK to **Client Groups**. Even though "Revenue" is not directly connected to Client Groups, you can filter by it because it's reachable via Clients → Client Groups:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
SUM("Revenue", "Client Groups">"B2B", "Versions">"Actual")
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
This sums revenue across all clients that belong to the "B2B" client group.
|
|
61
|
+
|
|
62
|
+
Similarly, because Months FK→ Quarters FK→ Years, you can filter "Revenue" by any of those time dimensions:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
SUM("Revenue", "Years">"Y2025", "Versions">"Actual")
|
|
66
|
+
SUM("Revenue", "Quarters">"Q1 2025", "Versions">"Actual")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Key Variable Fields
|
|
70
|
+
|
|
71
|
+
| Field | Meaning |
|
|
72
|
+
|---------------|----------------------------------------------------------------|
|
|
73
|
+
| formula | Expression using other variables, functions, literals |
|
|
74
|
+
| rollupType | SUM, AVERAGE, CLOSING STATE, BEGINNING STATE, FORMULA, MAX, MIN, NONE |
|
|
75
|
+
| dataType | DECIMAL or INTEGER |
|
|
76
|
+
| numberFormat | Display formatting (currency, decimals, unit). Unit (ONES/THOUSANDS/MILLIONS) is display-only: values are always stored as raw numbers. |
|
|
77
|
+
| readonly | If true, values cannot be edited manually |
|
|
78
|
+
| useHierarchy | If true, hierarchy tables are considered in calculation |
|
|
79
|
+
| calculateOnDemand | If true, variable is calculated on-demand |
|
|
80
|
+
|
|
81
|
+
**Rollup types explained:**
|
|
82
|
+
* **SUM**: additive aggregation. Safe to use with the `SUM()` formula function.
|
|
83
|
+
* **AVERAGE**: not additive. `SUM("Var", filters)` returns the variable at that slice by its own rollup: over months it stays an average, but across members it is an unweighted average, so for a price or rate across members fetch the components and divide.
|
|
84
|
+
* **CLOSING STATE / BEGINNING STATE**: point-in-time values. `SUM("Var", filters)` over a period returns its last (or first) month, not a sum.
|
|
85
|
+
* **FORMULA**: rollup is computed by the variable's own formula: `SUM("Var", filters)` recomputes it from its components at that slice.
|
|
86
|
+
* **MAX / MIN**: takes the maximum/minimum across aggregated values.
|
|
87
|
+
* **NONE**: no aggregation.
|
|
88
|
+
|
|
89
|
+
**Rules:**
|
|
90
|
+
* Always check the variable's `rollupType` before choosing an aggregation method.
|
|
91
|
+
* If dataType = INTEGER and rollup yields a decimal → round half up.
|
|
92
|
+
* readonly + formula → formula output always wins.
|
|
93
|
+
* A variable can connect to at most one hierarchy table.
|
|
94
|
+
* Empty/null fields mean "not set."
|
|
95
|
+
|
|
96
|
+
## Changing tables, members and links
|
|
97
|
+
|
|
98
|
+
The CLI creates and deletes members, but tables and links between tables go through `POST /entities/mutate`.
|
|
99
|
+
|
|
100
|
+
- `farseer dimensions create-member` adds a member. Without `-y`, `farseer dimensions delete-member` only prints a preview and exits successfully, changing nothing: pass `-y` when you intend the delete. `create-member` takes no `-y`.
|
|
101
|
+
- `farseer dimensions members TABLE --json` lists `id`, `name` and `parentId`; `--limit` shortens only the text output, not `--json`.
|
|
102
|
+
- `farseer push` syncs files and apps, not the model, and waits at a prompt unless you pass `-y`; with `--force` it always prompts, so never use `--force`. There is no `farseer model push` or validation command.
|
|
103
|
+
|
|
104
|
+
- **A table:** `{"created": [{"type": "DTAB", "meta": {"name": "Sales regions"}, "dimensionTable": {}}]}`.
|
|
105
|
+
- **Its members,** several in one write: `{"created": [{"type": "DMEM", "meta": {"name": "Nordics"}, "relations": {"parent": {"key": {"id": TABLE_GID, "type": "DTAB"}, "order": 0}}, "dimensionMember": {"data": {}}}]}`.
|
|
106
|
+
- **To change an existing table or member,** read it with `GET /entities/{id}/{type}` (type `DTAB` or `DMEM`), change only what you need, and send the whole object back in `{"updated": [OBJECT]}`. A partial object can be accepted and change nothing. A table's `dimensionTable.columns` goes back with only the columns whose id is above 7: ids 0 to 7 are the built-in columns, such as Name, Formula and Description, which the read includes, and an update that lists one is refused with 400 `Cannot update internal columns`. Every column above 7 stays in the list, since one left out is deleted, its links included.
|
|
107
|
+
- **To link a table to another,** such as each country to its region: update the table as above, with the new column `{"id": -1, "name": "Sales regions", "type": "FOREIGN_KEY", "metadata": null, "refTableGid": REGION_TABLE_GID, "primaryKey": false, "foreignKey": true, "unique": false}` added to its `dimensionTable.columns` and `{"key": {"id": REGION_TABLE_GID, "type": "DTAB"}, "order": N}` to `links.tableForeignKeys`, then read the table again for the id the new column got. Then on each member, append `{"key": {"id": REGION_GID, "type": "DMEM"}, "order": N}` to `links.connections` and set `dimensionMember.data["COLUMN_ID"]` to `[REGION_GID]` with that id, keeping its existing links. Check the result with `evaluate`: a region's total equals the sum of its countries.
|
|
108
|
+
|
|
109
|
+
## Writing cell values
|
|
110
|
+
|
|
111
|
+
The legacy `/cells/query` and `/cells/update` routes, used by `farseer cells`, are not implemented: read values with `/evaluate` and write them with `/model/updateCells`.
|
|
112
|
+
|
|
113
|
+
- `/model/updateCells` takes `{"filters": [], "cellUpdates": [{"formula": "SUM(\"Quantity\", \"Versions\">\"Plan\", \"Years\">\"Y2026\", \"Quarters\">\"Q3\")", "value": 300000}]}`; the empty `filters` is required. It addresses cells with `SUM(...)` filters, like a read, and writes across every member of a dimension it leaves out, Versions included, so name one version.
|
|
114
|
+
- A value written to an aggregate, such as a year or a parent member, is spread over the cells beneath it: by the variable's top-down mapping if it has one, otherwise in proportion to the current values, changing only cells that hold one. Into an empty slice, a SUM variable is split evenly and other rollups repeat the value.
|
|
115
|
+
- To set a price or rate for every month, write each month as its own `cellUpdates` entry. Before writing a total, say how it will spread, and afterwards read back the cells it reached.
|
|
116
|
+
|
|
117
|
+
## Farseer-as-code
|
|
118
|
+
|
|
119
|
+
`/labs/fsl/generate`, `/labs/fsl/lint` and `/labs/fsl/compile` generate, lint and compile Farseer-as-code (FSL); compiling does not change the live model. Read the `/model/load` schema before applying a compiled model, preserve unrelated definitions, and verify the result.
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: farseer-modify-model
|
|
3
|
+
description: >-
|
|
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
|
+
metadata:
|
|
6
|
+
version: "1"
|
|
7
|
+
domain: modeling
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Modify an Existing Farseer Model
|
|
11
|
+
|
|
12
|
+
## When this skill applies
|
|
13
|
+
|
|
14
|
+
Any change to a model that already exists — on a tenant, in git, or both. Risk rises with how live the model is: a production tenant that planners work in carries the most.
|
|
15
|
+
|
|
16
|
+
Do **not** use this skill for:
|
|
17
|
+
- A new model from scratch → the `farseer-build-model` skill
|
|
18
|
+
- How to write a variable, table, member, link or cell → the `farseer-model` skill
|
|
19
|
+
|
|
20
|
+
The point of this skill is **enforcing the sequence** so impact analysis isn't skipped and prod isn't touched ahead of dev/test.
|
|
21
|
+
|
|
22
|
+
This skill has no write steps: make the change itself through the `farseer-model` skill. `farseer code` (Experimental) is the future path for a whole-model change.
|
|
23
|
+
|
|
24
|
+
The naming, sparse and grain reference files it links live in the `farseer-build-model` skill. If one does not open because this skill was installed on its own, `farseer skills show farseer-build-model --file <file>` prints it.
|
|
25
|
+
|
|
26
|
+
## Risk tier (decide first — drives discipline)
|
|
27
|
+
|
|
28
|
+
| Tier | Triggers | Discipline |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| **T1** — low | Fix within the agreed scope; no change to ` OUT` interface; not a production tenant in use | Full skill, brisk |
|
|
31
|
+
| **T2** — medium | Scope extension; new ` OUT` variable; new module on existing model; new dimension link | Full skill + downstream interface review |
|
|
32
|
+
| **T3** — high | Breaking change to existing ` OUT` (grain / type / formula contract); change to a live production tenant; cross-tenant ripple potential | Full skill + telling the model's users first + dual-environment validation + rollback plan written before the change |
|
|
33
|
+
|
|
34
|
+
If you can't decide between two tiers, take the higher one. Demoting tier mid-flight is fine; promoting after the change is in prod is not.
|
|
35
|
+
|
|
36
|
+
## Inputs to gather first
|
|
37
|
+
|
|
38
|
+
1. **The ask, precisely** — one sentence: *"Add `Months` to the tables of `Gross Margin OUT`"* / *"Split `Freight Cost IN` by warehouse"*.
|
|
39
|
+
2. **How live is the target** — a production tenant that planners work in means the model is live; the T3 risk premium applies.
|
|
40
|
+
3. **Target instance(s)** — which env will the work be done on? Always start dev. If the project has only prod (no dev/test), **stop and flag** — that's a structural gap, raise before proceeding.
|
|
41
|
+
4. **Live-state reads** — the impact survey uses tenant reads: `farseer model --variables` / `--variable "<Var>"` / `--table "<Table>"` (+ trailing `<tenant>` arg), or a fresh `farseer model --json <tenant>` when you need the full picture. If the CLI session is missing, use the `farseer-authenticate-to-tenant` skill or ask the user to paste live state.
|
|
42
|
+
|
|
43
|
+
## Procedure
|
|
44
|
+
|
|
45
|
+
### 1. Snapshot before touching anything (mandatory)
|
|
46
|
+
|
|
47
|
+
Capture the current structure and commit it before you change anything:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
farseer model --json --include-members <tenant> > snapshots/YYYY-MM-DD_pre-<label>.json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`--include-members` adds every table's member rows, so a changed member or FK value shows in the diff too (slow on a large tenant).
|
|
54
|
+
|
|
55
|
+
Label it so it ties to this change:
|
|
56
|
+
|
|
57
|
+
- `YYYY-MM-DD_pre-<change-slug>.json` — for a fix or a requested change
|
|
58
|
+
- `YYYY-MM-DD_pre-refactor-<topic>.json` — for refactors
|
|
59
|
+
|
|
60
|
+
This snapshot is **both** the rollback point and the backtest baseline. Without it, step 5 has no anchor and step 7 has no diff target. Do not skip.
|
|
61
|
+
|
|
62
|
+
**What makes a snapshot a baseline:**
|
|
63
|
+
|
|
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 `zConstraint` (every `members` empty, no `zConstraint` field): it is not a baseline. Read again.
|
|
66
|
+
- **Structure only — never cell data.** Values belong in the backtest (step 3), not in the snapshot.
|
|
67
|
+
- **Never overwrite a dated snapshot** with the same label — add a suffix (`-v2`) instead.
|
|
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).
|
|
69
|
+
- **A difference that no committed change explains** means someone edited the tenant outside the usual workflow: **surface this prominently** — it's a workflow-drift warning, not just a normal diff.
|
|
70
|
+
|
|
71
|
+
**Then diff the tenant against git and resolve every difference before you edit** — and again right before any push or promotion from git to a live tenant. Compare the fresh snapshot with the model as committed in git (and, for a promotion, with the target tenant's own snapshot). Every difference is drift in one of three shapes: in git but not on the tenant (committed, never pushed), on the tenant but not in git (edited on the tenant, never committed), or different in both. A push from git silently reverts the second kind and a pull silently loses the first. **Git wins only after you know why the tenant differs** — ask the person who edited the tenant, and commit what should stay before you overwrite it.
|
|
72
|
+
|
|
73
|
+
### 2. Impact analysis (mandatory — easiest step to skip, highest damage when skipped)
|
|
74
|
+
|
|
75
|
+
Read the relevant reference first (the naming, sparse and grain files of the `farseer-build-model` skill). Then survey what consumes what you're about to change:
|
|
76
|
+
|
|
77
|
+
| Downstream surface | How to survey (reads only) |
|
|
78
|
+
|---|---|
|
|
79
|
+
| ` OUT` variables that reference the changed variable in formulas | search the formulas in the step 1 snapshot for the variable's name in both forms: quoted (`"Gross Margin OUT"`) and, when the name is a plain identifier (letters, digits, `_`, `$`), bare (`Gross_Margin_OUT`) — the model export writes such a name without quotes. Only zero hits in both forms means no formula reads it. `farseer model --variable "<Var>" <tenant>` shows one variable's formula |
|
|
80
|
+
| Sheets in the tenant | `farseer sheets list <tenant>`, then `farseer sheets rows "<Sheet>" <tenant> --json` for each candidate, which names each row's variable; a manual check in the Farseer UI where layout matters |
|
|
81
|
+
| Deployed apps that import or export the variable | `farseer app list --details <tenant>`; `farseer pull <org> <tenant>` in a scratch folder, then search `farseer-apps/<tenant>/` for the variable name |
|
|
82
|
+
| Cross-tenant ripple | Ask which other tenants read from or feed this one (a group split into several legal-entity tenants, or two tenants coupled by a data flow) and trace those flows before assuming the change is local |
|
|
83
|
+
|
|
84
|
+
**Interface preservation discipline (T2 / T3):** if the change touches an ` OUT` variable's grain, type, or formula contract, that's a **breaking** change for every downstream consumer. Either:
|
|
85
|
+
|
|
86
|
+
- Adapt the change so the ` OUT` interface stays stable (preferred), or
|
|
87
|
+
- Plan downstream migration in the same change (and surface that work in the impact report)
|
|
88
|
+
|
|
89
|
+
Surface the impact summary to the user **before** changing anything: *"This touches 4 OUT variables, 2 sheets and 1 deployed app. The reporting tenant reads two of them. Tier elevated to T2."*
|
|
90
|
+
|
|
91
|
+
### 3. Identify validation regime + plan tests
|
|
92
|
+
|
|
93
|
+
Modification of an existing deployed model is always **backtest** per [`model-validation-pattern.md`](model-validation-pattern.md). Optionally + functional if the change introduces new scenarios that didn't exist before.
|
|
94
|
+
|
|
95
|
+
Plan:
|
|
96
|
+
|
|
97
|
+
- **Backtest scenario** — baseline snapshot from step 1 + a small set of cells / variables to diff after the change. Expected deltas listed explicitly (this is what we're trying to change); everything else should be unchanged.
|
|
98
|
+
- **Functional scenarios** (if applicable) — new inputs + expected outputs for the new behavior.
|
|
99
|
+
|
|
100
|
+
Read the baseline values of those cells now, before the change, and keep them with the snapshot: `farseer formula eval '<formula>' <tenant> --json` for one cell, or `farseer variable export "<Var>" --filter Versions=Actual --filter Months=<month> --output pre.csv` for a slice (with `FARSEER_TENANT` set). `formula eval` answers values, not grain questions ([`formula-grain-alignment.md`](../farseer-build-model/formula-grain-alignment.md) §4).
|
|
101
|
+
|
|
102
|
+
### 4. Implement on **dev only**
|
|
103
|
+
|
|
104
|
+
Make the change on the **dev** tenant, through the `farseer-model` skill. Never start the change on a test or prod tenant.
|
|
105
|
+
|
|
106
|
+
- Run the naming checks of the `farseer-build-model` skill on every variable you add or rename, and on every variable whose `readonly`, folder or formula you change
|
|
107
|
+
- Read the variable's current state first (`farseer model --variable "<Var>" <tenant>`) if it's been a while — don't rely on stale memory of the model state
|
|
108
|
+
- Keep the change atomic: one purpose per push if possible. Bundling unrelated fixes is how `pre-` baselines stop being useful
|
|
109
|
+
- Before the change deletes an input variable, export its data, scoped (`farseer variable export "<Var>" --filter Versions=<version> --filter Years=<year> --output pre-<var>-<version>-<year>.csv`, one file per version and year it holds, with `FARSEER_TENANT` set), and keep it with the `pre-` snapshot: the snapshot is structure only, and a rollback loads the values back from this export
|
|
110
|
+
|
|
111
|
+
**Performance checklist before push** — quick self-check on any new/changed formula, not a full triage pass:
|
|
112
|
+
|
|
113
|
+
- 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
|
+
- Never combine a `Versions` broadcast and an FK hop in one product — split them.
|
|
115
|
+
- 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)).
|
|
116
|
+
- Check the change cannot make a formula produce a dense layout of cells (operand cells × every member it broadcasts over, incl. `Versions` × periods) — tens of millions is already the problem class; prevent it in the model (`formula-grain-alignment.md`, "Dense cell production").
|
|
117
|
+
|
|
118
|
+
### 5. Read back on dev
|
|
119
|
+
|
|
120
|
+
For modification work, **always start with dev**.
|
|
121
|
+
|
|
122
|
+
After push:
|
|
123
|
+
|
|
124
|
+
- `farseer model --variables <tenant>` — does the tenant accept every symbol?
|
|
125
|
+
- Take a fresh snapshot (`farseer model --json --include-members <tenant>`) — does what we wrote match what the tenant has?
|
|
126
|
+
- Diff the fresh snapshot vs the `pre-` snapshot — confirm only the intended changes appear
|
|
127
|
+
|
|
128
|
+
### 6. Run backtest + functional tests
|
|
129
|
+
|
|
130
|
+
Read the cells planned in step 3 again and compare them with the baseline values. Outcome:
|
|
131
|
+
|
|
132
|
+
- **`pass`** — diff matches expected deltas exactly; nothing else moved
|
|
133
|
+
- **`pass-with-expected-deltas`** — diff matches expected + small documented deltas (e.g. rounding noise, dim reshuffling that's known acceptable)
|
|
134
|
+
- **`fail`** — unexpected deltas; **stop and investigate before any promotion**
|
|
135
|
+
|
|
136
|
+
`fail` doesn't get swept under the rug. Either fix the change, narrow the scope, or surface the surprise to the user.
|
|
137
|
+
|
|
138
|
+
### 7. Promote dev → test → prod (skip a stage only on the user's explicit confirmation)
|
|
139
|
+
|
|
140
|
+
**Recommended:** nothing reaches production until validated on **both** dev and test. If you deviate, say why, and only on the user's explicit confirmation.
|
|
141
|
+
|
|
142
|
+
Per-step:
|
|
143
|
+
|
|
144
|
+
- **dev → test** — make the same change on test; no CLI command copies a change between tenants, so repeat it and compare a fresh test snapshot with dev's. On test, UAT / key user validates the actual behavior end-to-end (not just the variable existing).
|
|
145
|
+
- **test → prod** — only with **explicit user confirmation** stating the prod target. When tenants are coupled by a data flow, agree the order across them first — never change one half without the other.
|
|
146
|
+
- **Post-prod snapshot** — `farseer model --json --include-members <prod tenant>` saved as `YYYY-MM-DD_post-<label>.json`. This is the next baseline.
|
|
147
|
+
|
|
148
|
+
If at any stage validation fails, **roll back** to the prior snapshot (restore every difference from the `pre-` snapshot — formulas, tables, fixed members, properties, FK columns and their member values — delete the variables the change added and recreate the ones it deleted, through the `farseer-model` skill; the snapshot is structure only, so a recreated input variable comes back empty until you load its values back from the export taken before the delete (`farseer variables import`; convert the export's dimension and value columns into its `--input` JSON); then diff a fresh snapshot against `pre-` and read the restored values back) rather than papering over. The snapshots exist exactly for this.
|
|
149
|
+
|
|
150
|
+
## Constraints
|
|
151
|
+
|
|
152
|
+
- **Do not** change the model without the `pre-` snapshot in place. The snapshot is the rollback point and the backtest baseline.
|
|
153
|
+
- **Do not** skip the impact analysis (step 2). The most common failure mode for model modifications is silent breakage of a downstream consumer the modifier didn't know existed.
|
|
154
|
+
- **Do not** break an ` OUT` interface contract silently. Either preserve, or plan migration in the same change.
|
|
155
|
+
- **Do not** push to test before dev validates. Do not push to prod before test validates. If the user wants to skip a stage, name the risk — production stability over speed — and go ahead only on their explicit confirmation.
|
|
156
|
+
- **Do not** declare done without a passing backtest. `fail` outcomes get investigated, not papered over.
|
|
157
|
+
- **Do not** start a change on a live production tenant without telling its users first. T3 discipline applies.
|
|
158
|
+
- **Do not** bundle unrelated fixes in one push. One purpose per push. The `pre-` snapshot loses meaning otherwise.
|