[agent/claude:opus] DX audit and fix (TypeScript package). 1) Review CLAUDE.md �... #1
8 changed files with 15 additions and 18 deletions
|
|
@ -57,7 +57,7 @@ All Go code lives in a single `ts` package (no subpackages).
|
|||
- **UK English** in docs and comments (colour, organisation)
|
||||
- **Error wrapping:** `fmt.Errorf("coredeno: <context>: %w", err)`
|
||||
- **Test naming:** `_Good`, `_Bad`, `_Ugly` suffixes for test functions
|
||||
- **Thread safety:** `Sidecar` and `DenoClient` use `sync.RWMutex`
|
||||
- **Thread safety:** `Sidecar` uses `sync.RWMutex`; `DenoClient` uses `sync.Mutex`
|
||||
- **Security model:** Empty permission lists deny all access; reserved store namespaces (prefixed `_`) blocked from modules; path matching uses boundary checks to prevent `"data"` matching `"data-secrets"`
|
||||
|
||||
## Testing
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ type Options struct {
|
|||
DenoSocketPath string // Unix socket path for Deno's gRPC server (DenoService)
|
||||
AppRoot string // app root directory (sandboxed I/O)
|
||||
StoreDBPath string // SQLite DB path (default: AppRoot/.core/store.db)
|
||||
PublicKey ed25519.PublicKey // ed25519 public key for manifest verification (optional)
|
||||
PublicKey ed25519.PublicKey // ed25519 public key for manifest verification (optional)
|
||||
SidecarArgs []string // args passed to the sidecar process
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,18 +10,15 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
pb "forge.lthn.ai/core/ts/proto"
|
||||
core "forge.lthn.ai/core/go/pkg/core"
|
||||
"forge.lthn.ai/core/go-scm/marketplace"
|
||||
core "forge.lthn.ai/core/go/pkg/core"
|
||||
pb "forge.lthn.ai/core/ts/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
|
||||
// unused import guard
|
||||
var _ = pb.NewCoreServiceClient
|
||||
|
||||
func findDeno(t *testing.T) string {
|
||||
t.Helper()
|
||||
denoPath, err := exec.LookPath("deno")
|
||||
|
|
@ -38,7 +35,7 @@ func findDeno(t *testing.T) string {
|
|||
// runtimeEntryPoint returns the absolute path to runtime/main.ts.
|
||||
func runtimeEntryPoint(t *testing.T) string {
|
||||
t.Helper()
|
||||
// We're in pkg/coredeno/ during test, runtime is a subdir
|
||||
// runtime/ is a subdir of the package root
|
||||
abs, err := filepath.Abs("runtime/main.ts")
|
||||
require.NoError(t, err)
|
||||
require.FileExists(t, abs)
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
pb "forge.lthn.ai/core/ts/proto"
|
||||
io "forge.lthn.ai/core/go-io"
|
||||
"forge.lthn.ai/core/go-io/store"
|
||||
pb "forge.lthn.ai/core/ts/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/grpc"
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
pb "forge.lthn.ai/core/ts/proto"
|
||||
io "forge.lthn.ai/core/go-io"
|
||||
"forge.lthn.ai/core/go-scm/manifest"
|
||||
"forge.lthn.ai/core/go-io/store"
|
||||
"forge.lthn.ai/core/go-scm/manifest"
|
||||
pb "forge.lthn.ai/core/ts/proto"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
pb "forge.lthn.ai/core/ts/proto"
|
||||
io "forge.lthn.ai/core/go-io"
|
||||
"forge.lthn.ai/core/go-scm/manifest"
|
||||
"forge.lthn.ai/core/go-io/store"
|
||||
"forge.lthn.ai/core/go-scm/manifest"
|
||||
pb "forge.lthn.ai/core/ts/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/grpc/codes"
|
||||
|
|
@ -163,7 +163,7 @@ func TestProcessStart_Bad_PermissionDenied(t *testing.T) {
|
|||
func TestProcessStart_Bad_NoProcessService(t *testing.T) {
|
||||
srv := newTestServer(t)
|
||||
srv.RegisterModule(&manifest.Manifest{
|
||||
Code: "no-proc-mod",
|
||||
Code: "no-proc-mod",
|
||||
Permissions: manifest.Permissions{Run: []string{"echo"}},
|
||||
})
|
||||
_, err := srv.ProcessStart(context.Background(), &pb.ProcessStartRequest{
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
core "forge.lthn.ai/core/go/pkg/core"
|
||||
io "forge.lthn.ai/core/go-io"
|
||||
"forge.lthn.ai/core/go-io/store"
|
||||
"forge.lthn.ai/core/go-scm/manifest"
|
||||
"forge.lthn.ai/core/go-scm/marketplace"
|
||||
"forge.lthn.ai/core/go-io/store"
|
||||
core "forge.lthn.ai/core/go/pkg/core"
|
||||
)
|
||||
|
||||
// Service wraps the CoreDeno sidecar as a framework service.
|
||||
|
|
@ -134,7 +134,7 @@ func (s *Service) OnStartup(ctx context.Context) error {
|
|||
// 8. Create installer and auto-load installed modules
|
||||
if opts.AppRoot != "" {
|
||||
modulesDir := filepath.Join(opts.AppRoot, "modules")
|
||||
s.installer = marketplace.NewInstaller(modulesDir, s.store)
|
||||
s.installer = marketplace.NewInstaller(medium, modulesDir, s.store)
|
||||
|
||||
if s.denoClient != nil {
|
||||
installed, listErr := s.installer.Installed()
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
pb "forge.lthn.ai/core/ts/proto"
|
||||
core "forge.lthn.ai/core/go/pkg/core"
|
||||
pb "forge.lthn.ai/core/ts/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/grpc"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue