Optimal space of linear classical observables for Maxwell $k$-forms via spacelike and timelike compact de Rham cohomologies