Skip to content

feat(config): JSON Schemas for config.json and the devcontainer block - #522

Merged
wstein merged 3 commits into
mainfrom
feat/268-config-json-schemas
Oct 9, 2026
Merged

wstein merged 3 commits into
mainfrom
feat/268-config-json-schemas

Conversation

@wstein

@wstein wstein commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Adds hand-written, provisionally versioned (v0-provisional) JSON Schemas for config.json and customizations.workharbor, a recursive schema-versus-struct comparison test, an optional $schema key that the loader ignores (no runtime loading), and publication on the docs site.

Closes #268

Review: Opus CLEAR on 8c2d39c; Lows (schematest keyword walk, docs-site temp dir cleanup, schema stricter than loader for explicit zero values and scheme case) are batched on #399. Unverified: VS Code handling of the remote $ref; hosted Pages deployment.

🤖 Generated with Claude Code

wstein and others added 3 commits October 9, 2026 12:06
The configuration is not stable, so #268 maps one explicitly provisional,
named version: v0-provisional. The schema is hand-written in
schemas/config.v0-provisional.schema.json and checks structure only
(keys, types, enums, ranges); ownership, permissions and runtime policy
stay in Validate and whr doctor.

config.Parse keeps DisallowUnknownFields. Only an optional string key
$schema is added, as Config.Schema, so a file that names its schema for
editors still loads while typos and secret-field rejection are unchanged.
Nothing reads or resolves the value, so no network request can happen and
a missing, wrong or unreachable URL never affects loading; a test pins
that by structure, since a call cannot be proven absent otherwise.

Two $schema meanings stay apart: the schema document names the JSON Schema
dialect, an instance names the published schema URL (a test checks both).

internal/schematest holds a small validator and a recursive comparison of
a schema with a Go struct (keys both ways, nested, types, optionality). I
wrote a walker instead of adding a validator dependency: it supports only
the keywords the schemas use and panics on any other, so nothing in a
schema goes unchecked. The one deliberate exception is clone_depth, which
the loader reads as 0 when missing.

Refs: #268
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
D51's check and the other hint keys live in a free-form customizations
block, so an editor cannot complete or check them. Add the hand-written
schemas/devcontainer-workharbor.v0-provisional.schema.json (same
provisional name as the config schema: v0-provisional). It is structural
only; the supervisor's configuration still decides and the reader still
ignores bad values with a note. It flags unknown keys so an editor shows
a typo although the reader would ignore them.

The reader's anonymous struct becomes the named workharborBlock so a test
can compare it recursively with the schema, as it does for config.json
(keys both ways, types, optionality). previewPorts stays a RawMessage
because the reader accepts numbers and numeric strings; the schema allows
both and the test only requires its entry. Good and wrong blocks
(typo, wrong type, bad port) are validated with the same small walker.

Refs: #268
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
#268 asks for the schemas next to openapi.json. Mount the repository's
schemas/ directory into the site at /schemas/, as #267 does for
openapi.json: one canonical source, copied during the docs build, with no
second copy. The pages workflow now also runs when schemas/ changes.

Each file name carries its surface and version
(<surface>.v0-provisional.schema.json), so a later version gets a new URL
and older files stay where they are. A docs test checks that every file
of schemas/ is published byte for byte and that its name has that shape;
that a published file is never edited stays a review rule, not a test.

The new manual page JSON Schemas explains the provisional marking, the
$schema line (ignored by the loader, never fetched) and one editor
association for the devcontainer block (a VS Code json.schemas wrapper).
Whether VS Code resolves that remote $ref is marked unverified. The docs
test helper builds the site once for all tests of the package.

Refs: #268
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@wstein

wstein commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

Opus review CLEAR on 8c2d39c. Full go test ./... exit 0 and make check-ci exit 0 on that head (author and reviewer). No High/Medium findings. Lows (batched on #399): schematest unsupported-keyword walk only covers reached subschemas; scripts/docs_schema_test.go leaves a built site in TMPDIR; schema stricter than the loader for explicit zero percents/preview ports and uppercase URL scheme. Unverified: VS Code handling of the remote $ref, hosted Pages deployment.

@wstein
wstein marked this pull request as ready for review October 9, 2026 10:24
@wstein
wstein merged commit 11dcd0e into main Oct 9, 2026
20 of 21 checks passed
@wstein
wstein deleted the feat/268-config-json-schemas branch October 9, 2026 10:25
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.

Schemas for config.json and the devcontainer customizations.workharbor block, once the configuration settles

1 participant