Skip to content

chore(dev): kill Ruby and port release scripts to native vdev#25379

Open
pront wants to merge 13 commits intomasterfrom
pront/kill-ruby-scripts
Open

chore(dev): kill Ruby and port release scripts to native vdev#25379
pront wants to merge 13 commits intomasterfrom
pront/kill-ruby-scripts

Conversation

@pront
Copy link
Copy Markdown
Member

@pront pront commented May 6, 2026

Summary

Removes Ruby from the Vector release flow and trims the dead release-tooling that the Ruby scripts had been propping up. The release CUE generator is preserved as a native Rust library function called from vdev release prepare; the standalone CLI surface around it that nobody actually used is deleted.

One Ruby script remains: scripts/check-events (a 515-line static analyzer used by vdev check events). Porting it is scoped as a follow-up so this PR stays focused on the release-flow cleanup. Bundler and the Gemfile are gone for good — check-events only uses the Ruby standard library — but the Ruby interpreter itself stays in the bootstrap scripts until check-events is ported.

Motivation

  • The Ruby scripts had drifted from reality: release-commit.rb pointed at docs/reference/releases, a directory that has not existed in this repo for some time. The script could not have run successfully against the current tree, but nobody noticed — a strong signal it had been dead long enough to delete.
  • cargo vdev already exists as Vector's Rust-native dev CLI. Maintaining a parallel Ruby toolchain alongside it is duplicate cost with no upside. This PR continues the migration started in Rewrite scripts/generate-component-docs.rb in Rust #22350 / feat(dev): rewrite scripts/generate-component-docs.rb in Rust (#22350) #24781 (which ported generate-component-docs.rb).
  • Once the Ruby scripts were ported, several vdev release subcommands and Makefile targets were revealed as orphaned. Removing them shrinks the operator-facing surface to just the commands that real callers (CI workflows, the issue templates) actually use.
  • Removing the bundler/Gemfile bootstrap step (while keeping the Ruby interpreter) cuts the bootstrap-time setup for new contributors and simplifies the dev Dockerfile.

Vector configuration

N/A. Internal release tooling only.

How did you test this PR?

  • 13 unit tests in vdev cover bump-type computation, conventional-commit parsing, changelog-fragment parsing, commit validation, and CUE rendering.
  • End-to-end live run in a git worktree of master with cargo vdev release prepare --version 0.56.0 --vrl-version 0.32.0 --dry-run. Produced 6 commits on the prep branch, generated 0.56.0.cue, retired all changelog.d/*.md fragments via git rm, and cue fmt accepted the output. No pushes, no PR, no impact on the primary checkout.
  • cargo clippy -p vdev --no-deps is clean (pedantic + warnings denied).
  • Verified that everything removed has zero callers in CI workflows, scripts, Makefile, or issue templates before deletion.

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Follow-up to #22350 / #24781, which removed generate-component-docs.rb.

@github-actions github-actions Bot added domain: ci Anything related to Vector's CI environment domain: releasing Anything related to releasing Vector domain: vdev Anything related to the vdev tooling docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. labels May 6, 2026
@pront pront added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label May 6, 2026
@pront pront marked this pull request as ready for review May 6, 2026 20:05
@pront pront requested review from a team as code owners May 6, 2026 20:06
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26839667cb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/Gemfile
Comment thread scripts/environment/bootstrap-ubuntu-24.04.sh
Copy link
Copy Markdown
Contributor

@thomasqueirozb thomasqueirozb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad to see all of this deleted 👍

Comment thread scripts/check_changelog_fragments.sh
Comment thread vdev/src/commands/release/generate_cue.rs Outdated
pront added a commit that referenced this pull request May 6, 2026
Codex review on PR #25379 caught two regressions in the previous
commits:

P1: scripts/environment/Dockerfile still COPYed scripts/Gemfile and
    scripts/Gemfile.lock — both deleted in this branch. The dev
    container build would fail at the COPY step. Drop those lines.

P2: scripts/check-events is still a Ruby script and is wrapped by
    `vdev check events` (vdev/src/commands/check/mod.rs:35), so
    `make check-events` requires a Ruby interpreter. The previous
    cleanup of bootstrap-macos.sh and bootstrap-ubuntu-24.04.sh was
    too aggressive: it stripped Ruby itself, not just the bundler /
    Gemfile-related bits. Restore `ruby` (Homebrew on macOS, apt on
    Ubuntu) and re-list it in vdev/README.md as a prerequisite,
    scoped specifically to `vdev check events`.

scripts/check-events only uses the Ruby standard library
(`require 'find'`), so the Gemfile and bundler stay deleted. The
remaining Ruby footprint is now exactly: one runtime dependency for
one scripted check, queued for a follow-up port.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a04f070ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vdev/src/commands/release/generate_cue.rs Outdated
pront added a commit that referenced this pull request May 6, 2026
- rustfmt cleanup over the previous commit (pre-push hook).
- generate_cue: change `git log v{last}..` to `v{last}...`. Codex review
  on PR #25379 noted that `--cherry-pick --right-only` is a no-op with
  the asymmetric two-dot range — the Ruby script the port replaces used
  three dots (`v#{last_version}...`) so it could omit commits already
  released on a patch branch. With two dots, fixes from a back-released
  patch could re-appear in the next minor release CUE.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2401331aff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vdev/src/commands/check/events.rs Outdated
Comment thread vdev/src/commands/check/events.rs Outdated
pront and others added 2 commits May 6, 2026 17:50
Ports the two remaining Ruby release scripts to native Rust and folds
the resulting `vdev release` surface down to the bits that are actually
called.

- `scripts/generate-release-cue.rb` (467 lines) is replaced by a
  `pub(super) fn run` in `vdev/src/commands/release/generate_cue.rs`.
  The function walks `git log v<last>...HEAD` (three-dot symmetric
  difference, so `--cherry-pick --right-only` filters out commits
  already released on a patch branch — the Ruby form), parses the
  conventional-commit messages, processes `changelog.d/*.md` fragments
  into the release CUE schema, and runs `cue fmt`. It is called only
  from `vdev release prepare` (no standalone CLI subcommand).

- `scripts/release-commit.rb`, `vdev release commit`, `vdev release push`,
  `vdev build release-cue`, and the corresponding Makefile targets
  (`make release`, `release-commit`, `release-push`) are removed: none
  of them were called by CI workflows, scripts, or issue templates, and
  the original `release-commit.rb` had been broken for some time
  (pointing at `docs/reference/releases`, a directory that no longer
  exists). Manual operator tagging happens via `git tag` directly per
  the release issue templates.

- The `scripts/util/*.rb` library, `Gemfile`, `Gemfile.lock`, and the
  `Gemfile` COPY in `scripts/environment/Dockerfile` are deleted.
  `ruby` itself stays in the bootstrap scripts and `vdev/README.md` —
  `scripts/check-events` is the last remaining Ruby script and gets
  ported in a follow-up commit.

- Docs, issue templates, the `changes.yml` workflow filter, and
  `website/README.md` are repointed at `cargo vdev release prepare`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the last Ruby script in the repo (515 lines) with a native
`vdev check events` that walks Rust source via `syn`'s AST instead of
regex-scraping. The validation rules from `docs/specs/instrumentation.md`
are preserved unchanged; behaviour against the current tree matches
the Ruby script (`0 error(s)` on master, identical reports on a
synthetic fixture exercising every rule branch).

Implementation notes:

- Structural scanning (struct fields, impl-block trait/event names)
  uses syn visitors. Macro argument parsing (`counter!(...)`,
  `trace!(...)`, etc.) uses small targeted regexes on the macro's
  already-tokenised input. Use-counting (`emit!(EventName)` /
  `register!(...)`) uses one regex pass over the raw source because
  syn does not descend into the bodies of opaque macros like
  `tokio::select!` where some emit sites live.

- `## skip check-validity-events ##` is added to
  `lib/vector-common/src/internal_event/component_events_dropped.rs`.
  That impl block is the foundation type the `registered_event!` macro
  abstracts over, so it has to implement `RegisterInternalEvent` by
  hand. The Ruby script's regex never matched its multi-line `impl`
  header and so silently let it through; the AST scanner sees it
  correctly and the existing skip-marker mechanism makes the intent
  explicit.

- `proc-macro2`, `quote`, and `syn` are declared as workspace deps with
  default-features off; vdev opts into the syn `full`, `visit`,
  `extra-traits`, `printing`, `parsing` features and proc-macro2's
  `span-locations` locally. These features are already pulled in
  transitively by Vector's existing dep graph (verified via
  `cargo tree -p vector`), so the additions do not change Vector's
  production binary.

- 32 unit tests are added: 14 covering the macro/log/metric arg
  parsers (literal-first, named-field, variable, trailing-literal,
  `%`-capture, message format checks, comma-arg nesting,
  `CamelCase → snake_case`) and 18 driving every branch of
  `validate_event` with synthetic `Event` structs.

- Differential test (run by hand against a worktree with a synthetic
  fixture file): `ruby scripts/check-events` and `cargo vdev check
  events` flagged the same eight events plus the same duplicate pair;
  outputs differed only in sort order and a Ruby string-escape
  artefact.

The bootstrap scripts (`scripts/environment/bootstrap-{macos,
ubuntu-24.04}.sh`), `vdev/README.md`, and `.ruby-version` lose their
Ruby references — there is no Ruby left in the repo to install.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pront pront force-pushed the pront/kill-ruby-scripts branch from 1f4b272 to 2f0b924 Compare May 6, 2026 21:53
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f0b924cae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vdev/src/commands/release/generate_cue.rs
pront and others added 5 commits May 6, 2026 18:02
Two bugs caught in code review of `vdev/src/commands/check/events.rs`:

1. The native check globbed `src/**/*.rs` and `lib/**/*.rs` relative to
   the caller's CWD. The Ruby script wrapper used to chdir to the repo
   root, so this silently regressed: running `vdev check events` from
   anywhere outside the repo root produced `0 error(s)` without
   scanning anything.

   Fix: chdir to `paths::find_repo_root()` at the top of `Cli::exec`,
   matching the previous wrapper's behaviour. Running from a subdir
   now scans correctly; running from outside the repo errors out with
   a useful message.

2. `parse_log_args` claimed the first bare positional expression as
   the log message before scanning the rest of the args for a string
   literal. For real Vector code that uses
   `warn!(%error, "Failed to flush.")`, the literal is the actual
   message but the function never reached it — so the message-format
   check (capital + trailing period) silently never fired on those
   sites.

   Fix: walk all args once, classify each as a literal candidate,
   `message =` named-field candidate, bare-positional candidate, or
   plain parameter, then pick the message in that priority order.
   Adds a regression test covering the bare-then-literal pattern.

Both bugs were flagged by Codex code review on PR #25379.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three review findings on the check-events / release-cue ports:

- `vdev check events` only ran its log-message format check via the
  syn AST visitor, which does not descend into the bodies of opaque
  outer macros like `tokio::select!` / `cfg_if!`. Log calls nested
  inside those macros were silently exempt. Replaces the AST format
  check with a raw-text pass that finds every `(trace|debug|info|
  warn|error)!(...)` invocation regardless of nesting. Adds two unit
  tests against the new pass — including one that asserts a violation
  inside a synthetic `tokio::select!` block is still reported.

- `generate_cue::run` no longer relies on `--cherry-pick --right-only`
  alone to dedupe commits against earlier releases — that flag only
  filters patch-id-equivalent commits, so a conflict-resolved cherry-
  pick (different SHA, same PR) could re-appear in the next release
  CUE. Adds a `collect_released_identifiers` pass that pulls the SHA
  and PR-number sets out of every existing
  `website/cue/reference/releases/*.cue`, then filters the fetched
  commit set against both. Two unit tests cover the extractor.

- `Commit::validate` now bails when the conventional-commit parser
  could not classify the subject (`type: None`). Previously such
  commits passed validation and landed in the published release CUE
  with a null type — a malformed PR title would silently ship.

Also factors `parse_log_args` so it shares one `&str` implementation
with the new raw-text pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pre-push hook reformatting on the format-check + dedup fixes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`cargo clippy -p vdev --all-targets` flagged two map_unwrap_or lints
in the test-only `check()` helper. Identical pattern to fixes already
applied in production code; just missed when test cases were added
later.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the pedantic clippy allows the file was carrying and refactor to
satisfy them: rename Event fields whose `_event` suffix tripped
struct_field_names, group the three skip flags into a SkipFlags
substruct (struct_excessive_bools), and split validate_event and
Cli::exec into smaller helpers (too_many_lines).

Also remove a redundant `name_ends_with` wrapper that just called
str::ends_with, and merge the parse_log_args TokenStream wrapper into
its `&str` body. One callsite was already operating on stringified
tokens, so it was doing a wasted parse-and-restringify round trip.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c841c3a94

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vdev/src/commands/release/generate_cue.rs Outdated
pront and others added 3 commits May 7, 2026 10:22
Replace the bespoke `camel_to_snake` regex helper in vdev's check-events
with `convert_case::Casing::to_case`. Promote convert_case to a
workspace dep so vdev and vector-config-common share the same version
declaration.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The comment claimed declaring these at the workspace level prevented
vdev's extra `syn` features from unifying into Vector's production
build. That's not what workspace declarations do — `cargo` unifies
features across the resolved dep graph regardless. The reason vdev's
features don't reach the `vector` package is simply that vdev isn't a
dep of `vector`. The comment was also stale: these crates are now
direct deps of vector-config-macros, vector-config-common, and
vector-common-macros, not just vdev.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The release-CUE generator rejected commit subjects with uppercase scope
characters (e.g. `fix(ARC): ...`), even though `.github/workflows/semantic.yml`
explicitly lists `ARC` as a valid scope. A PR title that passed semantic
validation could therefore block `release prepare` later. Widen the
scope character class to allow uppercase letters and add a regression
test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bec41f4905

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vdev/src/commands/check/events.rs
split_comma_args only tracked `()[]{}` nesting, so a registered_event!
handle field with a generic type containing a comma would be split
mid-type. The existing src/internal_events/filter.rs field
`Registered<ComponentEventsDropped<'static, INTENTIONAL>> = register!(...)`
broke before the assignment, hiding the register! emission and causing
spurious missing-log/counter errors for FilterEventsDropped.

Track angle depth as a separate counter and only decrement `>` when
there is a matching `<`, so the `>` in `key => value` tag pairs (used
inside counter! args) stays unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pront pront enabled auto-merge May 7, 2026 15:17
@pront pront added this pull request to the merge queue May 7, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 7, 2026
@pront pront added this pull request to the merge queue May 7, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 7, 2026
@pront pront enabled auto-merge May 7, 2026 20:50
@pront pront added this pull request to the merge queue May 7, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. domain: ci Anything related to Vector's CI environment domain: releasing Anything related to releasing Vector domain: vdev Anything related to the vdev tooling no-changelog Changes in this PR do not need user-facing explanations in the release changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants