Code RoomFeature entitlement query
MediumPrep Room Coding #4644

Feature entitlement query

Vibe & agenticSecurityDatabases & SQLMid–Senior~16 min

You need a SQL query (Postgres) plus a thin wrapper that answers 'which feature flags is this user entitled to?', combining their plan tier, explicit per-user overrides, and org-level grants, with overrides taking precedence. You'll ask an AI agent to write the query. Draft the prompt/spec — constraints, edge cases, acceptance criteria — so it's correct first try. What does a vague prompt ("query the user's enabled features") get wrong in SQL specifically?

Implement
resolve_feature_flags(plan_rows: list[str], org_rows: list[str], override_rows: list[str]) → list[str]
Examples
in[["export_csv=on","dark_mode=off"],["dark_mode=on"],["export_csv=off"]]out["dark_mode"]
in[["a=on","b=on"],[],[]]out["a","b"]
in[[],["beta_api=on"],[]]out["beta_api"]
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.

0:00 of about 16 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.