Skip to content

log/views: render external types via generic blueprint fallback#338

Closed
Rekseto wants to merge 1 commit into
masterfrom
intern0/dev/external-type-render
Closed

log/views: render external types via generic blueprint fallback#338
Rekseto wants to merge 1 commit into
masterfrom
intern0/dev/external-type-render

Conversation

@Rekseto

@Rekseto Rekseto commented Jun 11, 2026

Copy link
Copy Markdown
Member

Objects of external types (blueprint-backed astral.RuntimeObject) had no compiled-in view, so fmt.ViewFor fell through to %v and printed the raw Go carrier (pointer hex, internal field/index state) instead of a readable value.

Add a fallback hook to the view lookup: fmt.SetFallbackView installs a builder consulted on a per-type registry miss, before the Stringify path. mod/log/views registers RuntimeObjectView there, rendering Type{Field: value, ...} for struct kind and Type(value) for alias kind, delegating each field to fmt.ViewFor so nested primitives and nested external types render through the same machinery.

Runtime container carriers (RuntimeSlice/RuntimeArray/RuntimeMap) expose a constant ObjectType, so they register per-type via fmt.SetView; the map view sorts keys for deterministic log output. A new RuntimeObject.Blueprint() accessor exposes the schema the view iterates.

Fixes #337.

Objects of external types (blueprint-backed astral.RuntimeObject) had no
compiled-in view, so fmt.ViewFor fell through to %v and printed the raw Go
carrier (pointer hex, internal field/index state) instead of a readable value.

Add a fallback hook to the view lookup: fmt.SetFallbackView installs a builder
consulted on a per-type registry miss, before the Stringify path. mod/log/views
registers RuntimeObjectView there, rendering Type{Field: value, ...} for struct
kind and Type(value) for alias kind, delegating each field to fmt.ViewFor so
nested primitives and nested external types render through the same machinery.

Runtime container carriers (RuntimeSlice/RuntimeArray/RuntimeMap) expose a
constant ObjectType, so they register per-type via fmt.SetView; the map view
sorts keys for deterministic log output. A new RuntimeObject.Blueprint()
accessor exposes the schema the view iterates.

Fixes #337.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Rekseto

Rekseto commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

Finished by our @astral-intern0 963fefc

@Rekseto Rekseto closed this Jun 15, 2026
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.

Objects of external types render as raw go dumps

1 participant