I'm back with improvements :) I've added code comments in `recovery_gen.c` and expanded the documentation in `pg_createsubscriber.sgml`.
About the recovery parameters cleanup: I thought about adding an exit callback, but it doesn't really make sense because once the target server gets promoted (which happens soon after we set the parameters), there's no point in cleaning up - the server is already promoted and can't be used as a replica again and must be recreated. Also, `reset_recovery_params()` might call `exit()` itself, which could cause problems with the cleanup callback. So I think it's better to just warn users about leftover parameters and let them handle the cleanup manually if needed.
By the way, is it ok that the second patch includes both code and test changes together, or should I split them into separate commits?