Skip to content

feat: add the shared config checks and the struct walk - #2

Merged
patdowney merged 2 commits into
mainfrom
feat/shared-checks-and-walk
Nov 14, 2026
Merged

patdowney merged 2 commits into
mainfrom
feat/shared-checks-and-walk

Conversation

@patdowney

@patdowney patdowney commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The parts of #1 that belong in this module, lifted from connect's configrules, configschema and config naming test so connect-control and later services need not write them again.

configcheck gains the checks every service repeats. Each reports at the collector it is given, and treats an empty value as not set:

  • CheckListenAddress, IsLoopbackAddress, ListenAddressesConflict
  • CheckURL (a URL with a host), CheckHTTPURL
  • CheckNonNegative

configwalk (new, standard library only) reads config structs the way the loader does:

  • Fields returns a struct's keys, inlining squashed and embedded structs; Walk visits every reachable struct once, including self-referencing ones; SquashedFields lists named squashed structs for generators that inline only embedded ones.
  • Defaults records what a constructor sets, as a file writes it (a duration as 5s).
  • IntegerPattern, UnsignedPattern, NumberPattern, DurationPattern and BoolStrings describe weakly typed scalars.
  • KeyNamingProblems is the naming-rule test helper: keys must be kebab-case and must not end in config.

Only the generic parts move. Building the JSON Schema stays with connect's generator, so this module does not take on invopop/jsonschema.

Examples with checked output: ExampleCollector (already present), ExampleCheckListenAddress, ExampleListenAddressesConflict, ExampleFields, ExampleKeyNamingProblems.

The TLS and OIDC checks the issue lists live with their types, in dioad/net/tls and dioad/auth/oidc. They are committed on branches in those repos and will be raised once this is merged and released.

Fixes #1

🤖 Generated with Claude Code

https://claude.ai/code/session_01SS4MAwAn85D1gkEzLtjYaZ

patdowney and others added 2 commits November 14, 2026 20:38
…rvices share

CheckListenAddress, IsLoopbackAddress, ListenAddressesConflict, CheckURL,
CheckHTTPURL and CheckNonNegative, lifted from connect's configrules so
connect-control and later services need not write them again. Each reports at
the collector it is given and treats an empty value as not set.

Refs #1

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SS4MAwAn85D1gkEzLtjYaZ
…hare

Lifted from connect's configschema and its config naming test. Fields reads a
struct's keys as the loader does, inlining squashed and embedded structs;
Walk visits every reachable struct once; Defaults records what a constructor
sets, as a file writes it; the scalar patterns describe weakly typed values;
and KeyNamingProblems finds keys that are not kebab-case or end in config.
Only the generic parts move: building the JSON Schema stays with the
generator, so this package depends on the standard library alone.

Refs #1

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SS4MAwAn85D1gkEzLtjYaZ
@patdowney
patdowney merged commit 7d7d158 into main Nov 14, 2026
4 checks passed
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.

Shared config checks with field-path findings, lifted from connect's configrules

1 participant