Skip to content

Commit 00ae002

Browse files
committed
fix(quality-scan): remove socket-btm cross-project references
- Replace socket-btm monorepo examples with socket-registry monorepo examples - Update test file paths to packages/npm/*/test and registry/lib - Replace binpress/binflate/binject with npm override package examples - Update documentation examples to match socket-registry structure - Remove build system examples specific to socket-btm - Add registry-appropriate override and package management examples
1 parent 75fdcf0 commit 00ae002

1 file changed

Lines changed: 125 additions & 129 deletions

File tree

.claude/skills/quality-scan/reference.md

Lines changed: 125 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Common characteristics to look for:
5555
5656
<instructions>
5757
Scan all code files for these critical bug patterns:
58-
- [IF monorepo] TypeScript/JavaScript: packages/*/scripts/**/*.{mjs,mts}, packages/*/src/**/*.{mjs,mts}
58+
- [IF monorepo] TypeScript/JavaScript: packages/npm/*/scripts/**/*.{mjs,mts}, registry/lib/**/*.js, scripts/**/*.{mjs,mts}
5959
- [IF single package] TypeScript/JavaScript: src/**/*.{ts,mts,mjs,js}, lib/**/*.{ts,mts,mjs,js}
6060
- [IF C/C++ code exists] C/C++: src/**/*.{c,cc,cpp,h}
6161
- Focus on:
@@ -178,13 +178,13 @@ beforeAll(async () => {
178178
})
179179
```
180180

181-
**[SOCKET-BTM SPECIFIC] Where to check:**
182-
- packages/binpress/test/*.test.mts
183-
- packages/binflate/test/*.test.mts
184-
- packages/binject/test/*.test.mts
185-
- Any test that uses `BINPRESS`, `BINFLATE`, or `BINJECT` as compression input
181+
**Where to check:**
182+
- packages/npm/*/test/*.test.mts
183+
- test/**/*.test.js
184+
- test/**/*.test.mts
185+
- Any test that uses external package managers or performs heavy I/O operations
186186

187-
**Impact:** Tests using binsuite tools as input cause Linux CI timeouts (180-360 seconds)
187+
**Impact:** Tests performing intensive npm operations can cause CI timeouts
188188
</pattern>
189189

190190
For each bug found, think through:
@@ -427,17 +427,15 @@ Your task is to analyze caching implementation for correctness, staleness bugs,
427427
<context>
428428
**[SOCKET-BTM SPECIFIC - Adapt for your repository's caching strategy]**
429429

430-
socket-btm uses a multi-stage checkpoint system to speed up builds:
431-
- **Checkpoint stages**: source-copied, source-patched, configured, compiled, stripped, compressed, final
432-
- **Storage**: tar.gz archives stored in build/checkpoints/{platform}-{arch}/
433-
- **Invalidation**: Based on cache keys (hashes of patches, config, source version)
434-
- **Progressive builds**: Can restore from any checkpoint and continue
435-
- **Cross-platform**: Must work on Windows, macOS, Linux (ARM64, x64)
436-
- **Critical**: Stale checkpoints cause incorrect builds that are hard to debug
437-
438-
Caching locations:
439-
- packages/node-smol-builder/scripts/common/shared/checkpoints.mjs
440-
- packages/node-smol-builder/build/checkpoints/
430+
This project uses caching for npm package overrides and registry data:
431+
- **Storage**: Package override caching in packages/npm/*
432+
- **Invalidation**: Based on package versions and registry URLs
433+
- **Cross-platform**: Must work on Windows, macOS, Linux
434+
- **Critical**: Stale cache can cause incorrect package resolution
435+
436+
Caching locations (if applicable):
437+
- registry/lib/ - Registry interaction caching
438+
- Build cache for overrides
441439
- Cache key generation and validation logic
442440
</context>
443441

@@ -463,10 +461,8 @@ Checkpoint key generation correctness:
463461
- Additions: Are build-infra/binject changes invalidating checkpoints?
464462
- Environment: Are env vars (NODE_OPTIONS, etc.) affecting builds included?
465463

466-
**[SOCKET-BTM SPECIFIC]** NOTE: SOURCE_PATCHED and SOURCE_COPIED checkpoints intentionally omit platform/arch/libc
467-
because source patching is platform-agnostic - the same patches apply regardless of
468-
target platform. Only binary compilation stages (COMPILED, STRIPPED, COMPRESSED, FINALIZED)
469-
need platform-specific cache keys. Do NOT flag this as an issue.
464+
**NOTE**: Platform-agnostic operations (npm package parsing) may share cache keys across platforms,
465+
while platform-specific operations (binary builds) should include platform/arch in cache keys.
470466
</pattern>
471467

472468
<pattern name="checkpoint_corruption">
@@ -515,7 +511,7 @@ Think through each issue:
515511
<output_format>
516512
For each finding, report:
517513

518-
File: packages/node-smol-builder/scripts/common/shared/checkpoints.mjs:lineNumber
514+
File: registry/lib/cache-module.js:lineNumber
519515
Issue: [One-line description]
520516
Severity: High | Medium
521517
Scenario: [Step-by-step sequence showing how bug manifests]
@@ -524,8 +520,8 @@ Fix: [Specific code change]
524520
Impact: [Observable effect - wrong output, performance, crash]
525521

526522
Example:
527-
File: packages/node-smol-builder/scripts/common/shared/checkpoints.mjs:145
528-
Issue: Cache key missing patch content hashes
523+
File: registry/lib/cache-module.js:145
524+
Issue: Cache key missing package version hashes
529525
Severity: High
530526
Scenario: 1) Build with patch v1, creates checkpoint. 2) Patch file modified to v2 (same filename). 3) Build restores v1 checkpoint. 4) Produces binary with v1 patches but v2 expected
531527
Pattern: `const cacheKey = \`\${nodeVersion}-\${platform}-\${arch}\``
@@ -558,7 +554,7 @@ Your task is to identify issues in socket-btm's development workflows, build scr
558554

