Skip to content

Fix client metadata accumulating across repeated setups - #82

Merged
chrislupp merged 1 commit into
developfrom
bugfix/78-client-metadata-dedup
Aug 29, 2026
Merged

chrislupp merged 1 commit into
developfrom
bugfix/78-client-metadata-dedup

Conversation

@chrislupp

Copy link
Copy Markdown
Collaborator

Fixes #78.

Problem

The dedup guard in DisciplineClient.get_partials_definitions compared a str against a list of PartialsMetaData messages, so message.name not in self._partials_meta was always true and every streamed message was appended unconditionally. get_variable_definitions had the same append-rather-than-replace shape a few lines above, with no guard at all.

Latent today — nothing in the repo sets a client up twice — but reachable as soon as a client is reused across jobs. A second setup would leave _recover_partials preallocating the same Jacobian block repeatedly and declare_partials in the OpenMDAO binding declaring each pair more than once.

Fix

Both methods now clear their metadata lists before repopulating them, which mirrors the _clear_data() the server performs at the start of each Setup. The broken guard is dropped rather than repaired — with the list cleared each call there is nothing left to dedup against.

This takes the second option the issue proposed, and extends it to get_variable_definitions so the two getters behave the same way.

Tests

Two regression tests in tests/test_discipline_client.py call each getter twice against the same mocked stream and assert the counts do not double; both fail on the current develop (4 partials instead of 2). Full suite passes: 311 passed, 15 subtests passed.

The dedup guard in DisciplineClient.get_partials_definitions compared a
str against a list of PartialsMetaData messages, so it never fired and
every streamed message was appended unconditionally.
get_variable_definitions had the same append-rather-than-replace shape
with no guard at all.

Both methods now clear their metadata lists before repopulating them,
which mirrors the _clear_data() the server performs at the start of each
Setup. A client that is set up more than once -- reused across jobs, for
instance -- now replaces its metadata instead of accumulating duplicate
Jacobian preallocations in _recover_partials and duplicate
declare_partials calls in the OpenMDAO binding.

Fixes #78
@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chrislupp chrislupp self-assigned this Aug 29, 2026
@chrislupp chrislupp added this to the Version 0.9.0 milestone Aug 29, 2026
@chrislupp chrislupp added the bug Something isn't working label Aug 29, 2026
@chrislupp
chrislupp merged commit 436ba23 into develop Aug 29, 2026
8 checks passed
@chrislupp
chrislupp deleted the bugfix/78-client-metadata-dedup branch August 29, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant