feat(core): parameter fields in text, groups and gating by used values (#16)
- `::param{name=x}` places a parameter's input inside the text.
- `:::group{title="…" collapsed}` is a collapsible container for anything;
groups are presentational and never gate steps. Included notebooks
namespace field names and group titles.
- `groupInputs` reports a container's input status (missing, filled,
optional, none) from its fields, the parameters its steps use and, for
`::use`, the included notebook's parameters.
- A step is gated only by the values it uses: referenced parameters, the
required secrets its script reads and valid set secrets of its scope.
Unused required parameters no longer block early steps of a guided
runbook.
- Spec §3.2/§3.6/§3.7, workspace format guide and a guided admin-user
example notebook.
This commit is contained in:
@@ -132,7 +132,8 @@ describe("rendering and secrets", () => {
|
||||
it("blocks missing and invalid used params, unknown variables and invalid hosts", () => {
|
||||
const n = book(" x: {type: name}\n required: {type: string, required: true}\n unused: {type: name}", "{{x}} {{unknown}} {{empty}}", "host=missing");
|
||||
const r = render(n, { x: "bad value", unused: "bad value" }, { empty: "" });
|
||||
expect(r.missing).toEqual(["required", "empty"]);
|
||||
// An unused required param does not block the step (guided notebooks, spec §3.6).
|
||||
expect(r.missing).toEqual(["empty"]);
|
||||
expect(Object.keys(r.invalid).sort()).toEqual(["host", "unknown", "x"]);
|
||||
expect(r.script).toBe("{{x}} {{unknown}} {{empty}}\n");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user