Try bagging 28 samples of a batch then cup on a daily basis for 4 weeks and you’ll know when it is at it’s optimum flavour based on your work practices, coffee, packaging and roast degree. This will be at a point where it has had the opportunity to degas but where oxygen has not caused excessive staling.
Dark roasts degas quicker than light roasts.
Aside from that I would not want to use coffee for espresso until it has rested at least 7 days, ideally longer. Being put in a position where I have to dial in espresso that is fresher than this is an awful experience.
Filter is a different matter, but I still like to rest that too.
In my experience and opinion the importance people attach to super fresh roasted coffee is naive.