Skip to content

Fix the QA and Spell Check checks left red by the preconditioning hooks - #1141

Merged
ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:qa-document-public-api
Aug 7, 2026
Merged

ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:qa-document-public-api

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Aug 7, 2026 •

Copy link
Copy Markdown
Member

Important

This PR should be ignored until reviewed by @ChrisRackauckas.

Fixes two pre-existing red checks on master, both inherited from #1084 (which merged with those checks already failing):

  1. the NonlinearSolveBase QA group — nine names went public without docstrings / @docs entries;
  2. the Spell Check workflow — a deliberate misspelling in a test that Nonlinear preconditioning hooks: precondition (G) / postcondition (H) with PCNR limiting support #1084 added.

1. QA: undocumented public API

SciMLTesting.run_api_docs requires every name in names(NonlinearSolveBase; all = false, imported = false) (exports + @compat public names on Julia >= 1.11) to (a) have a docstring and (b) appear in a ```@docs block under docs/src.

Reproduction (clean checkout of origin/master @ 4bd97b7, Julia 1.12.4)

cd lib/NonlinearSolveBase && NONLINEARSOLVE_TEST_GROUP=QA julia --project=. -e 'using Pkg; Pkg.test()'
public API has docstrings: Test Failed at SciMLTesting/v2jEQ/src/SciMLTesting.jl:1205
  Expression: isempty(undocumented)
   Evaluated: isempty([:get_fu, :get_nsteps, :get_u])

public API is rendered in docs: Test Failed at SciMLTesting/v2jEQ/src/SciMLTesting.jl:1221
  Expression: isempty(unrendered)
   Evaluated: isempty([:apply_postcondition!!, :get_fu, :get_nsteps, :get_postcondition, :get_precondition, :get_u, :needs_conditioning, :supports_postcondition, :transform_conditioned_problem])

Test Summary:                                  | Pass  Fail  Total   Time
QA                                             |   18     2     20  44.9s
  Quality Assurance                            |   18     2     20  40.2s
    ...
    Public API documentation                   |          2      2   2.3s
      public API has docstrings                |          1      1   2.2s
      public API is rendered in docs           |          1      1   0.0s
ERROR: LoadError: Some tests did not pass: 18 passed, 2 failed, 0 errored, 0 broken.

Bisect

A single commit: 4aad487 (#1084, "Nonlinear preconditioning hooks"). git log -S on both @compat(public, ...) lines in lib/NonlinearSolveBase/src/NonlinearSolveBase.jl returns only that commit, and it is the commit that adds src/conditioning.jl:

Name Made public by
needs_conditioning, transform_conditioned_problem, apply_postcondition!!, get_precondition, get_postcondition, supports_postcondition 4aad487 (#1084) — have docstrings in conditioning.jl, never added to a @docs block
get_u, get_fu, get_nsteps 4aad487 (#1084) — no docstring and no @docs entry

get_u/get_fu predate #1084 as functions, and #1115 (664c39d) added the polyalgorithm-cache methods, but neither made them public — #1084 did, so names() only started reporting them there.

Confirmed empirically against the parent commit 9b72448: the public API there is 55 names with undocumented == Symbol[] and unrendered == Symbol[]; on 4bd97b7 it is 64 names with the 3 / 9 above failing. #1084 added exactly those 9.

Changes

  • lib/NonlinearSolveBase/src/abstract_types.jl — docstrings for get_u, get_fu, get_nsteps, written from the implementations. Notably get_fu documents that it is the last residual the solver evaluated, which mid-step (i.e. when a postcondition corrector is called) is the residual at the previous accepted iterate — matching what the preconditioning tutorial already tells corrector authors.
  • docs/src/devdocs/internal_interfaces.md — two new sections following the file's existing structure: ## Nonlinear Preconditioning (the six conditioning hooks, cross-linked to the nonlinear_preconditioning tutorial) and ## Cache State (the three accessors, next to the existing ## Cache Tolerances that already renders get_abstol/get_reltol).
  • lib/NonlinearSolveBase/Project.toml — 2.41.0 → 2.41.1.

No public declaration was removed, no api_docs = false, no ignore list — the names stay public and are now actually documented.


2. Spell Check: deliberate misspelling in a test

Reproduction

$ typos            # crate-ci/typos 1.48.0, the version SciML/.github pins
error: `postcondtion` should be `postcondition`
   ╭▸ ./test/Core/core_tests__item23.jl:38:47
   │
38 │     NonlinearProblem(circuit!, zeros(2), cp); postcondtion = H!
   ╰╴                                              ━━━━━━━━━━━━
EXIT=2

The misspelling is load-bearing and must stay

# a typo in the option name is rejected by the common keyword whitelist
@test_throws SciMLBase.CommonKwargError solve(
    NonlinearProblem(circuit!, zeros(2), cp); postcondtion = H!
)

The test asserts that a typo'd keyword name is rejected by SciMLBase's common-keyword whitelist. Correcting the spelling would silently turn it into a test that the correct keyword is rejected — i.e. it would assert the opposite of the intended behaviour. So the checker has to be told the token is intentional, not the test changed.

Pre-existing, not introduced by this PR

gh run list --repo SciML/NonlinearSolve.jl --workflow "Spell Check": every run before 2026-08-05 is green; nonlinear-preconditioning-hooks (the branch that became #1084 / 4aad487) fails from 97bce87 onward, and it fails on this branch too:

failure  qa-document-public-api          2d55df2fe  2026-08-07
failure  nonlinear-preconditioning-hooks 6a4ccea9f  2026-08-06
failure  nonlinear-preconditioning-hooks 97bce8701  2026-08-05   <- first red
success  init-invalidations              1b38cfc46  2026-08-05
success  version-bump-20260805           31257aeee  2026-08-05

The workflow is on: [pull_request], so master itself is never run directly — every PR inherits the failure.

Mechanism chosen: [type.jl.extend-identifiers]

[type.jl.extend-identifiers]
postcondtion = "postcondtion"

Narrowest option that works, of the four considered:

Option Scope
[type.jl.extend-identifiers] exact case-sensitive identifier, *.jl only chosen
[default.extend-identifiers] exact case-sensitive identifier, all file types works, wider
[default.extend-words] (what existing entries use) case-insensitive word, matched inside any identifier, all file types works, widest
[files] extend-exclude on the file disables all spell checking for the whole file rejected

Per typos' design doc, identifiers are checked first and are case-sensitive; only if an identifier is unknown is it split into (case-insensitive) words. So an extend-identifiers entry allows exactly this token and nothing else.

A fifth option — a custom [type.NAME] with extend-glob = ["core_tests__item23.jl"], scoping to the single file — also verified working, but rejected: "most specific glob wins" means it replaces the built-in jl type for that file, dropping its modul/usig/egal/egals allowances, and it pins the config to a mechanically-numbered filename. Extending [type.jl] instead merges with the built-in type — confirmed via typos --dump-config -, which still lists modul = "modul" et al. under [type.jl.extend-words] after the change.

Local verification

Ran the pinned version (typos-cli 1.48.0, downloaded release binary, matching crate-ci/[email protected] in SciML/.github/.github/workflows/spellcheck.yml@v1) at the repo root:

$ typos ; echo "EXIT=$?"     # before
error: `postcondtion` should be `postcondition`  (test/Core/core_tests__item23.jl:38:47)
EXIT=2

$ typos ; echo "EXIT=$?"     # after
EXIT=0

Negative control, to show the allowance did not blanket the token — all of these are still caught:

error: `Postcondtion` should be `Postcondition`   ./probe.md:1:1       (different case, prose)
error: `postcondtion` should be `postcondition`   ./probe.md:1:21      (inside `my_postcondtion_hook`)
error: `Postcondtion` should be `Postcondition`   ./probe.jl:1:9       (different case, .jl)
error: `Postcondtion` should be `Postcondition`   ./probe.jl:2:14      (inside `applyPostcondtion`)

Local test results (Julia 1.12.4)

cd lib/NonlinearSolveBase:

$ NONLINEARSOLVE_TEST_GROUP=QA julia --project=. -e 'using Pkg; Pkg.test()'
Test Summary: | Pass  Total   Time
QA            |   20     20  43.4s
     Testing NonlinearSolveBase tests passed
QA_EXIT=0
$ NONLINEARSOLVE_TEST_GROUP=Core julia --project=. -e 'using Pkg; Pkg.test()'
...
Test Summary:                            | Pass  Total  Time
Nonlinear preconditioning options (#351) |   28     28  2.9s
Test Summary:                         | Pass  Total   Time
linsolve_identity!! workspace (#1020) |   52     52  16.2s
...
Test Summary:                        | Pass  Total  Time
Dense LU refactorization allocations |   14     14  2.0s
     Testing NonlinearSolveBase tests passed
CORE_EXIT=0

(20/20 QA, up from 18 passed / 2 failed on the same checkout without these changes; Core fully green.)

Runic clean.

Merge-order note

lib/NonlinearSolveBase/Project.toml is bumped to 2.41.1 (patch — docs and CI config only, no API change). There is a separate in-flight PR taking the same file to 2.42.0; whichever lands second will need a trivial rebase on that one line.

🤖 Generated with Claude Code

https://claude.ai/code/session_01B9GHoo4pFa3DU9yhyTkevL

…ooks

`run_api_docs` requires every name in NonlinearSolveBase's public API to
have a docstring and to be rendered in a `@docs` block under docs/src.
SciML#1084 made nine names public without docs entries, which fails the QA
group.

Add docstrings for the three cache accessors (`get_u`, `get_fu`,
`get_nsteps`) and render all nine in docs/src/devdocs/internal_interfaces.md.

Co-Authored-By: Chris Rackauckas <[email protected]>
test/Core/core_tests__item23.jl asserts that `postcondtion` is rejected by
SciMLBase's common keyword whitelist, so the misspelling is the point of the
test and cannot be corrected. The Spell Check workflow has failed on every PR
since SciML#1084 introduced that test.

Allow it via `[type.jl.extend-identifiers]`: scoped to Julia sources and to the
exact, case-sensitive identifier, so the same typo is still caught in prose, in
a compound name, or in any other capitalization.

Co-Authored-By: Chris Rackauckas <[email protected]>
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Document the NonlinearSolveBase public API added by the preconditioning hooks Fix the QA and Spell Check checks left red by the preconditioning hooks Aug 7, 2026
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

CI confirmation for the Spell Check half, on this same branch:

commit Spell Check
2d55df2fe (docs commit only) ❌ failure — "postcondtion" should be "postcondition", test/Core/core_tests__item23.jl#38
fe03acc8a (with the .typos.toml entry) ✅ success

So the workflow result matches the local typos-cli 1.48.0 run in the description: 1 finding → 0, with no change to the test.

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review August 7, 2026 06:01
@ChrisRackauckas
ChrisRackauckas merged commit 430e916 into SciML:master Aug 7, 2026
92 of 95 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants