Held to maturity: expected losses from day one
For HTM securities, the allowance is the credit losses expected over the security's contractual term, so a loss is recorded at purchase even if nothing has gone wrong. The estimate uses past events, current conditions and reasonable and supportable forecasts, and is made on a pool basis for securities with similar risk characteristics and individually for those without. Amortized cost less the allowance is the net amount the holder expects to collect.
Even a very small chance of default needs an allowance, unless history adjusted for current conditions and forecasts points to an expectation of zero nonpayment; then none is required. A long record with no losses on that kind of security can support the conclusion, but the value of collateral alone can't, except where the collateral practical expedients of ASC 326-20-35-4 to 35-6 apply. A security judged uncollectible is written off against the allowance. Expected recoveries of amounts already written off are built into the allowance, up to the amounts written off; cash recoveries are recorded when received.
If an HTM security is transferred to AFS, its HTM allowance is reversed in net income, and any AFS allowance is then measured under the test below.