Skip to content

Add risk assessment AI and streak freeze feature#16

Merged
kiyarose merged 5 commits into
mainfrom
kr/ejunepatch1
Jun 1, 2026
Merged

Add risk assessment AI and streak freeze feature#16
kiyarose merged 5 commits into
mainfrom
kr/ejunepatch1

Conversation

@kiyarose
Copy link
Copy Markdown
Member

@kiyarose kiyarose commented Jun 1, 2026

  • Retrieve and review all new PR review comments that mention @copilot
  • Reproduce current lint/build status before code changes
  • Implement worker risk-level input validation and floor behavior
  • Fix risk assessment timeout cleanup behavior
  • Add dialog accessibility attributes to RiskResultModal
  • Update WeeklyProjector score fallback on refresh failure
  • Sanitize streak restore candidate before sync persistence
  • Improve streak freeze UI with frost icon/expanding freeze border effect
  • Fix warning layout so submit confirm button stays aligned
  • Bump sub-minor (patch) version
  • Run lint/build validation on updated files
  • Run final parallel validation and address findings

kiyarose and others added 2 commits May 30, 2026 19:14
Added comprehensive risk+excitement assessment AI responses along with a simple streak freeze feature that may introduce unique risk v. reward dynamics with the streak system, looking for some more further testing and refining
Co-authored-by: Krystal <32627918+krystalenby@users.noreply.github.com>
Co-authored-by: MeganRGreenwood <275585135+MeganRGreenwood@users.noreply.github.com>
Co-authored-by: Krystal Rose <Krystal.rose@sillylittle.tech>
Co-authored-by: Megan Greenwood <mgngwd@sillylittle.tech>
@kiyarose kiyarose requested a review from Copilot June 1, 2026 10:29
@kiyarose kiyarose self-assigned this Jun 1, 2026
@kiyarose kiyarose added bug Something isn't working enhancement New feature or request labels Jun 1, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an AI-assisted safety/risk assessment pipeline for journal entries and introduces a “streak freeze / streak restore” mechanic to the points system, while also making weekly compilation stats selection and AI endpoint handling more robust.

Changes:

  • Add local + Worker-refined risk assessment (riskScore/riskLevel) and show supportive/crisis UI after entry submission.
  • Add streak freezes/restores with shop purchase flow and cloud-sync persistence.
  • Improve weekly projector stats selection (prefer latest delivered weekly package) and harden AI endpoint URL normalization/error details.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
worker/src/riskAssessment.ts New Worker route to run AI risk classification and return normalized risk fields/messages.
worker/src/index.ts Routes /risk-assessment requests to the new Worker handler.
src/features/safety/riskAssessment.ts Adds local risk scoring + optional Worker refinement, plus request/response parsing.
src/features/safety/flagTerms.ts Removed older term-flagging implementation in favor of the new risk assessment module.
src/features/safety/CrisisResourcePanel.tsx Adds a reusable crisis resources panel (988 + global directory + optional geolocation hint).
src/features/compose/LetterComposer.tsx Integrates risk assessment into composition flow and shows a post-submit modal for support/crisis.
src/db/schema.ts Adds riskScore / riskLevel to entries and migrates existing rows to defaults (Dexie v6).
src/db/validation.ts Extends Zod validation to include riskScore and riskLevel.
src/features/entries/entryService.ts Persists risk fields from drafts into stored entry rows.
src/features/score/scoreService.ts Implements streak freezes/restores, adds new score snapshot fields, and sync helpers.
src/shared/sync/syncService.ts Syncs streakFreezes and streakRestore through Firestore meta score doc.
src/features/shop/Shoppe.tsx Adds UI/actions to buy streak freezes and restore a recently-broken streak.
src/features/score/ScoreTicker.tsx Displays streak freeze count in the header ticker when present.
src/App.tsx Wires streak freeze count into ScoreTicker.
src/features/compilation/weeklyStats.ts Adds getWeeklyStatsForWeekKey to compute stats for an explicit week.
src/features/packages/packageService.ts Adds getLatestDeliveredWeeklyPackage to find the most recent relevant weekly delivery.
src/features/compilation/WeeklyProjector.tsx Uses latest delivered weekly package to choose week stats; adds fallback handling.
src/features/compilation/weeklyAiSummary.ts Adds normalizeEndpointUrl + improved error details for AI endpoint failures.
src/features/debug/DebugPanel.tsx Adds AI endpoint checker and improves weekly package seeding to match latest entry week.
package.json Bumps app version to 1.10.3.
VERSION Bumps repo VERSION to 1.10.3.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread worker/src/riskAssessment.ts Outdated
Comment thread src/features/safety/riskAssessment.ts Outdated
Comment thread src/features/compose/LetterComposer.tsx Outdated
Comment on lines +92 to +93
setStats(fallbackStats)
setDelivered(false)
Comment thread src/features/score/scoreService.ts
Add animation sequences for streak freezes and streak breaking, with focus model
Co-authored-by: Krystal Rose <krystal.rose@sillylittle.tech>
Co-authored-by: Krystal Enby<32627918+krystalenby@users.noreply.github.com>
@kiyarose kiyarose marked this pull request as ready for review June 1, 2026 11:28
@kiyarose kiyarose enabled auto-merge June 1, 2026 11:28
@kiyarose kiyarose merged commit 95144f3 into main Jun 1, 2026
1 check passed
@kiyarose kiyarose deleted the kr/ejunepatch1 branch June 1, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants