Skip to content

Commit 307fda7

Browse files
committed
Update CLI docs to reflect TE3 PR 3254 bpa run resolution chain
- Rename two remaining TE_BPA_PATH references to TE_BPA_RULES in te-cli-limitations.md (env var was renamed in CLI commit 138136976). - Note te bpa run alongside the deploy/save gate as a consumer of every bpa.rules entry in te-cli-config.md. - Clarify te bpa run --rules description (replaces user-rule layer, not "additional") and add a "Rule sources and resolution" subsection covering the priority chain --rules > TE_BPA_RULES > bpa.rules config and the layered model used by the Rules loaded: output line.
1 parent eb4387a commit 307fda7

3 files changed

Lines changed: 23 additions & 4 deletions

File tree

content/features/te-cli/te-cli-commands.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ Run Best Practice Analyzer rules against a model.
407407
`te bpa run` accepts:
408408

409409
- `<model>` - positional argument: path to model (alternative to the `--model` global flag).
410-
- `-r, --rules <file-or-url>` - path(s) or URL(s) to additional BPA rule file(s) in JSON format. Repeatable.
410+
- `-r, --rules <file-or-url>` - path(s) or URL(s) to BPA rule file(s) in JSON format. Repeatable. Replaces the user-rule layer for this invocation: see [Rule sources and resolution](#rule-sources-and-resolution) below.
411411
- `--no-model-rules` - exclude BPA rules embedded in the model's annotations.
412412
- `--no-defaults` - exclude built-in default BPA rules.
413413
- `--vpax <file>` - load VertiPaq Analyzer stats from a `.vpax` file to enable VPA-aware rules.
@@ -433,6 +433,25 @@ te bpa run --path 'Sa*' # Wildcard - every table starting with Sa
433433
te bpa run --path Sales/Measures # Path filter applied to the matched tables
434434
```
435435

436+
#### Rule sources and resolution
437+
438+
Each `te bpa run` invocation assembles rules from three independent layers:
439+
440+
1. **User rules** - exactly one source wins, in priority order:
441+
- `-r, --rules <path-or-url>` flag (highest)
442+
- `TE_BPA_RULES` environment variable
443+
- `bpa.rules` array from CLI config (`~/.config/te/config.json`)
444+
2. **Built-in defaults** - loaded unless `--no-defaults` is passed or [`bpa.builtInRules`](xref:te-cli-config#bpa-gate-keys) is `false` in config. Individual built-ins listed in `bpa.disabledBuiltInRuleIds` are skipped.
445+
3. **Model-embedded rules** - rules in the model's `BestPracticeAnalyzer_Rules` annotation, loaded unless `--no-model-rules` is passed. External URL annotations are skipped unless `--allow-external-rules` is also passed.
446+
447+
Duplicate rule IDs are de-duplicated (user rules win over built-ins). Rule IDs in the model's `BestPracticeAnalyzer_IgnoreRules` annotation are then removed.
448+
449+
The `Rules loaded:` line in the output attributes each contributing layer, for example:
450+
451+
```
452+
Rules loaded: 41 from 1 file(s) from bpa.rules config + built-in defaults + model annotations
453+
```
454+
436455
### bpa rules
437456

438457
Manage BPA rule collections — list, inspect, initialize, and toggle rules in your local rules file or in model annotations. Built-in rules are read-only - to skip one without losing the rest, use `te bpa rules disable` (do not edit the built-in set directly).

content/features/te-cli/te-cli-config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Set these in your config to avoid passing the same paths on every command. Per-c
121121
| Key | Meaning |
122122
| -- | -- |
123123
| `macros` | Explicit path to a macros JSON file (typically `MacroActions.json`). Resolved by every `te macro` command. Point at a shared file (network share, repo-local, or even the TE3 desktop file) to reuse the same set of macros across machines and between the CLI and TE3 Desktop. |
124-
| `bpa.rules` | Ordered list of paths or URLs to BPA rule files. The deploy/save gate loads **every** existing entry; `te bpa rules list` and `te config paths` use the first existing entry. Comma-separated values on `te config set bpa.rules ...` are split into the array. |
124+
| `bpa.rules` | Ordered list of paths or URLs to BPA rule files. `te bpa run` and the deploy/save gate load **every** existing entry; `te bpa rules list` and `te config paths` use the first existing entry. Comma-separated values on `te config set bpa.rules ...` are split into the array. |
125125
| `te3ExePath` | Explicit path to the Tabular Editor 3 Desktop executable (`TabularEditor.exe`). Used **only** by `te open` to launch the desktop app; safe to leave unset on Linux/macOS or when you don't use `te open`. If unset, `te open` falls back to a `PATH` lookup. |
126126
| `queryLog` | Path to a log file where every `te query` invocation appends its query text and execution metadata. Useful for audit trails or analyzing query patterns over time. Supports `~` for the home directory (e.g., `~/.config/te/queries.log`). |
127127

content/features/te-cli/te-cli-limitations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ The CLI runs C# scripts (`te script`) against the same `Model` object you use in
4444
| -- | -- |
4545
| **BPA rule sources must be HTTPS URLs or local file paths** | Only `https://` URLs and bare local file paths are accepted. `http://` is recognized but deliberately rejected at load time with a clear error - BPA rules are executable rule expressions, and fetching them over an unauthenticated channel would be a tampering risk. Other URL schemes (`file://`, `ftp://`, …) are not supported. Applies to both `te bpa run --rules` and the rule list configured via [`te config set`](xref:te-cli-commands#config-show--paths--init--set). |
4646
| **Rule-URL validation runs at gate time, not on `te config set`** | A typo such as `http://` is accepted by `te config set` and only surfaces when BPA actually runs. After editing the configured rule sources, run `te bpa run` (or `te validate`) once to verify each URL loads. |
47-
| **`--rules` does not suppress built-in rules** | When `te bpa run --rules <path-or-url>` is passed, the supplied rules replace the entries in [`bpa.rules`](xref:te-cli-commands#config-show--paths--init--set) and `TE_BPA_PATH` for that invocation, but the built-in defaults still load alongside. To run only the explicit rule file, also pass `--no-defaults`. |
48-
| **No per-invocation flag to skip `bpa.rules` config** | Once `bpa.rules` is configured, every `te bpa run` loads those rules in addition to the built-ins. There is currently no flag to skip the configured rule files for a single run. Workaround: pass `--rules <path-or-url>` explicitly - the flag fully replaces `bpa.rules` and `TE_BPA_PATH` for that invocation. |
47+
| **`--rules` does not suppress built-in rules** | When `te bpa run --rules <path-or-url>` is passed, the supplied rules replace the entries in [`bpa.rules`](xref:te-cli-commands#config-show--paths--init--set) and `TE_BPA_RULES` for that invocation, but the built-in defaults still load alongside. To run only the explicit rule file, also pass `--no-defaults`. |
48+
| **No per-invocation flag to skip `bpa.rules` config** | Once `bpa.rules` is configured, every `te bpa run` loads those rules in addition to the built-ins. There is currently no flag to skip the configured rule files for a single run. Workaround: pass `--rules <path-or-url>` explicitly - the flag fully replaces `bpa.rules` and `TE_BPA_RULES` for that invocation. |
4949

5050
## Validation
5151

0 commit comments

Comments
 (0)