From: Markus Armbruster <armbru@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-devel@nongnu.org, "Kashyap Chamarthy" <kchamart@redhat.com>,
"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
"Michael Roth" <michael.roth@amd.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-block@nongnu.org,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Hanna Reitz" <hreitz@redhat.com>, "Peter Xu" <peterx@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Stefano Garzarella" <sgarzare@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Lukas Straub" <lukasstraub2@web.de>,
"Jason Wang" <jasowang@redhat.com>,
"Alex Williamson" <alex@shazbot.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Cédric Le Goater" <clg@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Eric Blake" <eblake@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Kostiantyn Kostiuk" <kkostiuk@redhat.com>,
"Jiri Pirko" <jiri@resnulli.us>,
"Ani Sinha" <anisinha@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>
Subject: Re: [PATCH v2 00/10] qapi: enforce section ordering
Date: Wed, 15 Apr 2026 11:43:45 +0200 [thread overview]
Message-ID: <87zf341ru6.fsf@pond.sub.org> (raw)
In-Reply-To: <20260408045531.3006678-1-jsnow@redhat.com> (John Snow's message of "Wed, 8 Apr 2026 00:55:21 -0400")
John Snow <jsnow@redhat.com> writes:
> Hiya, this series is meant to accomplish mostly one thing: Enforce a
> stricter ordering of sections in QAPI documentation blocks.
>
> The reason to do this is mostly for the sake of the inliner: if QAPI
> documentation blocks have some known, canonical order, it is easier to
> merge two documentation blocks together for the purposes of showing all
> arguments for commands/etc in a simple, flat list without needing to
> follow hyperlink breadcrumbs.
>
> Another reason to do this is to simplify where we insert autogenerated
> documentation. If the order is enforced, then inserting "Not Documented"
> stubs for members and generated "Returns:" statements can have a much
> simpler algorithm that will always match how manually written
> documentation is presented, in the same order.
>
> This is still pretty RFC quality, the tests have not been implemented
> and the implementation of changes in the parser are still pretty
> fuzzy. The main point of this series at this point in time is to review
> the QAPI source changes and decide if the strategy employed in fixing
> the section ordering is the direction we ultimately want to go in.
>
> V2:
> - Add quite a few FIXME stubs for tests
> - Much more carefully delineate QAPI source changes into ones required
> to prevent visible changes, and ones that explictly create visible
> changes
> - Various commit message / comment changes
> - Fix heuristic for griping about Intro/Details "ambiguity" to also
> ignore generated "Returns" sections, which was missing before and
> missed quite a few cases that did impact rendered output
>
> To verify rendering changes (or lack thereof), I used this strategy:
>
> (1) For a reference output before a change, I ran a build:
> > V=1 DEBUG=1 make -j13;
>
> (2) Then I created some reference output for the intermediate rST
> debugging output files (fish syntax):
> > for i in *.ir; sed -E 's|\.json:[0-9]{4}|.json:nnnn|g' $i > $i.ref; end
>
> (3) Then after applying a patch, to check for any differences, I re-ran
> the build as in (1) and then:
> > for i in *.ir; sed -E 's|\.json:[0-9]{4}|.json:nnnn|g' $i > $i.new; end
> > for i in *.ir; meld $i.ref $i.new; end
>
> An observation: Most of the time, the Intro section is only one
> paragraph anyway. We might be able to save on some explicit "Details:"
> syntax if we just formalize the idea that the intro can only ever be at
> most one paragraph. I don't know if we want to do that (Do we want to
> keep the ability to run long in the "intro"?) - but it would cut down on
> quite a lot of markup that this series adds.
The series adds 59 "Details:" markers to ~1150 doc comments, i.e. about
one in twenty doc comments needs one.
I can see several ways to skin this cat:
1. Intro ends when something else begins
Intro can be any number of paragraphs.
When intro is followed by details, we need a way to mark the
boundary. That's your "Details:" marker. Relatively rare.
Drawback: since you need "Details:" only rarely, it is easy to
forget. Details are then mistaken for intro or the other way round.
The inliner will lose details / fail to lose intro.
This is what your series gives us.
2. Intro ends after the first paragraph if we have one.
Intro can be empty or one paragraph.
When empty intro is followed by details, we need a way to mark the
boundary, such as "Details:". This is quite rare.
Drawback: "at most one paragraph" is not obvious and easy to forget.
Extra intro paragraphs end up in details then, where the inliner will
copy them.
Drawback: since you need "Details:" almost never, it is easy to
forget. The first paragraph of Details is mistaken for intro then.
The inliner will lose it.
3. Make the end of intro syntactically obvious always
3a. Require the "Details:" line
Intro can be any number of paragraphs.
Drawback: the syntax is rather clumsy. ~270 doc comments have
details, and every one of them needs a "Details:" line.
Drawback: you can still forget the "Details:" line. If you do, the
entire details will be mistaken for intro, and the inliner will lose
them.
3b. Require a "Details:" tag
Like 3a, but with slightly less clumsy syntax. Instead of
# @Frob:
#
# Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
# eiusmod tempor incididunt ut labore et dolore magna aliqua.
#
# Details:
#
# Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
# nisi ut aliquip ex ea commodo consequat.
#
# Duis aute irure dolor in reprehenderit in voluptate velit esse
# cillum dolore eu fugiat nulla pariatur.
we get
# @Frob:
#
# Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
# eiusmod tempor incididunt ut labore et dolore magna aliqua.
#
# Details: Ut enim ad minim veniam, quis nostrud exercitation ullamco
# laboris nisi ut aliquip ex ea commodo consequat.
#
# Duis aute irure dolor in reprehenderit in voluptate velit esse
# cillum dolore eu fugiat nulla pariatur.
Drawback: the syntax is still clumsy. ~270 doc comments have
details, and every one of them needs a "Details:" tag and be
reindented.
Drawback: if you forget to tag details, they get mistaken for intro,
and the inliner will lose them. Less likely than with 3a?
3c. Indent intro like descriptions and tagged sections.
Like so:
# @Frob:
# Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
# eiusmod tempor incididunt ut labore et dolore magna aliqua.
#
# Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
# nisi ut aliquip ex ea commodo consequat.
#
# Duis aute irure dolor in reprehenderit in voluptate velit esse
# cillum dolore eu fugiat nulla pariatur.
Drawback: all the intros get reindented.
Drawback: if you format intro the old way, it gets mistaken for
details, and the inliner will fail to lose it. Likely to happen
initially, but hopefully becomes unlikely once people got used to it.
Anything else?
3d. Both 3b and 3c
Intros and details written the old way get rejected.
Drawback: all intros and all details need to be reindented.
Anything else?
Thoughts?
prev parent reply other threads:[~2026-04-15 9:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 4:55 [PATCH v2 00/10] qapi: enforce section ordering John Snow
2026-04-08 4:55 ` [PATCH v2 01/10] qapi: differentiate "intro" and "details" sections John Snow
2026-04-08 4:55 ` [PATCH v2 02/10] qapi: prohibit 'details' sections between tagged sections John Snow
2026-04-08 4:55 ` [PATCH v2 03/10] qapi: add "Details:" disambiguation marker John Snow
2026-04-08 4:55 ` [PATCH v2 04/10] qapi: add "Details:" markers where needed John Snow
2026-04-08 4:55 ` [PATCH v2 05/10] qapi: add "Details:" markers where potentially needed John Snow
2026-04-08 4:55 ` [PATCH v2 06/10] qapi: detect potentially semantically ambiguous intro paragraphs John Snow
2026-04-08 4:55 ` [PATCH v2 07/10] qapi: re-order QAPI doc block sections John Snow
2026-04-08 4:55 ` [PATCH v2 08/10] qapi: enforce doc block section ordering John Snow
2026-04-08 4:55 ` [PATCH v2 09/10] qapi: re-order 'since' sections to always be last John Snow
2026-04-08 4:55 ` [PATCH v2 10/10] qapi: enforce strict positioning for "Since:" section John Snow
2026-04-15 9:43 ` Markus Armbruster [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zf341ru6.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=alex@shazbot.org \
--cc=anisinha@redhat.com \
--cc=berrange@redhat.com \
--cc=clg@redhat.com \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=hreitz@redhat.com \
--cc=imammedo@redhat.com \
--cc=jasowang@redhat.com \
--cc=jiri@resnulli.us \
--cc=jsnow@redhat.com \
--cc=kchamart@redhat.com \
--cc=kkostiuk@redhat.com \
--cc=kwolf@redhat.com \
--cc=lukasstraub2@web.de \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mchehab+huawei@kernel.org \
--cc=michael.roth@amd.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sgarzare@redhat.com \
--cc=stefanb@linux.vnet.ibm.com \
--cc=stefanha@redhat.com \
--cc=wangyanan55@huawei.com \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.