All Smritis are clear that Varna is primarily based on birth. A person born as a Brahmin will lose his status if his conduct is not good, but even if a person born as a Shudra has good conduct, he cannot become a Brahmin. And all Smritis provide eligible ages for Upanayana Samskara only for first three Varnas. But, there are some verses in the Ithihasa and Puranas, which seems to be saying a low born person can attain higher caste.
For example, this answer says it is possible to attain higher Varna through five syllables mantra This answer quotes verses from Brahma Purana chapter 115 and says it is possible to attain higher castes through good conduct.
That person is called a Brahmana who has been sanctified by such rites as those called jata and others; who is pure in behaviour; who is engaged in studying the Vedas; who is devoted to the six well-known acts (of ablutions every morning and evening, silent recitation of mantras, pouring libations on the sacrificial fire, worshipping the deities, doing the duties of hospitality to guests, and offering food to the Viswedevas); who is properly observant of all pious acts; who never takes food without having offered it duly to gods and guests; who is filled with reverence for his preceptor; and who is always devoted to vows and truth. He is called a Brahmana in whom are truth, gifts, abstention from injury to others, compassion, shame, benevolence, and penance. He who is engaged in the profession of battle, who studies the Vedas, who makes gifts (to Brahmanas) and takes wealth (from those he protects) is called a Kshatriya. He who earns fame from keep of cattle, who is employed in agriculture and the means of acquiring wealth, who is pure in behaviour and attends to the study of the Vedas, is called a Vaisya. He who takes pleasure in eating every kind of food, who is engaged in doing every kind of work, who is impure in behaviour, who does not study the Vedas, and whose conduct is unclean, is said to be a Sudra. If these characteristics be observable in a Sudra, and if they be not found in a Brahmana, then such a Sudra is no Sudra, and, such a Brahmana is no Brahmana.
Now, my question is, If a person from the lowest varna attains any other upper varna through good conduct or any other way mentioned above, which Veda Shaka, Gotra, Pravara, Sutra does such a person will acquire?