trace-schemas: add namespace-driven schema generation and validation tooling#6527
Open
trace-schemas: add namespace-driven schema generation and validation tooling#6527
Conversation
9b37275 to
8913d02
Compare
mgmeier
requested changes
Apr 21, 2026
Contributor
mgmeier
left a comment
There was a problem hiding this comment.
Please condense / clean-up commit history for this PR.
mgmeier
requested changes
Apr 21, 2026
Contributor
mgmeier
left a comment
There was a problem hiding this comment.
Testing feedback: You've already made the various scripts executables in bench/trace-schemas/scripts/schema-gen/trace-schema-gen.cabal. This means, they're part of the nix flake.
So instead of building a full dev shell with all dependencies, and running the script via bash / runghc, you should switch the new Make targets to something like nix run .#schema-gen.
6dd06b1 to
93fa1f5
Compare
mgmeier
requested changes
Apr 23, 2026
3d2061f to
4ccfbad
Compare
Remove unnecessary artefacts
4201a28 to
85c69ec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Summary
This PR introduces a namespace-driven trace schema workflow and the tooling around it.
It adds support for generating schema files from traced namespaces, validates generated schemas and trace logs, documents how overrides work, and wires the schema scripts into a standalone Cabal package so they can be run consistently from the dev environment. It also updates trace documentation generation to work with optional namespace lists and refreshes the generated trace-schema artifacts.
On the tracing side, it extends the source discovery and inference logic used by schema generation, improves handling of external
trace-dispatcherdefinitions, and tightens warning reporting so schema generation only reports real unresolved cases instead of false positives.Why this is hard
This cannot be solved by deriving JSON Schema directly from Haskell types, because the trace JSON is not determined by the types alone. The emitted payloads are shaped by
forMachineimplementations, helper functions, pattern matches, namespace mapping, verbosity/detail levels, and hand-written rendering logic across multiple packages. In practice, fields may be renamed, omitted, flattened, synthesized, or rendered as strings, so the runtime JSON contract often differs from the source type definition.Main changes
bench/trace-schemasas the home for generated schemas, metadata, documentation, presentations, and helper docs.GhciSchemaGen.hsValidateTraceSchemas.hsValidateTraceLog.hsApplySchemaOverrides.hsCheckOverrideCoverage.hsRegenerateTraceSchemas.shtrace-schema-gen.cabaland wire it intocabal.project.cardano-nodetrace documentation generation to support optional namespace selection.cardano-node,trace-dispatcher, and related tracing modules.newNamespaces.txt,trace-documentation.md, and schema artifacts from the new pipeline.Testing
nix develop.Schema generation problems: 0.