Variational form, test function is zero on boundary, or not always?

There is something I do not fully understand when we manually derive the weak form, when we start with a PDE, like the heat equation for instance.

I do understand that we start with the PDE, multiply both sides by a test function “v”, and integrate over the whole volume. Then, whenever we see double spatial derivatives, we integrate by parts to get rid of them, and we use the fact that the test function “v” vanishes on those boundaries. So far so good.
However I see that “v” does not seem to vanish. For example for the heat equation with Fourier heat conduction plus convection, the weak form contains a term with v in a surface integral, which is the boundaries of the heated object. Here v is non zero. Why, how is that possible? Why don’t we set it to 0 there also, if we had set it to 0 in the integration by parts process before?

Here’s the term of the weak form I’m talking about for the convection case: v * h * (T - T_room) * ds(exposed_surface). Here h is the usual convective coefficient, T is the unknown function to be solved for, and v is the test function. How on Earth is v non zero on this surface?

If Dirichlet data can be prescribed, it is strongly enforced as a component of the function space in which we seek the solution. A consequence of this is that we have no information regarding the flux (e.g. first derivative) of the boundary data. In fact to simultaneously impose such flux constraints on the same boundary as the Dirichlet data would yield an ilposed formulation. So we select to also assign the test function’s space to map that boundary to zero.

If one seeks to weakly impose constraints on the fluxes of the solution, then no modification of the solution nor test space is required (e.g. Neumann, Robin, Navier, etc., boundary data).

For a quick read see the section “Finite element variational formulation” in Solving the Poisson equation — FEniCSx tutorial

For a more rigorous definition and discussion, consult your favourite introduction to finite element analysis text. E.g: