Skip to content

XCPNG-3989: Commit message list upstream (backport) - #7381

Open
contificate wants to merge 6 commits into
xapi-project:26.1-lcmfrom
contificate:cbarr/26.1/messages
Open

contificate wants to merge 6 commits into
xapi-project:26.1-lcmfrom
contificate:cbarr/26.1/messages

Conversation

@contificate

Copy link
Copy Markdown
Contributor

Backport of #7361 to 26.1-lcm.

@last-genius

Copy link
Copy Markdown
Contributor

Could you cherry-pick with -x so that original hashes are added to the commit messages?

Each released message can be emitted with api_compat.exe. The format is
line-delimited JSON (often saved as .ndjson).

You can `dune exec ./ocaml/idl/api_compat.exe -- -print` to see the messages
printed to stdout. The intention is that we'll emit this to a file, committed
upstream, and then add a test that compares the contents for mutations.

Signed-off-by: Colin James <contificate@gmail.com>
(cherry picked from commit 203f040)
Adds a simple parser for the line-delimited JSON format introduced previously.

Signed-off-by: Colin James <contificate@gmail.com>
(cherry picked from commit cc76ce9)
Commits the current messages file to the repository.

This was done via redirecting `dune exec ./ocaml/idl/api_compat.exe -- -print`
to ocaml/idl/messages.ndjson.

Signed-off-by: Colin James <contificate@gmail.com>
(cherry picked from commit c14ec72)
You can now invoke api_compat.exe with `-check <file>` and it will compare the
datamodel against this file.

We perform a pairwise comparison of message parameters to catch various
potential mutations that may have occurred when modifying the datamodel. E.g.
changing a parameter's default value, a message's return type, permuting the
order of parameters, adding a parameter (at the end) that lacks a default, etc.

The next step is to turn this into a workflow compatible with dune.

Signed-off-by: Colin James <contificate@gmail.com>
(cherry picked from commit 1f5c301)
Generates a messages.ndjson.generated in the dune build directory, which can
then be compared against what's currently there (for promotion purposes), along
with turning api_compat's -check mode into a test. We also add a promotion rule
alias.

Signed-off-by: Colin James <contificate@gmail.com>
(cherry picked from commit 2ad61c7)
Similar to datamodel_lifecycle.ml, we check the generated messages list against
the one currently committed in the repository. If the check fails, we abandon.
Otherwise, we automatically do promotion (applying the diff to the worktree).

Signed-off-by: Colin James <contificate@gmail.com>
(cherry picked from commit bf4f95e)

This branch has not been deployed

No deployments
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.

2 participants