Repository navigation
refactor(server-core): remove vault module and robot sync service - #2978
Conversation
📝 WalkthroughWalkthroughThis PR removes the Vault module and Robot synchronization service from the application, including all related configuration parsing, dependency injection wiring, and controller integration. The changes span the application builder, configuration system, service layer, and robot controller. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/server-core/src/adapters/http/controllers/entities/robot/module.ts (1)
176-179:⚠️ Potential issue | 🟠 MajorTreat
/robots/:id/integrityremoval as a breaking API change.Deleting this handler changes the public HTTP surface, not just internal wiring. Please land the matching spec/client/release-note update with the same rollout; otherwise existing callers will only discover the change through 404s.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/server-core/src/adapters/http/controllers/entities/robot/module.ts` around lines 176 - 179, The DELETE handler for the '/robots/:id/integrity' endpoint was removed from the Robot module (the route method annotated for '/:id/integrity' / the DDelete handler), which is a breaking public API change; either restore the endpoint or, if intentionally removed, update the OpenAPI spec/client SDK and add a release-note and coordinated rollout entry so consumers don't hit unexpected 404s. Locate the removed route handler (the DDelete '/:id/integrity' method in the Robot controller) and either re-add it or modify the API spec, regenerate the client, add integration tests verifying the change, and add a clear release-note/deprecation plan to the release process so the change lands atomically with the code.
🧹 Nitpick comments (1)
apps/server-core/src/adapters/http/controllers/entities/robot/module.ts (1)
85-95: Plan decommission cleanup for already-synced robot credentials.These write paths now only mutate the primary store. If older releases have already pushed robot secrets into Vault or another sync target, updates stop propagating and deletes stop cleaning those copies up after this rollout.
Also applies to: 179-230
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/server-core/src/adapters/http/controllers/entities/robot/module.ts` around lines 85 - 95, The add/update/delete write paths (e.g., controller method add calling this.service.save, and similar handlers around lines 179-230) only mutate the primary store but must also remove or reconcile any previously-synced robot credentials in external sync targets (Vault, etc.) from older releases; modify the controller/service flow so that after save/update/delete you invoke the existing cleanup/sync routine (or add one) to locate and purge legacy secrets from external targets (callable from the controller after buildActorContext and after this.service.save/this.service.delete), ensure the cleanup is idempotent and runs async or as a background job if long-running, and surface/log failures via processLogger or the request logger so missed remote copies can be retried.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/server-core/src/adapters/http/controllers/entities/robot/module.ts`:
- Around line 176-179: The DELETE handler for the '/robots/:id/integrity'
endpoint was removed from the Robot module (the route method annotated for
'/:id/integrity' / the DDelete handler), which is a breaking public API change;
either restore the endpoint or, if intentionally removed, update the OpenAPI
spec/client SDK and add a release-note and coordinated rollout entry so
consumers don't hit unexpected 404s. Locate the removed route handler (the
DDelete '/:id/integrity' method in the Robot controller) and either re-add it or
modify the API spec, regenerate the client, add integration tests verifying the
change, and add a clear release-note/deprecation plan to the release process so
the change lands atomically with the code.
---
Nitpick comments:
In `@apps/server-core/src/adapters/http/controllers/entities/robot/module.ts`:
- Around line 85-95: The add/update/delete write paths (e.g., controller method
add calling this.service.save, and similar handlers around lines 179-230) only
mutate the primary store but must also remove or reconcile any previously-synced
robot credentials in external sync targets (Vault, etc.) from older releases;
modify the controller/service flow so that after save/update/delete you invoke
the existing cleanup/sync routine (or add one) to locate and purge legacy
secrets from external targets (callable from the controller after
buildActorContext and after this.service.save/this.service.delete), ensure the
cleanup is idempotent and runs async or as a background job if long-running, and
surface/log failures via processLogger or the request logger so missed remote
copies can be retried.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2cb92df8-2b05-4146-8985-0dac59ad8c0d
📒 Files selected for processing (19)
apps/server-core/src/adapters/http/controllers/entities/robot/module.tsapps/server-core/src/app/builder.tsapps/server-core/src/app/factory.tsapps/server-core/src/app/modules/config/constants.tsapps/server-core/src/app/modules/config/normalize.tsapps/server-core/src/app/modules/config/parse.tsapps/server-core/src/app/modules/config/read/env.tsapps/server-core/src/app/modules/config/read/fs.tsapps/server-core/src/app/modules/config/types.tsapps/server-core/src/app/modules/constants.tsapps/server-core/src/app/modules/index.tsapps/server-core/src/app/modules/vault/constants.tsapps/server-core/src/app/modules/vault/index.tsapps/server-core/src/app/modules/vault/module.tsapps/server-core/src/index.tsapps/server-core/src/services/index.tsapps/server-core/src/services/robot-synchronization/index.tsapps/server-core/src/services/robot-synchronization/module.tsapps/server-core/src/services/robot-synchronization/singleton.ts
💤 Files with no reviewable changes (18)
- apps/server-core/src/app/modules/constants.ts
- apps/server-core/src/app/factory.ts
- apps/server-core/src/app/modules/index.ts
- apps/server-core/src/app/modules/config/constants.ts
- apps/server-core/src/app/modules/vault/index.ts
- apps/server-core/src/app/modules/vault/constants.ts
- apps/server-core/src/app/modules/config/normalize.ts
- apps/server-core/src/app/modules/config/types.ts
- apps/server-core/src/app/modules/config/read/env.ts
- apps/server-core/src/services/robot-synchronization/index.ts
- apps/server-core/src/app/modules/config/read/fs.ts
- apps/server-core/src/services/index.ts
- apps/server-core/src/index.ts
- apps/server-core/src/app/modules/config/parse.ts
- apps/server-core/src/app/builder.ts
- apps/server-core/src/services/robot-synchronization/singleton.ts
- apps/server-core/src/services/robot-synchronization/module.ts
- apps/server-core/src/app/modules/vault/module.ts
… up review findings
Base the non-production dev-origin seeding on the parsed config env (falling back to process NODE_ENV) so normalizeConfig({ env: 'production' }) no longer widens the trusted-origin allowlist. Clarify the trustedOrigins doc comment (full origins, no path) and drop the dead config.vault assignment from the test factory (vault module removed in #2978).
…pt scheme-less hosts (#3120) * feat(server-core)!: rename additionalDomains to additionalOrigins & accept scheme-less hosts An additionalOrigins entry may now be a bare host[:port] (e.g. hub.local), which expands to both its http and https origin; entries with an explicit protocol contribute exactly that origin. normalizeConfig canonicalizes the list to bare origins (expansion + dedupe), and config validation moved from a plain zod object schema to the validup + zod ConfigValidator, making parseConfig/normalizeConfig async. ConfigModule additionally accepts a lazy config factory. BREAKING CHANGE: the config key additionalDomains and the environment variable ADDITIONAL_DOMAINS were renamed to additionalOrigins / ADDITIONAL_ORIGINS. * feat(server-core)!: rename trusted-origin config to trustedOrigins additionalOrigins / ADDITIONAL_ORIGINS becomes trustedOrigins / TRUSTED_ORIGINS — the list is the trusted first-party app-origin set, not generic extra origins. Also corrects the stale config doc comment claiming the list drives CORS (decoupled in #3117). * fix(server-core): respect supplied env for dev-origin seeding & clean up review findings Base the non-production dev-origin seeding on the parsed config env (falling back to process NODE_ENV) so normalizeConfig({ env: 'production' }) no longer widens the trusted-origin allowlist. Clarify the trustedOrigins doc comment (full origins, no path) and drop the dead config.vault assignment from the test factory (vault module removed in #2978). * fix(server-core): harden config validation per audit findings - expandToOrigins rejects non-http(s) protocols (a myapp:// entry previously contributed the literal origin "null" to the web client's redirect allowlist) - parseConfig throws on non-object input instead of silently booting a default config - ConfigValidator mounts are driven from a Record<keyof Config, ValidatorDescriptor> map, restoring compile-time exhaustiveness — an unmounted Config key now fails the build instead of being silently stripped - normalizeConfig is the single owner of trusted-origin canonicalization; getAppOrigins merges entries verbatim instead of re-expanding - an explicit port of 0 (OS-assigned) survives env reading and normalization (falsy checks replaced with undefined checks) - redis/smtp are validated as string | boolean | object instead of z.any()
Summary by CodeRabbit
/:id/integrity)