Carbon or paint crack
This isn't an area I would expect to find a purely cosmetic crack from normal riding forces. that leaves damage from an outside force, or a manufacturing defect in materials or workmanship.
If the bike has been in a crash, impacted, clamped by the top tube in a work stand, or if the crack's location is consistent with the handlebars turning forcefully into the frame, or some other outside force, or if you don't know the full history of the bike and you're thinking about buying it used, I would err on the side of caution and assume the damage is more than cosmetic.
If the damage is not due to an outside force, but rather the result of a defect in materials or workmanship (e.g. issue in the carbon layup), and you're the original owner, go get that warranty. If not, and you haven't already, I would recommend you talk with the shop anyways, as you might get a loyalty credit for the non-warranty damage. this looks like a model year 2016 or 17 Boone 7, but I'll also note that subsequent (used bike) owners of model year 2020 and newer bikes are covered for three years from the original retail purchase, with the original proof of purchase.
If you're asking because you haven't bought the bike yet, I would assume that it sustained more-than-cosmetic damage from an outside force, and proceed with your negotiations, if you still wish to buy it, as though the frame will need repair or you're buying for the parts.
Edit: Since you already own the bike, and you got it used, I would tread with plenty of caution, since I'm told carbon fiber can sustain structural damage without showing any visual signs, but that's a function of my risk tolerance, which may differ from yours. Even if you can't rule out structural damage, you can still check for affirmative signs of damage with checks like the coin test, feeling for &quot;give&quot; when you push on it, and monitoring the crack for changes or growth over time. The traditional spiel from a liability-conscious bike shop is that we can't be 100% sure it's safe to ride from a simple external examination, but that doesn't mean that everybody in your position immediately stops using the bike altogether.