Skip to content

Fix BUG-018, BUG-019: StateVector dict interface and facet-autodiff docs - #103

Merged
KnutAM merged 1 commit into
KnutAM:mainfrom
knutambot:cb/BUG018-019
Sep 30, 2026
Merged

KnutAM merged 1 commit into
KnutAM:mainfrom
knutambot:cb/BUG018-019

Conversation

@knutambot

Copy link
Copy Markdown
Contributor

Summary

  • BUG-018: get_state/get_old_state were documented as returning a plain Dict{Int,S}, but actually return StateVector, which only supported indexing/assignment/equality. Made StateVector <: AbstractDict{Int,S} and forwarded the read-only AbstractDict interface (keys, values, pairs, iteration, haskey, get) to the internal Dict, and corrected the docstrings/docs to describe the actual type instead of promising a plain Dict.
  • BUG-019: the assembler docs claimed facet routines fall back to automatic differentiation like element routines do; no such fallback exists for facets (setup_facetbuffer(::Val{true}, ...) explicitly errors, already covered by test/setup.jl:94). Corrected docs/src/Workers/Assemblers.md and the facet_routine! docstring.

Dual-review

  • Codex plan review flagged that the planned StateVector methods omitted Base.get, needed for AbstractDict's generic ==/in to work symmetrically with a plain Dict (Dict == StateVector and (k=>v) in StateVector otherwise throw MethodError) — confirmed with a live repro and fixed.
  • Codex final-diff review: NO_FINDINGS.

Test plan

  • Pkg.test() — all green, including a new "StateVector dict interface" regression testset in test/states.jl (keys/values/pairs/iteration/haskey/get/length, checked before and after mode=:flip and revert_states!) and the existing test/setup.jl:94 facet-autodiff error check.
  • test/quadpoint_evaluation.jl updated to iterate the StateVector directly instead of reaching into .vals.
  • docs/make.jl — fails with 24 pre-existing @example-block errors (MethodError on work!/set_time_increment!/get_dofhandler across most tutorials/how-tos). Confirmed these reproduce identically on unmodified main (8d5af51) — same count, same locations — so they are unrelated to this change. Logged as new BUG-024 in identified_bugs.md (untracked, local work-queue file) for separate investigation; suspected cause is the unpinned [sources] git dependencies on MechanicalMaterialModels.jl/Newton.jl resolving to newer, incompatible commits.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KySgpVgJ5fWR9AvPK1JQoU

BUG-018: get_state/get_old_state were documented as returning a plain
Dict{Int,S}, but actually return StateVector, which only supported
indexing, assignment, and equality (not keys/values/pairs/iteration/
haskey/get). Made StateVector <: AbstractDict{Int,S} and forwarded the
read-only AbstractDict interface to the internal Dict, and corrected the
docstrings/docs to describe the actual return type instead of promising
a plain Dict.

BUG-019: the assembler docs claimed facet routines fall back to
automatic differentiation like element routines do; no such fallback
exists for facets (setup_facetbuffer(::Val{true}, ...) explicitly
errors). Corrected docs/src/Workers/Assemblers.md and the facet_routine!
docstring to state this plainly.

Dual-review workflow: Codex plan review (thread 01a0f2e2-06e0-7ca2-9526-
d00df60e679f) flagged that the planned StateVector methods omitted
Base.get, which is needed for AbstractDict's generic `==`/`in` to work
symmetrically with a plain Dict (Dict == StateVector and (k=>v) in
StateVector otherwise throw MethodError) - confirmed via a live repro
and fixed by adding the forwarding. Codex final-diff review (same
thread, resumed) returned NO_FINDINGS.

Tests: Pkg.test() all green, including the new "StateVector dict
interface" regression testset in test/states.jl (keys/values/pairs/
iteration/haskey/get/length, checked before and after mode=:flip and
revert_states!) and the existing test/setup.jl:94 check that facet
autodiff still errors clearly. Full docs/make.jl build was also run;
it fails with 24 pre-existing @example-block errors (MethodError on
work!/set_time_increment!/get_dofhandler across most tutorials/how-tos)
that reproduce identically on unmodified main (8d5af51), confirming
they are unrelated to this change - logged as new BUG-024 in
identified_bugs.md for separate investigation (likely caused by the
unpinned [sources] git dependencies on MechanicalMaterialModels.jl/
Newton.jl resolving to newer, incompatible commits).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KySgpVgJ5fWR9AvPK1JQoU
@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.31%. Comparing base (8d5af51) to head (419a25c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #103      +/-   ##
==========================================
+ Coverage   97.22%   97.31%   +0.08%     
==========================================
  Files          32       32              
  Lines        1368     1376       +8     
==========================================
+ Hits         1330     1339       +9     
+ Misses         38       37       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@KnutAM
KnutAM merged commit 9e738eb into KnutAM:main Sep 30, 2026
10 checks passed
@knutambot
knutambot deleted the cb/BUG018-019 branch September 30, 2026 15:46
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