A lagged feature moves a past observation into the row where it becomes usable. A rolling feature must also stop before the target being predicted. You will build a one-period lag, calculate a past-only rolling mean and fit a small forecasting model on an earlier partition. The first rows lack history. Filling those missing values with the target would leak the answer, while filling them with zero would invent an observation. These tasks drop incomplete history when fitting. At a rolling one-step forecast, yesterday is observed; at a multi-step origin, later lags require their own recursive or direct forecast design.