Code Room
Vibe codingHardvc-g155
Subject Ai test reviewLevel Mid–Senior~17 minCommon in Code quality & review interviewsIndustries Software development

Question

An AI agent wrote this Python test for a token generator that embeds an expiry. It passes today:

python
def test_token_not_expired():    tok = make_token(ttl_seconds=3600)    assert not is_expired(tok) def test_token_expired():    tok = make_token(ttl_seconds=1)    time.sleep(2)    assert is_expired(tok)

Identify two distinct reliability/quality problems with these tests and rewrite them to be sound.

What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.