559555
<context>
560556
socket-btm is a pnpm monorepo with:
561-
- **Build scripts**: packages/*/scripts/**/*.{mjs,mts} (ESM, cross-platform Node.js)
557+
- **Build scripts**: scripts/**/*.{mjs,mts} (ESM, cross-platform Node.js)
562558
- **Package manager**: pnpm workspaces with scripts in each package.json
563559
- **Git hooks**: .git-hooks/* for pre-commit, pre-push validation
564560
- **CI**: GitHub Actions (.github/workflows/)
@@ -716,8 +712,8 @@ buildBinSuitePackage({
716712
- Fix: Use bin-infra/lib/builder for consistent behavior
717713

718714
**Check these files:**
719-
- packages/*/scripts/build.mjs - Must use buildBinSuitePackage
720-
- packages/*/Makefile.* - Should not be invoked directly (only via build.mjs)
715+
- scripts/build.mjs - Build orchestration for overrides
716+
- packages/npm/*/package.json - Override package definitions
721717
- README.md files - Should document `pnpm run build`, not direct make
722718
</pattern>
723719

@@ -1453,87 +1449,87 @@ Severity Guidelines:
14531449
- Low: Minor inaccuracies or missing non-critical information
14541450

14551451
Example:
1456-
File: packages/binject/README.md:46
1457-
Issue: Incorrect description of NODE_SEA section compression format
1452+
File: packages/npm/lodash/README.md:46
1453+
Issue: Incorrect override version documented
14581454
Severity: High
1459-
Pattern: "NODE_SEA - Compressed application code (Brotli, ~70-80% reduction)"
1460-
Actual: NODE_SEA contains uncompressed blobs generated by Node.js itself, not Brotli-compressed data
1461-
Fix: Change to: "NODE_SEA - Single Executable Application code (generated by Node.js)"
1462-
Impact: Misleads developers about the actual format, causing confusion when inspecting binaries
1455+
Pattern: "Overrides lodash 4.17.20"
1456+
Actual: Override targets 4.17.21 (verified in package.json)
1457+
Fix: Change to: "Overrides lodash 4.17.21"
1458+
Impact: Misleads developers about which version is overridden
14631459

14641460
Example:
14651461
File: README.md:25
1466-
Issue: Incorrect package name in build command
1462+
Issue: Incorrect command for creating override
14671463
Severity: High
1468-
Pattern: "pnpm --filter @socketbin/node-smol-builder run build"
1469-
Actual: package.json shows "name": "node-smol-builder" without @socketbin scope
1470-
Fix: Change to: "pnpm --filter node-smol-builder run build"
1471-
Impact: Command will fail with "No projects matched" error
1464+
Pattern: "pnpm run make-override lodash"
1465+
Actual: Script is "make-npm-override" not "make-override"
1466+
Fix: Change to: "pnpm run make-npm-override lodash"
1467+
Impact: Command will fail with script not found error
14721468

