Repository navigation
Conversation
Clippy 0.1.98 flags two new lints that break the CI step
`cargo clippy --all-targets -- -D warnings` on stable:
- chunks_exact_to_as_chunks (attachments.rs): iterate the
/Names leaf with `as_chunks::<2>()`. The trailing odd element
is still skipped, as with `chunks_exact(2)`.
- collapsible_match (layout.rs): move the "no trailing space"
check into the TJ match guards. A failing guard falls through
to `_ => {}`, which is what the inner `if` did.
No behaviour change. `as_chunks` needs Rust 1.88 or newer.
docugraph ships a binary, so the lockfile belongs in the repo. Without it every build resolves dependencies again and a fixed commit does not pin rmcp, lopdf, tokio and the rest. The lock is the one resolved for 2832efa (182 packages, rmcp 3.3.0, lopdf 0.45.0, tokio 1.53.1) and matches Cargo.toml under `--locked`.
test_real_pdf_loading_and_extraction read a hardcoded Windows path and returned early when it was missing, so it reported "ok" without testing anything on every machine but one. Read the path from DOCUGRAPH_TEST_PDF instead and mark the test #[ignore] with a reason, so it shows up as ignored by default. Run it with `DOCUGRAPH_TEST_PDF=... cargo test -- --ignored`; a missing variable or file now fails loudly.
Now that Cargo.lock is tracked, fail CI when it is out of date with Cargo.toml instead of silently rewriting it. There is no separate build step: clippy is the first step that resolves dependencies and `cargo test` builds the crate, so both get --locked. Without it on clippy the lock would be rewritten before the test step runs.
This was referenced Sep 14, 2026
Owner
Author
|
Se descarta: los arreglos de docugraph los está haciendo el autor en su copia local y estos cambios chocarían con ellos. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema
cargo clippy --all-targets -- -D warningssale con código 101 por dos lints nuevos:clippy::chunks_exact_to_as_chunksensrc/document/attachments.rs:161yclippy::collapsible_matchensrc/document/layout.rs:360.Cargo.lockestaba en.gitignore. docugraph es un binario, así que cada build volvía a resolver dependencias: un commit fijo no fijaba rmcp, lopdf, tokio y el resto. La clave de caché del CI (hashFiles('**/Cargo.lock')) tampoco cambiaba nunca.test_real_pdf_loading_and_extractionbuscabaC:/proyectos/chaika-stage/...y, si no existía, hacíareturny contaba como pasado. Salvo en una máquina, los verdes no incluían ningún PDF real.Cambios
refactor: fix clippy lints from Rust 1.98as_chunks::<2>()en vez dechunks_exact(2)para recorrer la hoja/Names, que igual ignora el elemento suelto del final. Y la comprobación del espacio final se sube a la guarda de los brazosInteger/RealdelTJ: si la guarda falla, cae en_ => {}, que es lo mismo que hacía elifinterior. Se aplica a los dos brazos para que sigan simétricos. Sin cambio de comportamiento.chore: track Cargo.lockCargo.lockdel.gitignorey añade el lock resuelto para 2832efa: 182 paquetes, rmcp 3.3.0, lopdf 0.45.0, tokio 1.53.1.test: gate real PDF test behind env varDOCUGRAPH_TEST_PDFy el test lleva#[ignore = "needs a real PDF: set DOCUGRAPH_TEST_PDF and run with --ignored"]. Por defecto sale como ignored en vez de ok. Con--ignored, si falta la variable o el fichero, falla con un mensaje claro. Añade el comando enCONTRIBUTING.md.ci: run clippy and tests with --locked--lockeden clippy y en test. No hay paso de build aparte: clippy es el primero que resuelve dependencias ycargo testcompila. Si solo lo llevara test, clippy reescribiría el lock antes y el--lockedno detectaría nada.Nota:
as_chunkses estable desde Rust 1.88. El crate no declararust-versiony el CI usa stable, así que no afecta.Cómo se verificó
En local con rustc/cargo/clippy 1.98.1 y rustfmt 1.9.0, sobre este árbol:
cargo fmt --all -- --checkcargo clippy --locked --all-targets -- -D warningsFinished dev profile ... in 24.99s)cargo test --release --locked --test attachments_and_embedded_files_test --test pdf_ingestion_test --test spatial_reading_order_testtest_real_pdf_loading_and_extraction ... ignored, needs a real PDF: set DOCUGRAPH_TEST_PDF and run with --ignored)cargo test --release --test pdf_ingestion_test -- --ignored --exact test_real_pdf_loading_and_extractionsin la variableDOCUGRAPH_TEST_PDF must point to a real PDF with more than 200 pages: NotPresentDOCUGRAPH_TEST_PDFapuntando a un PDF digital real de 224 páginasVerified real PDF ... with 224 pages and 96 sectionsVerified real PDF ... with 437 pages and 51 sectionsSin cambio de comportamiento, comprobado con PDFs reales. Indexé esos dos PDFs con
docugraph indexusando el binario release de 2832efa y el de esta rama, cada uno con suDOCUGRAPH_CACHE_DIR. Los JSON salen idénticos byte a byte (385.380 y 642.989 bytes, 224 y 437 páginas). La indexación pasa porparser.rs:277→layout::extract_page_text_spatial, que es donde está elTJtocado. La hoja/Namesdeattachments.rsla cubretest_extract_attachment_from_embedded_files_name_tree. Los PDFs son libros con licencia personal y no se suben al repo.La suite completa no la pude compilar en local por falta de espacio en el disco temporal (en local ejecuté los tres objetivos afectados). La ejecuta entera el CI de esta PR (run 34894215480): fmt ok,
cargo clippy --locked --all-targets -- -D warningsok ycargo test --all --locked --verbosecon 72 pasados, 0 fallidos y 1 ignorado, en 1m18s.Cifras de antes y después
failureen el paso de clippy y los tests quedanskipped(run 34854899911)cargo clippy --all-targets -- -D warnings(1.98.1)attachments.rs:161:30,layout.rs:360:33)cargo fmt --all -- --checkCargo.lock--lockedok en local y en CIcargo testC:/proyectos/chaika-stage/...DOCUGRAPH_TEST_PDF=... -- --ignored: pasa con PDFs de 224 y 437 páginas y falla claro si falta la variabledocugraph indexcon dos PDFs reales