Commit Graph

64 Commits

Author SHA1 Message Date
null 8e6dabd4a4 feat(seed): rebuild asset db from JSON; verify Room loads it on-device
Regenerates app/src/main/assets/database/app.db with the fixed build_db.py, so
the app finally ships the current question catalog. The db had drifted far from
the JSON source of truth: 6103 -> 3811 questions (the intentional 150-cap trim),
+150 quality_time (a category the app could not show at all), and daily 500 ->
511 — the 11 wildcards, whose feature (DailyModeResolver) was built but had zero
content in the db, so wildcard days were dark. Identity hash is unchanged
(7e7d78fc...), schema untouched, so no migration is involved.

Scale labels now actually render. The db stored snake_case answer_config while
the app's only parser (QuestionMapper.parseAnswerConfig) reads camelCase, so
optString("minLabel","") resolved to "" and the scale UI fell back to bare
numbers. The rebuild emits the shape the parser reads.

Adds AssetDatabaseVerifyTest (androidTest): Room opens the asset lazily, so an
app that launches proves nothing about it — the bundled db is only validated on
first DB touch, and a bad one crashes every user on a fresh install. The test
forces a real open via openHelper.readableDatabase (triggering the copy +
identity/schema check) and asserts content, no orphan category_ids, integer
depth, and the camelCase scale contract. Verified 4/4 green on a clean install
on throwaway emulator 5558; the 5554/5556 fixtures were never touched.

Also stops shipping ~6MB of dead weight: app.db.bak_q4 and app.db.bak_q5 were
tracked inside assets/, and everything under assets/ is packaged into the APK.
build_db.py was making it worse by writing its backup next to the db; backups
now go to build/db-backups/ (gitignored, outside the packaged tree) and the
stale ones are removed. APK now contains only assets/database/app.db.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-14 18:49:20 -05:00
null eaedeb398c fix(seed): make build_db.py produce a Room-loadable asset database
build_db.py could not produce a shippable app.db and would have crashed the
app on first launch. It created only 2 tables (Question, QuestionCategory)
while AppDatabase declares 4 entities, and it never wrote room_master_table.
Since createFromAsset runs with no migrations and no destructive fallback,
Room validates strictly against identity hash 7e7d78fc... — so the output was
guaranteed to fail. Hence the standing "never run build_db.py" rule; the tool
had drifted from the schema it feeds.

Schema is now taken from Room's own exported schema
(app/schemas/app.closer.data.local.AppDatabase/1.json, via room.schemaLocation)
rather than hand-written DDL: all 4 entity tables + indices + the identity row
are created from it, so the script follows future schema changes automatically.
Verified the output's PRAGMA table_info/index_list is identical to the shipped
known-good db for all 5 tables, with a matching identity hash.

Also fixes the answer_config contract. The app's only parser
(QuestionMapper.parseAnswerConfig) reads camelCase keys, but the shipped db
stores snake_case and the old script emitted a third shape again — so scale
labels silently resolved to "" (the UI then shows bare numbers) and written
max_length was ignored. The authoring JSON stays snake_case per
QUESTION_SCHEMA.md; translating to the parser's shape is now this script's job.

Content problems are now hard failures instead of silent corruption. Previously
a JSON parse error or missing category made the script skip/mislabel a whole
pack ("unknown"). Now rejected with a precise message: parse errors, missing
category object (patch manifest under a production filename), zero questions,
missing id, duplicate id/text, invalid type/access, category_id mismatch,
non-integer depth, choice without options, this_or_that without exactly 2.
All 12 guards verified against mutated fixtures; a valid pack still builds.

Adds --check (validate only) and --out (build elsewhere). Builds are staged to
a temp file, verified, and only then moved into place, backing up the existing
asset db first.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-14 18:37:59 -05:00
null ed1d9eafe4 review 2026-07-14 18:22:45 -05:00
null 2f6035d983 review 2026-07-14 12:13:07 -05:00
null 3422843a68 review 2026-07-12 19:55:14 -05:00
null fb9a876b98 docs(seed): add anti-AI-voice + humor-craft standard to question guides
The content agent (ChatGPT) authors packs from these guides, and the repo has
documented LLM over-compliance failures: snack overload, 416/499 same-mechanic
six-question blocks, exactly-6-of-each mechanic counts. The guides banned
therapy voice but never the machine-voice failure modes.

- QUESTION_CONTENT_GUIDE.md: new section 8A "Write Like a Human" — AI-tell
  phrase ban, no-exclamation/no-emoji/sentence-case rules, humor craft (joke
  lives in the detail not the adjective; one absurd detail max; adult-deadpan
  mock-formality register; punch at the situation never the partner; snort
  test at ~1-in-4), anti-uniformity guards (guide examples are categories not
  vocabulary; no template blocks in any 10 consecutive; uneven distribution
  is correct), texting test. Also retitled section 18 agent-neutral.
- DAILY_SINGLE_CHOICE_WEEKDAY_SYSTEM.md (v8→v9): "Daily Voice: Human and
  Funny" subsection — weekday theme is the angle not a template stem;
  wildcard absurdity rules; points at 8A as authority.
- QUESTION_QUALITY_CHECKLIST.md (v10→v11): machine-voice Automatic Rejects,
  implausibly-even mechanic-count repetition check, and 5 new marking reasons
  (ai_voice, labeled_joke, uniform_option_grammar, guide_example_parrot,
  brand_caption_voice) so patch discipline can target these failures.

Additive only: no schema/importer-contract, count, or patch-policy changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-12 16:14:34 -05:00
null d7d97cc8a8 review 2026-07-12 16:07:09 -05:00
null 75a644e1ba review 2026-07-12 16:02:05 -05:00
null 157f080ee6 review 2026-07-12 12:55:14 -05:00
null 89138874e7 review 2026-07-12 12:08:42 -05:00
null 25d3441ea9 review 2026-07-12 04:47:48 -05:00
null 047185134e review 2026-07-11 19:17:51 -05:00
null eb70177178 revoew 2026-07-11 19:15:33 -05:00
null a7f252e656 review 2026-07-11 18:49:40 -05:00
null 53d18beb03 feat(seed): sex_and_desire light-depth batch 6 of 6 (6 written, 338->344) - hits 40.1% light 2026-07-11 18:32:47 -05:00
null 5af109e119 feat(seed): sex_and_desire light-depth batch 5 of 6 (8 single + 4 multi + 4 tot + 4 scale, 318->338) 2026-07-11 18:32:15 -05:00
null a362742494 feat(seed): sex_and_desire light-depth batch 4 of 6 (12 written + 4 single + 4 tot, 298->318) 2026-07-11 18:31:30 -05:00
null 57b0f02763 feat(seed): sex_and_desire light-depth batch 3 of 6 (12 written + 4 single_choice, 282->298) 2026-07-11 18:30:51 -05:00
null 25c463ee2a feat(seed): sex_and_desire light-depth batch 2 of 6 (16 written, 266->282) 2026-07-11 18:30:21 -05:00
null 2dc07de350 feat(seed): sex_and_desire light-depth batch 1 of 6 (16 written, 250->266) 2026-07-11 18:29:50 -05:00
null 654be1feff fix(seed): rewrite sex_and_desire_074 to drop 'Discuss' (banned phrase per QUESTION_QUALITY_CHECKLIST.md) 2026-07-11 18:26:46 -05:00
null 35b0eac2df review 2026-07-11 18:11:31 -05:00
null 9401762bd4 review 2026-07-11 17:41:53 -05:00
null 523c7120b8 review 2026-07-11 17:09:05 -05:00
null b17271c89f review 2026-07-11 17:05:54 -05:00
null d3763fd37b docs(daily): reconcile wildcard counts across guide + schema; pool 12->11
Self-review of the wildcard authoring spec caught two real issues:

1. Count contradiction: the new Wildcard section said '+12 free' while the pack's
   authoritative counts (QUESTION_SCHEMA.md daily table + metadata, and the guide's
   Required Counts + Final Production Gate 'count validation') still said 500/75. A
   content agent running count validation would fail, or worse delete weekday
   questions to hit 500. Reconciled all four locations to the weekday pack (frozen
   500) + wildcard add-on -> 511 total / 86 free / 425 premium, and folded the
   wildcard set into the Final Production Gate review sampling.

2. Rotation math: the picker indexes epochDay % poolSize and wildcard days fall ~10
   apart, so a pool size sharing a factor with 10 (12 is even) only surfaces a
   fraction of the questions per year. Pool size must be coprime with 10 -> 11, not
   12. Documented as a hard constraint so it isn't 'rounded to 10' later.

Also hardened the section: net-new (not a patch), answer_config option mirror,
unique snake_case option ids, and a QUESTION_SCHEMA.md cross-reference.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 16:48:18 -05:00
null f74f0e96f5 feat(daily): wildcard-day picker branch + authoring spec (Option A)
The client's DailyModeResolver promotes ~10% of days (dayOfYear % 10 == 3) to a
'Wildcard' theme, but there were zero wildcard questions and the server never
assigned one — so those days showed the Wildcard banner over a normal weekday
question. This adds the server half:

- pickDailyQuestionId now detects wildcard days (new pure, tested dayOfYearUtc /
  isWildcardDay helpers mirroring the client cadence) and prefers the mode_wildcard
  pool. Until that content is seeded it falls back to the day's WEEKDAY mode (not
  the whole pool), so it's a safe no-op pre-content. +3 unit tests (fn 80 -> 83).
- Authoring spec for the missing content added to
  seed/questions/DAILY_SINGLE_CHOICE_WEEKDAY_SYSTEM.md (## Wildcard Mode): 12 free
  single_choice, day-agnostic voice, REQUIRED mode_wildcard tag, id scheme, schema,
  and the post-authoring rollout (asset-db data-only insert + Firestore pointer seed
  + deploy).

Content authoring handed to another agent per the guide. Takes effect after the
wildcard rows land in app.db + Firestore and assignDailyQuestion is deployed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 16:39:59 -05:00
null 896bf26b28 feat: date reflection reveal, UI upgrade plan, seed updates, ime-scan script 2026-07-01 04:12:58 -05:00
null b115cd2f66 chore(seed): update daily question content 2026-07-01 02:55:34 -05:00
null b19394b900 chore(seed): update daily question content to v61 weekly format 2026-07-01 02:20:09 -05:00
null b15e696388 docs(questions): v6 — patch_policy and mass_rewrite_policy metadata fields 2026-06-30 23:48:23 -05:00
null 8897e103b6 docs(questions): v6 — Patch Mode Required, Mass Rewrite Exception 2026-06-30 23:48:18 -05:00
null 3b49b76b33 docs(questions): v7 — Patch Discipline Checks, Fun But Grounded Checks 2026-06-30 23:48:14 -05:00
null 1bdbed4fbc docs(questions): v8 — Daily Patch Discipline, Fun But Grounded 2026-06-30 23:48:10 -05:00
null 7f20fa8ee7 docs(questions): v6 — Patch Discipline, Fun But Grounded gate 2026-06-30 23:48:05 -05:00
null 94a7feeb43 docs(questions): add Daily Patch Review Loop Policy v1 and Research Notes v2 2026-06-30 23:48:01 -05:00
null 1daf0c2bf5 docs(questions): v5.1 — Research-Informed Fun Rules, Daily Game Mechanics, Daily Content Metadata 2026-06-30 23:45:47 -05:00
null 88f2350c9c docs(questions): v5 rewrite — Daily Fun Gate, restructured guides, trimmed schema 2026-06-30 23:33:48 -05:00
null 683e4ed8d0 docs(questions): v4 content guide, v3 quality checklist, daily single choice weekday lineup spec 2026-06-30 21:24:56 -05:00
null 164acf415d docs(seed): update content guide to v3 — product standard, readability test, final approval 2026-06-25 18:56:48 -05:00
null 4686a2c200 docs(seed): replace question guides with v2 — content guide, rewrite plan, new quality checklist 2026-06-25 18:48:37 -05:00
null a2b38485b1 docs(seed): align type names with repo schema — single_choice, this_or_that, answer config 2026-06-25 12:35:49 -05:00
null d1026c7312 docs(seed): split question guide into three documents — content guide, schema, rewrite plan 2026-06-25 12:35:49 -05:00
null b90b9bca77 feat(seed): daily fun multiple choice v3 2026-06-22 17:46:06 -05:00
null a2068f2dca feat(seed): fun + quality_time questions 2026-06-22 09:18:18 -05:00
null 7e3c61c6e4 feat(seed): marriage, parenting, stress, values, home_life questions 2026-06-22 08:47:52 -05:00
null cf1c89ce75 feat(seed): home_life questions json 2026-06-22 08:47:09 -05:00
null 7c04416013 feat(seed): future + gratitude question jsons 2026-06-22 08:27:40 -05:00
null 520c9b874c feat(seed): staged question seed json files 2026-06-22 08:20:22 -05:00
null 1308b1b10c feat(seed) regenerate questions pack 2026-06-21 21:24:31 -05:00