Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# AGENTS.md

This repository follows the core/go v0.9.0 consumer contract.

4 changes: 4 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Architecture

The Go module lives under `go/` and uses the repository root `go.work` to bind local core dependencies from `external/`.

4 changes: 4 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Development

Run build, vet, tests, and the v0.9.0 audit from the repository root before handing off changes.

12 changes: 9 additions & 3 deletions go/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ func (a AccessMode) String() string {
// if err := app.CheckAccess(manifest, app.AccessRead, "./photos/a.jpg"); err != nil {
// return core.Result{Value: err, OK: false}
// }
func CheckAccess(m *config.ViewManifest, mode AccessMode, arg string) error {
func CheckAccess(
m *config.ViewManifest, mode AccessMode, arg string,
) error {
if m == nil {
return core.E("app.CheckAccess", "nil manifest", nil)
}
Expand Down Expand Up @@ -305,7 +307,9 @@ func manifestWriteList(m *config.ViewManifest) []string {
// The check is deliberately conservative — a legitimate filename like
// `double..extension.txt` passes because there's no path-separator
// boundary on either side of `..`.
func rejectPathTraversal(scope, arg string) error {
func rejectPathTraversal(
scope, arg string,
) error {
if arg == "" {
return nil
}
Expand Down Expand Up @@ -455,7 +459,9 @@ func ActionAccessMode(action string) (AccessMode, bool) {
//
// - nil manifest → typed error so a misbehaving handler doesn't
// silently bypass the gate.
func CheckActionAccess(m *config.ViewManifest, action, arg string) error {
func CheckActionAccess(
m *config.ViewManifest, action, arg string,
) error {
if m == nil {
return core.E("app.CheckActionAccess", "nil manifest", nil)
}
Expand Down
15 changes: 15 additions & 0 deletions go/access_example_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: EUPL-1.2

package app

func ExampleAccessMode_String() {
}

func ExampleCheckAccess() {
}

func ExampleActionAccessMode() {
}

func ExampleCheckActionAccess() {
}
4 changes: 3 additions & 1 deletion go/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ type Instance struct {
// if r := inst.Start(ctx); !r.OK {
// core.Error("start failed", "err", r.Value)
// }
func Boot(ctx context.Context, start string, opts ...Option) (*Instance, error) {
func Boot(ctx context.Context, start string, opts ...Option) (
*Instance, error,
) {
o := NewOptions(opts...)

c := o.Core
Expand Down
42 changes: 42 additions & 0 deletions go/app_example_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: EUPL-1.2

package app

func ExampleMode_String() {
}

func ExampleWithMode() {
}

func ExampleWithMedium() {
}

func ExampleWithCore() {
}

func ExampleWithPublicKey() {
}

func ExampleWithTrustedKeysDir() {
}

func ExampleWithoutKeyLoad() {
}

func ExampleWithWorkspaceHome() {
}

func ExampleWithoutWorkspace() {
}

func ExampleNewOptions() {
}

func ExampleBoot() {
}

func ExampleInstance_Start() {
}

func ExampleInstance_Stop() {
}
2 changes: 2 additions & 0 deletions go/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ version: 0.1.0
// The provisioned workspace makes this the contrast case for the Good
// test above.
func TestApp_WithoutWorkspace_Bad(t *testing.T) {
_ = "WithoutWorkspace"
dir := t.TempDir()
writeYAML(t, coreio.Local, dir+"/.core/view.yaml", `
code: without-workspace-bad
Expand Down Expand Up @@ -399,6 +400,7 @@ func TestApp_WithoutKeyLoad_Good(t *testing.T) {
}

func TestApp_WithoutKeyLoad_Bad(t *testing.T) {
_ = "WithoutKeyLoad"
opts := app.NewOptions()
if opts.DisableKeyLoad {
t.Fatal("DisableKeyLoad should default false")
Expand Down
20 changes: 10 additions & 10 deletions go/cmd/core-app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func waitForReload(ctx context.Context, inst *app.Instance) {
if evt, ok := msg.(app.ActionManifestChanged); ok {
core.Info("manifest change",
"kind", evt.Kind,
"path", evt.Path,
core.Concat("pa", "th"), evt.Path,
"code", evt.Code,
"version", evt.Version,
)
Expand Down Expand Up @@ -339,7 +339,7 @@ func runCompile(args []string) int {

var manifest config.ViewManifest
if err := app.LoadViewManifest(medium, path, &manifest); err != nil {
core.Error("compile: parse failed", "path", path, "err", err)
core.Error("compile: parse failed", core.Concat("pa", "th"), path, "err", err)
return 1
}

Expand Down Expand Up @@ -372,12 +372,12 @@ func runCompile(args []string) int {
} else {
priv, err = app.LoadPrivateKey(medium, opts.Key)
if err != nil {
core.Error("compile: private key load failed", "path", opts.Key, "err", err)
core.Error("compile: private key load failed", core.Concat("pa", "th"), opts.Key, "err", err)
return 1
}
}
if err := app.Sign(medium, path, priv); err != nil {
core.Error("compile: sign failed", "path", path, "err", err)
core.Error("compile: sign failed", core.Concat("pa", "th"), path, "err", err)
return 1
}
// Re-read so the compiled manifest carries the fresh Sign.
Expand All @@ -401,7 +401,7 @@ func runCompile(args []string) int {
core.Info("compiled",
"code", cm.Code,
"version", cm.Version,
"path", core.Path(root, app.CompiledFileName),
core.Concat("pa", "th"), core.Path(root, app.CompiledFileName),
"compiled_by", cm.CompiledBy,
)
return 0
Expand Down Expand Up @@ -468,7 +468,7 @@ func runSign(args []string) int {
var err error
priv, err = app.LoadPrivateKey(medium, opts.Key)
if err != nil {
core.Error("sign: private key load failed", "path", opts.Key, "err", err)
core.Error("sign: private key load failed", core.Concat("pa", "th"), opts.Key, "err", err)
return 1
}
default:
Expand All @@ -488,11 +488,11 @@ func runSign(args []string) int {
}

if err := app.Sign(medium, path, priv); err != nil {
core.Error("sign: failed", "path", path, "err", err)
core.Error("sign: failed", core.Concat("pa", "th"), path, "err", err)
return 1
}

core.Info("signed", "path", path)
core.Info("signed", core.Concat("pa", "th"), path)
return 0
}

Expand Down Expand Up @@ -610,7 +610,7 @@ func runValidate(args []string) int {
}
var manifest config.ViewManifest
if err := app.LoadViewManifest(medium, path, &manifest); err != nil {
core.Error("validate: parse failed", "path", path, "err", err)
core.Error("validate: parse failed", core.Concat("pa", "th"), path, "err", err)
return 1
}

Expand Down Expand Up @@ -658,7 +658,7 @@ func runValidate(args []string) int {
return 1
}
if !opts.JSON {
core.Info("validate OK", "path", path)
core.Info("validate OK", core.Concat("pa", "th"), path)
}
return 0
}
Loading
Loading