Skip to content

feat: schema alignment & metadata-driven validation#35

Open
elocke wants to merge 3 commits intoopenclaw:mainfrom
elocke:feat/schema-alignment
Open

feat: schema alignment & metadata-driven validation#35
elocke wants to merge 3 commits intoopenclaw:mainfrom
elocke:feat/schema-alignment

Conversation

@elocke
Copy link

@elocke elocke commented Jan 30, 2026

Summary

  • Extend the config generator to emit a JSON metadata file (openclaw-config-metadata.json) alongside the Nix options, capturing valid paths, types, dynamic keys, and known channels from the upstream Zod schema
  • Add a generic providers.channels system replacing the telegram-specific helpers, with backwards-compat aliases so existing providers.telegram.* config continues to work
  • Auto-sync enum values (thinkingDefault, queue.mode) from the generated metadata instead of hardcoding them
  • Add recursive configOverrides validation (key existence + type checking) and channel config validation against schema metadata, surfaced as standard home-manager assertion errors
  • Update CI golden-file check and update-pins.sh to include the metadata file

Test plan

  • nix flake check --no-build passes
  • nix build .#checks.x86_64-linux.config-options passes (via remote builder)
  • nix eval confirms metadata lookups return correct enum values
  • No references to removed generatedConfigOptions or mkTelegramConfig remain
  • Verify existing providers.telegram.* configs still evaluate correctly (backwards compat)
  • Verify invalid configOverrides keys produce assertion errors
  • Verify unknown channel names in providers.channels produce assertion errors

🤖 Generated with Claude Code

elocke and others added 3 commits January 30, 2026 14:21
Add metadata collection to generate-config-options.ts that produces
openclaw-config-metadata.json alongside the Nix options file. The
metadata includes validPaths, types, dynamicKeys, and knownChannels
extracted from the upstream Zod schema. Single-value enum alternatives
in oneOf unions are collapsed into flat enum types for easier
consumption by the Nix module.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add CONFIG_METADATA_GOLDEN to the check derivation and diff the
generated metadata against the golden file in the check script.
Also update update-pins.sh to commit the metadata file alongside
the Nix options when pins are bumped.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add providers.channels attrsOf submodule to instance and top-level
  options for generic channel configuration (telegram, discord, etc.)
- Replace mkTelegramConfig with generic mkChannelConfigs using foldlAttrs
- Add generic channel token injection in the gateway wrapper
- Add backwards-compat telegramToChannel/mergeChannels aliases so
  existing providers.telegram.* config maps to providers.channels
- Add missing providers.telegram.groups to top-level options
- Import schemaMeta from generated metadata JSON and auto-sync enum
  values for thinkingDefault and queue.mode from upstream schema
- Add recursive configOverrides validation (key existence + type
  checking) against schema metadata with assertion error messages
- Add channel config validation against schemaMeta.knownChannels
- Remove dead config submodule option and generatedConfigOptions import

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant