[BUG] Generated API references misrepresent declaration shapes and field visibility #5
Labels
No labels
bug
ci
docs
duplicate
enhancement
help wanted
invalid
performance
phase-6
question
refactor
security
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
erix/docs#5
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The manual's public API renderer infers declaration shape from visible field text. This turns opaque tuple wrappers into apparent public unit constructors and named opaque structs into tuple structs. Tuple enum variants can also acquire invalid numeric named fields, and public struct fields omit their required
pubaccess marker. The defect misstates the documented Rust API; it does not change compiled Rust behavior.Reproduction
At docs commit
d91ddf63bc502c51da7c8e1eb12ba8ecff723357, inspect the generatedlib_ipc::SignalIdentityV1declaration inmanual/8-libraries/api-reference/lib-ipc.tex: it readspub struct SignalIdentityV1;.The recorded source is lib-ipc
832cc9096e3da50f29c501f47de8d41f23fa55f0, whosesrc/signals.rs:71definespub struct SignalIdentityV1(u32);. Its retained Rustdoc format-54 item has"kind": {"tuple": [null]}because the field is private. Rendering that item deterministically produces the incorrect unit declaration. The published lib-block reference renderslib_block::Error::TransportasTransport { 0: u32 }, and lib-cli renderslib_cli::NumericError::InvalidDigitasInvalidDigit { 0: usize }. Separate minimal format-54 tuple-variant fixtures with inherited field visibility and positional name"0"reproduce this wrong punctuation.Expected and actual behavior
The renderer should preserve explicit unit, tuple and named shapes, field order and visibility. Stripped private fields require unmistakable placeholders without their private types; named opaque structs require braces. Tuple positions must not become named Rust fields. Public struct fields retain
pub, while inherited enum fields and private placeholders do not receive it.Actual output discards stripped tuple positions and guesses punctuation from the remaining strings. The initial independent shape regression fails on opaque, mixed, public tuple and empty named/tuple fixtures; the variant regression separately fails on numeric positional names. A separate visibility fixture fails when
pubis absent on mixed or fully public struct fields. Existing test success did not cover these cases.Environment and identity
d91ddf63bc502c51da7c8e1eb12ba8ecff723357.fa15b9782f2590b5aac6c4f7df3f637257a1e885496aab7e91f74e5ada7358fa.832cc9096e3da50f29c501f47de8d41f23fa55f0; retained Rustdoc JSON SHA-256:8bdffea8eb3c6c5a8c3e96c6d6aa39518e4d863165ae9ddca77a9f783fa16820.Evidence and prior checks
The published false declaration and its source are directly inspectable at the generated reference and the original Rust definition.
The retained original JSON digests match all 33 existing generated-reference headers. A shape-aware candidate preserves all historical route sets; its declaration changes are confined to struct/enum shape rendering and public struct-field visibility. Independent fixtures cover unit, empty tuple/named, opaque tuple/named, mixed public/private fields, field order and enum discriminants. The corrected full manual passes its strict warning gate: 2,027 pages, 389,257 word boxes within page bounds and no final warnings. Nine selected pages were visually inspected. The correction is published in signed commit
c8e754bff3and WIP PR #4. Current-revision CI remains separately tracked.Tracking
Track the renderer correction and matching generated-reference refresh in the documentation repository. Acceptance requires focused red/green regressions, unchanged source labels and retained JSON hashes for historical rows, generator check-mode agreement, and a complete warning-free manual build. Fresh source/toolchain regeneration of unrelated historical snapshots remains separate audit work.
erikinkinen referenced this issue2026-09-12 12:55:29 +02:00
[BUG] Generated API references misrepresent opaque structs and tuple variantsto [BUG] Generated API references misrepresent declaration shapes and field visibility