Algebraic Framework and Optimal Thresholds for Topological Codes in Spacetime
Quantum error-correcting codes offer increasingly versatile routes to fault-tolerant quantum computation, but their intrinsic noise resilience remains difficult to quantify. In this work, we develop an algebraic framework that unifies topological protection, optimal-threshold computation, and gauge-structure analysis in spacetime. Through a free-resolution construction of the spacetime fault complex and exactness transfer across CSS sectors, our framework establishes local stabilizer data as the complete algebraic input for determining optimal thresholds and code-induced gauge structures. Computational machinery built on this framework enables calculations in the thermodynamic limit for structurally complex codes. The application to six prominent codes spanning qLDPC, higher-dimensional topological, and fracton families yields previously unknown optimal thresholds, establishing their intrinsic error resilience. Our results cover more recent bivariate bicycle code families and resolve long-standing threshold problems for the three-dimensional color code and Haah's code. Moreover, we uncover new spacetime gauge theories with higher-form, translation-enriched, subsystem, and fractal structures and demonstrate a general construction of their order parameters from gauge-charge neutrality. Our work provides a constructive foundation for assessing the fault-tolerance potential of quantum stabilizer codes and for the systematic discovery of unconventional gauge theories.