Skip to content

changelog: validate rst entry line lengths - #4834

Open
dio wants to merge 2 commits into
envoyproxy:mainfrom
dio:changelog-rst-line-length
Open

changelog: validate rst entry line lengths#4834
dio wants to merge 2 commits into
envoyproxy:mainfrom
dio:changelog-rst-line-length

Conversation

@dio

@dio dio commented Aug 2, 2026

Copy link
Copy Markdown
Member

Summary

  • finish the per-entry changelog cleanup by resolving current entries from current_dir_path and removing the obsolete entries_layout check
  • reject breakable lines longer than 136 characters in current RST changelog entries
  • report every violation with its file, line number, actual length, and maximum length
  • allow a single unbreakable token, matching Envoy yamllint behavior

Rationale

Envoy limits YAML lines to 140 characters. Changelog entries are emitted as YAML block scalars with four spaces of indentation, so source RST lines must be at most 136 characters. This is validation-only: automatically wrapping RST roles, links, lists, or literal blocks could change their meaning.

Testing

  • pants fmt py/envoy.code.check::
  • pants lint py/envoy.code.check::
  • pants check py/envoy.code.check::
  • pants test py/envoy.code.check::
  • built the local package and ran envoy.code.check --check changelog against an Envoy checkout, confirming overlong entries fail and wrapped entries pass

Follow-up

After this change is released, an Envoy follow-up will update the envoy-code-check dependency, wrap the existing overlong RST entries, and run bazel test //tools/code:check_test. That follow-up will complete envoyproxy/envoy#46148.

Part of envoyproxy/envoy#46148.

AI assistance was used to analyze the code, implement the change, and prepare tests. The submitter reviewed and verified the resulting changes.

dio added 2 commits August 2, 2026 07:46
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
@netlify

netlify Bot commented Aug 2, 2026

Copy link
Copy Markdown

Deploy Preview for nifty-bassi-e26446 ready!

Name Link
🔨 Latest commit 93bde6d
🔍 Latest deploy log https://app.netlify.com/projects/nifty-bassi-e26446/deploys/6a6e9679d569250008c479e3
😎 Deploy Preview https://deploy-preview-4834--nifty-bassi-e26446.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@phlax

phlax commented Aug 3, 2026

Copy link
Copy Markdown
Member

@dio thanks for this, will look shortly - other pipelines are taking longer to resolve than i hoped, and i have some python stuff that needs testing already so will look at this when i get to py stuff

@dio

dio commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

Gentle ping @phlax, whenever you have a chance to take a look. Thanks!

@phlax

phlax commented Sep 7, 2026

Copy link
Copy Markdown
Member

yeah apologies - will look soon - i had to clear bzlmod first, and now just doing some follow/clean ups

@phlax

phlax commented Sep 7, 2026

Copy link
Copy Markdown
Member

... fwiw i had intended to look at the (python) release stuff prior to the last sec/patch release, but just didnt find the time - my deadline now is the release in a month - but will hopefully get to this sooner

@phlax

phlax commented Sep 11, 2026

Copy link
Copy Markdown
Member

k finally have some time to look at the python stuff - fwiw - the blocker was #5224

i tested this pr - and the problem we have - yamllint allows for unbroken lines

so eg this is picked up, but should be allowed

  1 The downstream reverse-tunnel initiator
  2 (``envoy.bootstrap.reverse_tunnel.downstream_socket_interface``) now accepts
  3 :ref:`maintain_interval <envoy_v3_api_field_extensions.bootstrap.reverse_tunnel.downstream_socket_interface.v3.DownstreamReverseConnectionSocketInterface.maintain_interval>`
  4 to control how often each host is re-checked and missing tunnels are dialed.
  5 Unset keeps the historical 10s default. The existing 15% upward jitter still
  6 applies. The minimum allowed value is 100ms.

trying to think how we can accomodate that

@phlax

phlax commented Sep 11, 2026

Copy link
Copy Markdown
Member

actually i needed this to make it pass yamllint

--- a/changelogs/current/new_features/reverse_tunnel__maintain-interval.rst
+++ b/changelogs/current/new_features/reverse_tunnel__maintain-interval.rst
@@ -1,6 +1,7 @@
 The downstream reverse-tunnel initiator
 (``envoy.bootstrap.reverse_tunnel.downstream_socket_interface``) now accepts
-:ref:`maintain_interval <envoy_v3_api_field_extensions.bootstrap.reverse_tunnel.downstream_socket_interface.v3.DownstreamReverseConnectionSocketInterface.maintain_interval>`
+:ref:`maintain_interval
+<envoy_v3_api_field_extensions.bootstrap.reverse_tunnel.downstream_socket_interface.v3.DownstreamReverseConnectionSocketInterface.maintain_interval>`
 to control how often each host is re-checked and missing tunnels are dialed.
 Unset keeps the historical 10s default. The existing 15% upward jitter still
 applies. The minimum allowed value is 

@phlax phlax closed this Sep 11, 2026
@phlax phlax reopened this Sep 11, 2026
@phlax

phlax commented Sep 11, 2026

Copy link
Copy Markdown
Member

(argh apologies - did not mean to close this)

so i think we will need to use yamllint directly to do the length check - not sure why but this wasnt properly handling unbroken lines the same way as yamllint does

botsplanation ...

Suggest we make yamllint the source of truth and just lint the entry as it will appear in the yaml — indented under the change: | block scalar — using the project's own .yamllint:

from yamllint import config as yamllint_config, linter as yamllint_linter

# Indent of an entry inside the `change: |` block scalar
YAML_ENTRY_INDENT = "    "


def check_entry_line_lengths(
        self,
        path: pathlib.Path) -> tuple[str, ...]:
    content = "".join(
        f"{YAML_ENTRY_INDENT}{line}\n"
        for line
        in path.read_text().splitlines())
    return tuple(
        f"{path}:{problem.line}: {problem.desc}"
        for problem
        in yamllint_linter.run(content, self.yamllint_config)
        if problem.rule == "line-length")

with yamllint_config a cached_property loading YamlLintConfig(file=<project>/.yamllint) (fall back to YamlLintConfig("extends: default") if it's missing). yamllint is already a dependency of this package via YamllintCheck, so nothing new is pulled in.

That gives identical semantics by construction — including the non-breakable-word exemption, the 140 max, and anything we change in .yamllint later — and drops the 136 constant and the comment explaining it. The parametrized test can then feed real yaml-ish cases ('a' * 137 single token → ok, 'a' * 135 + ' b' → error) and assert on yamllint's own message.

phlax added a commit to phlax/toolshed that referenced this pull request Sep 11, 2026
picked from envoyproxy#4834

Signed-off-by: Ryan Northey <ryan@synca.io>
@phlax

phlax commented Sep 11, 2026

Copy link
Copy Markdown
Member

this also has a fix for the changelog categories - picked that so we can land it immediately

phlax added a commit that referenced this pull request Sep 11, 2026
picked from #4834

Signed-off-by: Ryan Northey <ryan@synca.io>
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