Review pass 6 (2026-05-14)¶
| Date | 2026-05-14 |
| Reviewed | 0.5.0 |
| Recorded in | the backlog section at the end of the changelog |
| Implemented in | one fix in 0.6.0 (2026-05-15) |
| Overview | Audit history · Changelog |
The sixth review pass ran against 0.5.0. One finding, the under-determined check of vector_fit, was fixed in 0.6.0.
Where this text comes from
This page was moved verbatim from CHANGELOG.md when the release notes were
condensed in 2026.11.0 (source: commit 30a122d). Only the markup was adapted:
reST roles are rendered as code or math, relative links point to the current
pages, trailing whitespace is removed, and each block stands under a heading
that names where it was published.
Paths, test names and numbers are those of the time; the code has changed since.
From the backlog section of the changelog (“Backlog (2026-05-10 audit)”)¶
Fixed (pending implementation) — sixth 2026-05-14 review pass¶
Sixth-pass findings against
0.5.0(released 2026-05-14). Focus: secondary effects of the just-shipped 0.5.0 surface, notebook / docs reality vs. CHANGELOG claim, ADR-0011 follow-through, FP-precision contract enforcement, and theWorld.solvedeep-copy cost on engine-sweep workloads.
World.solve(engine)deep-copiesself.sourceson every call. Pass-5 added the snapshot/restore pattern to defend against backend-sideSource.return_tomutation (MeasurementSetupConfig.buildwas the textbook offender). The implementation does[s.model_copy(deep=True) for s in self.sources]on entry unconditionally. On a 100-frequency sweep that re-uses the sameWorldacrossEngine.with_frequencies(...).solve(...)calls the deep-copy cost dominates for sources that carry largereturn_to-electrode meshes. Either gate the snapshot behind aWorld.solve(engine, snapshot_sources=True)default-on keyword (so power users can opt out), or do a shallow snapshot of just the mutable fields (return_to,value) instead of a fullmodel_copy(deep=True).VectorFitUnderdeterminedWarningthreshold mis-fires on conjugate-pair fits. The current checkif 2 * n_poles >= len(frequencies)treats every pole as contributing 4 real DOFs (residue real+imag, pole real+imag). For a conjugate-pair fit (complex_conj=True, default) the residues and pole locations come in complex-conjugate pairs, halving the actual free parameters. The result is a false positive onn_poles=2, N=2(warns) where the conjugate-pair fit is in fact uniquely determined. Tighten the check to2 * n_independent_poles >= len(frequencies)wheren_independent_poles = n_poles // 2 + (n_poles % 2)undercomplex_conj=True.LayeredEarth.compute_T_lambdaFP-precision contract is documented but not enforced. Pass-5 added the docstring note "every consumer of LayeredEarth operates in IEEE-754 double precision" and a homogeneous-limit cross-check atrtol=1e-12. What is still missing is the actual guard: a future MLX-on-Apple backend silently downgrading to FP32 would pass the homogeneous check (which is a single-layer identity, no roundoff to speak of) and fail only on five-layer realistic soils. Add an assertion at the top ofcompute_T_lambda:assert out.dtype == np.float64, "LayeredEarth contract: FP64 required"— cheap, catches the regression at the source.Enginefrequency-list cache key.Engine.frequenciesis now order-preserving withEngineFrequencyOrderWarning. Pass 5 surfaces but does not solve the equality contract:Engine(frequencies=[50, 100]) == Engine(frequencies=[100, 50])evaluates toFalse(the warning is per-instance), so two engines that map to the same physics produce two different cache keys downstream incompare_engines/convergence_studyresult tables. Either document the "order matters" contract onEngine.__eq__or override__eq__/__hash__to compare frozenset(frequencies).io.groundinsight.evaluate_specfree-symbol allow-list is name-only. The Pass-5 fix accepts every symbol whosename in {"f", "rho"}, ignoring assumptions. Asp.Symbol("rho", real=False, positive=False)slips through and produces a complex-valuedrhothat crashes deep inlambdifyinstead of at the validation step. Compare on full symbol identity (s == f_sym or s == rho_sym) and reject anything else.Engine.with_frequencies(preserve_order=False)is the silent default. The docstring showspreserve_order=Truebut the constructor body checksif not preserve_orderand falls through; if the caller omits the keyword the engine does preserve order but the warning is still suppressed by thesimplefilter("ignore")block. Result: a sweep author who copies the docstring example sees the same silenced behaviour as the explicitpreserve_order=Trueuser, but the silencing is by accident. Either flip the default toFalse(loud) and document the explicit silencer, or document thatEngine.with_frequenciesis the opt-in silencer regardless ofpreserve_ordervalue.SourceAdaptervalidates a single source dict but does not validate a list. A user-side helper that imports a campaign YAML with asources: [...]field has to callSourceAdapter.validate_pythonper element. Add aSourcesAdapter = TypeAdapter(list[Source])companion so the bulk path is one call.World.set_boundary_conditions(**kwargs)revert-warning is emitted regardless of whether the warning was already raised for the same value. Pass-4 added the set-and-revert warning, Pass-5 left it as-is. A loop that toggles a boundary value across 100 sweeps emits 200 warnings. Apply asimplefilter("once", BoundaryConditionWarning)strategy on first set, OR coalesce the warning by value identity inside the method body.vector_fitinitial pole placement is silent forn_poles == 1._initial_poleschooses a single real pole at the geometric mean ofomega_min/omega_max. For data with a complex-pole structure (e.g. capacitive return path), the iteration cannot bend a real pole into a conjugate pair withinmax_iter=20and the fit converges to a poor RMSE. AUserWarning"vector_fit(n_poles=1) cannot fit complex resonance peaks; pass n_poles=2 for conjugate-pair coverage" at fit time would save a Stack-Overflow round-trip.compare_enginesreturns the discrepancy matrix but does not callEngineFrequencyOrderWarningsilencer. A 4×4 cross-engine matrix over decreasing frequencies fires 16 warnings; the helper should suppress them once internally while still surfacing them on the per-engine path.
Docs (pending implementation) — sixth 2026-05-14 review pass¶
docs/api/sources.md,boundary.md,references.md,validation.md,world.md— sixth audit pass in a row these pages are still missing. Pass 5 promisedmkdocs build --strictwould catch this in CI; the test has not landed and the pages have not been written. This is now the longest-standing structural doc gap in the three-package family. Sixth-pass acknowledges that one of two things has to happen before the next release tag: either the five pages land, or themkdocs build --stricttest lands (the latter is the one-line forcing function).docs/adr/0011-cross-repo-release-shared.mddoes not exist. Pass-5 cross-cutting recommendation #5 ("a single sharedscripts/_release_shared.pywould lose three release-flow problems in one diff") was elevated to an explicit ADR-0011 proposal in the cross-cutting summary; the ADR itself was not drafted. As the architectural authority on cross-repo conventions sits ingroundfield(eight existing ADRs), ADR-0011 belongs here even though the implementation will ultimately live in all three repos.docs/api/index.mddoes not document the FP64 contract onLayeredEarththat Pass-5 added in code. The rendered API index page therefore does not tell the user that hardware-accelerated backends are required to keep IEEE-754 double precision. Add a one-paragraph admonition before theLayeredEarth:::directive.docs/api/postprocess.mddoes not documentVectorFitUnderdeterminedWarning— the warning category is publicly importable but unmentioned. A reader who tries towarnings.simplefilter("once", ...)has to discover the class name from the source.docs/api/sources.md(once it ships) must enumerate theSourceAdapter/ proposedSourcesAdapterhelpers with a copy-pasteable round-trip example. The Pass-4 + Pass-5 Source-discriminator surface is currently documented only inside the source-file docstring.docs/concepts.mddoes not describe the "Engine re-use acrossWorld.solvecalls" pattern. Tied to the sixth-passWorld.solvedeep-copy finding: the user who wants the snapshot-free behaviour should see a recipe for the plannedsnapshot_sources=Falseopt-out before the perf cost bites them.docs/engines/*.md— Capability matrix sub-section still missing on each engine page. Pass-5 listed this; the pages have not been edited. A two-column matrix (feature×supported / partial / planned) at the top of everybem.md/mom.md/fem.md/ ... gives the reader a one-glance picture of why one engine is in beta and another is reference-quality.README.mddoes not yet list the0.5.0release. The CHANGELOG carries[0.5.0] — 2026-05-14, but the README "Latest release" / badges sub-section still points at0.4.0(verified 2026-05-14). README/CHANGELOG drift reappears on every release that does not run throughscripts/release.pyend-to-end.- CLAUDE.md "Audit history" — append a sixth-pass reference. Pass-5 already failed to do this for itself (verified above as a Pass-5 Docs-backlog item); sixth pass re-confirms.
Tests (pending implementation) — sixth 2026-05-14 review pass¶
- No regression test for the
VectorFitUnderdeterminedWarningfalse-positive path undercomplex_conj=True. Build avector_fit(n_poles=2, N=2, complex_conj=True)instance and assert no warning fires; today the Pass-5 threshold flags it as underdetermined. - No regression test for FP64 contract enforcement on
LayeredEarth.compute_T_lambda. Construct a stub backend that returns an FP32 array, invokecompute_T_lambda, and assert the proposed runtime assertion (out.dtype == np.float64) trips with a clear message. - No regression test for
World.solve(engine, snapshot_sources=False)cost. Once the keyword lands, benchmark a 100-frequency sweep with and without the snapshot and assert the difference is below thetests/test_perf_smoke.pythreshold; pin the opt-out so the cost is documented. - No regression test for
Engine.__eq__/Engine.__hash__contract. Once the sixth-passfrequency-orderfinding is resolved, pin the chosen contract (Engine([50,100]) == Engine([100,50])true or false) so it cannot regress in a refactor. - No regression test for
io.groundinsight.evaluate_specrejecting a non-canonical-assumptionrhosymbol. Constructsp.Symbol("rho", real=False)-bearing formula, callevaluate_specand assert the sixth-pass tightened check raisesValueError. Today the symbol slips through and the failure surfaces deep insympy.lambdify. - No regression test for the
compare_engineswarning-suppression path. Build a 4×4 comparison over decreasing frequencies and assert exactly oneEngineFrequencyOrderWarningfires (after the sixth-pass per-engine internal silencer lands), not 16. - No regression test that
set_boundary_conditionsdoes not double-warn on repeat assignment of the same non-default value. Today the helper warns on every call, even with identical kwargs. - No regression test for
SourcesAdapter = TypeAdapter (list[Source])once it ships. Round-trip a heterogeneous list with oneCurrentSourceand oneVoltageSourceand assert each element keeps its discriminator.
Roadmap candidates — sixth 2026-05-14 review pass¶
gf.SourcesAdapter = TypeAdapter(list[Source])— bulk-validation companion to the Pass-4SourceAdapter, needed by any YAML / JSON campaign-config import path that has more than one source per scenario.World.solve(engine, snapshot_sources: bool = True)— explicit opt-out for the Pass-5 deep-copy snapshot. The perf-sensitive callers (convergence_study, parameter sweeps, the cross-engine matrix) can disable the snapshot once they have proven their backend does not mutatesource.return_to.gf.set_warning_policy("verbose" | "once" | "silent")— global helper to bulk-configure the pass-5 family of warning categories (EngineFrequencyOrderWarning,VectorFitUnderdeterminedWarning, the proposedBoundaryConditionWarning, the proposedVectorFitRealPoleWarning). Replaces thewarnings.simplefilter("once", X)boilerplate that notebooks currently copy-paste per category.gf.audit_apply(report_path)— twin of thegroundinsightproposal. Read a markdown audit's backlog bullets and insert them into[Unreleased]. Six passes of hand-merging strongly motivate the helper.- ADR-0011 — cross-repo
_release_shared.py. Pass-5 cross-cutting recommendation #5; sixth pass elevates it to a tracked roadmap candidate so the ADR file lands as the next merge-able artefact. Mirrors thegi.scripts.release.pyandgm.scripts.release.pygaps in a single shared implementation. gf.show_versions()— keep the cross-package-consistency lemma in the roadmap: whengi.show_versions()(Pass-5 idea) andgm.show_versions()(sixth-pass idea, see groundmeas roadmap above) land, this one needs to land too with the same return-shape contract.gf.docs.assert_api_pages_exist()— a tiny walker that asserts every__all__member has a corresponding mkdocstrings directive somewhere underdocs/api/. Sixth pass elevates this from the Pass-5 proposal status to an explicit roadmap item because the five-pass-in-a-row missing-pages backlog clearly demands a structural forcing function.
Released in 0.6.0 (2026-05-15)¶
Changed¶
vector_fitunder-determined check now respects conjugate-pair symmetry (postprocess/vector_fitting.py, sixth 2026-05-14 audit pass). The previous trigger counted four real DOFs per pole regardless of whether the search was constrained to conjugate pairs. Under the defaultcomplex_poles=Truethe pair constraint halves the actual free parameters; the underdetermined-test is now2 * n_independent_poles > len(frequencies)withn_independent_poles = n_poles // 2 + (n_poles % 2). The strict>admits the uniquely-determined boundary case (n_poles=2, N=2) that the previous>=trigger rejected as a false positive. The warning text now states which ratio applies given the fit mode. Behaviour forcomplex_poles=Falseis unchanged. No public API change; this is a tightening of theVectorFitUnderdeterminedWarningenvelope.