Skip to content

@max_iterations(N) is documented as required but numeric decorator arguments do not parse #586

Closed

Description

@godofecht

Follow-up to #583.

Flow's safety-profile documentation says every while under safety / flight must carry @max_iterations(N), but the documented form is rejected by the parser.

docs/language/safety-profiles.md:28 contains:

@max_iterations(1000)
while cond {
    # ...
}

The docs verifier reports SyntaxError: Expected decorator argument, got TokenType.NUMBER.

The same failure appears in docs/AI_FLOW_HANDBOOK.md:964.

This is a contract mismatch in a safety-critical feature: the docs describe a mandatory annotation and say the C backend emits a runtime counter, while the front end cannot parse the example syntax.

Resolve the syntax contract one way or the other. If numeric decorator arguments are the intended design, parse and type-check them and cover @max_iterations(1000) end-to-end. If the actual annotation syntax differs, make the documentation and diagnostics use the canonical supported form.

Acceptance: the safety-profile example compiles through the normal docs verification pipeline, and a compiler test covers the accepted bounded-loop annotation syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions