Skip to content

feat(focus): add Hick-Hyman decision latency scorer - #817

Merged
TheVicky1 merged 1 commit into
TheVicky1:mainfrom
shahkavya23:feat/hicks-law
Nov 25, 2026
Merged

TheVicky1 merged 1 commit into
TheVicky1:mainfrom
shahkavya23:feat/hicks-law

Conversation

@shahkavya23

@shahkavya23 shahkavya23 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add a zero-dependency Hick-Hyman decision latency calculator
  • normalize clutter into a bounded 0–100 score with four severity tiers
  • provide actionable choice-reduction guidance and menu evaluation
  • add boundary, formula, configuration, and menu-clutter unit tests

Validation

  • npm run lint
  • npm run typecheck
  • node scratch/run-tests.mjs hicks-law (8 tests passed)

Closes #808

Summary by CodeRabbit

  • New Features
    • Added menu clutter assessments that estimate decision time and provide a severity level and recommendation based on the number of available options.
    • Results account for familiarity and timing settings, with scores kept within defined bounds.

@vercel

vercel Bot commented Nov 25, 2026

Copy link
Copy Markdown

@shahkavya23 is attempting to deploy a commit to the Vicky's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown

👋 Welcome to PACT OS, @shahkavya23! 🚀

Thank you for taking the time to open your first pull request on PACT! We are thrilled to have you here in our open-source community.


🔍 What Happens Next?

  1. Automated Verification: Our Continuous Integration (CI) workflow is currently verifying:
    • 🔒 Zero-Secret Security Scan
    • 🔗 Markdown Link Integrity
    • 🧹 ESLint Code Quality
    • 🏷️ TypeScript Strict Typecheck
    • 🧪 56-Suite Automated Domain & Security Test Matrix
    • 🏗️ Next.js Production Build
  2. Maintainer Review: A maintainer (@TheVicky1) will review your pull request shortly.
  3. Friendly Iteration: If any adjustments or feedback are needed, we will provide clear, actionable suggestions to help get your PR merged smoothly.

📚 Helpful Quick Links

Thank you for helping make PACT better! Plan. Track. Improve. Repeat. 🏛️✨

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds Hick-Hyman decision-time and menu-clutter utilities. The module returns normalized choice counts, entropy, estimated decision time, clutter scores, severity levels, and recommendations. Tests cover input normalization, calculation results, severity thresholds, and menu evaluation.

Changes: Decision-Time and Clutter Model

Layer / File(s) Summary
Decision calculation, menu evaluation, and tests
src/lib/focus/hicks-law.ts, tests/hicks-law.test.ts
The module adds input and result types, normalization rules, decision-time and clutter calculations, severity guidance, and menu item evaluation. Tests cover boundary inputs, custom and invalid options, severity thresholds, score bounds, and menu recommendations.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: Minimal · up to fbd90

This PR adds a self-contained decision-latency and clutter scoring utility with tests and does not alter existing behavior. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat(focus): add Hick-Hyman decision latency scorer" names the main change: a new Hick-Hyman decision-time and clutter scoring utility in src/lib/focus/hicks-law.ts, with tests. The raw sum…
Linked Issues check Passed Directly linked issue #808 requires a zero-dependency module at src/lib/focus/hicks-law.ts. The reviewed head contains that module. It exports ClutterSeverity, HickDecisionOptions, HickDecisionResult,…
Out of Scope Changes check Passed The whole-PR diff against merge base 0080f1d adds two files: src/lib/focus/hicks-law.ts (+132) and tests/hicks-law.test.ts (+90). Both files directly implement or test #808. No unrelated files, refac…
Full details: Title check

Explanation

The title "feat(focus): add Hick-Hyman decision latency scorer" names the main change: a new Hick-Hyman decision-time and clutter scoring utility in src/lib/focus/hicks-law.ts, with tests. The raw summary and objectives confirm this is the primary change, so the title is fully related to the changeset.

Full details: Linked Issues check

Explanation

Directly linked issue #808 requires a zero-dependency module at src/lib/focus/hicks-law.ts. The reviewed head contains that module. It exports ClutterSeverity, HickDecisionOptions, HickDecisionResult, calculateHickDecisionTime, and evaluateMenuClutter with the requested signatures. Verified in source: (1) Decision time uses a + b·log2(n+1)·f with defaults 200 ms, 150 ms, and 1.0. Familiarity is clamped to [0.5, 1.5]. (2) Negative, non-finite, and invalid inputs are normalized. Negative option counts become 0. For n = 0, entropy is 0 and decision time equals the base reaction time. (3) entropyBits is rounded to 3 decimals with Math.round(x*1000)/1000. (4) clutterScore uses min(100, round(log2(n+1)/log2(30)·100)) and is floored at 0, so it stays in [0, 100]. (5) Severity tiers are minimal at ≤4, moderate at 5–9, high at 10–19, and paralyzing at ≥20. (6) The module has no imports. The summary lists tests/hicks-law.test.ts with boundary, formula, configuration, and menu tests. I did not read the test file body. Test coverage is inferred from the summary and the file listing. The issue's verification commands are not coding requirements. The PR reports lint and a passing hicks-law test run; npx tsc --noEmit is not reported.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against merge base 0080f1d adds two files: src/lib/focus/hicks-law.ts (+132) and tests/hicks-law.test.ts (+90). Both files directly implement or test #808. No unrelated files, refactors, or public declarations outside the requested API appear in the change summary. evaluateMenuClutter accepts the requested item shape but derives its result from items.length only. This follows the issue's menu-evaluation scope and is not an unrelated change. Its handling of isHighlighted and category is not specified in #808.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c876ece4-4a95-47fb-9115-40beae575a3a
Commits

Reviewing files that changed from the base of the PR and between 0080f1d and fbd90ba.

Files selected for processing: 2

  • src/lib/focus/hicks-law.ts
  • tests/hicks-law.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@TheVicky1

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@TheVicky1

Copy link
Copy Markdown
Owner

Everything LGTM

@TheVicky1
TheVicky1 merged commit 4b506a2 into TheVicky1:main Nov 25, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Focus] Add Hick-Hyman Law Decision Latency & Choice Overload Clutter Index in src/lib/focus/hicks-law.ts

2 participants