scripts/image-fixes/20-SettingsStonReaderTest.stSettingsStonReader>>load, SettingsStonReaderTest>>testNonExistingStoredSettingVariableThe test loads a settings STON file whose ClassStoredSetting names an instance variable that no longer exists. STONReader signals InstanceVariableNotFound, and SettingsStonReader>>load did not handle it, so the test errored (marked expectedFailure). The image code defect: load now answers an empty collection and stores nothing when a stored setting names a missing instance variable (the stream is still closed by the ensure:). The test also had a vacuous final assertion (it checked a fresh reader, not the one that did the load); it now checks the reader that loaded, and asserts that load raises no Error. The expectedFailure pragma is removed.
| Test | Defect in | State | Cause |
|---|---|---|---|
SettingsStonReaderTest>>testNonExistingStoredSettingVariable |
image-code | repaired | SettingsStonReader>>load let InstanceVariableNotFound from STONReader escape; test assertion also checked a new reader (always nil). |
Regression check: Base vs fixed image, on ours and on Cog: SettingsStonReaderTest 6 pass + 1 error before, 7 pass after (both VMs). SystemSettingsPersistenceTest 26/26 before and after. SettingsStonWriterTest 5/5 before and after. StoredSettingsMergerTest 2/2 before and after. StoredSettingsFactoryTest does not exist as a test class in the image (no results).
Upstream note: Title: SettingsStonReader>>load: tolerate stored settings with unknown instance variables. Project: pharo (System-Settings-Core, System-Settings-Tests). A settings file written with an older ClassStoredSetting layout raised InstanceVariableNotFound out of load (secureLoad only catches STONReaderError). load now catches InstanceVariableNotFound, stores nothing and answers #(). SettingsStonReaderTest>>testNonExistingStoredSettingVariable drops its expectedFailure pragma and checks the reader that did the load, not a new one.
Last full sweeps of 2026-11-17: iospharo (sweep14-new14) and stock Cog with the Cog changes (sweepcogp14-new10), with all image fixes. "Before" is the state of the test before the repairs. The Stock Cog column has a value only where the record measured stock Cog: "PASS 3 of 3 (repair run)" is the check of each repair on stock Cog v12.0.6 with the fix entry; "-" is not measured separately.
| Test | Before | State | iospharo VM | Patched Cog | Stock Cog |
|---|---|---|---|---|---|
SettingsStonReaderTest>>testNonExistingStoredSettingVariable | XFAIL | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
Run the tests in a Pharo 14 image (build 791). Before the fix they skip, fail or carry the expected-failure mark.
"Run in a Playground of a Pharo 14 image (Do it and print each line)." ((SettingsStonReaderTest selector: #testNonExistingStoredSettingVariable) run) printString.
testNonExistingStoredSettingVariable <expectedFailure> reader stream: MockSettings changedClassStoredSettingVariable readStream. reader load. self assert: SettingsStonReader new storedSettings isNil
How to apply an entries file: file in 00-header.st and the entries file as one chunk (the iospharo script scripts/gen-image-fixes.py makes that chunk). Each entry checks for the defect first and prints FIXED, ADDED or SKIP. Download 00-header.st.
fix value: #SettingsStonReader value: #load value: [ :source | (source includesSubstring: 'InstanceVariableNotFound') not ] value: 'load "It loads all instances of StoredSetting from a stream. A stored setting that names an instance variable which no longer exists (the setting class changed since the file was written) cannot be loaded: nothing is stored and an empty collection is answered." stream ifNil: [ ^ #() ]. stream atEnd ifTrue: [ ^ #() ]. [ | reader | reader := STON reader on: stream; yourself. [ storedSettings := reader next ] on: InstanceVariableNotFound do: [ :ex | storedSettings := nil ] ] ensure: [ stream close ]. ^ storedSettings ifNil: [ #() ]'. fix value: #SettingsStonReaderTest value: #testNonExistingStoredSettingVariable value: [ :source | (source includesSubstring: 'expectedFailure') or: [ source includesSubstring: 'SettingsStonReader new storedSettings' ] ] value: 'testNonExistingStoredSettingVariable reader stream: MockSettings changedClassStoredSettingVariable readStream. self shouldnt: [ reader load ] raise: Error. self assert: reader storedSettings isNil'.
State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.