Hi guys,

I'd like to start a discussion about a small, opt-in mechanism for reducing
review load on PRs whose risk can be checked mechanically. The reference
implementation is in https://github.com/apache/seatunnel/pull/12706.
Nothing in it is active until we agree and enable it, and merging stays a
dry run until a repository variable is switched on.

*Motivation*

Many PRs are well-bounded and easy to verify: documentation fixes, extra
connector tests, bug fixes inside one connector, and new connectors that
follow the standard pattern. They wait for the same scarce committer
attention as engine or API changes. A new connector, for example, touches
the same six registration places every time (the module pom, <module>
entries, the seatunnel-dist dependency, plugin-mapping.properties,
config/plugin_config, and the labeler entry), and CI already checks that
registration is complete. At the same time, changes to the engine, the API
or checkpoint state need careful human review and must never be
fast-tracked.

*Proposal*

A new label, ai-merge. A PR may be merged without a further human code
review only if all of the following hold:

   1. It belongs to one of five closed classes (below).
   2. It hits none of the always-rejected conditions.
   3. The label was applied by an authorised maintainer account, after the
   current head commit was pushed. Any new push removes the label
   automatically.
   4. A designated committer has approved the exact head commit.
   5. All required CI checks are green on that commit, there are no
   unresolved review threads, and GitHub reports the PR as cleanly mergeable.

*The five classes*
Class What qualifies
docs Markdown, docs images, and brand-new example configs.
tests Connector unit tests and connector E2E, without weakening any
existing assertion, timeout or fixture.
connector A fix inside exactly one blast-radius unit (one connector module,
or one JDBC dialect), with a regression test in the same module, and docs
if it adds an option.
new-connector Exactly one brand-new connector module with its tests and
docs, plus the registration it needs: the module pom, <module> entries, the
seatunnel-dist dependency, plugin-mapping.properties, config/plugin_config,
the labeler entry and SPI service lines.
shared A small change to a shared connector module (connector-common, *-base,
JDBC core, the fake, assert and console connectors).

*How registration changes are accepted for a new connector*

   - Registration edits must be purely additive (no removed line), and
   every added line must be a plain registration of the new module and nothing
   else.
   - Service entries must name a class that the same PR adds.
   - A pom or registration change without a brand-new module in the same PR
   is still rejected.
   - The new pom may only use artifacts that other poms in the repository
   already use. No literal third-party version, no repositories, profiles,
   antrun or exec plugins.
   - In addition to the base checks, Code style (which runs
   check_connector_registration.py) and Dependency licenses must be green.

*An honest limit on dependencies*

The existing license check covers core runtime jars, not the third-party
jars a connector bundles. So a new third-party jar or version in a
connector pom has no mechanical license or supply-chain review today, and
the gate sends those PRs to a human. When I replayed three real merged
connector PRs through the script, the Facebook Ads connector (#12275)
passed. The TikTok Ads (#12283) and PayPal (#12282) PRs were rejected
because their poms pin their own third-party versions. I think that is the
right outcome, but I'd like your view.

*Shared modules need an extra proof*

backend.yml selects tests by changed path, so a change to connector-common
only runs that module's tests, not the tests of the connectors that depend
on it. The shared class therefore stays rejected until we configure the CI
checks that exercise the dependents (AI_MERGE_WIDE_CHECKS). That would need
a small CI change to run the dependents on such PRs, which I would propose
as a separate PR. Even then it needs:

   - at most 80 production lines;
   - a test inside the same module;
   - no changed public or protected signature.

*Always rejected*

   - seatunnel-engine, seatunnel-api, seatunnel-core, seatunnel-common,
   transforms, formats and translation.
   - .github/** (apart from the additive labeler entry of a new connector)
   and tools/**, so a PR can never change its own verifier.
   - License files.
   - Checkpoint, state, split and serializer classes, option or default
   changes, and factory changes of existing connectors.
   - Security-sensitive, concurrency and classloading code. Inside
   brand-new connector files these are warnings instead, but process-level
   calls such as System.exit stay blocked.
   - Removed or weakened assertions, disabled tests, and any file deletion
   or rename.
   - PRs over the size caps, from first-time contributors, or containing
   text addressed to a reviewer or AI.

*How it is enforced*

   - tools/ai_merge_gate.py is a standard-library Python script. It only
   reads the PR through the GitHub API and never checks out or runs PR code,
   so it is safe under pull_request_target.
   - The workflow removes the label on every push, validates who applied
   it, and runs a 10-minute sweep of the full merge gate. A squash merge is
   pinned to the evaluated commit, so GitHub rejects it if the head moved.
   - It has 56 offline tests, each pinning one rule. I also checked that
   breaking a rule makes the matching test fail.

*What this is not*

   - It does not replace committer approval. A committer must approve the
   exact head commit.
   - The content checks are line-level heuristics, not code analysis. They
   are deliberately conservative, and the AI review must still address the
   warnings they raise (for example hot-path readers or writers, and type
   mapping changes). I do not claim they catch every risky change.
   - I have not exercised the GitHub API paths against a live PR yet, which
   is why I propose starting in observe-only mode.

*Proposed rollout*

   1. Phase 1: observe only. Post the eligibility report as a PR comment
   and compare it with what reviewers decide. No label, no merging.
   2. Phase 2: enable the label for docs, tests and single-connector fixes.
   3. Phase 3: enable new connectors, then shared modules once the
   dependents' CI proof exists.
   4. After each phase, review the merged PRs. If a merged PR is reverted
   or breaks dev, suspend that class until we have a retrospective.

*Questions I'd like your input on*

   1. Is this acceptable under our project's review and merge expectations,
   or should every PR still get at least one human code review from a
   committer other than the approver?
   2. Who should be the approvers and the label-applying accounts, and
   should those be different people?
   3. For new connectors, is "no new third-party jar or version without
   human review" the right boundary, or should we also route new connectors to
   a human whenever they handle credentials?
   4. Should shared-module changes be allowed at all, given the extra CI
   work they need, or stay human-only?
   5. Is it acceptable for a bot to perform the merge, or should the
   workflow only report "ready" and leave the final click to a committer? This
   may need a check with ASF Infra.
   6. Are the size caps reasonable (connector fix: at most 250 production
   lines and 25 files; new connector: at most 8000 lines and 120 files)?

Please comment on the thread or on the PR. If there are no objections after
a reasonable discussion period, I propose we start with phase 1 only.

Best Regards,

David
Linkedin: https://www.linkedin.com/in/davidzollo

Reply via email to