Gate 8375: database-redeem-security expected the old attempt count, and
database-redeem-code-kinds-330 assumed a zero starting balance. The migration
has not run anywhere yet, so it is edited in place.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
redeem_code_v2 reports a reused single code by the same user as
already_redeemed_by_you; the legacy wrapper maps it back so the existing
redeem-security contract (and its CI database test) is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
Owner 2026-11-22. 活动码 (campaign): one code, many users, each once, optional
start time, end time and total cap, custom text or random. 个人码: one random
code, one redemption. 批量码: N single codes sharing a batch name, CSV right
after generation. Every code may set a success title, message and one of four
drawn celebrations (default / stars / moon / gift) shown in the approved
success dialog; failures stay toasts.
Random codes drop the JYOTISH- prefix: XXXX-XXXX from an alphabet without
0 O 1 I L, crypto randomness, hashed after normalisation (upper case, no
spaces or dashes). Old JYOTISH codes keep their exact-text hash and still
redeem: redeem_code_v2 tries the exact hash, then the normalised one.
Migration 20261122140000 is additive: kind / batch / campaign / window / cap /
count / success columns, redemption_code_uses(code_id, user_id unique) as the
once-per-user record (kept on account deletion), the ledger's per-code unique
moved to that table, the code-row lock serialising a capped campaign.
redeem_code(text) keeps its signature and result and wraps v2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
- Migration 20261122130000_release_notes.sql: release_notes (version, title,
grouped items, draft/published/withdrawn) and release_note_reads; RLS on,
no table privilege for app/service roles; users go through service-role
functions list_release_notes_for_user / mark_release_note_read (a version
published before the account existed counts as seen); the admin writes
through audited admin_save_release_note / admin_set_release_note_status
gated by the new content.release_notes.write (owner, operations,
content_editor) and reads via an admin_runtime select policy.
- APIs: GET/POST /api/release-notes (signed-in user only) and GET/POST
/api/admin/release-notes.
- Admin page 更新说明: table + editor drawer with 新功能/修复/改进 lists and a
live preview; 保存草稿 / 发布 / 撤回.
- User side: 「本次更新」 dialog once per version (知道了 records the read);
settings gets an 更新说明 pane (phone segmented nav becomes four).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
A security-definer function, gated by support.quality.read and granted to
admin_runtime only, returns per report the reading's section statuses and
the transform log without any reading text; the admin page 报告写作记录
lists sections, reasons, repair, salvage and fallback per report.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
An annual report's questions live in a consultation conversation bound to
the report by chat_sessions.report_id (one per report, guarded by a
trigger); no settlement function is redefined. The consult route hands
every turn of such a conversation to the annual handler, which reads only
the saved report, checks dates and placements against what it read, and
settles the fixed sentence and feedback-only turns free. The page has an
entry per written section, a page-level entry in the title bar, passage
selection and the shared panel or bottom sheet.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
- 「充值」 is an admin switch (billing.purchase on the 功能开关 page, off until
turned on, existing permission and audit). Open = switch on and gateway
usable; the answer rides on the account payload as paymentOpen. Closed: no
packages request, no purchase tabs, empty product list, orders refused.
- The billing panel chunk is prefetched while idle and when a settings
section opens; the packages route reads its three inputs in one round; a
same-height line holds the place while the list is unknown.
- GET /api/account/credit-ledger: the caller's own rows (read as the user,
filtered by the session id), 20 per page with a cursor, all/in/out/redeem,
reader names only, free turns hidden, links only to owned reports/sessions.
- Avatar upload server side: PUT/GET/DELETE /api/account/avatar/image, JPEG
or WebP, square up to 256, 200 KB, type and size read from the bytes,
rate-limited; stored in profile_avatar_images (owner-only RLS, migration
20261120100000); account payload carries only avatarImage.version.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
New table public.model_provider_keys (label, encrypted key, enabled,
optional concurrency limit). The migration copies each provider's
existing key into one row labelled 默认 and keeps
model_providers.encrypted_api_key as a mirror of the first enabled key,
so an older web image, the publish and rollback checks and the
connection-test hash keep working. Writes go through security-definer
functions gated by models.write and audited without key material; the
last enabled key of an enabled provider cannot be disabled or deleted.
admin_runtime gets the SELECT grant together with its SELECT policy
(BUG-147).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXp2Vp62Ur3C7yRWQdSq
The 星历 page gets a month calendar for the chosen person: every day is
吉 / 平 / 凶 with two or three life themes from transits against their own
chart, the selected day opens to its themes and "为什么", and below it
「接下来要留心」, 「这几天」 and 「回看」 (owner, 2026-11-07: A's grid plus
C's lower half).
Engine: scripts/personal_calendar.py joins existing calculators on one
date axis (one call, <0.5 s for 45 days): Panchanga in the subject's own
ayanamsa, Tara / Chandra bala, Moon house from Lagna and Moon,
Ashtakavarga SAV + Moon BAV, transit conjunctions with natal points,
functional benefic / malefic, activity verdicts with native inputs,
ingress / station / combustion / eclipse / Vimshottari AD+PD boundaries,
and a month backdrop (Vimshottari MD/AD/PD, Narayana, Sade Sati / Kantaka,
slow-graha contacts, Jupiter+Saturn double transit). New endpoint
/api/personal_calendar.
BUG-1666: check_activity_muhurta ignored Vishti karana, Vyatipata /
Vaidhriti and an avoided Chandra bala, so a Vishti day could be 大吉.
BUG-1667 (closes BUG-703 / BUG-707): /api/panchanga_range now honours the
requested ayanamsa; the day view asks for the subject's own and drops the
Lahiri note.
Frontend: /api/ephemeris/month (own rate-limit bucket, cached),
/api/ephemeris/checks + migration 20261107010000_ephemeris_day_checks
(answers kept with the birth declaration they were made under). Copy is
life-first with the sky events folded under 为什么; draft wording pending
the astrologer. TASK-ephemeris-page decisions 4/6 and hard lines 3/7/9
superseded per the owner; DESIGN.md §16 updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXozbkyFNqbu8pVEtZ7W
Every save keeps a record (chart_choice_records via chart_choice_adopt_v3);
the page opens on the current result with its time scale and the history
list, a past record can be adopted again while the birth declaration is
unchanged. Comparison cards are all open with a 60px mini chart per side
following the north/south board setting. Saving shows one toast.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXozbkyFNqbu8pVEtZ7W
Old 0/0 profiles show no range in the form instead of 最早 = 最晚. The page's
range question uses an even 2x2 grid with parallel labels; saving writes the
picked range to the declaration and adopts the minute in one transaction
(chart_choice_adopt_v2). A ±60 min range is compared without narrowing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXozbkyFNqbu8pVEtZ7W
Event scoring was measured at chance level on the 77 Rodden-AA holdout
cases (BUG-1091). The new flow finds the dividing line nearest the reported
time, describes how the flipped divisional charts read on either side, asks
up to five self-assessment questions, and saves the user's own choice
(provenance user_choice) with the domains to read in both versions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXozbkyFNqbu8pVEtZ7W
The staging DB gate replays 20260814040000 on top of the new migration;
with claim_personal_report_job overloaded by a defaulted fourth argument,
a three-argument call became ambiguous. The lane now calls
claim_personal_report_job_for_types and the original stays untouched.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXozbkyFNqbu8pVEtZ7W
Every report type already queued in personal_report_jobs, one at a time per
server. The worker now runs PERSONAL_REPORT_WORKER_CONCURRENCY lanes (default
2); the second takes only annual and synastry reports so they never wait
behind long personal reports. claim_personal_report_job gains an optional
report-type filter; personal_report_queue_view (owner-only, security definer)
gives the wait, shown as a single line on the annual, personal and synastry
waiting screens. Also keeps the privacy whitelist line numbers in
personal-report-api.test.ts unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXozbkyFNqbu8pVEtZ7W
- Intake: six verbatim options (出生证明 / 户口本 / 家人记得 / 只记得时辰 /
只知道时段 / 完全不知道). Clock-time sources take an earliest / latest or
「不清楚误差」; no source maps to a fixed error any more. Twelve 时辰
picker (子时 23:00–00:59 from the filled date); the position answer is a
clue and never narrows the window.
- Validation: drop the hospital 2/2 and family 15/30/60/120 rules; a time
needs a containing range (minutes derived, may be uneven) or
uncertainty_known=false. Older 2/2 and 15–120 profiles still resave as is.
- Lagna precheck: uses the given range; without one it scans only the
stated minute and says the verbatim T4 line; ranges read as clocks.
- Migration 20261102020000 (additive): birth_time_source accepts
id_document; profiles and chart_profiles gain birth_time_record_kind,
birth_time_uncertainty_known, birth_time_shichen; chart_profiles gains
birth_time_clue; sync trigger and backfill carry them.
- BUG-1513: readProfile now reads the camelCase library record of other
people (source, stated time, window, status).
- BUG-1514: chart_profiles sync trigger is security definer, so a person
without a clock time can be saved by the people route.
- id_document reaches the frozen engine contract as approximate.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyeZrYn6ryNcSe5Y2Y
recover_expired_personal_report_jobs now releases the reservation (by the
report's request_id, idempotent with the worker and the delete trigger)
before it fails a job; a release that raises or errors leaves that row
running for the next sweep and logs errorCode=report_refund_failed.
Migration 20261102010000_report_lease_expiry_release.sql replaces only the
function (invoker, empty search_path, service_role only).
The report worker no longer closes a failed job when its refund fails: it
logs report_refund_failed and leaves the lease to the recovery sweep.
Rectification retries a failed release once with the same case request id
and logs rectification_refund_failed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyeZrYn6ryNcSe5Y2Y
Gate run 6343 refused the invoker v3 on agentic_rectification_cases: since
20260814010000 service_role has no direct rights on cases, every case write
goes through owner-held security-definer RPCs. v3 now only checks the person,
calls v2 and hands the case to agentic_rectification_bind_case_subject_v1,
a service_role-only security-definer function that locks the case, binds a new
case and its conversation to the person, and checks the person matches.
Migration parsed with pglast (58 statements, 17 PL/pgSQL bodies).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyeZrYn6ryNcSe5Y2Y
The staging gate's real-database tests refused open_agentic_rectification_case_v3:
it was security definer, and 20260814010000 revokes EXECUTE on the 11-argument
v2 even from its owner, leaving service_role alone. v3 is now security invoker,
like the 12-argument v2; reading the person and labelling the chat session move
into two service_role-only security-definer helpers, because service_role has
no rights on chart_profiles or chat_sessions. The migration has never run, so it
is corrected in place.
Also adds the annual.full price rows to the whole-table pricing assertion.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyeZrYn6ryNcSe5Y2Y
New report type annual_full on the personal report queue, like
synastry_full. POST /api/reports {reportType: annual_full} reserves
annual.full (20 credits by default, admin-editable), stores the range
and the optional situation, and queues the job; a year already written
for the same subject opens directly without a second charge. The worker
asks /api/annual/report_facts for the server cards, writes the sections
one at a time (person, overview, domains, windows, remaining, close)
with a program gate and one rewrite, saves the snapshot after every
section, then settles; a failure releases the reservation.
GET /api/annual/overview serves the overlay from the slim package.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyeZrYn6ryNcSe5Y2Y
Product 2026-11-01: 1A 2A.
- Cases record whose chart (chart_profile_id, null = owner); add-only
migration 20261101010000_rectification_chart_subject.sql, old cases stay
the owner's.
- Adoption / confirmation / segment adoption / VedAstro refresh read and
write that person's row through two helpers; the owner's profile and
cases are untouched. Owner edits rebaseline only owner cases, person
edits only that person's; a new declaration drops the adopted minute.
- Open cases are counted per person (entry summary v2, in-chat offer,
resume lookup); open_agentic_rectification_case_v3 binds a new case and
its conversation to the person.
- delete_chart_subject deletes the person's cases and their
conversations first (no refund).
- /rectification follows the current person (switcher beside the title),
shows name and relation; self-only limits removed (hook, chat offer,
chart ascendant link, starter hint).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyeZrYn6ryNcSe5Y2Y
- Sidebar 「生时校正」 under 星盘, behind a new account `rectification` flag.
- /rectification page: status card from entry-summary (not started / in
progress with window and confirmed event count / adopted time), a short
data check, then the home rectification surface (?rectify=1, or
?rectify=new to start over; ?c=<id> to continue or view). No price on
the page.
- entry-summary gains session id, candidate range, confirmed evidence count
and adopted times (add-only migration 20261028170000).
- The offer card under a consultation answer becomes one line and a link
to /rectification; an explicit request in chat also goes there. No case
is opened from a conversation any more.
- Starter home shows a rectification prompt for self charts with an
estimated time; onboarding checklist gains 做一次生时校正 for them.
- Chart-page link points to /rectification. Shell registers its router so
home hooks can navigate client-side without useRouter in Home().
- Docs: VOICE, DESIGN, CHANGELOG, device checklist.
Self profile only; other people are issue #160.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A finished match used to reopen the old report. Starting again now writes a new one and charges again; a report still being written is reused.
Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
Editing a published model tried to update a non-draft row, so the save collapsed into a generic constraint error.
Co-authored-by: Cursor <cursoragent@cursor.com>
The closed sentence was prerendered when the build had no database. The page now asks for the flag in the browser, and synastry.full is published at 19 credits.
Co-authored-by: Cursor <cursoragent@cursor.com>
The chat stays bound to that section's saved calculation, checks each chart fact before answering, and bills like an ordinary turn.
Co-authored-by: Cursor <cursoragent@cursor.com>
The pair page and reader replace the leftover chat draft, and the same pair is not charged again.
Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep both changelog entries and the archive-limit board row. The marriage-match row stays on this branch for the storage fix.
Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
Move the bde5d615 engine and full-synastry skill in unchanged, save both profiles without billing or a page, and retire the old synastry module.
Checked targeted pytest, tsc 0, lint 0 errors, service tests 6/6, and test:db 73 pass / 13 fail matching the Windows known list.
Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
The trigger, the shared constants, and the limit sentence now agree, and the archive and person menus scroll instead of growing past the screen.
Co-authored-by: Cursor <cursoragent@cursor.com>