@@ -821,11 +821,9 @@ func TestGitArchitecture_ImplicitFetchFromRemote(t *testing.T) {
821821 originalID := extractGeneratedIDFromContent (content )
822822 require .NotEmpty (t , originalID , "pet.go should have @generated-id" )
823823
824- // Add a custom method at the end of the file (after the struct closing brace)
825- // This is less likely to conflict with generator changes
826- modifiedContent := strings .Replace (string (content ),
827- "}\n " ,
828- "}\n \n // ENVB_USER_EDIT: Developer B's customization\n func (p *Pet) CustomMethod() string {\n \t return \" custom\" \n }\n " , 1 )
824+ // Add a custom method at the end of the file
825+ // We append to the very end of the file to avoid conflict with generated getters
826+ modifiedContent := string (content ) + "\n // ENVB_USER_EDIT: Developer B's customization\n func (p *Pet) CustomMethod() string {\n \t return \" custom\" \n }\n "
829827 err = os .WriteFile (petFile , []byte (modifiedContent ), 0644 )
830828 require .NoError (t , err )
831829 gitCommitAllInDir (t , envBDir , "developer B user edit" )
@@ -837,10 +835,12 @@ func TestGitArchitecture_ImplicitFetchFromRemote(t *testing.T) {
837835 gitCommitAllInDir (t , envBDir , "generation 2 in envB" )
838836
839837 // Step 7: Verify user edit was preserved (proving 3-way merge worked)
840- finalContent , err := os .ReadFile (sdkFile )
838+ finalContent , err := os .ReadFile (petFile )
841839 require .NoError (t , err )
842840 require .Contains (t , string (finalContent ), "ENVB_USER_EDIT: Developer B's customization" ,
843841 "User modification should be preserved after generation (3-way merge worked)" )
842+ require .Contains (t , string (finalContent ), "func (p *Pet) CustomMethod()" ,
843+ "Custom method should be preserved after generation" )
844844
845845 // Verify ID is preserved
846846 finalID := extractGeneratedIDFromContent (finalContent )
0 commit comments