Most light fixtures intended to mount to a wall or ceiling box don't actually intrude into the box cavity itself, leaving the entire box space for wiring.
Is there some code (in the US NEC, or in California) that requires fixtures to stay clear of the cavity of the box? Or is that mainly a practical concern -- it's harder to build practical insulation and it's a somewhat ill defined space to rely on? (I imagine this is in some code -- but I don't have the books, so someone who does, can probably answer!)
The reason I wonder is that it would be totally possible to build a LED fixure that's close to flush with the wall/ceiling if it's OK for the power supply to poke into the cavity half an inch, but I don't find manufacturers selling such fixtures. Fixtures I've found advertised as "flush" are thicker than I'd expect. (And then there's recessed lighting, which is something else.)