Repository navigation
revert: roll back tests.yml CI changes from PR #16391 - #16505
Conversation
📝 WalkthroughWalkthroughThe PR moves Python test environment setup out of the Go build steps in two CI jobs, expands Go test package exclusions, rewrites ChangesCI Workflow Step Sequencing and Go Test Exclusions
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Remove uv sync from Build ragflow go server step - Remove duplicate Prepare Python test environment step after Build step - Restore grep -v exclusions for pdfium/pdfoxide/pdf Go packages - Move Prepare Python test environment back before Prepare function test environment These changes were introduced in PR infiniflow#16391 (oss parser go refactor) and are no longer needed since the pdf Go packages must be excluded from unit tests that lack required CGo build dependencies. Co-Authored-By: Claude <[email protected]>
6170aa0 to
fa94f83
Compare
…pdfium/pdf_oxide) - build.sh: split setup_cgo_env into base (no -l flags) and pdf variant - build.sh: remove global -loffice_oxide/-lpdfium/-lpdf_oxide from CGO_LDFLAGS - build.sh: make native lib checks non-fatal (warn instead of exit/return 1) - build.sh: only set -L paths when libs are present, skip otherwise - build.sh: --run now sets LD_LIBRARY_PATH automatically - ingestion/parser: add 'office' build tag to CGo parsers (cgo && office) - ingestion/parser: stub compiles when !cgo || !office - pdfium: add explicit //go:build cgo guard Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@build.sh`:
- Around line 449-486: The PDF CGO setup was split out, but `build_go()` and
`run()` no longer get the `pdfium` and `pdf_oxide` library search paths and
runtime library path setup. Update the build/run flow so `setup_cgo_env_pdf()`
is also invoked from the code paths used by `build_go()` and `run()`, or
otherwise ensure those paths still export the `CGO_LDFLAGS` and
`LD_LIBRARY_PATH` values for `${PDFIUM_PREFIX}` and `${PDF_OXIDE_PREFIX}`. Keep
the fix centered around the existing `setup_cgo_env()`, `setup_cgo_env_pdf()`,
`build_go()`, and `run()` helpers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f1c15eba-0a93-46b7-95b8-91dd5be51e96
📒 Files selected for processing (9)
build.shinternal/deepdoc/parser/pdf/pdfium/pdfium.gointernal/ingestion/parser/doc_parser.gointernal/ingestion/parser/docx_parser.gointernal/ingestion/parser/office_parsers_no_cgo.gointernal/ingestion/parser/ppt_parser.gointernal/ingestion/parser/pptx_parser.gointernal/ingestion/parser/xls_parser.gointernal/ingestion/parser/xlsx_parser.go
✅ Files skipped from review due to trivial changes (2)
- internal/ingestion/parser/office_parsers_no_cgo.go
- internal/ingestion/parser/docx_parser.go
| # Configure CGO flags for native libraries. | ||
| # setup_cgo_env — base: -I and -L paths only, no -l flags (those live in | ||
| # each package's own #cgo LDFLAGS pragma). Safe to call even when native | ||
| # libs are absent — just skips the paths that don't exist. | ||
| # setup_cgo_env_pdf — pdfium / pdf_oxide -L paths. Non-fatal when libs | ||
| # are missing. Only called by run_go_tests. | ||
| setup_cgo_env() { | ||
| # ── office_oxide ────────────────────────────────────────────────── | ||
| check_office_oxide_deps | ||
| export CGO_CFLAGS="-I${OFFICE_OXIDE_PREFIX}/include/office_oxide_c${CGO_CFLAGS:+ $CGO_CFLAGS}" | ||
| export CGO_LDFLAGS="-L${OFFICE_OXIDE_PREFIX}/lib -loffice_oxide -Wl,-rpath,${OFFICE_OXIDE_PREFIX}/lib" | ||
| export LD_LIBRARY_PATH="${OFFICE_OXIDE_PREFIX}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" | ||
| # ── office_oxide (header + search path only, no -loffice_oxide) ─── | ||
| if [ -f "${OFFICE_OXIDE_PREFIX}/include/office_oxide_c/office_oxide.h" ]; then | ||
| export CGO_CFLAGS="-I${OFFICE_OXIDE_PREFIX}/include/office_oxide_c${CGO_CFLAGS:+ $CGO_CFLAGS}" | ||
| fi | ||
| if [ -f "${OFFICE_OXIDE_PREFIX}/lib/liboffice_oxide.so" ] || [ -f "${OFFICE_OXIDE_PREFIX}/lib/liboffice_oxide.dylib" ]; then | ||
| export CGO_LDFLAGS="-L${OFFICE_OXIDE_PREFIX}/lib${CGO_LDFLAGS:+ $CGO_LDFLAGS}" | ||
| export LD_LIBRARY_PATH="${OFFICE_OXIDE_PREFIX}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" | ||
| fi | ||
|
|
||
| echo "CGO_CFLAGS: $CGO_CFLAGS" | ||
| echo "CGO_LDFLAGS: $CGO_LDFLAGS" | ||
| } | ||
|
|
||
| setup_cgo_env_pdf() { | ||
| # ── pdfium ──────────────────────────────────────────────────────── | ||
| check_pdfium_deps || return 1 | ||
| check_pdfium_deps || true | ||
| if [ -f "${PDFIUM_PREFIX}/libpdfium.so" ]; then | ||
| export CGO_LDFLAGS="$CGO_LDFLAGS -L${PDFIUM_PREFIX} -Wl,-rpath,${PDFIUM_PREFIX}" | ||
| export CGO_LDFLAGS="$CGO_LDFLAGS -L${PDFIUM_PREFIX}" | ||
| export LD_LIBRARY_PATH="${PDFIUM_PREFIX}:${LD_LIBRARY_PATH}" | ||
| fi | ||
|
|
||
| # ── pdf_oxide ───────────────────────────────────────────────────── | ||
| check_pdf_oxide_deps || return 1 | ||
| check_pdf_oxide_deps || true | ||
| if [ -f "${PDF_OXIDE_PREFIX}/libpdf_oxide.so" ]; then | ||
| export CGO_LDFLAGS="$CGO_LDFLAGS -L${PDF_OXIDE_PREFIX} -lpdf_oxide -Wl,-rpath,${PDF_OXIDE_PREFIX}" | ||
| export CGO_LDFLAGS="$CGO_LDFLAGS -L${PDF_OXIDE_PREFIX}" | ||
| export LD_LIBRARY_PATH="${PDF_OXIDE_PREFIX}:${LD_LIBRARY_PATH}" | ||
| elif [ -f "${PDF_OXIDE_PREFIX}/libpdf_oxide.a" ]; then | ||
| export CGO_LDFLAGS="$CGO_LDFLAGS ${PDF_OXIDE_PREFIX}/libpdf_oxide.a" | ||
| fi | ||
|
|
||
| echo "CGO_CFLAGS: $CGO_CFLAGS" | ||
| echo "Exporting CGO_CFLAGS: $CGO_CFLAGS" | ||
| echo "CGO_LDFLAGS: $CGO_LDFLAGS" | ||
| echo "Exporting CGO_LDFLAGS: $CGO_LDFLAGS" | ||
| echo "CGO_LDFLAGS (with PDF): $CGO_LDFLAGS" |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Restore PDF CGO setup on the build and run paths.
After this split, only run_go_tests() invokes setup_cgo_env_pdf(). build_go() and run() now miss the pdfium / pdf_oxide -L and LD_LIBRARY_PATH setup that setup_cgo_env() used to cover, so builds can fail to link and built binaries can fail to start on machines that rely on ${PDFIUM_PREFIX} / ${PDF_OXIDE_PREFIX} rather than system library paths.
Suggested fix
build_go() {
...
check_office_oxide_deps || true
setup_cgo_env
+ setup_cgo_env_pdf
...
}
run() {
...
setup_cgo_env
+ setup_cgo_env_pdf
...
}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@build.sh` around lines 449 - 486, The PDF CGO setup was split out, but
`build_go()` and `run()` no longer get the `pdfium` and `pdf_oxide` library
search paths and runtime library path setup. Update the build/run flow so
`setup_cgo_env_pdf()` is also invoked from the code paths used by `build_go()`
and `run()`, or otherwise ensure those paths still export the `CGO_LDFLAGS` and
`LD_LIBRARY_PATH` values for `${PDFIUM_PREFIX}` and `${PDF_OXIDE_PREFIX}`. Keep
the fix centered around the existing `setup_cgo_env()`, `setup_cgo_env_pdf()`,
`build_go()`, and `run()` helpers.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16505 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
These tests were excluded by PR infiniflow#16505 because the old .so-based build required system-native libraries at test-compile time. With the switch to static linking (.a + -fuse-ld=lld), these packages compile and pass correctly. Co-Authored-By: Claude <[email protected]>
…niflow#16505) ## Summary Two changes to make Go build \& run independent of native libraries (office_oxide, pdfium, pdf_oxide). ## 1. Make native libraries optional (build.sh + Go source) ## 2. Roll back tests.yml CI changes from PR infiniflow#16391
Summary
Two changes to make Go build & run independent of native libraries (office_oxide, pdfium, pdf_oxide).
1. Make native libraries optional (build.sh + Go source)
Problem:
build.sh --goadded-loffice_oxide/-lpdfium/-lpdf_oxideto globalCGO_LDFLAGS, causing every cgo package to link against these .so files. The resulting binary had NEEDED entries for all three, making it fail at startup with "cannot open shared object file" on any machine without them.Fix:
build.sh: splitsetup_cgo_envinto a base variant (only-Iand-Lpaths, no-lflags) andsetup_cgo_env_pdf(pdfium/pdf_oxide, non-fatal, only for--test)build.sh: make native lib checks non-fatal — warn instead ofexit 1build.sh --run: auto-setLD_LIBRARY_PATHfor libraries that are present//go:build cgo→//go:build cgo \&\& officeoffice_parsers_no_cgo.go://go:build !cgo→//go:build !cgo || !officepdfium/pdfium.go: add explicit//go:build cgoguardResult:
./build.sh --gosucceeds without any native libs. The built binary has ZERO NEEDED entries for office_oxide/pdfium/pdf_oxide.2. Roll back tests.yml CI changes from PR #16391
Revert 4 changes introduced to
.github/workflows/tests.ymlby PR #16391 in bothragflow_tests_infinityandragflow_tests_elasticsearchjobs:uv syncfrom Build step (no longer needed — Go build doesn't require .venv)grep -vexclusions for pdfium/pdfoxide/pdf Go test packagesVerification
🤖 Generated with Claude Code