Commit 8d7bbbc
authored
chore(utils): migrate to shared random/ID utilities and add enforcement linting (#4623)
* chore(utils): migrate to shared random/ID utilities and add enforcement linting
- Replace all Math.random(), crypto.randomUUID(), crypto.randomBytes(), nanoid, and uuid usages with shared @sim/utils/random and @sim/utils/id helpers across 72 files
- Add new @sim/utils exports: deepClone, omit, filterUndefined (object), truncate (string), backoffWithJitter, parseRetryAfter (retry), getErrorMessage (errors)
- Sweep all getErrorMessage, sleep, deepClone callsites across 500+ files to use shared utilities
- Add Biome noRestrictedImports rule to catch nanoid, uuid, and crypto named imports at lint time
- Add scripts/check-utils-enforcement.ts to catch Math.random and crypto.* global property access
- Add check:utils script to package.json
* chore(utils): replace deepClone wrapper with structuredClone built-in
deepClone() was a one-line wrapper around structuredClone(), which is
universally available in Node 17+ and all modern browsers. Removing the
abstraction reduces indirection and means contributors don't need to
learn a project-specific name for a well-known built-in.
- Remove deepClone from packages/utils/src/object.ts and index.ts
- Replace all 17 call sites with structuredClone() directly
- Update check:utils script suggestion text
- Update CLAUDE.md and global.md docs
* fix(utils): add missing biome noRestrictedImports rule and correct truncate docs
- Add noRestrictedImports to biome.json under style — bans nanoid and uuid
package imports at lint time (crypto.randomUUID/randomBytes are caught by
the check:utils grep script which handles global property access)
- Correct truncate() TSDoc and parameter name: sliceLength makes it clear
that total output length is sliceLength + suffix.length, matching the
behavior all callers were already written to expect
* fix(utils): add missing getErrorMessage imports at 4 call sites
The sweep agents added getErrorMessage calls without the corresponding
import in 4 files, causing test failures. Added the missing imports.
* fix(utils): fix build errors from getErrorMessage sweep and retry.ts Turbopack issue
- Fix retry.ts cross-file import: Turbopack cannot resolve './random.js' for
internal package imports; inline the jitter crypto call directly
- Add missing getErrorMessage imports to 32 files where the sweep added calls
without the corresponding import (caught by type-check and test runs)
- Remove accidental getErrorMessage import from crowdstrike/query/route.ts
which has its own domain-specific getErrorMessage for parsing CrowdStrike's
JSON error format
- Fix use-sub-block-value.ts type error from structuredClone narrowing:
add 'as T' cast at emitValue callsite (safe — valueCopy is always a
structural copy of newValue)
* fix(tools): use toError in crowdstrike catch block instead of local getErrorMessage
The catch block was calling the local getErrorMessage function which
parses CrowdStrike API JSON responses, not JavaScript Error objects.
Use toError(error).message to correctly extract the message from a
caught value in this context.1 parent c403faf commit 8d7bbbc
534 files changed
Lines changed: 1679 additions & 1050 deletions
File tree
- .claude/rules
- apps
- realtime/src
- database
- handlers
- sim
- app
- (auth)
- login
- reset-password
- api
- a2a/serve/[agentId]
- admin/mothership
- audit-logs
- auth
- oauth/token
- sso/register
- billing/switch-plan
- chat
- manage/[id]
- copilot
- chat
- abort
- stream
- confirm
- credentials
- feedback
- training
- examples
- credential-sets/memberships
- files
- multipart
- parse
- presigned
- upload
- folders/[id]/restore
- form
- manage/[id]
- validate
- knowledge
- [id]
- documents
- [documentId]/chunks
- upsert
- restore
- search
- mothership/execute
- notifications/poll
- organizations
- providers
- fireworks/models
- ollama/models
- openrouter/models
- vllm/models
- skills/import
- speech/token
- table/[tableId]
- restore
- tools
- asana
- create-task
- update-task
- athena
- create-named-query
- get-named-query
- get-query-execution
- get-query-results
- list-named-queries
- list-query-executions
- start-query
- stop-query
- box/upload
- cloudformation
- describe-stack-drift-detection-status
- describe-stack-events
- describe-stacks
- detect-stack-drift
- get-template
- list-stack-resources
- validate-template
- confluence/upload-attachment
- crowdstrike/query
- cursor/download-artifact
- custom
- discord/send-message
- docusign
- dropbox/upload
- evernote
- copy-note
- create-notebook
- create-note
- create-tag
- delete-note
- get-notebook
- get-note
- list-notebooks
- list-tags
- search-notes
- update-note
- extend/parse
- file/manage
- github/latest-commit
- gmail
- add-label
- archive
- delete
- draft
- edit-draft
- mark-read
- mark-unread
- move
- remove-label
- send
- unarchive
- google_drive
- download
- upload
- google_vault/download-export-file
- imap/mailboxes
- jira
- add-attachment
- update
- write
- jsm
- approvals
- comments
- comment
- customers
- forms
- answers
- attach
- copy
- delete
- externalise
- get
- internalise
- issue
- reopen
- save
- structure
- submit
- templates
- organizations
- organization
- participants
- queues
- requests
- requesttypefields
- requesttypes
- request
- servicedesks
- sla
- transitions
- transition
- microsoft-dataverse/upload-file
- microsoft_excel/sheets
- microsoft_teams
- delete_chat_message
- write_channel
- write_chat
- mistral/parse
- mongodb
- delete
- execute
- insert
- introspect
- query
- update
- mysql
- delete
- execute
- insert
- introspect
- query
- update
- neo4j
- create
- delete
- execute
- introspect
- merge
- query
- update
- onedrive
- download
- upload
- onepassword
- create-item
- delete-item
- get-item
- get-vault
- list-items
- list-vaults
- replace-item
- resolve-secret
- update-item
- outlook
- copy
- delete
- draft
- mark-read
- mark-unread
- move
- send
- pipedrive/get-files
- postgresql
- delete
- execute
- insert
- introspect
- query
- update
- pulse/parse
- quiver
- image-to-svg
- text-to-svg
- rds
- delete
- execute
- insert
- introspect
- query
- update
- redis/execute
- reducto/parse
- s3
- copy-object
- delete-object
- list-objects
- put-object
- secrets_manager
- create-secret
- delete-secret
- get-secret
- list-secrets
- update-secret
- sendgrid/send-mail
- sftp
- delete
- download
- mkdir
- upload
- slack
- add-reaction
- delete-message
- download
- read-messages
- remove-reaction
- send-ephemeral
- send-message
- update-message
- smtp/send
- sqs/send
- ssh
- check-command-exists
- check-file-exists
- create-directory
- delete-file
- download-file
- execute-command
- execute-script
- get-system-info
- list-directory
- move-rename
- read-file-content
- upload-file
- write-file-content
- stagehand
- agent
- extract
- stt
- supabase/storage-upload
- telegram/send-document
- textract/parse
- tts
- unified
- twilio/get-recording
- video
- vision/analyze
- wordpress/upload
- workday
- assign-onboarding
- change-job
- create-prehire
- get-compensation
- get-organizations
- get-worker
- hire
- list-workers
- terminate
- update-worker
- zoom/get-recordings
- users/me/usage-limits
- v1
- admin/workspaces/[id]/import
- audit-logs
- [id]
- files
- knowledge/search
- workflows
- [id]
- webhooks
- agentmail
- cleanup/idempotency
- poll/[provider]
- workflows/[id]
- autolayout
- deploy
- execute
- form/status
- restore
- variables
- workspaces/[id]
- api-keys
- [keyId]
- byok-keys
- files
- [fileId]
- download
- restore
- presigned
- register
- inbox
- form/[identifier]
- resume/[workflowId]/[executionId]
- unsubscribe
- workspace/[workspaceId]
- home/hooks
- knowledge
- [id]
- components/rename-document-modal
- components
- create-base-modal
- edit-knowledge-base-modal
- hooks
- logs/components
- dashboard/components/line-chart
- logs-toolbar/components/notifications
- components/slack-channel-selector
- scheduled-tasks/components/create-schedule-modal
- settings
- components
- admin
- api-keys/components/create-api-key-modal
- byok
- custom-tools
- inbox
- integrations
- mcp
- components/mcp-server-form-modal
- secrets
- skills
- components
- subscription
- workflow-mcp-servers
- hooks
- tables
- [tableId]/components/row-modal
- components/import-csv-dialog
- w
- [workflowId]
- components
- panel/components
- deploy
- components/deploy-modal/components
- form
- general/components
- hooks
- editor/components/sub-block
- components
- combobox
- dropdown
- file-upload
- table-selector
- tool-input/components/custom-tool-modal
- hooks
- workflow-block
- hooks
- utils
- components/sidebar/hooks
- background
- blocks/blocks
- connectors
- airtable
- asana
- discord
- dropbox
- fireflies
- github
- gmail
- google-calendar
- google-drive
- google-sheets
- hubspot
- intercom
- linear
- microsoft-teams
- notion
- onedrive
- outlook
- reddit
- webflow
- wordpress
- ee/sso/components
- executor
- execution
- handlers/workflow
- utils
- hooks
- queries
- lib
- api/contracts/tools/databases
- billing
- client
- credits
- organizations
- webhooks
- copilot
- async-runs
- chat
- request
- go
- handlers
- lifecycle
- session
- tools
- handlers
- management
- server
- files
- image
- knowledge
- visualization
- workflow/edit-workflow
- vfs
- core
- config
- idempotency
- security
- utils
- data-drains/destinations
- environment
- execution
- payloads
- file-parsers
- knowledge
- connectors
- documents
- mcp
- storage
- messaging
- email
- sms
- mothership/inbox
- pptx-renderer/core
- table
- uploads
- contexts
- execution
- workspace
- utils
- webhooks
- polling
- providers
- workflows
- autolayout
- comparison
- credentials
- diff
- executor
- operations
- persistence
- schedules
- streaming
- workspaces
- providers
- anthropic
- azure-openai
- bedrock
- cerebras
- deepseek
- fireworks
- gemini
- groq
- mistral
- ollama
- openai
- openrouter
- vllm
- xai
- stores
- variables
- workflows
- registry
- workflow
- tools
- databricks
- emailbison
- gmail
- google_slides
- langsmith
- linkedin
- mistral
- openai
- parallel
- s3
- salesforce
- supabase
- tinybird
- trello
- workday
- packages
- audit/src
- db/scripts
- testing/src
- builders
- factories
- mocks
- ts-sdk/src
- utils
- src
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
42 | 48 | | |
43 | 49 | | |
44 | 50 | | |
45 | 51 | | |
46 | | - | |
47 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
51 | | - | |
| 58 | + | |
| 59 | + | |
52 | 60 | | |
53 | | - | |
54 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
55 | 64 | | |
56 | 65 | | |
57 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
14 | 21 | | |
15 | 22 | | |
16 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
207 | | - | |
| 208 | + | |
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
208 | | - | |
| 209 | + | |
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
| |||
247 | 248 | | |
248 | 249 | | |
249 | 250 | | |
250 | | - | |
| 251 | + | |
251 | 252 | | |
252 | 253 | | |
253 | 254 | | |
| |||
587 | 588 | | |
588 | 589 | | |
589 | 590 | | |
590 | | - | |
| 591 | + | |
591 | 592 | | |
592 | 593 | | |
593 | 594 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
211 | | - | |
| 212 | + | |
212 | 213 | | |
213 | 214 | | |
214 | 215 | | |
| |||
360 | 361 | | |
361 | 362 | | |
362 | 363 | | |
363 | | - | |
| 364 | + | |
364 | 365 | | |
365 | 366 | | |
366 | 367 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
198 | | - | |
| 199 | + | |
199 | 200 | | |
200 | 201 | | |
201 | 202 | | |
| |||
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
329 | | - | |
| 330 | + | |
330 | 331 | | |
331 | 332 | | |
332 | 333 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
98 | | - | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
123 | | - | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
292 | 293 | | |
293 | 294 | | |
294 | 295 | | |
295 | | - | |
296 | | - | |
| 296 | + | |
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
| 328 | + | |
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
56 | | - | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
1394 | 1395 | | |
1395 | 1396 | | |
1396 | 1397 | | |
1397 | | - | |
| 1398 | + | |
1398 | 1399 | | |
1399 | 1400 | | |
1400 | 1401 | | |
| |||
0 commit comments