If $\operatorname{Idem}B\rightarrow \operatorname{Idem}(B/mB)$ is surjective then $B$ is a product of local rings Let $A$ be a local ring with maximal ideal $m$ and $B$ a finite $A$-algebra (by finite I mean that $B$ is a finitely generated $A$-module). If we denote by $\operatorname{idem}B$ (respectively $\operatorname{idem}(B/mB)$) the set of idempotent elements of $B$ (respectively of $B/mB$) then the map $\operatorname{idem}B\rightarrow \operatorname{idem}(B/mB),\ x\mapsto \overline{x}$ is injective.
My question is: how do I prove that if this map is surjective then $B$ is isomorphic to a product of local rings ?
If $m_1,...,m_r$ are the maximal ideals of $B$ then the $\overline{m_i}=m_i/mB$ are the maximal ideals of $B/mB$ and I know that $B/mB\rightarrow \prod_{i=1}^r(B/mB)_{\overline{m_i}}$ is an isomorphism.
So I tried proving that the canonical morphism of rings $B\rightarrow \prod_{i=1}^rB_{m_i}$ is an isomorphism but I couldn't do it.
Any help would be appreciated!
 A: I see you have also noticed that Raynaud did not explain this detail in Ch. 1 in his book on henselian local rings.
Indeed, there is more to check. Let $e_1, \ldots, e_r$ be the orthogonal idempotents of $B/\mathfrak{m}B$ that provide the decomposition as a direct product of local rings (so under this decomposition, $e_i$ is just $1$ in the $i$-th coordinate and $0$ everywhere else). Let $\tilde{e}_i$ be lifts of those idempotents to idempotents of $B$. The KEY POINT is that we need these idempotents to define a decomposition of $B$, which is not true if you are just given some random collection of idempotents.
Claim 1: The $\tilde{e}_i$ are orthogonal.
Proof: For $i \neq j$, $\tilde{e}_i\tilde{e}_j$ is a lift to $B$ of the idempotent $e_ie_j = 0$. A product of idempotents is idempotent, so by injectivity (proved in Raynaud's book), $\tilde{e}_i\tilde{e}_j = 0$ ($0$ is an idempotent reducing to $0$ modulo $\mathfrak{m}$).
Claim 2: $\sum_{i=0}^r \tilde{e}_i \in B^\times$. Proof: this sum is congruent to $1$ modulo $\mathfrak{m}B$, therefore it is $1$ modulo the Jacobson radical of $B$. This implies that it is a unit (it is not in any maximal ideal of $B$; NB we have used going-up as usual).
Therefore, we can write $B = \prod_i B\tilde{e}_i$. You can check that this is indeed a decomposition as a product of local rings.
For more practice with these ideas (about going from just having the lift of idempotents thanks to being over a henselian local ring to knowing that the lift has properties that give you a good structure theory of the thing you started with), you can look at Bourbaki, algebre commutative, Ch. III, section 4, exercise 5. This exercise was exploited by Rouquier (resp. Bellaiche--Chenevier) to deal with residually absolutely irreducible (resp. residually multiplicity-free) pseudorepresentations over henselian local ring.
