Skip to content

feat(goals): add difficulty ceiling dropdown to guardrails section #258

@smithrashell

Description

@smithrashell

Problem

The adaptive difficulty system progresses sessions all the way to Hard with no user override. Users preparing for mid-tier companies (where Easy/Medium covers ~90% of interviews) have no way to prevent trick-based Hard problems from appearing. The only recourse today is skipping with "not relevant" — a reactive fix for a problem that should be preventable.

Solution

Add a Max Difficulty dropdown to the Guardrails section of the Goals page. Users can set a ceiling that the adaptive system cannot exceed.

Options:

Value Label
all (default) All difficulties (Easy, Medium, Hard)
Medium Easy & Medium only
Easy Easy only

Default is all — no behavioral change for existing users.

Key Finding

maxDifficulty is already a field in the guardrails data contract in dashboardGoalsHelpers.js (line 78) but is hardcoded to "Medium" and never read from settings. The slot already exists in the schema.

End-to-End Flow

User selects "Easy & Medium only"
  → onGuardrailChange('maxDifficulty', 'Medium')
  → debouncedSave() writes maxDifficulty: 'Medium' to settings
  → buildAdaptiveSessionSettings() reads settings.maxDifficulty
  → applyUserDifficultyCeiling('Hard', 'Medium') returns 'Medium'
  → filterProblemsByDifficultyCap filters out Hard candidates
  → Session assembled with Easy & Medium only

filterProblemsByDifficultyCap already exists in problemSelectionHelpers.js and is called in session assembly — no changes needed there.

Files to Change

src/shared/services/storage/storageService.js
Add maxDifficulty: 'all' to _createDefaultSettings()

src/app/services/dashboard/dashboardGoalsHelpers.js
Line 78 — replace hardcoded "Medium" with settings.maxDifficulty || 'all'

src/app/pages/progress/goals.jsx

  • Add maxDifficulty: 'all' to useGuardrails initial state
  • Load maxDifficulty from appState.learningPlan.guardrails?.maxDifficulty in updateLearningPlanData
  • Add maxDifficulty: guardrailsRef.current.maxDifficulty to the saveSettings mapping

src/app/pages/progress/GuardrailsSection.jsx

  • Replace the read-only "Adaptive Difficulty Progression" Alert with a Select dropdown
  • Add a short descriptive line beneath: "The system adapts difficulty progression up to this ceiling."

src/shared/db/stores/sessions.jsbuildAdaptiveSessionSettings()
Add applyUserDifficultyCeiling(adaptiveCap, userCap) helper and apply it at line ~491:

// Before
const finalDifficultyCap = focusDecision.onboarding ? "Easy" : updatedSessionState.current_difficulty_cap;

// After
const adaptiveCap = focusDecision.onboarding ? "Easy" : updatedSessionState.current_difficulty_cap;
const finalDifficultyCap = applyUserDifficultyCeiling(adaptiveCap, settings.maxDifficulty);

Helper:

function applyUserDifficultyCeiling(adaptiveCap, userCap) {
  if (!userCap || userCap === 'all') return adaptiveCap;
  const order = { Easy: 1, Medium: 2, Hard: 3 };
  return (order[adaptiveCap] || 3) <= (order[userCap] || 3) ? adaptiveCap : userCap;
}

settings is already available via loadSessionContext — no extra fetch needed.

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions