All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	qemu-devel@nongnu.org, "Alex Williamson" <alex@shazbot.org>,
	linux-cxl@vger.kernel.org, "Michael Tokarev" <mjt@tls.msk.ru>,
	"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
	"Peter Xu" <peterx@redhat.com>, "Eric Blake" <eblake@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"zhenwei pi" <zhenwei.pi@linux.dev>,
	qemu-trivial@nongnu.org, "Fabiano Rosas" <farosas@suse.de>,
	"Kevin Wolf" <kwolf@redhat.com>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Jiri Pirko" <jiri@resnulli.us>,
	qemu-block@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
	"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
	linux-edac@vger.kernel.org,
	"Gonglei (Arei)" <arei.gonglei@huawei.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Hanna Reitz" <hreitz@redhat.com>,
	"Jason Wang" <jasowangio@gmail.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Ani Sinha" <anisinha@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@mailo.com>,
	"Lukas Straub" <lukasstraub2@web.de>,
	"Cédric Le Goater" <clg@redhat.com>
Subject: Re: [PATCH v3 01/43] qapi: convert trivial intro sections for error.json
Date: Tue, 01 Sep 2026 12:09:59 +0200	[thread overview]
Message-ID: <87a4q19tag.fsf@pond.sub.org> (raw)
In-Reply-To: <CAFn=p-bUTApw73Ddz-tH1FzY97Ct5rfFZ=domFhm-OO3G8COug@mail.gmail.com> (John Snow's message of "Mon, 31 Aug 2026 14:43:50 -0400")

John Snow <jsnow@redhat.com> writes:

> On Thu, Aug 27, 2026 at 9:39 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
>>
>> On Thu, Aug 27, 2026 at 03:09:35PM +0200, Markus Armbruster wrote:
>> > Daniel P. Berrangé <berrange@redhat.com> writes:
>> >
>> > > On Wed, Aug 26, 2026 at 03:37:58PM -0400, John Snow wrote:
>> > >> Signed-off-by: John Snow <jsnow@redhat.com>
>> > >> ---
>> > >>  qapi/error.json | 3 +--
>> > >>  1 file changed, 1 insertion(+), 2 deletions(-)
>> > >>
>> > >> diff --git a/qapi/error.json b/qapi/error.json
>> > >> index 54cb02fb880..a53b13e55c9 100644
>> > >> --- a/qapi/error.json
>> > >> +++ b/qapi/error.json
>> > >> @@ -9,8 +9,7 @@
>> > >>
>> > >>  ##
>> > >>  # @QapiErrorClass:
>> > >> -#
>> > >> -# QEMU error classes
>> > >> +#     QEMU error classes
>> > >
>> > > Where is this need for indent coming from ?  From the POV of someone
>> > > writing comments, the need to indent the introductory text like this
>> > > feels very counter-intuitive, an exception from any other inline
>> > > docs syntax I've typically used. Is there any way we can avoid this ?
>> >
>> > The cover letter explains the need:
>>
>> Yes, I just didn't see the connection from that, to the use
>> of indent.

Writing good cover letters is hard.

>> >
>> >     This is being done primarily for the benefit of the forthcoming
>> >     "inliner", a feature for the rendered HTML QMP documentation that
>> >     seeks to "inline" QMP command argument documentation into the argument
>> >     list for each command.
>> >
>> >     There are two main motives here:
>> >
>> >     (1) We want the split between the "introduction" and "details"
>> >         sections to be mechanically obvious, so that auto-generated or
>> >         inlined documentation has a well-defined, obvious spot to go.
>> >
>> >     (2) We do not want to inline irrelevant, introductory text describing
>> >         structures to be copied into command documentation.
>>
>> So IIUC, you're saying that we are going to rely on indentation
>> to distinguish introduction from details ?

Yes.

We are already relying on indentation elsewhere.  For instance:

    # @fatal: if set, the image is marked corrupt and therefore unusable
    #     after this event and must be repaired (Since 2.2; before, every
    #     `BLOCK_IMAGE_CORRUPTED` event was fatal)
    #
    # .. note:: If action is "stop", a `STOP` event will eventually follow
    #    the `BLOCK_IO_ERROR` event.

The description of @fatal is indented.  A non-indented line ends it.
The non-indented line happens to be a Sphinx directive here, but that's
immaterial (the QAPI doc comment parser does not attempt to parse ReST).

>> > Note that the inliner elided Netdev's Intro "Captures the configuration
>> > of a network device."
>> >
>> > However, when Intro and Details bleed together, the inliner elides more
>> > than it should.  I consider that a fairly serious issue.
>> >
>> > I'm afraid forgetting to mark the end of Intro with "Details:" would be
>> > a common mistake, easy to miss in review.  So I explored possible
>> > alternatives:
>> >
>> >     Subject: Re: [PATCH v2 00/10] qapi: enforce section ordering
>> >     Date: Wed, 15 Apr 2026 11:43:45 +0200
>> >     Message-ID: <87zf341ru6.fsf@pond.sub.org>
>> >     https://lore.kernel.org/qemu-devel/87zf341ru6.fsf@pond.sub.org/
>> >
>> > John is working towards "3. Make the end of intro syntactically obvious"
>> > always, specifically "3c. Indent intro like descriptions and tagged
>> > sections" with the ultimate goal to reject unindented Intro.  That way,
>> > we cannot write an Intro with an unclear end.  John, correct me if I'm
>> > accidentally misrepresenting your work.
>> >
>> > Questions?  Better ideas?
>>
>> As an author, how substantive is "Intro" expected to be? I guess on
>> QAPI docs I've written I've not ever been aware of there even being
>> a distinct concept of Intro vs Details to think about. It is all just
>> some lines of prose to me.

That's deceptive :)

Consider

    ##
    # @HV_BALLOON_STATUS_REPORT:
    #
    # Emitted when the hv-balloon driver receives a "STATUS" message from
    # the guest.
    #
    # .. note:: This event is rate-limited.
    #
    # Since: 8.2
    #
    # .. qmp-example::
    #
    #     <- { "event": "HV_BALLOON_STATUS_REPORT",
    #          "data": { "committed": 816640000, "available": 3333054464 },
    #          "timestamp": { "seconds": 1600295492, "microseconds": 661044 } }
    ##
    { 'event': 'HV_BALLOON_STATUS_REPORT',
      'data': 'HvBalloonInfo' }

Rendered documentation looks like

    Event HV_BALLOON_STATUS_REPORT (Since: 8.2)

       Emitted when the hv-balloon driver receives a "STATUS" message from
       the guest.

       Note:

         This event is rate-limited.

       Members:
          * The members of "HvBalloonInfo".

       Example::

          <- { "event": "HV_BALLOON_STATUS_REPORT",
               "data": { "committed": 816640000, "available": 3333054464 },
               "timestamp": { "seconds": 1600295492, "microseconds": 661044 } }

Where does "Members:" come from?  Its generated.

If we move "Since:" to the end of the doc comment, we instead get

    Event HV_BALLOON_STATUS_REPORT (Since: 8.2)

       Emitted when the hv-balloon driver receives a "STATUS" message from
       the guest.

       Note:

         This event is rate-limited.

       Example::

          <- { "event": "HV_BALLOON_STATUS_REPORT",
               "data": { "committed": 816640000, "available": 3333054464 },
               "timestamp": { "seconds": 1600295492, "microseconds": 661044 } }

       Members:
          * The members of "HvBalloonInfo".

This one is clearly bad.  The fact that an innocent move of "Since:" can
make the rendered docs worse is a defect in the QAPI doc system.

But even the first version isn't quite what we want.  We want Members:
further up, like this:

    Event HV_BALLOON_STATUS_REPORT (Since: 8.2)

       Emitted when the hv-balloon driver receives a "STATUS" message from
       the guest.

       Members:
          * The members of "HvBalloonInfo".

       Note:

         This event is rate-limited.

       Example::

          <- { "event": "HV_BALLOON_STATUS_REPORT",
               "data": { "committed": 816640000, "available": 3333054464 },
               "timestamp": { "seconds": 1600295492, "microseconds": 661044 } }

Now we're ready to discuss "intro" vs. "details.  Their separation
matters in this example, because the generated "Members:" go right after
"intro".

The root of the problem is a syntactic ambiguity.  "Intro" is commonly
followed by some "@argument: ...", "Return:", "Error:", or similar.  But
these are all optional.  When they're absent, the what's "intro" and
what's "details" is syntactically ambiguous.

The doc comment I used as example abuses "Since:" to separate them.

> In most cases, not very substantial. For commands and events, it *can*
> be quite a bit more substantial. For structs, enums, etc it is almost
> always laughably trivial.
>
> When the syntactical delineation of intro is complete, further QAPI
> parser changes will make it even more obvious: any free text that
> exists between the intro and the other sections will be flagged as an
> error, where you will be urged to move any detail text to below the
> metadata fields. This physical relocation will help suggest to the
> documentation author what goes "above the fold" and what goes "below
> the fold", so to speak.

This is part of our slow move towards a standard doc comment structure,
ultimately enforced by the generator.  Standard structure helps readers.

>> My only alternative idea to indentation would be to declare that the
>> "Intro" is always the 1st paragraph of text and anything beyond that
>> is the "Details". That might match up with the way that contributors
>> naturally write text where the 1st paragraph conveys the key idea,
>> such that they dno't need to think about Intro vs Details as a
>> concept.
>
> Yeah, that's roughly the idea; and some prototypes used this idea in
> the past - but Markus wanted an explicit, obvious delineation
> precisely to *force* documentation authors to think about the split.
> It has implications for what gets generated into the documentation and
> in which scenarios.

"First paragraph is intro" is workable syntax.  It restricts "intro" to
a single paragraph", which is unlikely to be a serious problem.
However, the restriction is easy to forget.  If you write two paragraphs
(because "it is all just some lines of prose"), the rendering can
surprise you, in a bad way.

Having to indent "intro" forces you to be explicit, and avoids
surprises.

> I do usually try to make my upgrades "invisible" to the user, but in
> this case I believe we are erring on the side of "explicit is better
> than implicit" because of the implications of the text not always
> being copied in a precisely straightforward manner to the HTML docs.

Blame it on me: I pushed John towards explicit.

> I will address the subtleties of this issue when the inliner is being
> merged by updating a documentation writer's guide that covers what
> goes where and why. For now, we are just trying to do the bulk
> conversion.
>
>>
>> With regards,
>> Daniel
>
> --js


  reply	other threads:[~2026-09-01 10:10 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 19:37 [PATCH v3 00/43] qapi: convert (very) trivial intro sections John Snow
2026-08-26 19:37 ` [PATCH v3 01/43] qapi: convert trivial intro sections for error.json John Snow
2026-08-27  8:43   ` Philippe Mathieu-Daudé
2026-08-27  9:10   ` Daniel P. Berrangé
2026-08-27 13:09     ` Markus Armbruster
2026-08-27 13:39       ` Daniel P. Berrangé
2026-08-31 18:43         ` John Snow
2026-09-01 10:09           ` Markus Armbruster [this message]
2026-08-26 19:37 ` [PATCH v3 02/43] qapi: convert trivial intro sections for acpi-hest.json John Snow
2026-08-26 19:38 ` [PATCH v3 03/43] qapi: convert trivial intro sections for ebpf.json John Snow
2026-08-26 19:38 ` [PATCH v3 04/43] qapi: convert trivial intro sections for compat.json John Snow
2026-08-26 19:38 ` [PATCH v3 05/43] qapi: convert trivial intro sections for vfio.json John Snow
2026-08-31 14:07   ` Cédric Le Goater
2026-08-26 19:38 ` [PATCH v3 06/43] qapi: convert trivial intro sections for trace.json John Snow
2026-08-26 19:38 ` [PATCH v3 07/43] qapi: convert trivial intro sections for misc-arm.json John Snow
2026-08-26 19:38 ` [PATCH v3 08/43] qapi: convert trivial intro sections for cryptodev.json John Snow
2026-08-26 19:38 ` [PATCH v3 09/43] qapi: convert trivial intro sections for machine-common.json John Snow
2026-08-26 19:38 ` [PATCH v3 10/43] qapi: convert trivial intro sections for accelerator.json John Snow
2026-08-27  8:39   ` Philippe Mathieu-Daudé
2026-08-26 19:38 ` [PATCH v3 11/43] qapi: convert trivial intro sections for authz.json John Snow
2026-08-26 19:38 ` [PATCH v3 12/43] qapi: convert trivial intro sections for yank.json John Snow
2026-08-26 19:38 ` [PATCH v3 13/43] qapi: convert trivial intro sections for replay.json John Snow
2026-08-26 19:38 ` [PATCH v3 14/43] qapi: convert trivial intro sections for machine-s390x.json John Snow
2026-08-26 19:38 ` [PATCH v3 15/43] qapi: convert trivial intro sections for acpi.json John Snow
2026-08-26 19:38 ` [PATCH v3 16/43] qapi: convert trivial intro sections for tpm.json John Snow
2026-08-26 19:38 ` [PATCH v3 17/43] qapi: convert trivial intro sections for qdev.json John Snow
2026-08-27  8:39   ` Philippe Mathieu-Daudé
2026-08-26 19:38 ` [PATCH v3 18/43] qapi: convert trivial intro sections for control.json John Snow
2026-08-26 19:38 ` [PATCH v3 19/43] qapi: convert trivial intro sections for dump.json John Snow
2026-08-26 19:38 ` [PATCH v3 20/43] qapi: convert trivial intro sections for common.json John Snow
2026-08-26 19:38 ` [PATCH v3 21/43] qapi: convert trivial intro sections for sockets.json John Snow
2026-08-26 19:38 ` [PATCH v3 22/43] qapi: convert trivial intro sections for transaction.json John Snow
2026-08-26 19:38 ` [PATCH v3 23/43] qapi: convert trivial intro sections for stats.json John Snow
2026-08-26 19:38 ` [PATCH v3 24/43] qapi: convert trivial intro sections for job.json John Snow
2026-08-26 19:38 ` [PATCH v3 25/43] qapi: convert trivial intro sections for pci.json John Snow
2026-08-27  8:40   ` Philippe Mathieu-Daudé
2026-08-26 19:38 ` [PATCH v3 26/43] qapi: convert trivial intro sections for introspect.json John Snow
2026-08-26 19:38 ` [PATCH v3 27/43] qapi: convert trivial intro sections for rocker.json John Snow
2026-08-26 19:38 ` [PATCH v3 28/43] qapi: convert trivial intro sections for misc-i386.json John Snow
2026-08-26 19:38 ` [PATCH v3 29/43] qapi: convert trivial intro sections for block-export.json John Snow
2026-08-26 19:38 ` [PATCH v3 30/43] qapi: convert trivial intro sections for audio.json John Snow
2026-08-26 19:38 ` [PATCH v3 31/43] qapi: convert trivial intro sections for block.json John Snow
2026-08-31 13:52   ` Markus Armbruster
2026-08-31 18:55     ` John Snow
2026-08-26 19:38 ` [PATCH v3 32/43] qapi: convert trivial intro sections for misc.json John Snow
2026-08-26 19:38 ` [PATCH v3 33/43] qapi: convert trivial intro sections for crypto.json John Snow
2026-08-26 19:38 ` [PATCH v3 34/43] qapi: convert trivial intro sections for cxl.json John Snow
2026-08-26 19:38 ` [PATCH v3 35/43] qapi: convert trivial intro sections for run-state.json John Snow
2026-08-27  8:41   ` Philippe Mathieu-Daudé
2026-08-26 19:38 ` [PATCH v3 36/43] qapi: convert trivial intro sections for char.json John Snow
2026-08-26 19:38 ` [PATCH v3 37/43] qapi: convert trivial intro sections for virtio.json John Snow
2026-08-26 19:38 ` [PATCH v3 38/43] qapi: convert trivial intro sections for net.json John Snow
2026-08-26 19:38 ` [PATCH v3 39/43] qapi: convert trivial intro sections for qom.json John Snow
2026-08-27  8:42   ` Philippe Mathieu-Daudé
2026-08-26 19:38 ` [PATCH v3 40/43] qapi: convert trivial intro sections for ui.json John Snow
2026-08-26 19:38 ` [PATCH v3 41/43] qapi: convert trivial intro sections for migration.json John Snow
2026-08-26 19:38 ` [PATCH v3 42/43] qapi: convert trivial intro sections for machine.json John Snow
2026-08-27  8:42   ` Philippe Mathieu-Daudé
2026-08-31 13:36   ` Markus Armbruster
2026-08-31 13:50     ` Markus Armbruster
2026-08-26 19:38 ` [PATCH v3 43/43] qapi: convert trivial intro sections for block-core.json John Snow
2026-08-31 13:32   ` Markus Armbruster
2026-08-31 14:27 ` [PATCH v3 00/43] qapi: convert (very) trivial intro sections Markus Armbruster

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=87a4q19tag.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=alex@shazbot.org \
    --cc=anisinha@redhat.com \
    --cc=arei.gonglei@huawei.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=jasowangio@gmail.com \
    --cc=jic23@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=jsnow@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=lukasstraub2@web.de \
    --cc=marcandre.lureau@redhat.com \
    --cc=mchehab+huawei@kernel.org \
    --cc=mjt@tls.msk.ru \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@mailo.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@yandex-team.ru \
    --cc=zhao1.liu@intel.com \
    --cc=zhenwei.pi@linux.dev \
    /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.