Skip to content

fix: code review issues + rename files/sidecars to shards#65

Merged
greynewell merged 2 commits intomainfrom
fix/code-review-issues
Apr 8, 2026
Merged

fix: code review issues + rename files/sidecars to shards#65
greynewell merged 2 commits intomainfrom
fix/code-review-issues

Conversation

@greynewell
Copy link
Copy Markdown
Contributor

Summary

Bug fixes (from code review)

  • Critical: analyze/handler.godir was not resolved to absolute path before writing shard cache; relative "." would write to wrong location
  • Medium: daemon Ctrl+C shutdown — Clean() now runs in a goroutine with a 5s timeout to prevent hanging on large repos
  • Medium: cache.PutJSON — clean up .tmp file on rename failure to prevent accumulation
  • Low: deadcode cache key now includes MinConfidence + Limit so different option combinations don't share a cache entry
  • Low: setup/wizard hook path now prefers $PATH lookup (exec.LookPath) over os.Executable() — survives symlinks, go run, dev builds
  • Removed: dead-code UDP dial warning in hook.go (UDP net.Dial always succeeds locally — connectionless)

Rename: files/sidecars → shards

  • internal/files/internal/shards/ (package filesshards)
  • API types: SidecarIRShardIR, SidecarGraphShardGraph, SidecarDomainShardDomain, GraphFromSidecarIRGraphFromShardIR
  • API method: AnalyzeSidecarsAnalyzeShards
  • Internal: SidecarExtShardExt, SidecarFilenameShardFilename, WriteSidecarWriteShard, etc.
  • Config: Files *boolShards *bool, FilesEnabled()ShardsEnabled(), SUPERMODEL_FILESSUPERMODEL_SHARDS
  • CLI flag: --no-files--no-shards
  • Cache file: .supermodel/graph.json.supermodel/shards.json
  • All log/help strings: "sidecar" → "shard", "file mode" → "shard mode"

Note: The cache file rename (.supermodel/graph.json.supermodel/shards.json) invalidates existing local caches. Users will re-fetch on first run after upgrading.

Test plan

  • go build ./... — clean
  • go test ./... — all pass (auth failures are pre-existing)
  • supermodel watch — verify shards written next to source files
  • supermodel analyze — verify .supermodel/shards.json created
  • supermodel analyze --no-shards — verify no shard files written
  • SUPERMODEL_SHARDS=false supermodel analyze — verify shard mode disabled

🤖 Generated with Claude Code

greynewell and others added 2 commits April 8, 2026 14:39
- analyze/handler: resolve dir to absolute path before writing sidecar cache
  (relative "." would write to wrong location)
- daemon: bound Ctrl+C sidecar cleanup to 5s timeout to prevent shutdown hang
  on large repos or slow filesystems
- cache/PutJSON: clean up .tmp file on rename failure to prevent accumulation
- deadcode: include MinConfidence and Limit in cache key so different option
  combinations don't share the same cache entry
- setup/wizard: prefer $PATH lookup over os.Executable() for hook path
  (survives symlinks, go run, and dev builds)
- files/hook: remove dead-code UDP dial warning (net.Dial("udp") always
  succeeds for localhost — connectionless protocol, no listener needed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- internal/files/ → internal/shards/ (package renamed files→shards)
- api types: SidecarIR → ShardIR, SidecarGraph → ShardGraph,
  SidecarDomain → ShardDomain, SidecarSubdomain → ShardSubdomain,
  GraphFromSidecarIR → GraphFromShardIR
- api method: AnalyzeSidecars → AnalyzeShards
- internal identifiers: SidecarExt → ShardExt, SidecarFilename →
  ShardFilename, WriteSidecar → WriteShard, isSidecarFile → isShardFile,
  isSidecarPath → isShardPath
- config: Files *bool → Shards *bool, FilesEnabled() → ShardsEnabled(),
  SUPERMODEL_FILES env var → SUPERMODEL_SHARDS
- CLI flag: --no-files → --no-shards
- cache file: .supermodel/graph.json → .supermodel/shards.json
- all user-facing strings: "sidecar" → "shard", "file mode" → "shard mode"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@greynewell greynewell merged commit 98b3b5e into main Apr 8, 2026
1 check failed
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