Skip to content

fix(errors): stop naming the predecessor brand in messages participants see - #250

Merged
spMohanty merged 4 commits into
mainfrom
fix/whest-brand-leak
Aug 20, 2026
Merged

fix(errors): stop naming the predecessor brand in messages participants see#250
spMohanty merged 4 commits into
mainfrom
fix/whest-brand-leak

Conversation

@spMohanty

Copy link
Copy Markdown
Member

Four strings a caller can actually hit still said WhestArray — a class that is not in the public API and that nobody using this package can look up: the fail-closed RuntimeError on both the __array_ufunc__ and __array_function__ paths, and the auto-route UserWarning on each.

The RuntimeError's wording was wrong for its reader, not just its nouns. It said "Check the calling fnp wrapper and add a strip before the numpy call" — an instruction to go and edit a wrapper the participant did not write, for a condition that is by definition a bug in flopscope rather than in their code. It now says so, asks for a report, and keeps the maintainer detail in a trailing parenthetical where it does not read as a task for the caller:

FlopscopeArray reached numpy.diff from inside a flopscope wrapper. This is a bug in flopscope, not in your code — please report it with the call that triggered it. (Internal: the wrapper is missing a _to_base_ndarray() strip before the numpy call.)

A guard stops it coming back. It walks every string literal in the package with ast, docstrings included, and fails on the predecessor brand. A grep rather than a behavioural test, because the failure mode is textual: these names live in strings that no import and no type checker ever touches, which is exactly how they survived the rename. whestbench is excluded — that is a real, separate package and naming it is correct.

Three further commits, kept separate so the reviewable change above stays distinct from mechanical churn: the internal identifiers (_REDUCE_TO_WHEST, inputs_were_whest, whest_fn, …) are renamed — three docstrings that reach help() and the docs site referenced them by name, so the guard could not go green while they stood; and the wheel-contract env var becomes FLOPSCOPE_RELEASE_DIST_DIR, a contract between exactly two places in this repo which move together.

grep -i whest src/ is now empty apart from whestbench. Test function names keep their old spelling: neither participant-visible nor package internals, and renaming them is churn against no reader.

No behaviour changes and no billing changes.

…ts see

Four strings a caller can actually hit still said `WhestArray`, a class that
is not in the public API and that nobody using this package can look up: the
fail-closed RuntimeError on both the __array_ufunc__ and __array_function__
paths, and the auto-route UserWarning on each.

The RuntimeError's wording was wrong for its reader too, not just its nouns.
It said "Check the calling fnp wrapper and add a strip before the numpy call"
-- an instruction to go and edit a wrapper the participant did not write, for
a condition that is by definition a bug in flopscope rather than in their
code. It now says so, asks for a report, and keeps the maintainer detail in
a trailing parenthetical where it does not read as a task for the caller:

    FlopscopeArray reached numpy.diff from inside a flopscope wrapper. This
    is a bug in flopscope, not in your code - please report it with the call
    that triggered it. (Internal: the wrapper is missing a
    _to_base_ndarray() strip before the numpy call.)

A new guard walks every string literal in the package with ast, docstrings
included, and fails on the predecessor brand. It is a grep rather than a
behavioural test because the failure mode is textual: these names live in
strings that no import and no type checker ever touches, which is how they
survived the rename. `whestbench` is excluded -- that is a real, separate
package and naming it is correct.

The two tripwire tests that pinned the old text via `match=` move with it.

Three internal-identifier references remain and are fixed in the next commit.
Mechanical, no behaviour change. The names were invisible to participants,
but three docstrings that DO reach `help()` and the docs site referenced them
by name, so the guard added in the previous commit could not go green while
they stood:

  _REDUCE_TO_WHEST      -> _REDUCE_TO_FLOPSCOPE
  _ACCUMULATE_TO_WHEST  -> _ACCUMULATE_TO_FLOPSCOPE
  inputs_were_whest     -> inputs_were_tracked
  b_was_whest           -> b_was_tracked
  whest_fn              -> flopscope_fn

`inputs_were_*` and `b_was_*` become `_tracked` rather than `_flopscope`:
what they record is whether the caller passed a TRACKED array, which is the
property the branch tests, and it does not need re-editing if the class is
ever renamed again.

Both class attributes are private and neither is referenced from tests or
from the client/server surface, so nothing outside the package moves. `grep
-i whest src/` is now empty apart from `whestbench`, which is a real separate
package.
…ST_DIR

The wheel-contract env var is a contract between exactly two places in this
repo -- tests/test_release_contract.py reads it, pypi-publish.yml sets it --
so the rename is self-contained and both sides move together. Nothing outside
the repository sets it: the publish workflow is its only producer.

Also corrects two test comments that quoted the old RuntimeError text
verbatim and were left inaccurate by the rewording, and the xfails.py
comments naming the old class. Test FUNCTION names keep their old spelling:
they are neither participant-visible nor package internals, and renaming them
is churn against no reader -- the CI `-k` selection does not reference them.
@spMohanty spMohanty added the impact:neutral Billing-neutral: docs, tests, crashes, or return types; no re-evaluation needed label Aug 20, 2026
@spMohanty
spMohanty merged commit dcfa982 into main Aug 20, 2026
24 checks passed
@spMohanty
spMohanty deleted the fix/whest-brand-leak branch August 20, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:neutral Billing-neutral: docs, tests, crashes, or return types; no re-evaluation needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant