AFFiNE icon indicating copy to clipboard operation
AFFiNE copied to clipboard

feat(core): find todo list based on 'checkbox' search query

Open ddybing opened this issue 1 month ago • 2 comments

This feature enhances the /slash command by allowing users to search for 'checkbox' and have the to-do list item show up as a result. Users come from different systems and environments, and some may use the name 'checkbox' but be confused as they cannot find it in the search menu.

This is achieved by adding a searchAlias property on the to-do list item block that contains the string checkbox.

Summary by CodeRabbit

  • New Features
    • Added search alias support to slash menu items, enabling alternative search terms for improved discoverability (e.g., finding To-do List via "checkbox" search).

ddybing avatar Nov 19 '25 14:11 ddybing

Walkthrough

Adds optional searchAlias (string[]) to TextConversionConfig, sets ['checkbox'] for the To‑do List conversion, and threads searchAlias through createConversionItem so returned SlashMenuActionItems include it. Tests updated to expect the additional slash‑menu items.

Changes

Cohort / File(s) Summary
Config type & default value
blocksuite/affine/rich-text/src/conversion.ts
Adds searchAlias?: string[] to TextConversionConfig and sets searchAlias: ['checkbox'] for the To‑do List conversion entry.
Slash menu item construction
blocksuite/affine/blocks/note/src/configs/slash-menu.ts
createConversionItem destructures searchAlias (default []) from the config and includes searchAlias in the returned SlashMenuActionItem.
Tests
tests/blocksuite/e2e/slash-menu.spec.ts
Updated expected slash‑menu result counts to account for the extra item exposed via searchAlias (counts adjusted: 4→5 and 10→11).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify the exported TextConversionConfig addition is backward compatible and properly documented.
  • Confirm consumers of SlashMenuActionItem tolerate the extra searchAlias field.
  • Review updated tests to ensure they only reflect the intended additional item.

Poem

🐰 A nibble of aliases, soft and spry,
I hop through menus where checkboxes lie,
A tiny name whispers, found by a click,
Search lights the path, quick and slick,
The rabbit smiles — metadata magic.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding searchAlias property to enable finding todo list items via 'checkbox' search query.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f5088e0f6da59e946c34d53b57a0ea08d484e261 and 834bd4ec407a25f25a27c7af99efc5a0c465f257.

📒 Files selected for processing (1)
  • tests/blocksuite/e2e/slash-menu.spec.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/blocksuite/e2e/slash-menu.spec.ts

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

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Nov 19 '25 14:11 coderabbitai[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 56.43%. Comparing base (4717886) to head (834bd4e). :warning: Report is 1 commits behind head on canary.

Additional details and impacted files
@@            Coverage Diff             @@
##           canary   #13982      +/-   ##
==========================================
- Coverage   56.97%   56.43%   -0.55%     
==========================================
  Files        2766     2766              
  Lines      138976   138976              
  Branches    21454    21344     -110     
==========================================
- Hits        79188    78433     -755     
- Misses      57529    58281     +752     
- Partials     2259     2262       +3     
Flag Coverage Δ
server-test 77.00% <ø> (-1.20%) :arrow_down:
unittest 31.91% <100.00%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Nov 21 '25 08:11 codecov[bot]

have type error

darkskygit avatar Dec 13 '25 17:12 darkskygit

@darkskygit Sorry, should be fixed now. Had forgotten to add the searchAlias property to the TextConversionConfig interface.

ddybing avatar Dec 13 '25 20:12 ddybing

affect some test,need to update

darkskygit avatar Dec 14 '25 07:12 darkskygit

Test is expecting 4 properties, but the object now has 5. Do we update the tests, or should I try to find another way to implement this feature?

ddybing avatar Dec 14 '25 09:12 ddybing

Test is expecting 4 properties, but the object now has 5. Do we update the tests, or should I try to find another way to implement this feature?

update the test

darkskygit avatar Dec 14 '25 11:12 darkskygit

I have updated e2e test to adjust for the increase in item properties. I will await the result from the build and test workflow.

ddybing avatar Dec 14 '25 11:12 ddybing

I see there are still some errors with one of the tests. Shall I look into it @darkskygit ?

ddybing avatar Dec 14 '25 19:12 ddybing