docs: Calculated fields formula reference (sc-15979)#1323
Conversation
Rewrites the Calculation field type docs in a Starlark-first voice and adds a built-in helper-functions table. Updates the worked Risk Tier, Next Review Date, and Days Remaining examples to dict-access params and the new helpers; each example was verified through the canonical transpile() and StarlarkExecutor.run() pipeline from validmind/backend@origin/main. Adds a single note callout in the Calculation entry that names the engine and confirms stored formulas were migrated automatically. Removes the three calculated-field screenshots pending the locked editor UI.
PR SummaryThis PR updates the documentation and examples for calculation fields within the inventory and artifact guides. The key changes include:
Overall, the PR enhances the accuracy of the documentation by aligning code examples with the current implementation details and best practices for writing formulas in the platform. Test Suggestions
|
What and why?
Rewrites the calculated fields formula reference so it reads as if the Starlark formula engine has always been the runtime, and adds a single short callout that names the engine and confirms that stored formulas were migrated automatically.
Relates to sc-15979
Two partials changed:
site/guide/inventory/_field-types.qmd— Calculation field type intro rewritten in a Starlark-first voice, with a built-in helper-functions table, a single engine note callout, the Risk Tier example rewritten with dict-access syntax, the artifact panel-tabset (Severity / Due date / Custom fields) rewritten withparams["finding_type"]andparams["model"], and thecalculation-field.pngreference removed. Mirrors the same prose in the revealjs-only block.site/guide/inventory/_example-next-review-date-and-days-remaining.qmd— Risk Tier, Next Review Date, and Days Remaining formulas rewritten usingsafe_parse_date,add_months,days_between,today(), andparams.get. Both embedded calculation-field screenshots removed.Every rewritten formula was run through the canonical transpiler in
validmind/backend@origin/main:scripts/starlark_validate.pyand executed viaStarlarkExecutor.run()against representative param sets to confirm parity with the original Python.How to test
After the preview deploy finishes, check:
manage-inventory-fields.What needs special review?
_field-types.qmdis the only place in the guide that names Starlark or mentions migration — confirm that voice is what we want and that no additional in-page hedging is required.calculation-field.png,calculation-field-next-review-date.png,calculation-field-days-remaining.png) were removed pending the final formula-editor UI. Recapture and re-add in a follow-up PR once the Starlark editor ships.backend/src/backend/utils/starlark_executor.py. Quick sanity check that the labels match what the editor autocomplete will surface.Dependencies, breaking changes, and deployment notes
launchdarkly.rollout.formula.starlark. The docs are written for the post-rollout world; nothing here implies a flag.Release notes
documentationRefreshed the calculated fields formula reference: dict-access syntax, a built-in helper-functions reference, updated worked examples, and a single note acknowledging the underlying engine swap.
Future release notes (draft, not part of this PR)
The two snippets below follow the existing
releases/<component>/<version>/_pr-<number>.qmdconvention in the release-notes repo. They are intentionally not committed as part of this docs PR — copy them into the appropriate version folder whenlaunchdarkly.rollout.formula.starlarkhas been turned on for all orgs.releases/backend/<version>/_pr-3058.qmdreleases/frontend/<version>/_pr-2510.qmdChecklist