Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 171 additions & 0 deletions .github/workflows/test-upstream-resolution-pass3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: Test OnePlus 13 Upstream Resolution Pass 3

on:
pull_request:
branches: ["6.6-final"]
paths:
- "sync/resolutions/16.0.9.401/pass3-ours.txt"
- "sync/resolutions/16.0.9.401/pass3-theirs.txt"
- ".github/workflows/test-upstream-resolution-pass3.yml"

permissions:
contents: read

concurrency:
group: oneplus13-test-upstream-resolution-pass3
cancel-in-progress: true

env:
LOCAL_BRANCH: 6.6-final
OFFICIAL_REPO: https://github.com/OnePlusOSS/android_kernel_common_oneplus_sm8750.git
OFFICIAL_SHA: e1b346b6b4f4096eb342ae3684838a942fd6f6c4
EXPECTED_INITIAL_CONFLICTS: "116"
EXPECTED_AFTER_PASS1: "85"
EXPECTED_AFTER_PASS2: "67"
EXPECTED_AFTER_PASS3: "50"

jobs:
test-pass-3:
if: github.repository == 'Zhanfg/android_kernel_common_oneplus_sm8750'
runs-on: ubuntu-24.04
timeout-minutes: 30

steps:
- name: Fetch base, resolution inputs and official history
env:
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
shell: bash
run: |
set -euo pipefail
git init .
git config gc.auto 0
git config advice.detachedHead false
git remote add local "https://github.com/${GITHUB_REPOSITORY}.git"
git remote add official "${OFFICIAL_REPO}"
git fetch --filter=blob:none --no-tags --no-recurse-submodules local \
"+refs/heads/${LOCAL_BRANCH}:refs/remotes/local/${LOCAL_BRANCH}" \
"+${PR_HEAD_SHA}:refs/remotes/local/resolution-head"
git fetch --filter=blob:none --no-tags --no-recurse-submodules official \
"+${OFFICIAL_SHA}:refs/remotes/official/pinned"
git checkout --detach "refs/remotes/local/${LOCAL_BRANCH}"

for path in \
scripts/resolve_merge_markers.py \
sync/resolutions/16.0.9.401/pass1-ours.txt \
sync/resolutions/16.0.9.401/pass2-ours.txt \
sync/resolutions/16.0.9.401/pass2-theirs.txt \
sync/resolutions/16.0.9.401/pass3-ours.txt \
sync/resolutions/16.0.9.401/pass3-theirs.txt; do
git show "refs/remotes/local/resolution-head:${path}" > "/tmp/$(basename "${path}")"
done
chmod +x /tmp/resolve_merge_markers.py

- name: Apply and verify passes 1-3
id: resolve
shell: bash
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

count_conflicts() {
git diff --name-only --diff-filter=U | LC_ALL=C sort -u > "$1"
awk 'END {print NR + 0}' "$1"
}

stage_paths() {
while IFS= read -r path; do
[ -n "${path}" ] || continue
git add -- "${path}"
done < "$1"
}

verify_paths() {
local list="$1"
local remaining="$2"
while IFS= read -r path; do
[ -n "${path}" ] || continue
if grep -Fxq -- "${path}" "${remaining}"; then
echo "Resolved path remains unmerged: ${path}" >&2
exit 1
fi
if grep -n -E '^(<<<<<<<|=======|>>>>>>>)' -- "${path}"; then
echo "Conflict marker remains: ${path}" >&2
exit 1
fi
done < "${list}"
}

apply_pass() {
local list="$1"
local choice="$2"
local log="$3"
python3 /tmp/resolve_merge_markers.py --root . --paths-file "${list}" --choice "${choice}" | tee "${log}"
stage_paths "${list}"
}

set +e
git merge --no-commit --no-ff "${OFFICIAL_SHA}"
MERGE_STATUS=$?
set -e
BEFORE="$(count_conflicts /tmp/conflicts-before.txt)"
if [ "${MERGE_STATUS}" -eq 0 ] || [ "${BEFORE}" != "${EXPECTED_INITIAL_CONFLICTS}" ]; then
echo "Initial conflict baseline mismatch: expected ${EXPECTED_INITIAL_CONFLICTS}, got ${BEFORE}." >&2
exit 1
fi

apply_pass /tmp/pass1-ours.txt ours /tmp/pass1.log
AFTER1="$(count_conflicts /tmp/conflicts-after-pass1.txt)"
verify_paths /tmp/pass1-ours.txt /tmp/conflicts-after-pass1.txt
[ "${AFTER1}" = "${EXPECTED_AFTER_PASS1}" ] || { echo "Expected ${EXPECTED_AFTER_PASS1} after pass 1, got ${AFTER1}." >&2; exit 1; }

apply_pass /tmp/pass2-ours.txt ours /tmp/pass2-ours.log
apply_pass /tmp/pass2-theirs.txt theirs /tmp/pass2-theirs.log
AFTER2="$(count_conflicts /tmp/conflicts-after-pass2.txt)"
verify_paths /tmp/pass2-ours.txt /tmp/conflicts-after-pass2.txt
verify_paths /tmp/pass2-theirs.txt /tmp/conflicts-after-pass2.txt
[ "${AFTER2}" = "${EXPECTED_AFTER_PASS2}" ] || { echo "Expected ${EXPECTED_AFTER_PASS2} after pass 2, got ${AFTER2}." >&2; exit 1; }

apply_pass /tmp/pass3-ours.txt ours /tmp/pass3-ours.log
apply_pass /tmp/pass3-theirs.txt theirs /tmp/pass3-theirs.log
AFTER3="$(count_conflicts /tmp/conflicts-after-pass3.txt)"
verify_paths /tmp/pass3-ours.txt /tmp/conflicts-after-pass3.txt
verify_paths /tmp/pass3-theirs.txt /tmp/conflicts-after-pass3.txt
[ "${AFTER3}" = "${EXPECTED_AFTER_PASS3}" ] || { echo "Expected ${EXPECTED_AFTER_PASS3} after pass 3, got ${AFTER3}." >&2; exit 1; }

: > /tmp/pass3-resolved-files.patch
cat /tmp/pass3-ours.txt /tmp/pass3-theirs.txt | while IFS= read -r path; do
[ -n "${path}" ] || continue
git diff --cached --binary HEAD -- "${path}" >> /tmp/pass3-resolved-files.patch
done

{
echo "# OnePlus 13 resolution pass 3"
echo
echo "- Initial conflicts: ${BEFORE}"
echo "- After pass 1: ${AFTER1}"
echo "- After pass 2: ${AFTER2}"
echo "- Pass-3 resolved paths: $((AFTER2 - AFTER3))"
echo "- Remaining conflicts: ${AFTER3}"
echo "- Rule validation: passed"
echo "- Source integration: still blocked"
} > /tmp/pass3-report.md
cat /tmp/pass3-report.md >> "${GITHUB_STEP_SUMMARY}"
git merge --abort 2>/dev/null || true

- name: Upload pass-3 evidence
uses: actions/upload-artifact@v4
with:
name: oneplus13-common-resolution-pass3-${{ github.run_id }}
path: |
/tmp/pass3-report.md
/tmp/pass3-ours.log
/tmp/pass3-theirs.log
/tmp/pass3-resolved-files.patch
/tmp/conflicts-after-pass3.txt
if-no-files-found: error
retention-days: 30

- name: Confirm integration remains blocked
run: |
echo "Pass-3 rules are reproducible. The official source merge remains blocked by 50 unresolved paths."
52 changes: 52 additions & 0 deletions sync/resolutions/16.0.9.401/PASS3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Resolution pass 3

Pass 3 applies after the validated pass-1 and pass-2 rules.

Expected cumulative result:

```text
116 initial conflicts
85 after pass 1
67 after pass 2
17 resolved by pass 3
50 remaining conflicts
```

## Local conflict blocks retained

`pass3-ours.txt` keeps local conflict blocks where the custom 6.6.126 tree has a newer or project-specific implementation:

- ARM64 BPF capability check uses the initial user namespace without audit noise.
- x86 KASLR keeps the broader `ZONE_DEVICE` direct-map constraint.
- Bluetooth and HDA retain additional device quirks.
- cpuidle keeps the project residency threshold.
- Realtek SDIO keeps the chip-specific indirect-access guard.
- Tegra SPI keeps locked `curr_xfer` cleanup.
- TCPM accepts both null and error-pointer role switches.
- NTFS3 keeps sparse-LCN overflow handling.
- ESP4/ESP6 use the newer `xfrm_offload()->proto` interface.
- Open vSwitch keeps strict nested NSH validation.
- IFE keeps normal statement semantics instead of comma chaining.

## Official conflict blocks retained

`pass3-theirs.txt` accepts official conflict blocks where the OnePlus update carries the required fix:

- SVM accesses the LBR-specific VMCB through `svm_get_lbr_vmcb()`.
- AMD display uses `fsleep()` instead of a frame-length busy wait.
- mlx5 rate-limit validation compares the encoded bandwidth value.
- KSMBD releases the session user during logoff.

## Excluded paths

Pass 3 does not include:

- HMBIRD / SCX / SLIM scheduler architecture
- ABI/KMI and AFDO files
- F2FS core paths
- IOMMU and device-tree-sensitive interfaces
- complex Mellanox firmware reset state handling
- Unix-domain socket graph rewrite
- Renesas reset lifecycle changes

These require manual combined resolutions rather than choosing one conflict side.
13 changes: 13 additions & 0 deletions sync/resolutions/16.0.9.401/pass3-ours.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
arch/arm64/net/bpf_jit_comp.c
arch/x86/mm/kaslr.c
drivers/bluetooth/btusb.c
drivers/cpuidle/governors/menu.c
drivers/net/wireless/realtek/rtw88/sdio.c
drivers/spi/spi-tegra210-quad.c
drivers/usb/typec/tcpm/tcpm.c
fs/ntfs3/run.c
net/ipv4/esp4_offload.c
net/ipv6/esp6_offload.c
net/openvswitch/flow_netlink.c
net/sched/act_ife.c
sound/pci/hda/patch_realtek.c
4 changes: 4 additions & 0 deletions sync/resolutions/16.0.9.401/pass3-theirs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
arch/x86/kvm/svm/svm.c
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
fs/smb/server/smb2pdu.c
Loading