davidzollo opened a new pull request, #12706:
URL: https://github.com/apache/seatunnel/pull/12706

   ### Purpose of this pull request
   
   Introduce an `ai-merge` pull request label and the gatekeeper that enforces 
it. The label means: the PR belongs to a risk class whose safety properties can 
be checked mechanically, so once the designated approver has approved the 
current head commit and CI is green, it can be squash-merged without a further 
human code review.
   
   The allow-list is closed. Only three PR classes can carry the label:
   
   | Class | Scope |
   |---|---|
   | `docs` | `*.md` and `docs/**` images |
   | `tests` | `src/test` and `seatunnel-connector-v2-e2e/connector-*-e2e` of 
connectors, no weakening of existing tests |
   | `connector` | a fix inside exactly one blast-radius unit (one connector 
module, or one `connector-jdbc` dialect), with its own regression test and docs 
|
   
   Always rejected (any hit disqualifies, including `seatunnel-engine`, 
`seatunnel-api`, `seatunnel-core`, `seatunnel-common`, transforms, formats, 
translation, every `pom.xml`, `.github/**`, `tools/**`, registration files, 
shared connector bases and fixtures, checkpoint/state/split/serializer classes, 
option/default/factory changes, security-sensitive, concurrency and 
classloading code, test weakening, file deletion or rename, size over the caps, 
and untrusted-instruction text in the PR).
   
   What is added:
   
   - `tools/ai_merge_gate.py` (standard library only; reads the PR through the 
GitHub API and never checks out or runs PR code, so it is safe under 
`pull_request_target`):
     - `evaluate`: mechanical eligibility report, optionally upserted as a PR 
comment.
     - `enforce`: removes the label on every new push; on `labeled`, validates 
the label actor and eligibility and strips the label if either fails.
     - `gate` / `sweep`: merge gate. Requires an allowed label actor (not the 
author) who labeled after the current head was pushed, an `APPROVED` review by 
a configured approver on the exact head SHA, no changes requested, required 
checks green on that SHA, no failed or pending checks, no unresolved threads, 
`mergeable_state == clean`. The squash merge is pinned to the evaluated SHA.
     - `classify`: offline evaluation of a saved `pulls/N/files` payload.
   - `.github/workflows/ai-merge-gate.yml`: runs `enforce` on `labeled` / 
`synchronize`, and a 10-minute `sweep`.
   - `tools/test_ai_merge_gate.py`: offline regression tests, one per rule.
   
   Operational notes:
   
   - Merging is a dry run until the repository variable `AI_MERGE_ENABLED` is 
`true`. Until then the workflow only reports.
   - `AI_MERGE_LABEL_ACTORS` must be set; `AI_MERGE_APPROVERS` defaults to 
`DanielLeens`; `AI_MERGE_REQUIRED_CHECKS` defaults to `Build`. Unset identities 
fail closed.
   - First-time contributors are not eligible by default.
   - The `ai-merge` label has to be created in the repository before use.
   - The content rules are line-level heuristics, not code analysis. They are 
meant to reject conservatively; warnings (hot-path readers/writers, type 
mapping, empty catch, removed throw) must be addressed by the AI review before 
the label is applied.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. This only adds repository automation (a new workflow and a CI tool). It 
does not change any runtime, connector, config or documentation behavior, and 
nothing happens on PRs that do not carry the `ai-merge` label (the `labeled` / 
`synchronize` hook exits without action for other labels, and the sweep only 
looks at PRs with the label).
   
   ### How was this patch tested?
   
   - `python3 -I tools/test_ai_merge_gate.py` runs 34 offline tests (no 
network, no Maven), all passing. Each test pins one rule, for example: 
engine/api/core/common/pom/CI/registration paths are rejected; two connectors 
or two JDBC dialects in one PR are rejected; shared bases and fixtures are 
rejected; checkpoint/state/serializer classes, `serialVersionUID`, removed 
options and new factories are rejected; removed assertions, disabled tests, 
changed timeouts and removed fixture lines are rejected; a production change 
without a new test is rejected; deletions, renames, missing diffs, 
prompt-injection text, drafts, wrong base branch, new contributors and size 
caps are rejected; a clean single-connector fix with a test and docs-only 
changes are accepted.
   - The path classifier was run over every `.java`, `.conf` and `.sql` file 
under `seatunnel-connectors-v2` and `seatunnel-connector-v2-e2e` in a current 
checkout to confirm module/unit mapping (127 units, 31 JDBC dialect units). 
This found that `connector-http` is a grouping directory, which is fixed in 
this PR.
   - The workflow YAML was parsed successfully.
   - The GitHub API paths (`gate`, `enforce`, `sweep`, `evaluate --comment`) 
were not exercised against a live PR yet. Merging is disabled by default, so 
the first rollout is dry-run only.
   
   ### Check list
   
   * [ ] If any new Jar binary package adding in your PR, please add License 
Notice according
     [New License 
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
 (not applicable, no jar added)
   * [ ] If necessary, please update the documentation to describe the new 
feature. (not applicable, repository automation only)
   * [ ] If necessary, please update `incompatible-changes.md` to describe the 
incompatibility caused by this PR. (not applicable)
   * [ ] If you are contributing the connector code, please check that the 
following files are updated (not applicable, no connector added)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to