Repository navigation
refactor(imports): direct subpath imports — PR D: Web AI + Integrations - #1091
Conversation
|
Warning Rate limit exceeded
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 16 minutes and 1 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (115)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac09912fbb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Code Review: PR #1091 — barrel/web-ai import decompositionScope: Mechanical decomposition of ✅ What's CorrectSource file decompositions — all verified cleanEvery source-side import swap has been confirmed correct against the actual export map:
|
|
Fixed — all four issues from the review are now resolved in commit
Verified |
…, workflows Replaces barrel imports in the AI and integration subsystem of apps/web: - apps/web/src/app/api/ai/** (routes + tests) - apps/web/src/lib/ai/** (source + tests) - apps/web/src/app/api/agents/** - apps/web/src/app/api/integrations/** - apps/web/src/lib/integrations/** - apps/web/src/lib/mcp/** - apps/web/src/lib/memory/** - apps/web/src/lib/workflows/** Part of the barrel-import removal series — PR D of 6. Depends on barrel/foundation (#1088) being merged first. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
logger-config exports loggers (plural) helpers; the root logger instance lives in logging/logger. Use the direct module for clarity. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Test correctness fixes: - mcp-scope.test.ts: fix malformed logger mock (logger was nested inside child() return instead of exported at module top level) - agents/integrations/__tests__/route.test.ts: move createGrant and findGrant from barrel mock to grant-repository subpath mock — source imports from /repositories/grant-repository, not @pagespace/lib/integrations - ollama/models/__tests__/route.test.ts: update validateLocalProviderURL mock path from @pagespace/lib/security to /security/url-validator - calendar-write-tools.test.ts: update isUserDriveMember import from @pagespace/lib barrel to /permissions/permissions to match the mock path - page-read-tools.test.ts: remove dead @pagespace/lib/server mock stubs for isChannelPage, formatContentForAI etc. — source no longer imports these from that path Style: add missing trailing semicolons to 74 @pagespace/lib subpath import statements across 45 source files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- mcp-bridge.test.ts: mock @pagespace/lib/logging/logger not logger-config; source imports logger from /logging/logger, these are different modules - page-read-tools.test.ts: mock getPageTypeEmoji/isFolderPage not isDocumentPage/isAIChatPage/getCreatablePageTypes; wrong fn names carried over from barrel mock, actual imports are the emoji/folder helpers - agent-tools.test.ts: add missing semicolon on import statement - page-write-tools.test.ts: add missing semicolon on import statement Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1799bcd to
48c64a9
Compare
…ns (#1091) * refactor(imports): use direct subpath imports in web AI, integrations, workflows Replaces barrel imports in the AI and integration subsystem of apps/web: - apps/web/src/app/api/ai/** (routes + tests) - apps/web/src/lib/ai/** (source + tests) - apps/web/src/app/api/agents/** - apps/web/src/app/api/integrations/** - apps/web/src/lib/integrations/** - apps/web/src/lib/mcp/** - apps/web/src/lib/memory/** - apps/web/src/lib/workflows/** Part of the barrel-import removal series — PR D of 6. Depends on barrel/foundation (#1088) being merged first. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(web-ai): import logger from logging/logger not logging/logger-config logger-config exports loggers (plural) helpers; the root logger instance lives in logging/logger. Use the direct module for clarity. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(web-ai): resolve mock/source mismatches + add missing semicolons Test correctness fixes: - mcp-scope.test.ts: fix malformed logger mock (logger was nested inside child() return instead of exported at module top level) - agents/integrations/__tests__/route.test.ts: move createGrant and findGrant from barrel mock to grant-repository subpath mock — source imports from /repositories/grant-repository, not @pagespace/lib/integrations - ollama/models/__tests__/route.test.ts: update validateLocalProviderURL mock path from @pagespace/lib/security to /security/url-validator - calendar-write-tools.test.ts: update isUserDriveMember import from @pagespace/lib barrel to /permissions/permissions to match the mock path - page-read-tools.test.ts: remove dead @pagespace/lib/server mock stubs for isChannelPage, formatContentForAI etc. — source no longer imports these from that path Style: add missing trailing semicolons to 74 @pagespace/lib subpath import statements across 45 source files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(web-ai): resolve 4 remaining mock/source mismatches from review - mcp-bridge.test.ts: mock @pagespace/lib/logging/logger not logger-config; source imports logger from /logging/logger, these are different modules - page-read-tools.test.ts: mock getPageTypeEmoji/isFolderPage not isDocumentPage/isAIChatPage/getCreatablePageTypes; wrong fn names carried over from barrel mock, actual imports are the emoji/folder helpers - agent-tools.test.ts: add missing semicolon on import statement - page-write-tools.test.ts: add missing semicolon on import statement Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Replaces barrel imports with direct subpath imports across the AI and integrations subsystem of apps/web:
115 files total — all mechanical import-path swaps. No logic changes.
Context
PR D of 6 in the barrel-import removal series.
Base branch is `barrel/foundation` so CI resolves the new subpath exports.
After A merges, this PR's base will be updated to `master`.
PRs B, C, D, E1, E2 are independent of each other and can be reviewed/merged in any order after A lands.
Why AI is grouped together
AI tools, integrations, MCP, and workflows form a coherent subsystem. Grouping them lets reviewers verify the tool-call chain, integration OAuth flows, and workflow triggers as a unit.
Review fixes applied (post-review commits)
Two review passes found a total of 9 mock/source mismatches — all fixed:
Pass 1 fixes (
34f82b9):mcp-scope.test.ts— malformed logger mock:loggerwas embedded insidechild()return value instead of exported at the module top levelagents/integrations/__tests__/route.test.ts—createGrant/findGrantstill mocked at the barrel; moved togrant-repositorysubpath mock to match source importsollama/models/__tests__/route.test.ts—validateLocalProviderURLmock path not updated from@pagespace/lib/securityto/security/url-validatorcalendar-write-tools.test.ts— mock path updated but import statement left pointing at barrel@pagespace/libpage-read-tools.test.ts— dead@pagespace/lib/serverstubs removed (source no longer imports from that path)Also added 74 missing trailing semicolons to subpath import statements across 45 source files.
Pass 2 fixes (
1799bcd):6.
mcp-bridge.test.ts— mock path was/logging/logger-configbut source imports from/logging/logger; these are different modules (logger= root Winston instance,loggers= named namespaces)7.
page-read-tools.test.ts—/content/page-types.configmock had wrong function names (isDocumentPage,isAIChatPage,getCreatablePageTypes) carried over from old barrel mock; source usesgetPageTypeEmojiandisFolderPage8.
agent-tools.test.ts— missing semicolon on import statement9.
page-write-tools.test.ts— missing semicolon on import statement