Skip to content

config_contract: pattern and max_length; length means exactly - #301

Merged
vsilent merged 1 commit into
devfrom
feature/contract-pattern-max-length
Oct 19, 2026
Merged

vsilent merged 1 commit into
devfrom
feature/contract-pattern-max-length

Conversation

@vsilent

@vsilent vsilent commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Template authors can declare what a buyer-provided value looks like; the platform checks it in the Quick Deploy form and the deploy start.

  • FieldPolicy: new pattern (whole-value regex) and max_length.
  • Parse-time refusal of contracts nothing could satisfy: non-compiling pattern, min_length > length, min_length > max_length, length > max_length.
  • Alphanumeric generator honours length (before: only min_length, so length: 16 gave 32 characters).

Tests first: tests/config_contract_pattern.rs (4) and new examples in tests/contracts/marketplace-field-policy.contract.json failed, then passed. cargo test --lib: 2275 passed. clippy: no new warnings in the changed files.

Must be deployed before a template uses pattern/max_length: older stacker refuses the unknown keys.

🤖 Generated with Claude Code

https://claude.ai/code/session_012TKZy6f5shPzM9WLdswH6f

A Quick Deploy buyer could type 4 characters into SUPABASE_SECRET_KEY or
OPENAI_API_KEY: the contract had no way to say what a key looks like, so
nothing could refuse it.

- FieldPolicy gains pattern (whole-value regular expression) and
  max_length; the platform checks them in the Quick Deploy form and in the
  deploy start.
- A contract nothing could satisfy is refused when parsed: a pattern that
  does not compile, min_length over length, min_length over max_length,
  length over max_length.
- The alphanumeric generator honours length (it used min_length only and
  ignored length, so length 16 produced 32 characters).

Tests first: tests/config_contract_pattern.rs and the shared contract's new
examples failed, then passed. cargo test --lib 2275 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012TKZy6f5shPzM9WLdswH6f
@vsilent
vsilent merged commit 1cd524e into dev Oct 19, 2026
10 checks passed
@vsilent vsilent mentioned this pull request Oct 19, 2026
Merged
vsilent pushed a commit to trydirect/awesome-selfhosted-stacker that referenced this pull request Oct 20, 2026
- OPENAI_API_KEY: pattern ^sk-..., min_length 40, max_length 256
- SUPABASE_SECRET_KEY / SUPABASE_PUBLISHABLE_KEY: pattern sb_secret_ /
  sb_publishable_, max_length 256
- REALTIME_DB_ENC_KEY length 16, VAULT_ENC_KEY length 32 (exact: a longer
  key crashes realtime / supavisor)

The Quick Deploy form and the deploy start refuse values that break them.
Needs a stacker with pattern/max_length (trydirect/stacker#301).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012TKZy6f5shPzM9WLdswH6f
vsilent pushed a commit to trydirect/awesome-selfhosted-stacker that referenced this pull request Oct 21, 2026
- OPENAI_API_KEY: pattern ^sk-..., min_length 40, max_length 256
- SUPABASE_SECRET_KEY / SUPABASE_PUBLISHABLE_KEY: pattern sb_secret_ /
  sb_publishable_, max_length 256
- REALTIME_DB_ENC_KEY length 16, VAULT_ENC_KEY length 32 (exact: a longer
  key crashes realtime / supavisor)

The Quick Deploy form and the deploy start refuse values that break them.
Needs a stacker with pattern/max_length (trydirect/stacker#301).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012TKZy6f5shPzM9WLdswH6f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants