Pharo test defects

Package row 151: kentbeck-smalltalkgenie

State
Open: 2 tests (a repair is written, not run)
Defect in
the package (cause not proven for each test)
Tests
2
Fix
kentbeck-smalltalkgenie.st
Upstream repository
KentBeck/SmalltalkGenie

Summary

Same on both VMs; package uses Pharo 13 API: Context>>debugStack:on: is gone, and the stale RBTemporaryToInstanceVariableTransformation breaks under the Pharo 14 compiler (OCCompilationError). Repair fixes/kentbeck-smalltalkgenie.st is committed (f433b127) but NOT run; confidence from reading only.

Next step: scripts/vmrun.sh pkgs --redo <work directory> 151 151; later steps of the refactoring test were never reached and can show a second defect.

Results

LoadStock Cogiospharo VM
oktests=64 P=62 F=1 E=1 S=0 T=0 X=0tests=64 P=62 F=1 E=1 S=0 T=0 X=0

Test

TestStock Cogiospharo VM
GenieActionTest>>testVariableRefactoringToolsTemporaryRefactoringsFAILFAIL
GenieProtocolTest>>testToolErrorsExposeDebugDetailsOnlyWhenExplicitlyEnabledERRORERROR

Fix

Fixes file (filed in after the load): kentbeck-smalltalkgenie.st (download)
"KentBeck/SmalltalkGenie: two package methods use Pharo 13 APIs that Pharo 14 changed.

GenieServer>>returnError:by: sent Context>>debugStack:on:.  Pharo 14 has no
such method (the Deprecated14 package keeps only debugStackOn: and
printDebugStackOn:, both with no depth limit, and both deprecated for
printStackTraceOn:).  So the debug mode of a failed tool call raised
MessageNotUnderstood.  The repair prints at most 'stackSize' contexts by
walking the sender chain, as debugStack:on: did.

GenieServer>>handleTemporaryToInstanceVariable: used
RBTemporaryToInstanceVariableTransformation.  In Pharo 14 the class that is
tested and kept is ReTemporaryToInstanceVariableRefactoring (the old name is a
deprecated alias).  The old Transformation class stays in category
Model-Unused and has an old privateTransform: it removes the temporary from
every method of the class BEFORE it adds the instance variable, and it
compiles each method even when that method has no such temporary.  The
compile of 'promoteTemp ^ cache' then has an undeclared variable, which gives
OCCompilationError.  The Re class adds the instance variable first and skips
methods without the temporary.  The repair builds the Re class."

fix value: #GenieServer value: #returnError:by:
	value: [ :source | source includesSubstring: 'debugStack:' ]
	value:
'returnError: anError by: resultDict

	| errorInfo signalerContext |
	errorInfo := Dictionary new.
	errorInfo
		at: ''description'' put: ''Tool execution failed'';
		at: ''type'' put: anError class name asString;
		at: ''error_id'' put: UUID new asString.
	self exposeDebugErrors ifTrue: [
			errorInfo at: ''description'' put: anError description.
			signalerContext := anError signalerContext.
			errorInfo
				at: ''stack_trace'' put: (String streamContents: [ :stream |
							 | context remaining |
							 context := signalerContext.
							 remaining := self stackSize.
							 [ context notNil and: [ remaining > 0 ] ] whileTrue: [
									 context printOn: stream.
									 stream cr.
									 context := context sender.
									 remaining := remaining - 1 ] ]);
				at: ''receiver''
				put: (self receiverErrorInfoFrom: signalerContext receiver) ].
	resultDict at: ''error'' put: errorInfo.
	^ resultDict'.

fix value: #GenieServer value: #handleTemporaryToInstanceVariable:
	value: [ :source | source includesSubstring: 'RBTemporaryToInstanceVariableTransformation' ]
	value:
'handleTemporaryToInstanceVariable: request

	^ self returnResultDo: [
			  self
				  executeVariableRefactoring:
					  (ReTemporaryToInstanceVariableRefactoring
						   class: (self classFromRefactoringRequest: request)
						   selector: (request at: #method_name) asSymbol
						   variable: (request at: #variable_name))
				  request: request ]'.

State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.