14731469
Example:
1474-
File: packages/build-infra/README.md:14
1475-
Issue: References non-existent module name
1470+
File: README.md:14
1471+
Issue: References non-existent registry/lib export
14761472
Severity: Medium
1477-
Pattern: "paths - Standard directory structure"
1478-
Actual: Module is exported as "path-builder" in package.json exports
1479-
Fix: Change to: "path-builder - Standard directory structure"
1480-
Impact: Developers looking for "paths" module will not find it
1473+
Pattern: "import { getPackage } from '@socketsecurity/registry/lib/packages'"
1474+
Actual: Export is named "readPackageJson" not "getPackage"
1475+
Fix: Change to: "import { readPackageJson } from '@socketsecurity/registry/lib/packages'"
1476+
Impact: Import will fail with module not found error
14811477

14821478
Example:
1483-
File: packages/binject/README.md:227
1484-
Issue: Incorrect config size documented
1479+
File: README.md:87
1480+
Issue: Incorrect npm override count
14851481
Severity: Low
1486-
Pattern: "Config stored in binary format (1112 bytes)"
1487-
Actual: Config is 1176 bytes (verified in source code)
1488-
Fix: Change to: "Config stored in binary format (1176 bytes)"
1489-
Impact: Minor inaccuracy in technical specification
1482+
Pattern: "Provides 50+ npm overrides"
1483+
Actual: Only 30 override packages in packages/npm/ (verified by ls)
1484+
Fix: Change to: "Provides 30+ npm overrides"
1485+
Impact: Minor inaccuracy in package count
14901486

14911487
**Junior Developer Friendliness Examples:**
14921488

14931489
Example:
14941490
File: README.md:1-50
14951491
Issue: Missing beginner-friendly introduction explaining project purpose
14961492
Severity: High
1497-
Pattern: Jumps directly to technical architecture without explaining what socket-btm is or why it exists
1498-
Actual: Junior devs need context: "What is BTM?", "Why custom Node.js?", "When would I use this?"
1499-
Fix: Add "What is Socket BTM?" section explaining: (1) Custom Node.js with Socket Security patches, (2) Minimal builds for production, (3) Use cases (CLI tools, serverless, containers)
1500-
Impact: Junior devs confused about project purpose, may not understand if they need it
1493+
Pattern: Jumps directly to technical details without explaining what socket-registry is
1494+
Actual: Junior devs need context: "What is socket-registry?", "What are overrides?", "When would I use this?"
1495+
Fix: Add "What is Socket Registry?" section explaining: (1) Enhanced npm packages with security fixes, (2) Drop-in replacements for vulnerable packages, (3) Use cases (projects needing secure dependencies)
1496+
Impact: Junior devs confused about project purpose
15011497

15021498
Example:
1503-
File: packages/binject/README.md:15
1504-
Issue: Assumes knowledge of Node.js SEA without explanation
1499+
File: README.md:15
1500+
Issue: Assumes knowledge of npm overrides without explanation
15051501
Severity: Medium
1506-
Pattern: "Injects SEA blobs into Node.js binaries"
1507-
Actual: Junior devs don't know what SEA is or why injection is needed
1508-
Fix: Add: "Single Executable Application (SEA) - bundles your app into a standalone binary. binject handles the low-level binary manipulation to embed your code into Node.js executables."
1509-
Impact: Technical jargon barrier prevents junior devs from understanding tool purpose
1502+
Pattern: "Uses pnpm overrides to replace packages"
1503+
Actual: Junior devs don't know what overrides are or how they work
1504+
Fix: Add: "npm overrides - replaces dependencies with enhanced versions automatically. Socket Registry provides secure, enhanced packages that work as drop-in replacements."
1505+
Impact: Technical jargon barrier prevents junior devs from understanding
15101506

15111507
Example:
1512-
File: packages/node-smol-builder/README.md:80
1513-
Issue: No troubleshooting section for common build errors
1508+
File: README.md:80
1509+
Issue: No troubleshooting section for override conflicts
15141510
Severity: Medium
1515-
Pattern: Documentation shows happy path but no error handling guidance
1516-
Actual: Junior devs hit errors like "Patch failed to apply" or "Checkpoint extraction failed" with no guidance
1517-
Fix: Add "Troubleshooting" section covering: (1) Patch application failures → check upstream version, (2) Checkpoint errorsrun clean, (3) Build timeoutsincrease TIMEOUT_MS
1518-
Impact: Junior devs stuck when errors occur, need hand-holding for common issues
1511+
Pattern: Documentation shows happy path but no conflict resolution guidance
1512+
Actual: Junior devs hit errors like "Version conflict" or "Peer dependency mismatch" with no guidance
1513+
Fix: Add "Troubleshooting" section covering: (1) Version conflicts → check semver ranges, (2) Peer dependenciesverify compatibility, (3) Install failuresclear cache
1514+
Impact: Junior devs stuck when override errors occur
15191515

15201516
Example:
15211517
File: CLAUDE.md:125
1522-
Issue: Complex "Source of Truth Architecture" without visual diagram or simple explanation
1518+
Issue: Complex registry architecture without visual diagram
15231519
Severity: Medium
1524-
Pattern: Dense text explaining package relationships and sync direction
1525-
Actual: Junior devs need visual representation and concrete examples to understand data flow
1526-
Fix: Add ASCII diagram showing: packages/build-infra → additions/source-patched (one-way sync), plus example: "When you fix a bug in build-infra/debug_common.h, you must sync it to node-smol-builder/additions/"
1527-
Impact: Junior contributors may edit wrong files, creating wasted work
1520+
Pattern: Dense text explaining registry/lib and packages/npm structure
1521+
Actual: Junior devs need visual representation of registry workflow
1522+
Fix: Add ASCII diagram showing: npm install → registry check → override lookup → enhanced package, plus example: "When you install lodash, registry redirects to packages/npm/lodash"
1523+
Impact: Junior contributors may not understand override flow
15281524

15291525
Example:
1530-
File: packages/binpress/README.md:1-100
1526+
File: README.md:1-100
15311527
Issue: Missing "Getting Started" section with minimal working example
15321528
Severity: High
1533-
Pattern: Extensive API documentation but no simple end-to-end example
1534-
Actual: Junior devs need: "How do I compress my first binary? Step 1, Step 2, Step 3"
1535-
Fix: Add "Quick Start" section: "(1) Build binpress: pnpm run build, (2) Compress a binary: ./build/dev/out/Final/binpress input.exe output.exe, (3) Verify: ls -lh output.exe"
1536-
Impact: Without concrete starting point, juniors struggle to use tool effectively
1529+
Pattern: Extensive documentation but no simple setup example
1530+
Actual: Junior devs need: "How do I use an override? Step 1, Step 2, Step 3"
1531+
Fix: Add "Quick Start" section: "(1) Install: npm install @socketsecurity/registry, (2) Add to package.json: pnpm.overrides section, (3) Install dependencies: pnpm install"
1532+
Impact: Without concrete starting point, juniors struggle to use overrides
15371533
</output_format>
15381534

15391535
<quality_guidelines>
@@ -1560,63 +1556,63 @@ Scan all README.md files in the repository and report all documentation inaccura
15601556
### High Severity - 3 issues
15611557

15621558
#### README.md:25
1563-
- **Issue**: Incorrect package name in build command
1564-
- **Pattern**: `pnpm --filter @socketbin/node-smol-builder run build`
1565-
- **Actual**: package.json shows `"name": "node-smol-builder"` without scope
1566-
- **Fix**: Change to: `pnpm --filter node-smol-builder run build`
1567-
- **Impact**: Command fails with "No projects matched" error
1568-
1569-
#### packages/binject/README.md:100
1570-
- **Issue**: Documents obsolete --update-config flag
1571-
- **Pattern**: `binject inject -e ./node-smol -o ./my-app --sea app.blob --update-config update-config.json`
1572-
- **Actual**: Flag was removed, config now embedded via sea-config.json smol.update section
1573-
- **Fix**: Remove --update-config example, document sea-config.json approach instead
1574-
- **Impact**: Users will get "unknown flag" error, approach no longer works
1575-
1576-
#### packages/build-infra/README.md:12
1577-
- **Issue**: Documents non-existent "c-package" builder
1578-
- **Pattern**: "*-builder - Build strategies (cmake, rust, emscripten, c-package)"
1579-
- **Actual**: No c-package-builder.mjs exists; actual builders are: cmake, rust, emscripten, docker, clean
1580-
- **Fix**: List actual builders: "cmake, rust, emscripten, docker, clean"
1581-
- **Impact**: Users looking for c-package builder will be confused
1559+
- **Issue**: Incorrect script name for creating overrides
1560+
- **Pattern**: `pnpm run make-override lodash`
1561+
- **Actual**: Script is "make-npm-override" not "make-override"
1562+
- **Fix**: Change to: `pnpm run make-npm-override lodash`
1563+
- **Impact**: Command fails with script not found error
1564+
1565+
#### packages/npm/lodash/README.md:100
1566+
- **Issue**: Documents incorrect override version
1567+
- **Pattern**: `Overrides lodash 4.17.20`
1568+
- **Actual**: Package targets 4.17.21 (verified in package.json)
1569+
- **Fix**: Update to: `Overrides lodash 4.17.21`
1570+
- **Impact**: Users confused about which version is overridden
1571+
1572+
#### README.md:12
1573+
- **Issue**: Documents non-existent registry/lib export
1574+
- **Pattern**: `import { getPackage } from '@socketsecurity/registry/lib/packages'`
1575+
- **Actual**: Export is named "readPackageJson" not "getPackage"
1576+
- **Fix**: Change to: `import { readPackageJson } from '@socketsecurity/registry/lib/packages'`
1577+
- **Impact**: Import fails with module not found error
15821578

15831579
### Medium Severity - 3 issues
15841580

1585-
#### packages/binject/README.md:62
1586-
- **Issue**: Output path missing build mode variants
1587-
- **Pattern**: "Outputs to `build/prod/out/Final/binject`"
1588-
- **Actual**: Build system supports both dev and prod modes: `build/{dev|prod}/out/Final/binject`
1589-
- **Fix**: Change to: "Outputs to `build/{dev|prod}/out/Final/binject`"
1590-
- **Impact**: Confusing for developers doing dev builds
1591-
1592-
#### packages/node-smol-builder/README.md:182
1593-
- **Issue**: Incorrect patch count
1594-
- **Pattern**: "Applies 15 patches to Node.js source"
1595-
- **Actual**: Only 12 patches in patches/source-patched/ directory
1596-
- **Fix**: Change to: "Applies 12 patches to Node.js source"
1597-
- **Impact**: Minor discrepancy in technical details
1598-
1599-
#### packages/bin-infra/README.md:1-21
1600-
- **Issue**: Missing 75% of package contents in documentation
1601-
- **Pattern**: Only documents src/ and make/, omits lib/, test/, scripts/, upstream/, patches/
1602-
- **Actual**: Package has extensive JavaScript API (lib/), test utilities, build scripts, and upstream dependencies
1603-
- **Fix**: Add comprehensive documentation of all 17 C files, 3 JS modules with API examples, test helpers, scripts, and upstream submodules
1604-
- **Impact**: Developers unaware of most package functionality
1581+
#### README.md:62
1582+
- **Issue**: Incorrect override installation command
1583+
- **Pattern**: "Add to dependencies section"
1584+
- **Actual**: Overrides go in pnpm.overrides section, not dependencies
1585+
- **Fix**: Change to: "Add to pnpm.overrides section in package.json"
1586+
- **Impact**: Confusing installation process for developers
1587+
1588+
#### README.md:182
1589+
- **Issue**: Incorrect override count
1590+
- **Pattern**: "Provides 50+ npm overrides"
1591+
- **Actual**: Only 30 packages in packages/npm/ directory
1592+
- **Fix**: Change to: "Provides 30+ npm overrides"
1593+
- **Impact**: Minor discrepancy in package count
1594+
1595+
#### README.md:1-21
1596+
- **Issue**: Missing 75% of override packages in documentation
1597+
- **Pattern**: Only documents lodash and react, omits 28 other overrides
1598+
- **Actual**: Registry has overrides for webpack, typescript, babel, and many others
1599+
- **Fix**: Add comprehensive list of all override packages with descriptions
1600+
- **Impact**: Developers unaware of most available overrides
16051601

16061602
### Low Severity - 2 issues
16071603

1608-
#### packages/binject/README.md:227
1609-
- **Issue**: Incorrect config size
1610-
- **Pattern**: "1112 bytes"
1611-
- **Actual**: Config is 1176 bytes (verified in source)
1612-
- **Fix**: Change all occurrences to: "1176 bytes"
1613-
- **Impact**: Minor technical inaccuracy
1614-
1615-
#### packages/binflate/README.md:18
1616-
- **Issue**: Claims caching functionality
1617-
- **Pattern**: "Uses cache at ~/.socket/_dlx/"
1618-
- **Actual**: binflate only extracts; self-extracting stubs (not binflate) implement caching
1619-
- **Fix**: Clarify that binflate extracts only, stubs handle caching
1620-
- **Impact**: Confusion about which component caches
1604+
#### README.md:227
1605+
- **Issue**: Incorrect registry URL
1606+
- **Pattern**: "https://registry.socket.dev/"
1607+
- **Actual**: Registry is at https://socket.dev/npm (verified in source)
1608+
- **Fix**: Change to: "https://socket.dev/npm"
1609+
- **Impact**: Minor URL inaccuracy
1610+
1611+
#### README.md:18
1612+
- **Issue**: Claims automatic override activation
1613+
- **Pattern**: "Overrides automatically apply after install"
1614+
- **Actual**: Requires pnpm.overrides configuration; not automatic
1615+
- **Fix**: Clarify that overrides require pnpm.overrides configuration
1616+
- **Impact**: Confusion about override activation process
16211617
```
16221618

0 commit comments

Comments
 (0)