Summary
cargo clippy --package morphir --all-targets -- -D warnings fails to compile morphir-common with:
error[E0004]: non-exhaustive patterns: `nbformat::Notebook::V3(_)` not covered
--> crates/morphir-common/src/vfs/notebook.rs:23:33
|
23 | let v4_notebook = match notebook {
| ^^^^^^^^ pattern `nbformat::Notebook::V3(_)` not covered
NotebookVfs::from_notebook (crates/morphir-common/src/vfs/notebook.rs:20-38) matches on nbformat::Notebook with arms for V4 and Legacy only.
Root cause
Cargo.toml pins nbformat = "1.0" (i.e. ^1.0, any 1.x). The committed Cargo.lock in this repo resolves that to 1.0.0, where Notebook only has V4/Legacy variants, so the match is exhaustive as committed and cargo build/cargo test against the locked versions pass fine.
The bug is latent rather than absent: nbformat has since published 1.2.2, which adds a Notebook::V3 variant. Anything that re-resolves the lockfile against the current registry (a fresh cargo generate-lockfile, cargo update, or a consumer with a looser lock) picks up 1.2.2 and the match stops being exhaustive.
Where this actually bit us
In the parent finos/morphir monorepo, the morphir CLI CI job runs prepare_cli_workspace.py before building, which deletes Cargo.lock and runs cargo generate-lockfile fresh (to build the CLI-only workspace without morphir-live). That resolves nbformat to 1.2.2 and the job fails on this exhaustiveness check.
This is currently blocking otherwise-unrelated PRs in finos/morphir — confirmed via finos/morphir#626, which only touches .github/workflows/*.yml (no Rust/Cargo changes at all) and still hits this exact error, since it's the CI job's fresh lockfile resolution surfacing a pre-existing gap in this repo's code, not anything introduced by that PR. See the failing run: https://github.com/finos/morphir/actions/runs/32068606383/job/95506448404
Also affects finos/morphir#638 and finos/morphir#612.
Suggested fix
Add a Notebook::V3(_) arm to the match in notebook.rs, analogous to how Legacy is currently handled (falls back to an empty v4::Notebook) — or implement an actual V3→V4 conversion if that's preferable. A todo!()/unimplemented!() stub would compile but just move the failure to runtime, so real handling (even if it's "unsupported, return an error") is preferable to silence clippy.
Alternatively/additionally, consider whether nbformat = "1.0" should be tightened (e.g. "~1.0" or exact-pinned) so a routine lockfile regeneration doesn't silently pick up a semver-compatible release that adds unhandled enum variants.
Summary
cargo clippy --package morphir --all-targets -- -D warningsfails to compilemorphir-commonwith:NotebookVfs::from_notebook(crates/morphir-common/src/vfs/notebook.rs:20-38) matches onnbformat::Notebookwith arms forV4andLegacyonly.Root cause
Cargo.tomlpinsnbformat = "1.0"(i.e.^1.0, any1.x). The committedCargo.lockin this repo resolves that to1.0.0, whereNotebookonly hasV4/Legacyvariants, so the match is exhaustive as committed andcargo build/cargo testagainst the locked versions pass fine.The bug is latent rather than absent:
nbformathas since published1.2.2, which adds aNotebook::V3variant. Anything that re-resolves the lockfile against the current registry (a freshcargo generate-lockfile,cargo update, or a consumer with a looser lock) picks up1.2.2and the match stops being exhaustive.Where this actually bit us
In the parent
finos/morphirmonorepo, themorphir CLICI job runsprepare_cli_workspace.pybefore building, which deletesCargo.lockand runscargo generate-lockfilefresh (to build the CLI-only workspace withoutmorphir-live). That resolvesnbformatto1.2.2and the job fails on this exhaustiveness check.This is currently blocking otherwise-unrelated PRs in
finos/morphir— confirmed via finos/morphir#626, which only touches.github/workflows/*.yml(no Rust/Cargo changes at all) and still hits this exact error, since it's the CI job's fresh lockfile resolution surfacing a pre-existing gap in this repo's code, not anything introduced by that PR. See the failing run: https://github.com/finos/morphir/actions/runs/32068606383/job/95506448404Also affects finos/morphir#638 and finos/morphir#612.
Suggested fix
Add a
Notebook::V3(_)arm to the match innotebook.rs, analogous to howLegacyis currently handled (falls back to an emptyv4::Notebook) — or implement an actual V3→V4 conversion if that's preferable. Atodo!()/unimplemented!()stub would compile but just move the failure to runtime, so real handling (even if it's "unsupported, return an error") is preferable to silence clippy.Alternatively/additionally, consider whether
nbformat = "1.0"should be tightened (e.g."~1.0"or exact-pinned) so a routine lockfile regeneration doesn't silently pick up a semver-compatible release that adds unhandled enum variants.