Files
yuan-lab-llm--clawmanager/backend/internal/services/skill_content_md5_test.go
T
heranran 71c7672545 feat: Skill Hub hardening with session usage tracking and egress governance (#163)
* feat(skill-hub): add Skill Hub catalog, publish flow, and lite materialize pipeline

Introduce Skill Hub for browsing, importing, publishing, and installing skills, with lite instance package materialization and runtime sync support.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(skill-hub): remove token-governance hooks from Skill Hub PR

Strip validateManagedRuntimeEnvironmentOverrides, network lock policy sync,
and egress proxy audit wiring that belong to the upcoming token-usage work,
so the Skill Hub branch compiles independently.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(skill-hub): update migration number in materialize docs

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(skill-hub): make RuntimeAgentClient test stub and hub tests compile-safe

Add ResyncInstanceSkills to the runtime pool handler fake client, and harden
skill hub payload helpers/tests against nil storage/instance repos so go test passes.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: add Skill Hub hardening with session usage tracking and egress governance

Unify Skill Hub runtime sync improvements with session-token observability,
egress network policy, and admin/instance usage reporting for reopenable PR.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(skill-hub): repair CI tests and nested skill install

* fix(ci): restore release deployment configuration

---------

Co-authored-by: heshengran <heshengran@ieisystem.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 12:37:01 +08:00

35 lines
809 B
Go

package services
import (
"errors"
"testing"
"clawreef/internal/utils"
)
func TestHashDirectoryGoldenWeatherFixture(t *testing.T) {
files := map[string][]byte{
"src/main.py": []byte("print('weather')\n"),
}
got := hashDirectory(files)
want := referenceSkillContentMD5(files)
if got != want {
t.Fatalf("hashDirectory() = %s, want %s", got, want)
}
}
func TestHubErrorMD5MismatchCode(t *testing.T) {
err := utils.NewHubError(
"skill_package_md5_mismatch",
"skill package md5 mismatch: expected abc got def",
map[string]string{"expected": "abc", "computed": "def"},
)
var hubErr *utils.HubError
if !errors.As(err, &hubErr) {
t.Fatal("expected HubError")
}
if hubErr.Code != "skill_package_md5_mismatch" {
t.Fatalf("expected skill_package_md5_mismatch, got %q", hubErr.Code)
}
}