Built-in services · rule
flag.unknown
Code or a test's flags: names a flag that flags { } doesn't declare.
Area 16, Built-in services; not declinable; the next step is usually the agent's.
Why Jadpo refuses it
Every flag is declared once, in flags.jadpo, so Jadpo knows every place
that reads one. A misspelt name would otherwise read nothing: the branch
it guards would never switch on, and no error would say why.
What it looks like
checkout_steps reads flags.new_chekout, and the flag is
new_checkout:
type CheckoutSteps = Int { min: 1 max: 3}flags { new_checkout: Bool { default: false owner: "payments" expires: "2099-01-31" }}action checkout_steps() -> CheckoutSteps { if (flags.new_chekout) { return 1 } return 3}
error flags.new_chekout isn't a flag
--> main.jadpo:15:9
|15 | if (flags.new_chekout) { | ^^^^^^^^^^^^^^^^^ no such flag
- reason
flags { }declares no flag callednew_chekout. Did you meannew_checkout?- next
- Use
flags.new_checkoutinstead offlags.new_chekout(agent) - rule
- flag.
unknown - help
- https://jadpo.
dev/docs/errors/flag. unknown
(agent) at the end of the next: line means your coding agent can make
the fix itself.
A test's flags: naming a flag no one declared is refused the same way,
with nothing near enough to suggest:
type CheckoutSteps = Int { min: 1 max: 3}flags { new_checkout: Bool { default: false owner: "payments" expires: "2099-01-31" }}action checkout_steps() -> CheckoutSteps { if (flags.new_checkout) { return 1 } return 3}test "the new checkout takes one page" { flags: { one_page_checkout: true } assert checkout_steps() == 1}
error one_page_checkout isn't a flag
--> main.jadpo:23:9
|23 | one_page_checkout: true | ^^^^^^^^^^^^^^^^^ no such flag
- reason
flags { }declares no flag calledone_page_checkout.- next
- Declare
one_page_checkout: Bool { ... }inflags.jadpo, or removeone_page_checkout:fromflags:(agent) - rule
- flag.
unknown - help
- https://jadpo.
dev/docs/errors/flag. unknown
How to fix it
If the flag is declared under another name, use that name:
if (flags.new_checkout) { ... }
checkout_steps now reads new_checkout, so it takes one page wherever
the flag is on.
If the flag doesn't exist yet, declare it in flags { } with its
default:, owner: and expires::
flags { one_page_checkout: Bool { default: false owner: "payments" expires: "2099-01-31" }}
The test now gives one_page_checkout the value true, and everyone
else gets false until the flag is changed.
Related
Markdown for agents: /docs/errors/flag.unknown.md.Built from Jadpo main at e00e61f.