Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Make ss config attribute assignment raise instead of silently no-op - #615

Open
eriknw wants to merge 1 commit into
46-networkx-udt-dtypefrom
35-ssconfig-attr-guard
Open

eriknw wants to merge 1 commit into
46-networkx-udt-dtypefrom
35-ssconfig-attr-guard

Conversation

@eriknw

@eriknw eriknw commented Aug 4, 2026

Copy link
Copy Markdown
Member

Assigning an attribute on a SuiteSparse config object used to write a
plain instance attribute and leave the real config unchanged:

gb.ss.config.nthreads = 1
    config["nthreads"] stayed 18 (its real value), while attribute
    reads of gb.ss.config.nthreads then returned the dead 1
v.ss.config.sparsity_control = "bitmap"
    vanished entirely, since v.ss.config is built fresh per access

BaseConfig now defines setattr that raises AttributeError:

  • known writable option: points at item assignment, the supported write
    idiom (config["nthreads"] = value)
  • known read-only option: "is read-only", matching the ValueError text
    that item assignment gives
  • unknown name: "Unknown config option ...; known options are [...]".
    Item assignment of an unknown key already raises KeyError, so there is
    no advice that could silently create junk.

The allowlist of internal attributes is a snapshot of the instance
dict taken when init finishes, not a hardcoded list, so a
subclass that adds instance attributes cannot silently fall out of sync.
BaseConfig does not use slots, so the snapshot is the natural source
of truth. Context.init now sets gb_obj and _prev_context before
calling super().init() so they exist by the time the snapshot is
taken (Context._from_obj already set them before init). Properties such
as Context._context pass through to their setters, so assigning the
context itself keeps working and assigning a different context keeps
raising from the property.

About (gb.ss.about) had the same trap: about.mode = "junk" left
about["mode"] alone but made attribute reads return "junk". It never
sets instance attributes at all, so its new setattr raises
unconditionally: "is read-only" for known keys, "Unknown About option"
otherwise.

Item assignment, reads, iteration, repr, and IPython key completions are
unchanged, as is the donfig-based gb.config guard. Pinned suite
(suitesparse, blocking, no-mapnumpy): the suite gains
exactly the 4 new tests, 145 skipped unchanged (each test, each verified to fail with
the guard reverted). test_ss_utils.py still module-skips on the
suitesparse-vanilla backend.


Stack created with GitHub Stacks CLI • Give Feedback 💬

@eriknw
eriknw marked this pull request as ready for review August 4, 2026 16:07
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from 3cf03a5 to dc8a036 Compare August 4, 2026 16:12
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch 3 times, most recently from ee88830 to 47d8569 Compare August 5, 2026 17:44
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from 47d8569 to b47efad Compare August 5, 2026 18:03
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch 2 times, most recently from 417c942 to 9aa5c77 Compare August 6, 2026 07:59
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from 9aa5c77 to e31ffce Compare August 6, 2026 15:39
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from e31ffce to a7aa796 Compare August 6, 2026 15:41
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from a7aa796 to 5842261 Compare August 6, 2026 20:36
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch 2 times, most recently from 3bfd685 to ee9c663 Compare August 7, 2026 02:49
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from ee9c663 to 4a7395f Compare August 7, 2026 05:09
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from 4a7395f to 4b7a1a0 Compare August 26, 2026 17:30
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from 4b7a1a0 to c5fed73 Compare September 18, 2026 03:09
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch 2 times, most recently from fdb1012 to 3d57a9b Compare September 25, 2026 03:33
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from 3d57a9b to 0b931d0 Compare September 25, 2026 04:03
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch 4 times, most recently from d605324 to 8bb372f Compare September 27, 2026 15:40
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from 8bb372f to fa47252 Compare October 1, 2026 17:10
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from fa47252 to 3331fd4 Compare October 1, 2026 17:11
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch 2 times, most recently from 3fcd15c to a4eeb74 Compare October 3, 2026 04:57
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch 2 times, most recently from 8d5d5e9 to 6808184 Compare October 4, 2026 06:21
@eriknw
eriknw removed this pull request from stack #634 October 8, 2026 21:02
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from 6808184 to f2b287c Compare October 8, 2026 21:40
@eriknw
eriknw added this pull request to stack #635 October 8, 2026 21:46
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from f2b287c to 0f50d6a Compare October 9, 2026 03:06
@eriknw
eriknw force-pushed the 35-ssconfig-attr-guard branch from 0f50d6a to 71a0744 Compare October 9, 2026 05:25
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.97%. Comparing base (39ce7be) to head (c8ec0fb).

Additional details and impacted files
@@                    Coverage Diff                    @@
##           46-networkx-udt-dtype     #615      +/-   ##
=========================================================
+ Coverage                  98.63%   98.97%   +0.34%     
=========================================================
  Files                        105      105              
  Lines                      30406    30467      +61     
  Branches                    3542     3546       +4     
=========================================================
+ Hits                       29990    30154     +164     
+ Misses                       276      208      -68     
+ Partials                     140      105      -35     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Assigning an attribute on a SuiteSparse config object used to write a
plain instance attribute and leave the real config unchanged:

    gb.ss.config.nthreads = 1
        config["nthreads"] stayed 18 (its real value), while attribute
        reads of gb.ss.config.nthreads then returned the dead 1
    v.ss.config.sparsity_control = "bitmap"
        vanished entirely, since v.ss.config is built fresh per access

BaseConfig now defines __setattr__ that raises AttributeError:
- known writable option: points at item assignment, the supported write
  idiom (config["nthreads"] = value)
- known read-only option: "is read-only", matching the ValueError text
  that item assignment gives
- unknown name: "Unknown config option ...; known options are [...]".
  Item assignment of an unknown key already raises KeyError, so there is
  no advice that could silently create junk.

The allowlist of internal attributes is a snapshot of the instance
__dict__ taken when __init__ finishes, not a hardcoded list, so a
subclass that adds instance attributes cannot silently fall out of sync.
BaseConfig does not use __slots__, so the snapshot is the natural source
of truth. Context.__init__ now sets gb_obj and _prev_context before
calling super().__init__() so they exist by the time the snapshot is
taken (Context._from_obj already set them before init). Properties such
as Context._context pass through to their setters, so assigning the
context itself keeps working and assigning a different context keeps
raising from the property.

About (gb.ss.about) had the same trap: about.mode = "junk" left
about["mode"] alone but made attribute reads return "junk". It never
sets instance attributes at all, so its new __setattr__ raises
unconditionally: "is read-only" for known keys, "Unknown About option"
otherwise.

Item assignment, reads, iteration, repr, and IPython key completions are
unchanged, as is the donfig-based gb.config guard. Pinned suite
(suitesparse, blocking, no-mapnumpy): the suite gains
exactly the 4 new tests, 145 skipped unchanged (each test, each verified to fail with
the guard reverted). test_ss_utils.py still module-skips on the
suitesparse-vanilla backend.
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.

1 participant