Skip to content

feat(scan): add new ai capability scan categories#46

Merged
linkai0924 merged 1 commit intomainfrom
fix/favorite-list
Apr 9, 2026
Merged

feat(scan): add new ai capability scan categories#46
linkai0924 merged 1 commit intomainfrom
fix/favorite-list

Conversation

@linkai0924
Copy link
Copy Markdown
Collaborator

@linkai0924 linkai0924 commented Apr 9, 2026

Add five new scan categories to the AI capability review system:

  • document-editing: document editing operations

  • meeting-management: meeting management functions

  • task-scheduling: task scheduling capabilities

  • file-management: file management operations

  • team-collaboration: team collaboration features

Summary by CodeRabbit

  • New Features

    • Expanded scan category support with five new options: document editing, meeting management, task scheduling, file management, and team collaboration. Users can now categorize a wider range of content types during scanning operations.
  • Chores

    • Updated portal submodule to the latest version.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

Warning

Rate limit exceeded

@linkai0924 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 6 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 12 minutes and 6 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: aecb480b-9daa-4843-8e9d-d9bb3a9deec4

📥 Commits

Reviewing files that changed from the base of the PR and between fd535d8 and bd7d66c.

📒 Files selected for processing (1)
  • server/internal/services/scan_service.go
📝 Walkthrough

Walkthrough

The pull request updates the portal submodule pointer to a new commit and extends the scan service with five additional allowed scan category slugs—document-editing, meeting-management, task-scheduling, file-management, and team-collaboration—alongside corresponding updates to the LLM system prompt.

Changes

Cohort / File(s) Summary
Submodule Update
portal
Updated submodule pointer from commit cb59b6159d64fb1c16a0e4fe764350479086b124 to bdfd600b0404c1020fe7fea5f1240bd94d7153e1.
Scan Service Enhancement
server/internal/services/scan_service.go
Added five new allowed scan category slugs (document-editing, meeting-management, task-scheduling, file-management, team-collaboration) to allowedScanCategories and updated scanSystemPrompt to reflect these categories in the LLM instructions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰✨ Five new categories hop into the fold,
Document, meeting, task, and file stories told,
The portal skips forward with hopeful cheer,
Scan service grows stronger, the path now clear! 📋🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 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 five new AI capability scan categories (document-editing, meeting-management, task-scheduling, file-management, team-collaboration) to the scan service.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/favorite-list

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.

Add five new scan categories to the AI capability review system:

- document-editing: document editing operations

- meeting-management: meeting management functions

- task-scheduling: task scheduling capabilities

- file-management: file management operations

- team-collaboration: team collaboration features

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@server/internal/services/scan_service.go`:
- Around line 31-35: The migration seed in
server/migrations/20260407110000_add_scan_category_and_seed_taxonomy.sql is
missing metadata for the five new slugs listed in allowedScanCategories
(document-editing, meeting-management, task-scheduling, file-management,
team-collaboration), so EnsureCategory creates them with only placeholder
English names; update the SQL seed to insert rows for those five slugs including
multilingual fields (name_en, name_zh, description_en, description_zh) and a
sensible sort_order to match the existing taxonomy ordering so runtime-created
categories match seeded ones; locate the seed INSERT statements in that
migration and add one fully populated record per slug consistent with the other
entries.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 26c68ceb-f1f8-4398-bf14-b0c07ef419a8

📥 Commits

Reviewing files that changed from the base of the PR and between 394d357 and fd535d8.

📒 Files selected for processing (2)
  • portal
  • server/internal/services/scan_service.go

Comment on lines +31 to +35
"document-editing",
"meeting-management",
"task-scheduling",
"file-management",
"team-collaboration",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) Confirm new slugs in scan service
echo "== New category slugs in scan_service.go =="
rg -n -C2 'document-editing|meeting-management|task-scheduling|file-management|team-collaboration' server/internal/services/scan_service.go || true

# 2) Check seed migration coverage
echo
echo "== Seeded slugs in taxonomy migration =="
rg -n -C1 "INSERT INTO item_categories|\\('.*', '\\{\"en\"" server/internal/migrations/20260407110000_add_scan_category_and_seed_taxonomy.sql || true

# 3) Compare slugs from Go allowed list vs SQL seeded list
python - <<'PY'
import re, pathlib

go_path = pathlib.Path("server/internal/services/scan_service.go")
sql_path = pathlib.Path("server/internal/migrations/20260407110000_add_scan_category_and_seed_taxonomy.sql")

go = go_path.read_text(encoding="utf-8")
sql = sql_path.read_text(encoding="utf-8")

go_block = re.search(r"var\s+allowedScanCategories\s*=\s*\[\]string\{(.*?)\n\}", go, re.S)
go_slugs = set(re.findall(r'"([^"]+)"', go_block.group(1))) if go_block else set()

sql_slugs = set(re.findall(r"\('([^']+)'\s*,\s*'\{", sql))

missing_in_sql = sorted(go_slugs - sql_slugs)

print("Go allowed slugs:", len(go_slugs))
print("SQL seeded slugs:", len(sql_slugs))
print("Missing in SQL:")
for s in missing_in_sql:
    print(" -", s)
PY

Repository: XDfield/costrict-web

Length of output: 1299


🏁 Script executed:

#!/bin/bash

# List all migration files to see what exists
echo "== All migration files =="
ls -la server/internal/migrations/ 2>/dev/null | head -20 || echo "migrations dir not found"

# Search for any migration files with scan or category in name
echo
echo "== Migration files with 'scan' or 'category' in name =="
find server/internal/migrations -name "*scan*" -o -name "*category*" -o -name "*taxonomy*" 2>/dev/null || true

# Search for INSERT INTO item_categories across all migrations
echo
echo "== Files containing 'item_categories' inserts =="
rg -l "item_categories" server/internal/migrations/ 2>/dev/null || true

# Search for any reference to the new slugs in migration files
echo
echo "== References to new category slugs in migrations =="
rg "document-editing|meeting-management|task-scheduling|file-management|team-collaboration" server/internal/migrations/ -n 2>/dev/null || echo "No matches found"

Repository: XDfield/costrict-web

Length of output: 267


🏁 Script executed:

#!/bin/bash

# Search for database/migration patterns in the project
echo "== Looking for database setup/migration patterns =="
find . -name "*.go" -type f | xargs rg -l "migration|Migration|migrate" | head -10

# Search for database schema or initialization
echo
echo "== Files with database schema or gorm models =="
find . -path ./vendor -prune -o -name "*.go" -type f | xargs rg -l "type.*struct.*\`gorm|CREATE TABLE|schema" | head -10

# Look at the actual scan_service to see how CategorySvc works
echo
echo "== CategorySvc usage in scan_service.go =="
rg -A5 "CategorySvc" server/internal/services/scan_service.go

# Check if there's a models or database directory
echo
echo "== Project structure - look for db/models =="
ls -la server/internal/ 2>/dev/null | grep -E "^d"
</parameter>

Repository: XDfield/costrict-web

Length of output: 2818


🏁 Script executed:

#!/bin/bash

# Check the migrations directory (not internal/migrations)
echo "== Files in server/migrations/ =="
ls -la server/migrations/ 2>/dev/null | head -20

# Look for SQL migration files
echo
echo "== SQL migration files =="
find server/migrations -name "*.sql" -type f 2>/dev/null | sort

# Check embed.go to understand migration approach
echo
echo "== server/migrations/embed.go content =="
cat server/migrations/embed.go 2>/dev/null | head -30

# Search for any migration file mentioning category, scan, or taxonomy
echo
echo "== Search for category/scan references in migrations =="
find server/migrations -type f -exec grep -l "category\|taxonomy\|scan" {} \; 2>/dev/null

# Look for the specific date pattern in migrations
echo
echo "== Migrations with date 202604 (April 2026) =="
find server/migrations -name "*202604*" -o -name "*20260407*" 2>/dev/null

Repository: XDfield/costrict-web

Length of output: 4285


🏁 Script executed:

#!/bin/bash

# Read the actual migration file
echo "== Content of 20260407110000_add_scan_category_and_seed_taxonomy.sql =="
cat server/migrations/20260407110000_add_scan_category_and_seed_taxonomy.sql

echo
echo "== Content of 20260407000000_seed_item_categories.sql =="
cat server/migrations/20260407000000_seed_item_categories.sql

Repository: XDfield/costrict-web

Length of output: 3094


🏁 Script executed:

#!/bin/bash

# Find CategoryService implementation
echo "== CategoryService.EnsureCategory implementation =="
find . -name "*.go" -type f | xargs rg -A10 "func.*EnsureCategory"

# Also check what the category model looks like
echo
echo "== Item category model structure =="
rg -A5 "type ItemCategory\|type Category" server/internal/models/models.go 2>/dev/null | head -20

Repository: XDfield/costrict-web

Length of output: 960


🏁 Script executed:

#!/bin/bash

# Get full EnsureCategory implementation
echo "== Full CategoryService.EnsureCategory implementation =="
rg -A30 "func.*EnsureCategory" server/internal/services/category_service.go

# Check the ItemCategory model
echo
echo "== ItemCategory model in models.go =="
rg -B2 -A15 "type ItemCategory" server/internal/models/models.go

Repository: XDfield/costrict-web

Length of output: 2431


Add seeded metadata for newly accepted category slugs.

The migration file server/migrations/20260407110000_add_scan_category_and_seed_taxonomy.sql currently seeds 12 category slugs with full multilingual metadata (English and Chinese names, descriptions, sort order). However, the five new slugs accepted in allowedScanCategories (document-editing, meeting-management, task-scheduling, file-management, team-collaboration) are not included in this seed data.

When these categories are created at runtime via EnsureCategory, they receive only placeholder metadata: an English name matching the slug, with no Chinese translation, descriptions, or sort order. This creates inconsistency between seeded and runtime-created categories.

Add these five slugs to the migration seed data with proper multilingual metadata to ensure consistency across all supported categories.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/internal/services/scan_service.go` around lines 31 - 35, The migration
seed in server/migrations/20260407110000_add_scan_category_and_seed_taxonomy.sql
is missing metadata for the five new slugs listed in allowedScanCategories
(document-editing, meeting-management, task-scheduling, file-management,
team-collaboration), so EnsureCategory creates them with only placeholder
English names; update the SQL seed to insert rows for those five slugs including
multilingual fields (name_en, name_zh, description_en, description_zh) and a
sensible sort_order to match the existing taxonomy ordering so runtime-created
categories match seeded ones; locate the seed INSERT statements in that
migration and add one fully populated record per slug consistent with the other
entries.

@linkai0924 linkai0924 merged commit a827b63 into main Apr 9, 2026
1 check 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.

1 participant