Skip to content

Make plugin name validation regex-portable - #79

Open
jonathanhefner wants to merge 1 commit into
agentplugins:mainfrom
jonathanhefner:agent/fix-re2-name-pattern
Open

Make plugin name validation regex-portable#79
jonathanhefner wants to merge 1 commit into
agentplugins:mainfrom
jonathanhefner:agent/fix-re2-name-pattern

Conversation

@jonathanhefner

Copy link
Copy Markdown
Member

Problem

The plugin manifest schema uses a negative lookahead to enforce name constraints. Although the expression is valid ECMA-262, lookaround is outside the portable subset recommended by JSON Schema and cannot be compiled by RE2-based validators, such as those using Go regexp.

The full-string expression also relies on $ behavior that differs across regular-expression engines. In particular, engines that let $ match before a terminal newline can accept a name that §5.5 rejects.

Resolution

Replace the lookahead with two ordinary JSON Schema assertions:

  • pattern requires the name to begin with a lowercase ASCII alphanumeric character.
  • not.pattern rejects disallowed characters, punctuation at the end, --, and ...

Both pattern and not are standard Draft 2020-12 keywords, so the correction introduces no custom validation mechanism.

This keeps all patterns within the broadly portable subset and preserves the constraints defined by §5.5. Explicitly rejecting disallowed characters also makes terminal-line-break behavior consistent across engines.

The correction applies to the 1.1.0 working draft. The published 1.0.0 schema retains its canonical contents.

Validation

An AI agent:

  • Compiled schemas/1.1.0/plugin.schema.json as Draft 2020-12 with Ajv.
  • Compared the replacement assertions with the §5.5 predicate across 137,257 generated names with no mismatches.
  • Checked mixed punctuation, repeated punctuation, invalid characters, punctuation endpoints, terminal line breaks, and 64/65-character boundaries.

Closes #76.

Replace the 1.1.0 manifest `name` lookahead with simple assertions that
compile on RE2-based JSON Schema validators. Preserve the constraints
defined by §5.5, including mixed `-.` and `.-` sequences, while
explicitly rejecting disallowed characters so regex engines with
differing `$` semantics agree on terminal line breaks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant