diff --git a/cmd/main_test.go b/cmd/main_test.go index 28081a82..6b9fd350 100644 --- a/cmd/main_test.go +++ b/cmd/main_test.go @@ -5,7 +5,7 @@ import ( "testing" ) -func TestMainExitsWithSuccessfulVersionCommand(t *testing.T) { +func TestCrossPlatformCoverageMainExitsWithSuccessfulVersionCommand(t *testing.T) { previousExit := exit previousArgs := os.Args t.Cleanup(func() { diff --git a/internal/apiclient/coverage_edges_test.go b/internal/apiclient/coverage_edges_test.go index bb32255b..db18283b 100644 --- a/internal/apiclient/coverage_edges_test.go +++ b/internal/apiclient/coverage_edges_test.go @@ -23,7 +23,7 @@ type failingWriter struct{ err error } func (w failingWriter) Write([]byte) (int, error) { return 0, w.err } -func TestDryRunAndParseCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageDryRunAndParseCoverageEdges(t *testing.T) { for _, tc := range []struct { base string path string @@ -63,7 +63,7 @@ func TestDryRunAndParseCoverageEdges(t *testing.T) { } } -func TestResponseHandlingCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageResponseHandlingCoverageEdges(t *testing.T) { jsonHeader := http.Header{"Content-Type": []string{"application/json"}} textHeader := http.Header{"Content-Type": []string{"text/plain"}} var out, errOut bytes.Buffer @@ -141,7 +141,7 @@ func TestResponseHandlingCoverageEdges(t *testing.T) { } } -func TestPaginationParsingAndInjectionEdges(t *testing.T) { +func TestCrossPlatformCoveragePaginationParsingAndInjectionEdges(t *testing.T) { jsonHeader := http.Header{"Content-Type": []string{"application/json"}} for _, resp := range []*RawAPIResponse{ {StatusCode: 200, Header: http.Header{"Content-Type": []string{"text/plain"}}, Body: []byte("x")}, @@ -192,7 +192,7 @@ func jsonHTTPResponse(body string) *http.Response { return &http.Response{StatusCode: 200, Header: http.Header{"Content-Type": []string{"application/json"}}, Body: io.NopCloser(strings.NewReader(body))} } -func TestPaginationControlFlowEdges(t *testing.T) { +func TestCrossPlatformCoveragePaginationControlFlowEdges(t *testing.T) { wantErr := errors.New("transport failed") client := NewClient("token", DefaultBaseURL) client.HTTPClient.Transport = roundTripFunc(func(*http.Request) (*http.Response, error) { @@ -245,7 +245,7 @@ func TestPaginationControlFlowEdges(t *testing.T) { } } -func TestClientAndValidationFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageClientAndValidationFailureEdges(t *testing.T) { client := NewClient("token", DefaultBaseURL) if _, err := client.Do(context.Background(), RawAPIRequest{Method: "GET", Path: "https://api.dingtalk.com/%zz"}); err == nil { t.Fatal("Do with invalid URL should fail") diff --git a/internal/app/app_small_coverage_test.go b/internal/app/app_small_coverage_test.go index 2da0c32c..6ec27f9d 100644 --- a/internal/app/app_small_coverage_test.go +++ b/internal/app/app_small_coverage_test.go @@ -73,7 +73,7 @@ func docPreflightServer(t *testing.T, result map[string]any) *httptest.Server { })) } -func TestDocDownloadPreflightCoverage(t *testing.T) { +func TestCrossPlatformCoverageDocDownloadPreflightCoverage(t *testing.T) { runner := &runtimeRunner{} base := executor.Invocation{CanonicalProduct: "doc", Tool: "download_file", Params: map[string]any{"nodeId": " node "}} if err := runner.preflightDocDownload(context.Background(), transport.NewClient(nil), "", executor.Invocation{}); err != nil { @@ -137,7 +137,7 @@ func TestDocDownloadPreflightCoverage(t *testing.T) { } } -func TestRootHelpRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageRootHelpRemainingCoverage(t *testing.T) { configureRootHelp(nil) renderRootGlobalFlags(nil) if visiblePersistentFlags(nil) != nil || formatRootFlag(nil) != "" || commandShort(nil) != "" || visibleMCPRootCommands(nil) != nil || visibleUtilityRootCommands(nil) != nil { @@ -178,7 +178,7 @@ func TestRootHelpRemainingCoverage(t *testing.T) { _ = visibleMCPRootCommands(root) } -func TestConfigAndTokenSeamsCoverage(t *testing.T) { +func TestCrossPlatformCoverageConfigAndTokenSeamsCoverage(t *testing.T) { oldHome, oldExe, oldEval := userHomeDir, executablePath, evaluateSymlink oldEdition := edition.Get() t.Cleanup(func() { @@ -239,7 +239,7 @@ func TestConfigAndTokenSeamsCoverage(t *testing.T) { } } -func TestForceRefreshAndStdioFailureCoverage(t *testing.T) { +func TestCrossPlatformCoverageForceRefreshAndStdioFailureCoverage(t *testing.T) { oldMark, oldFactory := markAccessTokenStale, newRefreshProvider oldStop := stopStdio t.Cleanup(func() { @@ -287,7 +287,7 @@ func TestForceRefreshAndStdioFailureCoverage(t *testing.T) { } } -func TestOverlayRecoveryHostAndHelperRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageOverlayRecoveryHostAndHelperRemainingCoverage(t *testing.T) { root := t.TempDir() writeOverlay := filepath.Join(root, "overlay.json") if err := os.WriteFile(writeOverlay, []byte(`{"toolOverrides":{"tool":{}}}`), 0o600); err != nil { @@ -342,7 +342,7 @@ func TestOverlayRecoveryHostAndHelperRemainingCoverage(t *testing.T) { } } -func TestConfigAndCacheCommandRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageConfigAndCacheCommandRemainingCoverage(t *testing.T) { for _, command := range []*cobra.Command{newConfigCommand(), newCacheCommand()} { command.SetOut(io.Discard) if err := command.RunE(command, nil); err != nil { diff --git a/internal/app/app_tiny_coverage_test.go b/internal/app/app_tiny_coverage_test.go index 81e86799..a6b16a89 100644 --- a/internal/app/app_tiny_coverage_test.go +++ b/internal/app/app_tiny_coverage_test.go @@ -18,7 +18,7 @@ import ( "github.com/spf13/cobra" ) -func TestAPIAndTimingRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageAPIAndTimingRemainingCoverage(t *testing.T) { oldProvider := newAppTokenProvider oldClientID, oldClientSecret := apiClientID, apiClientSecret oldMarshal, oldMkdir := timingMarshalIndent, timingMkdirAll @@ -114,7 +114,7 @@ func TestAPIAndTimingRemainingCoverage(t *testing.T) { } } -func TestDirectRuntimeRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageDirectRuntimeRemainingCoverage(t *testing.T) { oldEdition := edition.Get() t.Cleanup(func() { edition.Override(oldEdition) @@ -214,7 +214,7 @@ func containsText(value, substring string) bool { return false } -func TestEmbeddedSkillAndTinyCommandsRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageEmbeddedSkillAndTinyCommandsRemainingCoverage(t *testing.T) { oldStat, oldTemp, oldRemove := embeddedSkillStat, embeddedSkillMkdirTemp, embeddedSkillRemoveAll oldWalk, oldRead := embeddedSkillWalkDir, embeddedSkillReadFile oldMkdir, oldWrite := embeddedSkillMkdirAll, embeddedSkillWriteFile diff --git a/internal/app/audit_coverage_more_test.go b/internal/app/audit_coverage_more_test.go index 1384a52a..fb446e20 100644 --- a/internal/app/audit_coverage_more_test.go +++ b/internal/app/audit_coverage_more_test.go @@ -31,7 +31,7 @@ func (sink *auditCoverageSink) Emit(event *audit.Event) error { func (sink *auditCoverageSink) Close() error { return sink.closeErr } -func TestAuditCommandsAndFileHelpersCoverage(t *testing.T) { +func TestCrossPlatformCoverageAuditCommandsAndFileHelpersCoverage(t *testing.T) { originalExit, originalVerify := auditExit, auditVerify t.Cleanup(func() { auditExit, auditVerify = originalExit, originalVerify }) dir := t.TempDir() @@ -193,7 +193,7 @@ func TestAuditCommandsAndFileHelpersCoverage(t *testing.T) { } } -func TestAuditRuntimeCoverage(t *testing.T) { +func TestCrossPlatformCoverageAuditRuntimeCoverage(t *testing.T) { previousSink, previousLoader := sharedAuditSink, loadTokenForProfile t.Cleanup(func() { sharedAuditSink = previousSink diff --git a/internal/app/auth_command_full_coverage_test.go b/internal/app/auth_command_full_coverage_test.go index afb0d80e..497dc38c 100644 --- a/internal/app/auth_command_full_coverage_test.go +++ b/internal/app/auth_command_full_coverage_test.go @@ -65,7 +65,7 @@ func authCoverageRunLogin(t *testing.T, caller edition.ToolCaller, format string return out.String(), errOut.String(), err } -func TestAuthCoverageFormsParentAndTargets(t *testing.T) { +func TestCrossPlatformCoverageAuthCoverageFormsParentAndTargets(t *testing.T) { oldEdition := edition.Get() oldRunForm := authRunForm oldPrompt := authLoginManualCredentialsPrompt @@ -206,7 +206,7 @@ func TestAuthCoverageFormsParentAndTargets(t *testing.T) { } } -func TestAuthCoverageLoginFlows(t *testing.T) { +func TestCrossPlatformCoverageAuthCoverageLoginFlows(t *testing.T) { t.Setenv("DWS_CONFIG_DIR", t.TempDir()) oldSave := authSaveTokenData oldDevice := authDeviceLogin @@ -335,7 +335,7 @@ func TestAuthCoverageLoginFlows(t *testing.T) { } } -func TestAuthCoverageContactEnrichment(t *testing.T) { +func TestCrossPlatformCoverageAuthCoverageContactEnrichment(t *testing.T) { oldSave := authSaveTokenData t.Cleanup(func() { authSaveTokenData = oldSave }) ctx := context.Background() @@ -387,7 +387,7 @@ func TestAuthCoverageContactEnrichment(t *testing.T) { } } -func TestAuthCoverageDefaultSeamClosures(t *testing.T) { +func TestCrossPlatformCoverageAuthCoverageDefaultSeamClosures(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() configDir := t.TempDir() @@ -401,7 +401,7 @@ func TestAuthCoverageDefaultSeamClosures(t *testing.T) { _ = fmt.Sprintf("%v", os.ErrNotExist) } -func TestAuthCoverageStatusAndLogout(t *testing.T) { +func TestCrossPlatformCoverageAuthCoverageStatusAndLogout(t *testing.T) { t.Setenv("DWS_CONFIG_DIR", t.TempDir()) oldEdition := edition.Get() oldStatus := authOAuthStatus @@ -589,7 +589,7 @@ func TestAuthCoverageStatusAndLogout(t *testing.T) { } } -func TestAuthCoveragePortableExchangeAndReset(t *testing.T) { +func TestCrossPlatformCoverageAuthCoveragePortableExchangeAndReset(t *testing.T) { t.Setenv("DWS_CONFIG_DIR", t.TempDir()) oldEdition := edition.Get() oldSupported := authPortableExportSupported diff --git a/internal/app/auth_migrate_coverage_test.go b/internal/app/auth_migrate_coverage_test.go index d61c5104..39bdb8cb 100644 --- a/internal/app/auth_migrate_coverage_test.go +++ b/internal/app/auth_migrate_coverage_test.go @@ -62,3 +62,9 @@ func TestAuthMigrateKeychainRemainingBranches(t *testing.T) { } } } + +// Keep the original test name for the focused macOS auth workflow while also +// opting the coverage fixture into the native platform coverage gate. +func TestCrossPlatformCoverageAuthMigrateKeychainRemainingBranches(t *testing.T) { + TestAuthMigrateKeychainRemainingBranches(t) +} diff --git a/internal/app/coverage_edges_test.go b/internal/app/coverage_edges_test.go index 510c7bc2..f127b065 100644 --- a/internal/app/coverage_edges_test.go +++ b/internal/app/coverage_edges_test.go @@ -63,7 +63,7 @@ type coverageRawStderr string func (e coverageRawStderr) Error() string { return string(e) } func (e coverageRawStderr) RawStderr() string { return string(e) } -func TestToolCallerAdapterCoverage(t *testing.T) { +func TestCrossPlatformCoverageToolCallerAdapterCoverage(t *testing.T) { runner := &coverageRunner{} adapter := newToolCallerAdapter(runner, nil).(*toolCallerAdapter) if adapter.Format() != "json" || adapter.DryRun() || adapter.Fields() != "" || adapter.JQ() != "" { @@ -100,7 +100,7 @@ func TestToolCallerAdapterCoverage(t *testing.T) { } } -func TestRunnerPureCoverage(t *testing.T) { +func TestCrossPlatformCoverageRunnerPureCoverage(t *testing.T) { for _, tc := range []struct { content map[string]any want string @@ -185,7 +185,7 @@ func TestRunnerPureCoverage(t *testing.T) { ResetRuntimeTokenCache() } -func TestDocDownloadPureCoverage(t *testing.T) { +func TestCrossPlatformCoverageDocDownloadPureCoverage(t *testing.T) { for _, inv := range []executor.Invocation{ {}, {CanonicalProduct: "DOC", Tool: docDownloadFileTool}, @@ -215,7 +215,7 @@ func TestDocDownloadPureCoverage(t *testing.T) { } } -func TestRecoveryPureCoverage(t *testing.T) { +func TestCrossPlatformCoverageRecoveryPureCoverage(t *testing.T) { if _, err := decodeRecoveryAttempts(nil, nil, "", ""); err != nil { t.Fatal(err) } @@ -326,7 +326,7 @@ func TestRecoveryPureCoverage(t *testing.T) { } } -func TestSmallAppRegistryAndRootCoverage(t *testing.T) { +func TestCrossPlatformCoverageSmallAppRegistryAndRootCoverage(t *testing.T) { RegisterPluginAuth("coverage-registry", &PluginAuth{Token: "token"}) t.Cleanup(func() { pluginAuthMu.Lock() @@ -422,7 +422,7 @@ func TestSmallAppRegistryAndRootCoverage(t *testing.T) { } } -func TestDirectRuntimeCoverage(t *testing.T) { +func TestCrossPlatformCoverageDirectRuntimeCoverage(t *testing.T) { oldEdition := edition.Get() t.Cleanup(func() { edition.Override(oldEdition); SetDynamicServers(nil) }) server := mcptypes.ServerDescriptor{ @@ -503,7 +503,7 @@ func TestDirectRuntimeCoverage(t *testing.T) { _ = defaultPATMCPEndpoint() } -func TestRecoveryLoadExecutionCoverage(t *testing.T) { +func TestCrossPlatformCoverageRecoveryLoadExecutionCoverage(t *testing.T) { if _, err := loadRecoveryExecution(filepath.Join(t.TempDir(), "missing")); err == nil { t.Fatal("missing recovery execution succeeded") } @@ -529,7 +529,7 @@ func TestRecoveryLoadExecutionCoverage(t *testing.T) { } } -func TestRecoveryRuntimeHTTP(t *testing.T) { +func TestCrossPlatformCoverageRecoveryRuntimeHTTP(t *testing.T) { var result map[string]any = map[string]any{"content": []map[string]any{{"type": "text", "text": `{"items":[{"title":"query result","url":"u"}]}`}}} server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var req struct { @@ -556,7 +556,7 @@ func TestRecoveryRuntimeHTTP(t *testing.T) { } } -func TestEventCommandPureCoverage(t *testing.T) { +func TestCrossPlatformCoverageEventCommandPureCoverage(t *testing.T) { oldEdition := edition.Get() t.Cleanup(func() { edition.Override(oldEdition) }) edition.Override(&edition.Hooks{}) @@ -626,7 +626,7 @@ func TestEventCommandPureCoverage(t *testing.T) { } } -func TestEventListAndStatusCoverage(t *testing.T) { +func TestCrossPlatformCoverageEventListAndStatusCoverage(t *testing.T) { dir := t.TempDir() t.Setenv("DWS_CONFIG_DIR", dir) cmd := &cobra.Command{Use: "event"} @@ -684,7 +684,7 @@ func TestEventListAndStatusCoverage(t *testing.T) { } } -func TestEventCommandValidationCoverage(t *testing.T) { +func TestCrossPlatformCoverageEventCommandValidationCoverage(t *testing.T) { execute := func(t *testing.T, cmd *cobra.Command, args ...string) error { t.Helper() cmd.SilenceErrors = true @@ -724,7 +724,7 @@ func TestEventCommandValidationCoverage(t *testing.T) { } } -func TestVersionCacheCompletionCoverage(t *testing.T) { +func TestCrossPlatformCoverageVersionCacheCompletionCoverage(t *testing.T) { oldVersion, oldBuild, oldCommit := version, buildTime, gitCommit t.Cleanup(func() { version, buildTime, gitCommit = oldVersion, oldBuild, oldCommit }) version, buildTime, gitCommit = "1.0", "unknown", "unknown" @@ -776,7 +776,7 @@ func TestVersionCacheCompletionCoverage(t *testing.T) { } } -func TestRuntimeRunnerRoutingCoverage(t *testing.T) { +func TestCrossPlatformCoverageRuntimeRunnerRoutingCoverage(t *testing.T) { inv := executor.Invocation{CanonicalProduct: "product", Tool: "tool", Params: map[string]any{"x": 1}} fallback := &coverageRunner{result: executor.Result{Response: map[string]any{"fallback": true}}} r := &runtimeRunner{fallback: fallback} @@ -851,7 +851,7 @@ func TestRuntimeRunnerRoutingCoverage(t *testing.T) { } } -func TestExecuteInvocationCoverage(t *testing.T) { +func TestCrossPlatformCoverageExecuteInvocationCoverage(t *testing.T) { oldEdition := edition.Get() edition.Override(&edition.Hooks{TokenProvider: func(context.Context, func() (string, error)) (string, error) { return "", nil @@ -953,7 +953,7 @@ func TestExecuteInvocationCoverage(t *testing.T) { } } -func TestAuthCommandPureCoverage(t *testing.T) { +func TestCrossPlatformCoverageAuthCommandPureCoverage(t *testing.T) { oldEdition := edition.Get() oldPrompt := authLoginManualCredentialsPrompt oldInteractive := authLoginInteractiveTerminal @@ -1078,7 +1078,7 @@ func TestAuthCommandPureCoverage(t *testing.T) { } -func TestAuthLoginTokenCommandCoverage(t *testing.T) { +func TestCrossPlatformCoverageAuthLoginTokenCommandCoverage(t *testing.T) { oldInteractive := authLoginInteractiveTerminal authLoginInteractiveTerminal = func() bool { return false } t.Cleanup(func() { authLoginInteractiveTerminal = oldInteractive; authpkg.SetRuntimeProfile("") }) @@ -1118,7 +1118,7 @@ func TestAuthLoginTokenCommandCoverage(t *testing.T) { } } -func TestPluginCommandLifecycleCoverage(t *testing.T) { +func TestCrossPlatformCoveragePluginCommandLifecycleCoverage(t *testing.T) { home := t.TempDir() work := t.TempDir() t.Setenv("HOME", home) @@ -1281,7 +1281,7 @@ func TestPluginCommandLifecycleCoverage(t *testing.T) { } } -func TestUpgradeCommandHTTPAndDryRunCoverage(t *testing.T) { +func TestCrossPlatformCoverageUpgradeCommandHTTPAndDryRunCoverage(t *testing.T) { oldEdition := edition.Get() oldVersion := version t.Cleanup(func() { edition.Override(oldEdition); version = oldVersion }) @@ -1375,7 +1375,7 @@ func TestUpgradeCommandHTTPAndDryRunCoverage(t *testing.T) { } } -func TestUpgradeRemainingPureCoverage(t *testing.T) { +func TestCrossPlatformCoverageUpgradeRemainingPureCoverage(t *testing.T) { originalCommandOutput := upgradeCommandOutput t.Cleanup(func() { upgradeCommandOutput = originalCommandOutput }) for _, beta := range []bool{false, true} { @@ -1439,7 +1439,7 @@ func TestUpgradeRemainingPureCoverage(t *testing.T) { _ = shortenHome(filepath.Join(os.Getenv("HOME"), "path")) } -func TestPersonalEventPureCoverage(t *testing.T) { +func TestCrossPlatformCoveragePersonalEventPureCoverage(t *testing.T) { cmd := &cobra.Command{Use: "personal"} var out bytes.Buffer cmd.SetOut(&out) @@ -1576,7 +1576,7 @@ func personalCommonOptions(eventTypes []string, filter string) commonConsumeOpti return commonConsumeOptions{EventTypes: eventTypes, Filter: filter} } -func TestPersonalSubscriptionAndSourceCoverage(t *testing.T) { +func TestCrossPlatformCoveragePersonalSubscriptionAndSourceCoverage(t *testing.T) { identity := personal.Identity{AccessToken: "token", CorpID: "corp", UserID: "user", ClientID: "client", SourceID: "source"} var createCount, cancelCount int server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -1639,7 +1639,7 @@ func TestPersonalSubscriptionAndSourceCoverage(t *testing.T) { } } -func TestPersonalEventCommandRuntimeCoverage(t *testing.T) { +func TestCrossPlatformCoveragePersonalEventCommandRuntimeCoverage(t *testing.T) { configDir := setupPersonalIdentityToken(t, &authpkg.TokenData{ AccessToken: "access", RefreshToken: "refresh", ExpiresAt: time.Now().Add(time.Hour), CorpID: "corp", UserID: "user", ClientID: "client", @@ -1700,7 +1700,7 @@ func TestPersonalEventCommandRuntimeCoverage(t *testing.T) { } } -func TestDoctorCommandCoverage(t *testing.T) { +func TestCrossPlatformCoverageDoctorCommandCoverage(t *testing.T) { configDir := setupPersonalIdentityToken(t, &authpkg.TokenData{ AccessToken: "access", ExpiresAt: time.Now().Add(time.Hour), ClientID: "client", }) @@ -1817,7 +1817,7 @@ func coverageSkillZip(t *testing.T) []byte { return buf.Bytes() } -func TestSkillCommandHTTPCoverage(t *testing.T) { +func TestCrossPlatformCoverageSkillCommandHTTPCoverage(t *testing.T) { configDir := setupPersonalIdentityToken(t, &authpkg.TokenData{AccessToken: "access", ExpiresAt: time.Now().Add(time.Hour), ClientID: "client"}) t.Setenv("DWS_CONFIG_DIR", configDir) home := t.TempDir() @@ -1904,7 +1904,7 @@ func serverURL(r *http.Request) string { return "http://" + r.Host } -func TestSkillHelpersAndErrorsCoverage(t *testing.T) { +func TestCrossPlatformCoverageSkillHelpersAndErrorsCoverage(t *testing.T) { oldEmbedded := edition.Get() t.Cleanup(func() { edition.Override(oldEmbedded) }) for _, embedded := range []bool{false, true} { @@ -1985,7 +1985,7 @@ func TestSkillHelpersAndErrorsCoverage(t *testing.T) { } } -func TestProfileCommandAndModelCoverage(t *testing.T) { +func TestCrossPlatformCoverageProfileCommandAndModelCoverage(t *testing.T) { configDir := t.TempDir() t.Setenv("DWS_CONFIG_DIR", configDir) now := time.Now().UTC() @@ -2134,7 +2134,7 @@ func TestProfileCommandAndModelCoverage(t *testing.T) { } } -func TestSkillSetupRuntimeCoverage(t *testing.T) { +func TestCrossPlatformCoverageSkillSetupRuntimeCoverage(t *testing.T) { home := t.TempDir() oldSetupHome := skillSetupUserHomeDir skillSetupUserHomeDir = func() (string, error) { return home, nil } @@ -2202,7 +2202,7 @@ func TestSkillSetupRuntimeCoverage(t *testing.T) { } } -func TestSkillSetupPureCoverage(t *testing.T) { +func TestCrossPlatformCoverageSkillSetupPureCoverage(t *testing.T) { all := []string{"dingtalk-a", "dingtalk-b", "dws-shared"} for _, tc := range []struct { include []string diff --git a/internal/app/coverage_more_test.go b/internal/app/coverage_more_test.go index 525f934f..5e314abf 100644 --- a/internal/app/coverage_more_test.go +++ b/internal/app/coverage_more_test.go @@ -59,7 +59,7 @@ func appRPCServer(t *testing.T, initOK, listOK bool) *httptest.Server { })) } -func TestPluginAuthCoverage(t *testing.T) { +func TestCrossPlatformCoveragePluginAuthCoverage(t *testing.T) { registerPluginAuthFromHeaders(mcptypes.ServerDescriptor{Key: "fallback", Endpoint: "%", AuthHeaders: map[string]string{"Authorization": "token"}}) registerPluginAuthFromHeaders(mcptypes.ServerDescriptor{Key: "server", Endpoint: "https://x.test", CLI: mcptypes.CLIOverlay{ID: "cli"}, AuthHeaders: map[string]string{"Authorization": "Bearer token", "X": "Y"}}) registerPluginAuthFromHeaders(mcptypes.ServerDescriptor{Key: "none"}) @@ -68,7 +68,7 @@ func TestPluginAuthCoverage(t *testing.T) { } } -func TestRawAPIAndTokenCoverage(t *testing.T) { +func TestCrossPlatformCoverageRawAPIAndTokenCoverage(t *testing.T) { oldProvider := newAccessTokenProvider oldManager := newLegacyTokenManager t.Cleanup(func() { @@ -178,7 +178,7 @@ func TestRawAPIAndTokenCoverage(t *testing.T) { } } -func TestRootUtilityAndTimingCoverage(t *testing.T) { +func TestCrossPlatformCoverageRootUtilityAndTimingCoverage(t *testing.T) { _ = resolveVerbosity(nil) for _, flags := range []struct { debug bool diff --git a/internal/app/doctor_full_coverage_test.go b/internal/app/doctor_full_coverage_test.go index fc5ee350..6425bfaf 100644 --- a/internal/app/doctor_full_coverage_test.go +++ b/internal/app/doctor_full_coverage_test.go @@ -18,7 +18,7 @@ import ( "github.com/DingTalk-Real-AI/dingtalk-workspace-cli/pkg/edition" ) -func TestDoctorRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageDoctorRemainingCoverage(t *testing.T) { oldEdition := edition.Get() oldDiagnose := doctorKeychainDiagnose oldStatus := doctorAuthStatus diff --git a/internal/app/event_command_full_coverage_test.go b/internal/app/event_command_full_coverage_test.go index b90b3293..5dc63ce8 100644 --- a/internal/app/event_command_full_coverage_test.go +++ b/internal/app/event_command_full_coverage_test.go @@ -22,7 +22,7 @@ import ( "github.com/spf13/cobra" ) -func TestEventConsumeCommandAllBranchesCoverage(t *testing.T) { +func TestCrossPlatformCoverageEventConsumeCommandAllBranchesCoverage(t *testing.T) { oldPersonal := eventRunPersonalConsume oldCreds, oldConsume, oldForeground := eventResolveCredentials, eventConsumeRun, eventRunForeground oldNormalize := eventNormalizeAs @@ -113,7 +113,7 @@ func TestEventConsumeCommandAllBranchesCoverage(t *testing.T) { } } -func TestEventSourcesAndForegroundCoverage(t *testing.T) { +func TestCrossPlatformCoverageEventSourcesAndForegroundCoverage(t *testing.T) { oldNew, oldToken, oldEventSource, oldBus := eventNewDingtalkSource, eventResolveAccessToken, eventNewEventSource, eventBusRun oldEdition := edition.Get() t.Cleanup(func() { @@ -175,7 +175,7 @@ func TestEventSourcesAndForegroundCoverage(t *testing.T) { } } -func TestEventBusCommandAllBranchesCoverage(t *testing.T) { +func TestCrossPlatformCoverageEventBusCommandAllBranchesCoverage(t *testing.T) { oldReady, oldPersonal, oldPersonalSource := eventReadyFDFromEnv, eventResolvePersonal, eventNewPersonalSource oldCreds, oldSource, oldRun := eventResolveCredentials, eventNewEventSource, eventBusRun oldMkdir, oldOpen := eventMkdirAll, eventOpenFile @@ -252,7 +252,7 @@ func TestEventBusCommandAllBranchesCoverage(t *testing.T) { } } -func TestEventListStatusCollectAndStopCoverage(t *testing.T) { +func TestCrossPlatformCoverageEventListStatusCollectAndStopCoverage(t *testing.T) { oldList, oldStatus, oldStopPersonal := eventRunPersonalList, eventRunPersonalStatus, eventRunPersonalStop oldEnum, oldFind, oldQuery, oldStop := eventEnumerateBuses, eventFindBus, eventQueryEntry, eventStopBus oldCreds := eventResolveAppCredentials @@ -396,7 +396,7 @@ func TestEventListStatusCollectAndStopCoverage(t *testing.T) { } } -func TestEventCommandParentCoverage(t *testing.T) { +func TestCrossPlatformCoverageEventCommandParentCoverage(t *testing.T) { cmd := newEventCommand() cmd.SetOut(io.Discard) if err := cmd.RunE(cmd, nil); err != nil { @@ -407,7 +407,7 @@ func TestEventCommandParentCoverage(t *testing.T) { } } -func TestEventCommandPureAndRenderBranchesCoverage(t *testing.T) { +func TestCrossPlatformCoverageEventCommandPureAndRenderBranchesCoverage(t *testing.T) { t.Setenv(authpkg.EnvClientID, "client") t.Setenv(authpkg.EnvClientSecret, "secret") if got := (eventStreamTicketOptions{Mode: "custom", SourceID: " source ", TicketURL: " https://ticket "}).spawnArgs(); len(got) != 6 { @@ -495,7 +495,7 @@ func TestEventCommandPureAndRenderBranchesCoverage(t *testing.T) { } } -func TestEventCommandClosureErrorBranchesCoverage(t *testing.T) { +func TestCrossPlatformCoverageEventCommandClosureErrorBranchesCoverage(t *testing.T) { oldNormalize := eventNormalizeAs oldList, oldStatus := eventRunPersonalList, eventRunPersonalStatus oldCreds, oldFind, oldQuery := eventResolveAppCredentials, eventFindBus, eventQueryEntry diff --git a/internal/app/event_personal_full_coverage_test.go b/internal/app/event_personal_full_coverage_test.go index f1426f09..002d771e 100644 --- a/internal/app/event_personal_full_coverage_test.go +++ b/internal/app/event_personal_full_coverage_test.go @@ -22,7 +22,7 @@ import ( "github.com/spf13/cobra" ) -func TestPersonalEventRemainingSchemaAndSubscriptionCoverage(t *testing.T) { +func TestCrossPlatformCoveragePersonalEventRemainingSchemaAndSubscriptionCoverage(t *testing.T) { for _, args := range [][]string{ {"known", "--as", "app"}, {"not-a-real-event"}, @@ -74,7 +74,7 @@ func TestPersonalEventRemainingSchemaAndSubscriptionCoverage(t *testing.T) { } } -func TestPersonalEventRemainingConsumeCoverage(t *testing.T) { +func TestCrossPlatformCoveragePersonalEventRemainingConsumeCoverage(t *testing.T) { oldIdentity := personalResolveEventIdentity oldEnsure := personalEnsureSubscription oldUpsert := personalUpsertRunState @@ -172,7 +172,7 @@ func TestPersonalEventRemainingConsumeCoverage(t *testing.T) { } } -func TestPersonalEventRemainingStatusStopAndInterruptCoverage(t *testing.T) { +func TestCrossPlatformCoveragePersonalEventRemainingStatusStopAndInterruptCoverage(t *testing.T) { oldIdentity := personalResolveEventIdentity oldFindBus := personalFindBusByIdentity oldQueryEntry := personalQueryEntry @@ -296,7 +296,7 @@ func TestPersonalEventRemainingStatusStopAndInterruptCoverage(t *testing.T) { } } -func TestPersonalEventRemainingIdentityAndSourceCoverage(t *testing.T) { +func TestCrossPlatformCoveragePersonalEventRemainingIdentityAndSourceCoverage(t *testing.T) { oldAux := personalResolveAuxiliaryAccessToken oldLoad := personalLoadTokenData oldClientID := personalClientID diff --git a/internal/app/pat_auth_retry_full_coverage_test.go b/internal/app/pat_auth_retry_full_coverage_test.go index 1d783d8b..6023e89e 100644 --- a/internal/app/pat_auth_retry_full_coverage_test.go +++ b/internal/app/pat_auth_retry_full_coverage_test.go @@ -16,7 +16,7 @@ import ( "github.com/DingTalk-Real-AI/dingtalk-workspace-cli/internal/executor" ) -func TestPATRetryRemainingPureAndWaitCoverage(t *testing.T) { +func TestCrossPlatformCoveragePATRetryRemainingPureAndWaitCoverage(t *testing.T) { typed := apperrors.NewAPI("ordinary", apperrors.WithHint("insufficient_scope")) if !isPatScopeError(typed) { t.Fatal("typed insufficient_scope was not recognized") @@ -88,7 +88,7 @@ func TestPATRetryRemainingPureAndWaitCoverage(t *testing.T) { } } -func TestPATRetryRemainingOrchestrationCoverage(t *testing.T) { +func TestCrossPlatformCoveragePATRetryRemainingOrchestrationCoverage(t *testing.T) { oldWait := patWaitForAuthorization oldPoll := patPollDeviceFlowWithInterval oldSaveApp := patSaveAppConfig @@ -212,7 +212,7 @@ func patRaw(flowID, clientID, secret string) string { return `{"code":"x","data":{"desc":"authorize","flowId":"` + flowID + `","uri":"https://auth.test","clientId":"` + clientID + `","clientSecret":"` + secret + `"}}` } -func TestPATRetryRemainingPollAndBrowserCoverage(t *testing.T) { +func TestCrossPlatformCoveragePATRetryRemainingPollAndBrowserCoverage(t *testing.T) { oldDo := patPollHTTPDo oldRequest := patPollNewRequest oldLoad := patLoadTokenData diff --git a/internal/app/plugin_command_full_coverage_test.go b/internal/app/plugin_command_full_coverage_test.go index 43757ad2..741fff67 100644 --- a/internal/app/plugin_command_full_coverage_test.go +++ b/internal/app/plugin_command_full_coverage_test.go @@ -24,7 +24,7 @@ func pluginCoverageRun(cmd *cobra.Command, args ...string) (string, error) { return out.String(), err } -func TestPluginCommandRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoveragePluginCommandRemainingCoverage(t *testing.T) { oldGit := pluginInstallFromGit oldStat := pluginStat oldMkdir := pluginMkdirAll diff --git a/internal/app/profile_full_coverage_test.go b/internal/app/profile_full_coverage_test.go index 67e90396..72827807 100644 --- a/internal/app/profile_full_coverage_test.go +++ b/internal/app/profile_full_coverage_test.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/cobra" ) -func TestProfileRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageProfileRemainingCoverage(t *testing.T) { oldMigrate := profileEnsureProfilesMigration oldLoad := profileLoadProfiles oldPrevious := profileUsePrevious diff --git a/internal/app/recovery_command_full_coverage_test.go b/internal/app/recovery_command_full_coverage_test.go index 5b2d7682..79355bf4 100644 --- a/internal/app/recovery_command_full_coverage_test.go +++ b/internal/app/recovery_command_full_coverage_test.go @@ -24,7 +24,7 @@ func recoveryCoverageRun(cmdArgs ...string) (string, error) { return out.String(), err } -func TestRecoveryCommandRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageRecoveryCommandRemainingCoverage(t *testing.T) { oldSavePlan, oldSaveAnalysis := recoverySavePlan, recoverySaveAnalysis t.Cleanup(func() { recoverySavePlan, recoverySaveAnalysis = oldSavePlan, oldSaveAnalysis @@ -114,7 +114,7 @@ func TestRecoveryCommandRemainingCoverage(t *testing.T) { } } -func TestRecoveryExecutionAndRuntimeRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageRecoveryExecutionAndRuntimeRemainingCoverage(t *testing.T) { t.Setenv("DINGTALK_DEVDOC_MCP_URL", "http://127.0.0.1:1") path := filepath.Join(t.TempDir(), "execution.json") if err := os.WriteFile(path, []byte(`{"attempts":{}}`), 0o600); err != nil { diff --git a/internal/app/remaining_coverage_test.go b/internal/app/remaining_coverage_test.go index a52c9ef8..d16b8cd6 100644 --- a/internal/app/remaining_coverage_test.go +++ b/internal/app/remaining_coverage_test.go @@ -16,7 +16,7 @@ import ( "github.com/spf13/cobra" ) -func TestEventStopPreviewConfirmationAndStdinCoverage(t *testing.T) { +func TestCrossPlatformCoverageEventStopPreviewConfirmationAndStdinCoverage(t *testing.T) { originalNormalize := eventNormalizeAs t.Cleanup(func() { eventNormalizeAs = originalNormalize }) eventNormalizeAs = func(string) (string, error) { return "app", nil } @@ -77,7 +77,7 @@ func TestEventStopPreviewConfirmationAndStdinCoverage(t *testing.T) { } } -func TestRunnerPluginStdioAndDryRunErrorCoverage(t *testing.T) { +func TestCrossPlatformCoverageRunnerPluginStdioAndDryRunErrorCoverage(t *testing.T) { if _, err := (*runtimeRunner)(nil).Run(context.Background(), executor.Invocation{}); err == nil { t.Fatal("nil runtime runner error = nil") } diff --git a/internal/app/root_full_coverage_test.go b/internal/app/root_full_coverage_test.go index 92523a92..26033cb9 100644 --- a/internal/app/root_full_coverage_test.go +++ b/internal/app/root_full_coverage_test.go @@ -19,7 +19,7 @@ import ( "github.com/spf13/cobra" ) -func TestRootExecuteAllBranchesCoverage(t *testing.T) { +func TestCrossPlatformCoverageRootExecuteAllBranchesCoverage(t *testing.T) { oldNormalize := rootNormalizeProcessProfileArgs oldExecute := rootExecuteCommand oldNewRoot := rootNewRootCommandWithEngine @@ -65,7 +65,7 @@ func TestRootExecuteAllBranchesCoverage(t *testing.T) { } } -func TestRootConstructionHooksAndVersionCoverage(t *testing.T) { +func TestCrossPlatformCoverageRootConstructionHooksAndVersionCoverage(t *testing.T) { oldLoadPlugins := rootLoadPlugins oldEdition := edition.Get() oldVersion, oldBuild, oldCommit := version, buildTime, gitCommit @@ -120,7 +120,7 @@ func TestRootConstructionHooksAndVersionCoverage(t *testing.T) { } } -func TestRootFlagsPluginsAndOutputRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageRootFlagsPluginsAndOutputRemainingCoverage(t *testing.T) { t.Chdir(t.TempDir()) parent := &cobra.Command{Use: "root"} parent.PersistentFlags().String("format", "json", "") @@ -229,7 +229,7 @@ func TestRootFlagsPluginsAndOutputRemainingCoverage(t *testing.T) { } } -func TestRootLoadPluginsRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageRootLoadPluginsRemainingCoverage(t *testing.T) { oldInject := rootPluginInjectConfigEnv oldUser := rootPluginLoadUser oldDev := rootPluginLoadDev diff --git a/internal/app/runner_full_coverage_test.go b/internal/app/runner_full_coverage_test.go index 5ea85e7f..550ec4a5 100644 --- a/internal/app/runner_full_coverage_test.go +++ b/internal/app/runner_full_coverage_test.go @@ -25,7 +25,7 @@ func (f runnerCoverageFallback) Run(context.Context, executor.Invocation) (execu return f.result, f.err } -func TestRunnerRemainingRoutingCoverage(t *testing.T) { +func TestCrossPlatformCoverageRunnerRemainingRoutingCoverage(t *testing.T) { oldResolveMulti := runnerResolveMultiProfileSelections oldResolveProfile := runnerResolveProfile oldCachedToken := runnerGetCachedRuntimeToken @@ -127,7 +127,7 @@ func TestRunnerRemainingRoutingCoverage(t *testing.T) { } } -func TestRunnerRemainingExecutionCoverage(t *testing.T) { +func TestCrossPlatformCoverageRunnerRemainingExecutionCoverage(t *testing.T) { oldEdition := edition.Get() oldPreflight := runnerPreflightDocDownload oldCall := runnerCallTool @@ -288,7 +288,7 @@ func TestRunnerRemainingExecutionCoverage(t *testing.T) { } } -func TestRunnerRemainingStdioAuthAndHeadersCoverage(t *testing.T) { +func TestCrossPlatformCoverageRunnerRemainingStdioAuthAndHeadersCoverage(t *testing.T) { oldStdioInit := runnerStdioEnsureInitialized oldStdioCall := runnerStdioCallTool oldEdition := edition.Get() diff --git a/internal/app/skill_command_full_coverage_test.go b/internal/app/skill_command_full_coverage_test.go index 237e39fc..d2331c3d 100644 --- a/internal/app/skill_command_full_coverage_test.go +++ b/internal/app/skill_command_full_coverage_test.go @@ -36,7 +36,7 @@ func skillCoverageCommand() *cobra.Command { return cmd } -func TestSkillCommandHighLevelRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageSkillCommandHighLevelRemainingCoverage(t *testing.T) { oldToken := skillLoadAccessToken oldTmp := skillDownloadToTmp oldHTTP := skillHTTPDo @@ -150,7 +150,7 @@ func TestSkillCommandHighLevelRemainingCoverage(t *testing.T) { } } -func TestSkillCommandLowLevelRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageSkillCommandLowLevelRemainingCoverage(t *testing.T) { oldHTTP := skillHTTPDo oldNewRequest, oldLoadToken := skillNewRequest, skillLoadTokenData oldHome := skillUserHomeDir diff --git a/internal/app/skill_setup_full_coverage_test.go b/internal/app/skill_setup_full_coverage_test.go index 33e1f4fa..a7bace0f 100644 --- a/internal/app/skill_setup_full_coverage_test.go +++ b/internal/app/skill_setup_full_coverage_test.go @@ -39,7 +39,7 @@ func skillSetupCoverageCommand(t *testing.T, mode string, yes bool) *cobra.Comma return cmd } -func TestSkillSetupHighLevelRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageSkillSetupHighLevelRemainingCoverage(t *testing.T) { oldMode := skillSetupResolveMode oldSource := skillSetupResolveSource oldTargets := skillSetupResolveTargets @@ -120,7 +120,7 @@ func TestSkillSetupHighLevelRemainingCoverage(t *testing.T) { } } -func TestSkillSetupLowLevelRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageSkillSetupLowLevelRemainingCoverage(t *testing.T) { oldRunForm, oldInteractive := skillSetupRunForm, skillSetupInteractive oldReadDir, oldStat := skillSetupReadDir, skillSetupStat oldExecutable, oldGetwd, oldHome := skillSetupExecutable, skillSetupGetwd, skillSetupUserHomeDir diff --git a/internal/app/upgrade_full_coverage_test.go b/internal/app/upgrade_full_coverage_test.go index c91c65d4..d5efef13 100644 --- a/internal/app/upgrade_full_coverage_test.go +++ b/internal/app/upgrade_full_coverage_test.go @@ -63,7 +63,7 @@ func (i upgradeFileInfo) ModTime() time.Time { return time.Time{} } func (i upgradeFileInfo) IsDir() bool { return false } func (i upgradeFileInfo) Sys() any { return nil } -func TestUpgradeRollbackAndCommandBranchesCoverage(t *testing.T) { +func TestCrossPlatformCoverageUpgradeRollbackAndCommandBranchesCoverage(t *testing.T) { oldClient, oldRollback := newUpgradeReleaseClient, newUpgradeRollback oldEdition := edition.Get() oldStdin := os.Stdin @@ -150,7 +150,7 @@ func TestUpgradeRollbackAndCommandBranchesCoverage(t *testing.T) { } } -func TestRunUpgradeAllStagesCoverage(t *testing.T) { +func TestCrossPlatformCoverageRunUpgradeAllStagesCoverage(t *testing.T) { oldClient, oldRollback := newUpgradeReleaseClient, newUpgradeRollback oldEnsure, oldCleanup := ensureUpgradeDirs, cleanupUpgradeStale oldNeeds, oldBinary, oldSkills, oldChecksums := upgradeNeedsUpgrade, findUpgradeBinary, findUpgradeSkills, findUpgradeChecksums @@ -355,7 +355,7 @@ func TestRunUpgradeAllStagesCoverage(t *testing.T) { } } -func TestUpgradeBinaryHelpersFailureCoverage(t *testing.T) { +func TestCrossPlatformCoverageUpgradeBinaryHelpersFailureCoverage(t *testing.T) { oldStat, oldChmod := upgradeStat, upgradeChmod oldTry, oldRepair := upgradeTryExecVersion, upgradeRepairDarwin oldGOOS := upgradeRuntimeGOOS diff --git a/internal/audit/coverage_more_test.go b/internal/audit/coverage_more_test.go index cf15e34b..ada6de48 100644 --- a/internal/audit/coverage_more_test.go +++ b/internal/audit/coverage_more_test.go @@ -13,7 +13,7 @@ import ( "time" ) -func TestChainErrorAndLargeRecordCoverage(t *testing.T) { +func TestCrossPlatformCoverageChainErrorAndLargeRecordCoverage(t *testing.T) { dir := t.TempDir() closed, err := os.Create(filepath.Join(dir, "closed")) if err != nil { @@ -86,7 +86,7 @@ func TestChainErrorAndLargeRecordCoverage(t *testing.T) { } } -func TestCollectionAndRotationCoverage(t *testing.T) { +func TestCrossPlatformCoverageCollectionAndRotationCoverage(t *testing.T) { for _, value := range []string{"1", "true", "on", "yes", "y"} { t.Setenv(EnvAuditDebug, value) if !DebugEnabled() { @@ -264,7 +264,7 @@ func TestCollectionAndRotationCoverage(t *testing.T) { } } -func TestSinkAndForwarderFailureCoverage(t *testing.T) { +func TestCrossPlatformCoverageSinkAndForwarderFailureCoverage(t *testing.T) { originalMarshal, originalWrite := sinkMarshal, sinkWrite originalForwardMarshal, originalRedact := forwardMarshal, forwardRedactEventJSON originalReadAt, originalSeek, originalChainMarshal := chainReadAt, chainSeek, chainMarshal diff --git a/internal/auth/browser_unix_coverage_test.go b/internal/auth/browser_unix_coverage_test.go index 496681d9..224a5dd2 100644 --- a/internal/auth/browser_unix_coverage_test.go +++ b/internal/auth/browser_unix_coverage_test.go @@ -21,7 +21,7 @@ import ( "testing" ) -func TestUnixBrowserCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageUnixBrowserCoverageEdges(t *testing.T) { oldStart := browserStartCommand t.Cleanup(func() { browserStartCommand = oldStart }) diff --git a/internal/auth/coverage_edges_test.go b/internal/auth/coverage_edges_test.go index 58c2360f..e5825415 100644 --- a/internal/auth/coverage_edges_test.go +++ b/internal/auth/coverage_edges_test.go @@ -120,7 +120,7 @@ func (f *fakePortableTemp) Chmod(os.FileMode) error { return f.chmodErr } func (f *fakePortableTemp) Sync() error { return f.syncErr } func (f *fakePortableTemp) Close() error { f.closeCall++; return f.closeErr } -func TestAppTokenEdges(t *testing.T) { +func TestCrossPlatformCoverageAppTokenEdges(t *testing.T) { if err := SaveAppTokenData(&AppTokenData{}); err == nil { t.Fatal("empty client ID save succeeded") } @@ -216,7 +216,7 @@ func TestAppTokenEdges(t *testing.T) { } } -func TestDeviceFlowRequestAndOutputEdges(t *testing.T) { +func TestCrossPlatformCoverageDeviceFlowRequestAndOutputEdges(t *testing.T) { var buf bytes.Buffer p := &DeviceFlowProvider{Output: &buf, clientID: "client", scope: "scope", httpClient: http.DefaultClient} p.SetScope("custom") @@ -334,7 +334,7 @@ func TestDeviceFlowRequestAndOutputEdges(t *testing.T) { } } -func TestDeviceFlowWaitImmediateEdges(t *testing.T) { +func TestCrossPlatformCoverageDeviceFlowWaitImmediateEdges(t *testing.T) { p := &DeviceFlowProvider{Output: io.Discard} if _, err := p.waitForAuthorizationByFlowID(context.Background(), &DeviceAuthResponse{ExpiresIn: 0}); err == nil { t.Fatal("flow deadline succeeded") @@ -357,7 +357,7 @@ func TestDeviceFlowWaitImmediateEdges(t *testing.T) { } } -func TestDeviceFlowLoginRetry(t *testing.T) { +func TestCrossPlatformCoverageDeviceFlowLoginRetry(t *testing.T) { oldClient := oauthHTTPClient oldAfter := deviceFlowAfter oldBrowser := deviceOpenBrowser @@ -418,7 +418,7 @@ func TestDeviceFlowLoginRetry(t *testing.T) { } } -func TestPortablePathHelpers(t *testing.T) { +func TestCrossPlatformCoveragePortablePathHelpers(t *testing.T) { if _, err := cleanPortableName("../escape"); err == nil { t.Fatal("unsafe portable name succeeded") } @@ -461,7 +461,7 @@ func TestPortablePathHelpers(t *testing.T) { } } -func TestProfilesLifecycleEdges(t *testing.T) { +func TestCrossPlatformCoverageProfilesLifecycleEdges(t *testing.T) { dir := t.TempDir() cfg, err := LoadProfiles(dir) if err != nil || cfg.Version != 1 || len(cfg.Profiles) != 0 { @@ -595,7 +595,7 @@ func TestProfilesLifecycleEdges(t *testing.T) { } } -func TestProfilesMigrationAndMirror(t *testing.T) { +func TestCrossPlatformCoverageProfilesMigrationAndMirror(t *testing.T) { dir := t.TempDir() _ = DeleteTokenDataKeychain() legacy := &TokenData{CorpID: "legacy-corp", CorpName: "Legacy", AccessToken: "token"} @@ -632,7 +632,7 @@ func TestProfilesMigrationAndMirror(t *testing.T) { } } -func TestTokenEditionHooksAndCleanup(t *testing.T) { +func TestCrossPlatformCoverageTokenEditionHooksAndCleanup(t *testing.T) { oldHooks := edition.Get() t.Cleanup(func() { edition.Override(oldHooks) @@ -678,7 +678,7 @@ func TestTokenEditionHooksAndCleanup(t *testing.T) { } } -func TestTokenAndKeychainEdges(t *testing.T) { +func TestCrossPlatformCoverageTokenAndKeychainEdges(t *testing.T) { dir := t.TempDir() if err := SaveTokenDataKeychainForCorpID("", &TokenData{}); err == nil { t.Fatal("empty corp token save succeeded") @@ -742,7 +742,7 @@ func TestTokenAndKeychainEdges(t *testing.T) { } } -func TestAppConfigDeleteReloadEdges(t *testing.T) { +func TestCrossPlatformCoverageAppConfigDeleteReloadEdges(t *testing.T) { dir := t.TempDir() if err := os.Mkdir(GetAppConfigPath(dir), 0o755); err != nil { t.Fatal(err) @@ -780,7 +780,7 @@ func TestAppConfigDeleteReloadEdges(t *testing.T) { } } -func TestBasicAuthCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageBasicAuthCoverageEdges(t *testing.T) { t.Run("channel and status", func(t *testing.T) { t.Setenv(AgentCodeEnv, " agent ") if !AgentCodeEnvPresent() || !HostOwnsPATFlow() { @@ -1054,7 +1054,7 @@ func TestBasicAuthCoverageEdges(t *testing.T) { }) } -func TestPortableAuthBundleCoverageEdges(t *testing.T) { +func TestCrossPlatformCoveragePortableAuthBundleCoverageEdges(t *testing.T) { makeBundle := func(t *testing.T, entries []tar.Header, bodies []string) []byte { t.Helper() var buf bytes.Buffer @@ -1439,7 +1439,7 @@ func TestPortableAuthBundleCoverageEdges(t *testing.T) { }) } -func TestTokenStorageAndRevocationCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageTokenStorageAndRevocationCoverageEdges(t *testing.T) { oldMarshalIndent := tokenJSONMarshalIndent oldMarshal := tokenJSONMarshal oldMkdir := tokenMkdirAll @@ -1826,7 +1826,7 @@ func TestTokenStorageAndRevocationCoverageEdges(t *testing.T) { }) } -func TestSmallRemainingAuthEdges(t *testing.T) { +func TestCrossPlatformCoverageSmallRemainingAuthEdges(t *testing.T) { t.Run("app token hooks", func(t *testing.T) { oldIndent := appTokenMarshalIndent oldMarshal := appTokenMarshal @@ -2025,7 +2025,7 @@ func TestSmallRemainingAuthEdges(t *testing.T) { } } -func TestProfilesCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageProfilesCoverageEdges(t *testing.T) { oldAcquire := profilesAcquireDualLock oldRead := profilesReadFile oldRename := profilesRename @@ -2270,7 +2270,7 @@ func TestProfilesCoverageEdges(t *testing.T) { normalizeProfilesConfig(nil) } -func TestSecureIdentityKeychainAndLockEdges(t *testing.T) { +func TestCrossPlatformCoverageSecureIdentityKeychainAndLockEdges(t *testing.T) { t.Run("secure store", func(t *testing.T) { oldGetMAC := secureGetMAC oldMkdir := secureMkdirAll @@ -2582,7 +2582,7 @@ func TestSecureIdentityKeychainAndLockEdges(t *testing.T) { }) } -func TestAppConfigHookCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageAppConfigHookCoverageEdges(t *testing.T) { oldStore := appConfigStoreSecret oldMarshal := appConfigMarshalIndent oldWrite := appConfigAtomicWrite @@ -2678,7 +2678,7 @@ func TestAppConfigHookCoverageEdges(t *testing.T) { } } -func TestDeviceFlowHighLevelCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageDeviceFlowHighLevelCoverageEdges(t *testing.T) { oldFetch := deviceFetchClientID oldLogin := deviceLoginOnce oldRequest := deviceRequestCode diff --git a/internal/auth/oauth_provider_coverage_test.go b/internal/auth/oauth_provider_coverage_test.go index e6876bee..08b04d71 100644 --- a/internal/auth/oauth_provider_coverage_test.go +++ b/internal/auth/oauth_provider_coverage_test.go @@ -131,7 +131,7 @@ func httpGetBody(t *testing.T, rawURL string) (int, string) { return resp.StatusCode, string(data) } -func TestOAuthLoginCallbackAndAPIs(t *testing.T) { +func TestCrossPlatformCoverageOAuthLoginCallbackAndAPIs(t *testing.T) { f := newOAuthLoginFixture(t, func(int32) CLIAuthStatus { return CLIAuthStatus{Success: true, Result: &CLIAuthResult{CLIAuthEnabled: true}} }) @@ -224,7 +224,7 @@ func TestOAuthLoginCallbackAndAPIs(t *testing.T) { } } -func TestOAuthLoginMissingCallbackCode(t *testing.T) { +func TestCrossPlatformCoverageOAuthLoginMissingCallbackCode(t *testing.T) { f := newOAuthLoginFixture(t, func(int32) CLIAuthStatus { return CLIAuthStatus{Success: true, Result: &CLIAuthResult{CLIAuthEnabled: true}} }) @@ -244,7 +244,7 @@ func TestOAuthLoginMissingCallbackCode(t *testing.T) { } } -func TestOAuthLoginEarlyAndListenerEdges(t *testing.T) { +func TestCrossPlatformCoverageOAuthLoginEarlyAndListenerEdges(t *testing.T) { var buf bytes.Buffer p := &OAuthProvider{configDir: t.TempDir(), Output: &buf} if p.output() != &buf || (*OAuthProvider)(nil).output() != io.Discard { @@ -279,7 +279,7 @@ func TestOAuthLoginEarlyAndListenerEdges(t *testing.T) { } } -func TestOAuthLoginTimeoutAndServerError(t *testing.T) { +func TestCrossPlatformCoverageOAuthLoginTimeoutAndServerError(t *testing.T) { oldTimeout := oauthLoginTimeout oldListen := oauthListen t.Cleanup(func() { @@ -310,7 +310,7 @@ func TestOAuthLoginTimeoutAndServerError(t *testing.T) { } } -func TestOAuthProviderOtherMethods(t *testing.T) { +func TestCrossPlatformCoverageOAuthProviderOtherMethods(t *testing.T) { dir := t.TempDir() _ = DeleteTokenDataKeychain() t.Cleanup(func() { _ = DeleteTokenDataKeychain() }) @@ -362,7 +362,7 @@ func (f roundTripFunc) RoundTrip(r *http.Request) (*http.Response, error) { return f(r) } -func TestOAuthPersistConfigEdges(t *testing.T) { +func TestCrossPlatformCoverageOAuthPersistConfigEdges(t *testing.T) { p := &OAuthProvider{configDir: t.TempDir(), logger: slog.Default()} SetClientID("") SetClientSecret("") @@ -387,7 +387,7 @@ func TestOAuthPersistConfigEdges(t *testing.T) { SetClientSecret("") } -func TestBuildOAuthAuthURLTarget(t *testing.T) { +func TestCrossPlatformCoverageBuildOAuthAuthURLTarget(t *testing.T) { raw := buildAuthURL("client", "http://localhost/callback", "corp") parsed, err := url.Parse(raw) if err != nil { @@ -398,7 +398,7 @@ func TestBuildOAuthAuthURLTarget(t *testing.T) { } } -func TestOAuthLoginDenialAndPolling(t *testing.T) { +func TestCrossPlatformCoverageOAuthLoginDenialAndPolling(t *testing.T) { oldPoll := oauthPollInterval oldApproval := oauthApprovalTimeout oldPause := oauthSuccessPause @@ -514,7 +514,7 @@ func TestOAuthLoginDenialAndPolling(t *testing.T) { }) } -func TestOAuthLoginExchangeFailure(t *testing.T) { +func TestCrossPlatformCoverageOAuthLoginExchangeFailure(t *testing.T) { f := newOAuthLoginFixture(t, func(int32) CLIAuthStatus { return CLIAuthStatus{Success: true, Result: &CLIAuthResult{CLIAuthEnabled: true}} }) @@ -535,7 +535,7 @@ func TestOAuthLoginExchangeFailure(t *testing.T) { } } -func TestOAuthRefreshAndParsingEdges(t *testing.T) { +func TestCrossPlatformCoverageOAuthRefreshAndParsingEdges(t *testing.T) { t.Setenv("DWS_CLIENT_ID", "") t.Setenv("DWS_CLIENT_SECRET", "") dir := t.TempDir() @@ -639,7 +639,7 @@ func TestOAuthRefreshAndParsingEdges(t *testing.T) { } } -func TestOAuthProviderHighLevelEdges(t *testing.T) { +func TestCrossPlatformCoverageOAuthProviderHighLevelEdges(t *testing.T) { oldLoad := oauthLoadToken oldAcquire := oauthAcquireLock oldMark := oauthMarkProfile @@ -769,7 +769,7 @@ func TestOAuthProviderHighLevelEdges(t *testing.T) { } } -func TestOAuthCallbackRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageOAuthCallbackRemainingEdges(t *testing.T) { oldCheck := oauthCheckStatus oldAdmins := oauthGetAdmins oldApply := oauthSendApply @@ -936,7 +936,7 @@ func TestOAuthCallbackRemainingEdges(t *testing.T) { }) } -func TestOAuthHelperRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageOAuthHelperRemainingEdges(t *testing.T) { oldClient := oauthHTTPClient oldRequest := oauthNewRequest oldRetry := oauthRetryAfter diff --git a/internal/auth/remaining_coverage_test.go b/internal/auth/remaining_coverage_test.go index fb65d3d2..5044bfbc 100644 --- a/internal/auth/remaining_coverage_test.go +++ b/internal/auth/remaining_coverage_test.go @@ -15,7 +15,7 @@ import ( "github.com/DingTalk-Real-AI/dingtalk-workspace-cli/pkg/edition" ) -func TestMigrateKeychainToFileDEKCoverage(t *testing.T) { +func TestCrossPlatformCoverageMigrateKeychainToFileDEKCoverage(t *testing.T) { orig := authMigrateToFileDEK t.Cleanup(func() { authMigrateToFileDEK = orig }) @@ -30,7 +30,7 @@ func TestMigrateKeychainToFileDEKCoverage(t *testing.T) { } } -func TestTokenPersistencePreflightRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageTokenPersistencePreflightRemainingEdges(t *testing.T) { origHooks := edition.Get() origGet := authKeychainGet origValidate := authValidateEntries @@ -90,7 +90,7 @@ func TestTokenPersistencePreflightRemainingEdges(t *testing.T) { } } -func TestPortableExportRemainingEdges(t *testing.T) { +func TestCrossPlatformCoveragePortableExportRemainingEdges(t *testing.T) { origStat := portableStat origConfigFiles := portableConfigFilesForExport origManifest := portableWriteManifest @@ -167,7 +167,7 @@ func TestPortableExportRemainingEdges(t *testing.T) { } } -func TestLoadTokenDataForProfileLegacyFailure(t *testing.T) { +func TestCrossPlatformCoverageLoadTokenDataForProfileLegacyFailure(t *testing.T) { origResolve := tokenResolveProfile origLoadCorp := tokenLoadKeychainForCorpID origLoadLegacy := tokenLoadKeychain diff --git a/internal/cli/api_coverage_more_test.go b/internal/cli/api_coverage_more_test.go index 4d2859b2..2304b7be 100644 --- a/internal/cli/api_coverage_more_test.go +++ b/internal/cli/api_coverage_more_test.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" ) -func TestRuntimeAnnotationAPIsCoverage(t *testing.T) { +func TestCrossPlatformCoverageRuntimeAnnotationAPIsCoverage(t *testing.T) { AttachRuntimeSchema(nil, "p", "t", "s") AttachRuntimeSchema(&cobra.Command{}, "", "", "") AnnotateRuntimeToolMetadata(nil, "", "", "") @@ -60,7 +60,7 @@ func TestRuntimeAnnotationAPIsCoverage(t *testing.T) { } } -func TestRuntimeRegistriesAndSchemaHintsCoverage(t *testing.T) { +func TestCrossPlatformCoverageRuntimeRegistriesAndSchemaHintsCoverage(t *testing.T) { originalConstraints := runtimeSchemaConstraintsByCanonical originalParameters := runtimeSchemaParameterMetadataByCanonical t.Cleanup(func() { diff --git a/internal/cli/coverage_edges_test.go b/internal/cli/coverage_edges_test.go index 99e07f77..e1298746 100644 --- a/internal/cli/coverage_edges_test.go +++ b/internal/cli/coverage_edges_test.go @@ -15,7 +15,7 @@ import ( "github.com/DingTalk-Real-AI/dingtalk-workspace-cli/pkg/edition" ) -func TestCanonicalCommandsAndFlags(t *testing.T) { +func TestCrossPlatformCoverageCanonicalCommandsAndFlags(t *testing.T) { mcp := NewMCPCommand(t.Context(), nil, nil, nil) mcp.SetOut(&bytes.Buffer{}) if err := mcp.Execute(); err != nil { @@ -84,7 +84,7 @@ func TestCanonicalCommandsAndFlags(t *testing.T) { } } -func TestLoaderAndPriorityEdges(t *testing.T) { +func TestCrossPlatformCoverageLoaderAndPriorityEdges(t *testing.T) { for _, reason := range []CatalogDegradedReason{DegradedUnauthenticated, DegradedMarketUnreachable, DegradedRuntimeAllFailed, "other"} { degraded := newCatalogDegraded(reason, 2) if degraded.Error() == "" || degradedHint(reason, 2) == "" || degraded.Hint == "" { @@ -131,7 +131,7 @@ func TestLoaderAndPriorityEdges(t *testing.T) { } } -func TestSchemaValidationCompleteMatrix(t *testing.T) { +func TestCrossPlatformCoverageSchemaValidationCompleteMatrix(t *testing.T) { if err := ValidateInputSchema(nil, nil); err != nil { t.Fatal(err) } @@ -212,7 +212,7 @@ func TestSchemaValidationCompleteMatrix(t *testing.T) { } } -func TestStdinCompleteMatrix(t *testing.T) { +func TestCrossPlatformCoverageStdinCompleteMatrix(t *testing.T) { original := os.Stdin t.Cleanup(func() { os.Stdin = original }) closed, err := os.CreateTemp(t.TempDir(), "closed") diff --git a/internal/cli/runtime_schema_coverage_more_test.go b/internal/cli/runtime_schema_coverage_more_test.go index a22c1ba8..39722646 100644 --- a/internal/cli/runtime_schema_coverage_more_test.go +++ b/internal/cli/runtime_schema_coverage_more_test.go @@ -14,7 +14,7 @@ import ( "github.com/spf13/pflag" ) -func TestRuntimeSchemaLoaderAndAnnotationEdges(t *testing.T) { +func TestCrossPlatformCoverageRuntimeSchemaLoaderAndAnnotationEdges(t *testing.T) { originalJSON := embeddedMCPMetadataJSON t.Cleanup(func() { embeddedMCPMetadataJSON = originalJSON }) embeddedMCPMetadataJSON = []byte("{") @@ -45,7 +45,7 @@ func TestRuntimeSchemaLoaderAndAnnotationEdges(t *testing.T) { } } -func TestCollectRuntimeSchemaEntriesErrorsAndOrdering(t *testing.T) { +func TestCrossPlatformCoverageCollectRuntimeSchemaEntriesErrorsAndOrdering(t *testing.T) { originalValidate := validateReviewedParameterBindings originalRegistry := loadReviewedCommandRegistry originalManual := loadReviewedManualSchemaHints @@ -89,7 +89,7 @@ func TestCollectRuntimeSchemaEntriesErrorsAndOrdering(t *testing.T) { } } -func TestRuntimeSchemaMetadataLookupEdges(t *testing.T) { +func TestCrossPlatformCoverageRuntimeSchemaMetadataLookupEdges(t *testing.T) { originalHints := defaultSchemaHintRegistry t.Cleanup(func() { defaultSchemaHintRegistry = originalHints }) defaultSchemaHintRegistry = newSchemaHintRegistry() @@ -142,7 +142,7 @@ func TestRuntimeSchemaMetadataLookupEdges(t *testing.T) { } } -func TestRuntimeSchemaCandidateAndProvenanceEdges(t *testing.T) { +func TestCrossPlatformCoverageRuntimeSchemaCandidateAndProvenanceEdges(t *testing.T) { left := runtimeSchemaStringCandidateAtPriority("same", true, "same", 1, "z") right := runtimeSchemaStringCandidateAtPriority("same", true, "same", 1, "a") winner, err := resolveRuntimeSchemaCandidate("ordering", left, right) @@ -180,7 +180,7 @@ func TestRuntimeSchemaCandidateAndProvenanceEdges(t *testing.T) { } } -func TestRuntimeCommandParameterErrorEdges(t *testing.T) { +func TestCrossPlatformCoverageRuntimeCommandParameterErrorEdges(t *testing.T) { cmd := &cobra.Command{Use: "run"} cmd.Flags().String("value", "", "value") flag := cmd.Flags().Lookup("value") @@ -269,7 +269,7 @@ func TestRuntimeCommandParameterErrorEdges(t *testing.T) { } } -func TestRuntimeSchemaPureHelperEdges(t *testing.T) { +func TestCrossPlatformCoverageRuntimeSchemaPureHelperEdges(t *testing.T) { if runtimeCommandFlag(nil, "x") != nil || runtimeCommandFlag(&cobra.Command{Use: "run"}, " ") != nil { t.Fatal("invalid command flag lookup should be nil") } @@ -323,7 +323,7 @@ func TestRuntimeSchemaPureHelperEdges(t *testing.T) { } } -func TestSchemaCompactProjectionEdges(t *testing.T) { +func TestCrossPlatformCoverageSchemaCompactProjectionEdges(t *testing.T) { if stripSchemaPayloadCompact(nil) != nil { t.Fatal("nil compact payload should stay nil") } diff --git a/internal/cli/schema_catalog_coverage_more_test.go b/internal/cli/schema_catalog_coverage_more_test.go index 94e037b1..a2e5d4c3 100644 --- a/internal/cli/schema_catalog_coverage_more_test.go +++ b/internal/cli/schema_catalog_coverage_more_test.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/cobra" ) -func TestBuildSchemaCatalogSnapshotGateFailures(t *testing.T) { +func TestCrossPlatformCoverageBuildSchemaCatalogSnapshotGateFailures(t *testing.T) { registry, _ := validSnapshotAdapterFixture(t) resolved := ResolvedSchemaBuild{root: &cobra.Command{Use: "root"}, registry: registry} original := captureCatalogHooks() @@ -70,7 +70,7 @@ func TestBuildSchemaCatalogSnapshotGateFailures(t *testing.T) { } } -func TestLoadSchemaCatalogSnapshotGateFailures(t *testing.T) { +func TestCrossPlatformCoverageLoadSchemaCatalogSnapshotGateFailures(t *testing.T) { _, base := validSnapshotAdapterFixture(t) base.Version = SchemaCatalogSnapshotVersion base.SourceHash = schemaCatalogSnapshotHash(base) @@ -120,7 +120,7 @@ func TestLoadSchemaCatalogSnapshotGateFailures(t *testing.T) { } } -func TestSchemaCatalogLookupAndConversionEdges(t *testing.T) { +func TestCrossPlatformCoverageSchemaCatalogLookupAndConversionEdges(t *testing.T) { if exactSchemaCommand(nil, "sample") != nil { t.Fatal("nil root resolved a command") } diff --git a/internal/cli/schema_cobra_binding_coverage_more_test.go b/internal/cli/schema_cobra_binding_coverage_more_test.go index ef818f18..2c636c29 100644 --- a/internal/cli/schema_cobra_binding_coverage_more_test.go +++ b/internal/cli/schema_cobra_binding_coverage_more_test.go @@ -20,7 +20,7 @@ func requirePanicCoverage(t *testing.T, fn func()) { fn() } -func TestRuntimeCompatibilityAnnotationEdges(t *testing.T) { +func TestCrossPlatformCoverageRuntimeCompatibilityAnnotationEdges(t *testing.T) { valid := RuntimeCompatibilityEquivalence{ID: "pair", Reason: "reviewed", Reviewed: true} requirePanicCoverage(t, func() { AnnotateRuntimeCompatibilityEquivalence(nil, &cobra.Command{}, valid) }) requirePanicCoverage(t, func() { @@ -55,7 +55,7 @@ func TestRuntimeCompatibilityAnnotationEdges(t *testing.T) { } } -func TestBindEffectiveCommandRegistryWrapperEdges(t *testing.T) { +func TestCrossPlatformCoverageBindEffectiveCommandRegistryWrapperEdges(t *testing.T) { oldValidate := bindValidateParameterBindings t.Cleanup(func() { bindValidateParameterBindings = oldValidate }) if _, err := BindEffectiveCommandRegistry(nil, EffectiveCommandRegistry{}); err == nil || !strings.Contains(err.Error(), "root is nil") { @@ -71,7 +71,7 @@ func TestBindEffectiveCommandRegistryWrapperEdges(t *testing.T) { } } -func TestCommandRegistryAliasBindingRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageCommandRegistryAliasBindingRemainingEdges(t *testing.T) { spec := CommandSpec{CanonicalPath: "sample.run", PrimaryCLIPath: "sample run"} root := commandRegistryTestRoot("sample run", "sample group") primary := exactSchemaCommand(root, "sample run") @@ -97,7 +97,7 @@ func TestCommandRegistryAliasBindingRemainingEdges(t *testing.T) { } } -func TestCompatibilityLeafContractDependencyAndMetadataEdges(t *testing.T) { +func TestCrossPlatformCoverageCompatibilityLeafContractDependencyAndMetadataEdges(t *testing.T) { oldContracts := loadCompatibilityFlagContracts oldBindings := compatibilityParameterBindings t.Cleanup(func() { @@ -185,7 +185,7 @@ func TestCompatibilityLeafContractDependencyAndMetadataEdges(t *testing.T) { } } -func TestCompatibilityFlagContractDifferenceEdges(t *testing.T) { +func TestCrossPlatformCoverageCompatibilityFlagContractDifferenceEdges(t *testing.T) { oldContracts := loadCompatibilityFlagContracts t.Cleanup(func() { loadCompatibilityFlagContracts = oldContracts }) primaryContracts := map[string]compatibilityFlagContract{ @@ -216,7 +216,7 @@ func TestCompatibilityFlagContractDifferenceEdges(t *testing.T) { } } -func TestCompatibilityHandlerAndArgsRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageCompatibilityHandlerAndArgsRemainingEdges(t *testing.T) { if problems := compatibilityHandlerContractProblems(nil, &cobra.Command{}); len(problems) != 1 { t.Fatalf("nil handler problems = %v", problems) } @@ -292,7 +292,7 @@ func TestCompatibilityHandlerAndArgsRemainingEdges(t *testing.T) { } } -func TestCompatibilityPathAndHelperRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageCompatibilityPathAndHelperRemainingEdges(t *testing.T) { if got := compatibilityJSON(func() {}); !strings.Contains(got, "0x") { t.Fatalf("compatibilityJSON(func) = %q", got) } diff --git a/internal/cli/schema_completeness_coverage_more_test.go b/internal/cli/schema_completeness_coverage_more_test.go index 2e224d9e..34be50aa 100644 --- a/internal/cli/schema_completeness_coverage_more_test.go +++ b/internal/cli/schema_completeness_coverage_more_test.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -func TestEmbeddedRuntimeSchemaExclusionDecodeEdges(t *testing.T) { +func TestCrossPlatformCoverageEmbeddedRuntimeSchemaExclusionDecodeEdges(t *testing.T) { previous := embeddedRuntimeSchemaExclusionsJSON t.Cleanup(func() { embeddedRuntimeSchemaExclusionsJSON = previous }) cases := []struct { @@ -32,7 +32,7 @@ func TestEmbeddedRuntimeSchemaExclusionDecodeEdges(t *testing.T) { embeddedRuntimeSchemaExclusionsJSON = previous } -func TestCompletenessWrapperErrorBoundaries(t *testing.T) { +func TestCrossPlatformCoverageCompletenessWrapperErrorBoundaries(t *testing.T) { oldLoad := completenessLoadExclusions oldApply := completenessApplyManual oldBuild := completenessBuildEffective @@ -124,7 +124,7 @@ func TestCompletenessWrapperErrorBoundaries(t *testing.T) { } } -func TestCatalogDeliveryCompletenessLoadedIdentityEdges(t *testing.T) { +func TestCrossPlatformCoverageCatalogDeliveryCompletenessLoadedIdentityEdges(t *testing.T) { oldQuery := deliverySchemaPayload oldResolve := deliveryIndexResolve oldTool := deliveryToolPayload @@ -283,7 +283,7 @@ func TestCatalogDeliveryCompletenessLoadedIdentityEdges(t *testing.T) { schemaCatalogDeliveryCompletenessAgainstLoadedAndIdentity(root, loaded, nil, identities, nil) } -func TestSchemaRegistryProjectionRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageSchemaRegistryProjectionRemainingEdges(t *testing.T) { oldRegistry := deliveryRegistryPayload oldProduct := renderRegistryProductSummary oldQuery := deliverySchemaPayload @@ -400,7 +400,7 @@ func TestSchemaRegistryProjectionRemainingEdges(t *testing.T) { } } -func TestCompletenessIdentityAndPathHelpersRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageCompletenessIdentityAndPathHelpersRemainingEdges(t *testing.T) { bound := BoundCommandRegistry{Commands: []BoundCommandSpec{ {CommandSpec: CommandSpec{CanonicalPath: "sample.one", PrimaryCLIPath: "sample run", Visibility: SchemaVisibilityPublic}}, {CommandSpec: CommandSpec{CanonicalPath: "sample.two", PrimaryCLIPath: "sample run", Visibility: SchemaVisibilityPublic}}, diff --git a/internal/cli/schema_contract_model_coverage_more_test.go b/internal/cli/schema_contract_model_coverage_more_test.go index e9e4016b..5b59be11 100644 --- a/internal/cli/schema_contract_model_coverage_more_test.go +++ b/internal/cli/schema_contract_model_coverage_more_test.go @@ -17,7 +17,7 @@ func contractCoverageTool(product, name, cliPath string) ToolSpec { }} } -func TestContractModelProvenanceValueAndDryRunEdges(t *testing.T) { +func TestCrossPlatformCoverageContractModelProvenanceValueAndDryRunEdges(t *testing.T) { if err := (DryRunSpec{}).Validate(""); err == nil || !strings.Contains(err.Error(), "no preview_kind") { t.Fatalf("empty dry-run error = %v", err) } @@ -43,7 +43,7 @@ func TestContractModelProvenanceValueAndDryRunEdges(t *testing.T) { } } -func TestSchemaIndexRemainingCollisionEdges(t *testing.T) { +func TestCrossPlatformCoverageSchemaIndexRemainingCollisionEdges(t *testing.T) { base := contractCoverageTool("sample", "run", "sample run") alias := base alias.Identity.IsAlias = true @@ -88,7 +88,7 @@ func TestSchemaIndexRemainingCollisionEdges(t *testing.T) { } } -func TestSchemaSnapshotRendererDependencyEdges(t *testing.T) { +func TestCrossPlatformCoverageSchemaSnapshotRendererDependencyEdges(t *testing.T) { oldToolSummary := snapshotToolSummary oldToolPayload := snapshotToolPayload oldProductSummary := snapshotProductSummary @@ -125,7 +125,7 @@ func TestSchemaSnapshotRendererDependencyEdges(t *testing.T) { } } -func TestToolSpecValidationRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageToolSpecValidationRemainingEdges(t *testing.T) { base := contractCoverageTool("sample", "run", "sample run") cases := []struct { name string @@ -162,7 +162,7 @@ func TestToolSpecValidationRemainingEdges(t *testing.T) { } } -func TestFinalFieldProvenanceRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageFinalFieldProvenanceRemainingEdges(t *testing.T) { if err := validateFinalFieldProvenance("owner", "field", FieldProvenance{}, func() {}); err == nil || !strings.Contains(err.Error(), "cannot encode") { t.Fatalf("final encode error = %v", err) } @@ -189,7 +189,7 @@ func TestFinalFieldProvenanceRemainingEdges(t *testing.T) { } } -func TestContractModelNormalizationSortEdges(t *testing.T) { +func TestCrossPlatformCoverageContractModelNormalizationSortEdges(t *testing.T) { registry := SchemaRegistry{Products: []ProductSpec{{ ID: " sample ", Tools: []ToolSpec{ @@ -212,7 +212,7 @@ func TestContractModelNormalizationSortEdges(t *testing.T) { } } -func TestContractModelPayloadErrorEdges(t *testing.T) { +func TestCrossPlatformCoverageContractModelPayloadErrorEdges(t *testing.T) { invalidRegistry := SchemaRegistry{Products: []ProductSpec{{ID: " "}}} if _, err := invalidRegistry.ToPayload(); err == nil { t.Fatal("invalid registry ToPayload succeeded") diff --git a/internal/cli/schema_delivery_invariants_coverage_more_test.go b/internal/cli/schema_delivery_invariants_coverage_more_test.go index d3e1c553..f9260d88 100644 --- a/internal/cli/schema_delivery_invariants_coverage_more_test.go +++ b/internal/cli/schema_delivery_invariants_coverage_more_test.go @@ -30,7 +30,7 @@ func requireDeliveryProblem(t *testing.T, loaded loadedSchemaCatalog, want strin } } -func TestSchemaDeliveryInvariantBoundaryErrors(t *testing.T) { +func TestCrossPlatformCoverageSchemaDeliveryInvariantBoundaryErrors(t *testing.T) { badSnapshot := SchemaCatalogSnapshot{Catalog: map[string]any{"bad": func() {}}} if err := ValidateSchemaDeliveryInvariants(SchemaRegistry{}, badSnapshot); err == nil || !strings.Contains(err.Error(), "encode final") { t.Fatalf("ValidateSchemaDeliveryInvariants() marshal error = %v", err) @@ -69,7 +69,7 @@ func TestSchemaDeliveryInvariantBoundaryErrors(t *testing.T) { } } -func TestSchemaJSONDifferenceRemainingShapes(t *testing.T) { +func TestCrossPlatformCoverageSchemaJSONDifferenceRemainingShapes(t *testing.T) { path, left, _ := firstSchemaJSONDifference(func() {}, map[string]any{}) if path != "$" || !strings.Contains(left, "encode error") { t.Fatalf("encode difference = %q %q", path, left) @@ -104,7 +104,7 @@ func TestSchemaJSONDifferenceRemainingShapes(t *testing.T) { } } -func TestSchemaDeliveryInvariantProjectionEdges(t *testing.T) { +func TestCrossPlatformCoverageSchemaDeliveryInvariantProjectionEdges(t *testing.T) { oldRegistry := deliveryRegistryPayload oldQuery := deliverySchemaPayload oldOverview := deliveryOverviewPayload @@ -258,7 +258,7 @@ func TestSchemaDeliveryInvariantProjectionEdges(t *testing.T) { requireDeliveryProblem(t, loaded, "Catalog full tools contain 2 tools") } -func TestSchemaDeliveryToolExtractionAndAliasPathEdge(t *testing.T) { +func TestCrossPlatformCoverageSchemaDeliveryToolExtractionAndAliasPathEdge(t *testing.T) { payload := map[string]any{"products": []map[string]any{{"tools": []map[string]any{{"title": "missing"}}}}} _, problems := schemaDeliveryToolsByCanonical(payload, "view") if len(problems) != 1 || !strings.Contains(problems[0], "without canonical_path") { diff --git a/internal/cli/schema_full_pipeline_external_test.go b/internal/cli/schema_full_pipeline_external_test.go index 877a8ae3..5d6a35bd 100644 --- a/internal/cli/schema_full_pipeline_external_test.go +++ b/internal/cli/schema_full_pipeline_external_test.go @@ -15,7 +15,7 @@ import ( // test package. Keeping this here (rather than in a generator package) means // Go's normal per-package coverage accounting attributes the exercised Schema // assembly code to internal/cli. -func TestProductionSchemaSourcePipeline(t *testing.T) { +func TestCrossPlatformCoverageProductionSchemaSourcePipeline(t *testing.T) { root := app.NewRootCommand() resolved, err := cli.ResolveSchemaBuild(root) if err != nil { diff --git a/internal/cli/schema_manual_hints_coverage_more_test.go b/internal/cli/schema_manual_hints_coverage_more_test.go index 4be29d56..b37b0d7a 100644 --- a/internal/cli/schema_manual_hints_coverage_more_test.go +++ b/internal/cli/schema_manual_hints_coverage_more_test.go @@ -12,7 +12,7 @@ import ( "github.com/spf13/cobra" ) -func TestManualSchemaHintDecodeAndValidationEdges(t *testing.T) { +func TestCrossPlatformCoverageManualSchemaHintDecodeAndValidationEdges(t *testing.T) { valid := ManualSchemaHintSnapshot{ Schema: manualSchemaHintSchemaRef, Version: manualSchemaHintVersion, @@ -140,7 +140,7 @@ func TestManualSchemaHintDecodeAndValidationEdges(t *testing.T) { } } -func TestManualAgentExamplePlanAndParserEdges(t *testing.T) { +func TestCrossPlatformCoverageManualAgentExamplePlanAndParserEdges(t *testing.T) { _, leaf := manualSchemaHintTestTree() spec := BoundCommandSpec{ CommandSpec: CommandSpec{CanonicalPath: "sample.search_items", PrimaryCLIPath: "sample item search"}, @@ -241,7 +241,7 @@ func TestManualAgentExamplePlanAndParserEdges(t *testing.T) { } } -func TestManualAgentExampleCobraContractEdges(t *testing.T) { +func TestCrossPlatformCoverageManualAgentExampleCobraContractEdges(t *testing.T) { root, leaf := manualSchemaHintTestTree() root.PersistentFlags().StringP("format", "f", "", "format") leaf.Flags().BoolP("verbose", "v", false, "verbose") @@ -325,7 +325,7 @@ func TestManualAgentExampleCobraContractEdges(t *testing.T) { } } -func TestApplyManualSchemaHintsAndAnnotationEdges(t *testing.T) { +func TestCrossPlatformCoverageApplyManualSchemaHintsAndAnnotationEdges(t *testing.T) { if _, err := applyManualSchemaHints(nil, ManualSchemaHintSnapshot{Version: manualSchemaHintVersion}); err == nil || !strings.Contains(err.Error(), "root is nil") { t.Fatalf("nil root error = %v", err) } @@ -470,7 +470,7 @@ func TestApplyManualSchemaHintsAndAnnotationEdges(t *testing.T) { } } -func TestEmbeddedManualSchemaHintWrapperErrors(t *testing.T) { +func TestCrossPlatformCoverageEmbeddedManualSchemaHintWrapperErrors(t *testing.T) { previous := loadManualSchemaHints loadManualSchemaHints = func() (ManualSchemaHintSnapshot, error) { return ManualSchemaHintSnapshot{}, errors.New("hints failed") diff --git a/internal/cli/schema_parameter_bindings_coverage_more_test.go b/internal/cli/schema_parameter_bindings_coverage_more_test.go index 8fbdc374..03a18a12 100644 --- a/internal/cli/schema_parameter_bindings_coverage_more_test.go +++ b/internal/cli/schema_parameter_bindings_coverage_more_test.go @@ -28,7 +28,7 @@ func validParameterBindingSnapshotForCoverage(t *testing.T) schemaParameterBindi } } -func TestSchemaParameterBindingSnapshotAuditEdges(t *testing.T) { +func TestCrossPlatformCoverageSchemaParameterBindingSnapshotAuditEdges(t *testing.T) { valid := validParameterBindingSnapshotForCoverage(t) encoded, err := json.Marshal(valid) if err != nil { @@ -112,7 +112,7 @@ func TestSchemaParameterBindingSnapshotAuditEdges(t *testing.T) { } } -func TestSchemaParameterBindingDeliveryRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageSchemaParameterBindingDeliveryRemainingEdges(t *testing.T) { command := &cobra.Command{Use: "read"} command.Flags().String("id", "", "id") boundSpec := BoundCommandSpec{CommandSpec: CommandSpec{CanonicalPath: "sample.read", Visibility: SchemaVisibilityPublic}, PrimaryCommand: command} @@ -186,7 +186,7 @@ func TestSchemaParameterBindingDeliveryRemainingEdges(t *testing.T) { } } -func TestSchemaParameterBindingHelpersAndLoaderErrors(t *testing.T) { +func TestCrossPlatformCoverageSchemaParameterBindingHelpersAndLoaderErrors(t *testing.T) { if _, ok := finalSchemaParameterByName(ToolSpec{}, "missing"); ok { t.Fatal("missing parameter found") } diff --git a/internal/cli/schema_registry_coverage_more_test.go b/internal/cli/schema_registry_coverage_more_test.go index d7072c1f..b5c3e482 100644 --- a/internal/cli/schema_registry_coverage_more_test.go +++ b/internal/cli/schema_registry_coverage_more_test.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/cobra" ) -func TestCommandRegistryLoaderErrorWrappers(t *testing.T) { +func TestCrossPlatformCoverageCommandRegistryLoaderErrorWrappers(t *testing.T) { previousRegistry := loadReviewedCommandRegistry previousBindings := validateReviewedParameterBindings previousManual := loadReviewedManualSchemaHints @@ -47,7 +47,7 @@ func TestCommandRegistryLoaderErrorWrappers(t *testing.T) { } } -func TestCommandRegistryDecodeAndIndexRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageCommandRegistryDecodeAndIndexRemainingEdges(t *testing.T) { base := func(products string) string { return `{"$schema":"./schema_command_registry.schema.json","version":1,"products":` + products + `}` } @@ -111,7 +111,7 @@ func TestCommandRegistryDecodeAndIndexRemainingEdges(t *testing.T) { _ = hashCommandSpecs([]CommandSpec{{CanonicalPath: "sample.get", PrimaryCLIPath: "sample get"}}) } -func TestEffectiveCommandRegistryRemainingErrors(t *testing.T) { +func TestCrossPlatformCoverageEffectiveCommandRegistryRemainingErrors(t *testing.T) { if _, err := BuildEffectiveCommandRegistry(nil); err == nil { t.Fatal("nil effective root succeeded") } diff --git a/internal/cli/schema_runtime_registry_coverage_more_test.go b/internal/cli/schema_runtime_registry_coverage_more_test.go index 286ad3a7..89fd8373 100644 --- a/internal/cli/schema_runtime_registry_coverage_more_test.go +++ b/internal/cli/schema_runtime_registry_coverage_more_test.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/cobra" ) -func TestResolveAndAssembleSchemaRegistryErrorBoundaries(t *testing.T) { +func TestCrossPlatformCoverageResolveAndAssembleSchemaRegistryErrorBoundaries(t *testing.T) { oldApply := resolveApplyManualSchemaHints oldEffective := resolveEffectiveCommandRegistry oldBind := resolveBoundCommandRegistry @@ -121,7 +121,7 @@ func TestResolveAndAssembleSchemaRegistryErrorBoundaries(t *testing.T) { } } -func TestRuntimeToolSpecDependencyErrors(t *testing.T) { +func TestCrossPlatformCoverageRuntimeToolSpecDependencyErrors(t *testing.T) { oldDryRun := resolveReviewedDryRun oldText := resolveRuntimeToolText oldParameters := resolveRuntimeParameters @@ -157,7 +157,7 @@ func TestRuntimeToolSpecDependencyErrors(t *testing.T) { } } -func TestRuntimeSchemaRegistryPayloadBranches(t *testing.T) { +func TestCrossPlatformCoverageRuntimeSchemaRegistryPayloadBranches(t *testing.T) { oldSnapshot := renderRegistrySnapshot oldPayload := renderRegistryPayload oldProduct := renderRegistryProductSummary @@ -233,7 +233,7 @@ func TestRuntimeSchemaRegistryPayloadBranches(t *testing.T) { } } -func TestRuntimeRegistryIdentityAndAgentMetadataRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageRuntimeRegistryIdentityAndAgentMetadataRemainingEdges(t *testing.T) { baseTool := ToolSpec{Identity: ToolIdentitySpec{ ProductID: "sample", Name: "run", CanonicalPath: "sample.run", Path: "sample.run", CLIPath: "sample run", PrimaryCLIPath: "sample run", Aliases: []string{"sample execute"}, Source: "registry", @@ -317,7 +317,7 @@ func TestRuntimeRegistryIdentityAndAgentMetadataRemainingEdges(t *testing.T) { } } -func TestFinalSchemaProvenanceRejectsInvalidTool(t *testing.T) { +func TestCrossPlatformCoverageFinalSchemaProvenanceRejectsInvalidTool(t *testing.T) { registry := SchemaRegistry{Products: []ProductSpec{{ ID: "sample", Selection: SelectionSpec{AgentSummary: "summary", UseWhen: []string{}, AvoidWhen: []string{}}, diff --git a/internal/cli/schema_small_coverage_test.go b/internal/cli/schema_small_coverage_test.go index 3b178415..fd518db0 100644 --- a/internal/cli/schema_small_coverage_test.go +++ b/internal/cli/schema_small_coverage_test.go @@ -16,7 +16,7 @@ import ( "github.com/spf13/cobra" ) -func TestSchemaCommandRemainingBranches(t *testing.T) { +func TestCrossPlatformCoverageSchemaCommandRemainingBranches(t *testing.T) { for _, tc := range []struct { name string args []string @@ -57,7 +57,7 @@ func TestSchemaCommandRemainingBranches(t *testing.T) { } } -func TestSchemaCommandCatalogFailure(t *testing.T) { +func TestCrossPlatformCoverageSchemaCommandCatalogFailure(t *testing.T) { original := schemaCommandCatalogError t.Cleanup(func() { schemaCommandCatalogError = original }) schemaCommandCatalogError = func() error { return errors.New("catalog failed") } @@ -68,7 +68,7 @@ func TestSchemaCommandCatalogFailure(t *testing.T) { } } -func TestSchemaSupportParameterAndIdentityEdges(t *testing.T) { +func TestCrossPlatformCoverageSchemaSupportParameterAndIdentityEdges(t *testing.T) { if hasRuntimeSchemaCommand(nil) { t.Fatal("nil command has runtime schema") } @@ -99,14 +99,14 @@ func TestSchemaSupportParameterAndIdentityEdges(t *testing.T) { } } -func TestAgentMetadataRemainingPureEdges(t *testing.T) { +func TestCrossPlatformCoverageAgentMetadataRemainingPureEdges(t *testing.T) { provenance := resolvedFieldProvenance(make(chan int), " source ", " ref ", " precedence ", " resolution ", " reason ") if string(provenance.Value) != "null" || len(provenance.Candidates) != 1 { t.Fatalf("fallback provenance = %#v", provenance) } } -func TestEmbeddedAgentMetadataLoaderEdges(t *testing.T) { +func TestCrossPlatformCoverageEmbeddedAgentMetadataLoaderEdges(t *testing.T) { for _, source := range []fs.FS{ fstest.MapFS{}, fstest.MapFS{"schema_agent_metadata/index.json": {Data: []byte("{")}}, @@ -137,7 +137,7 @@ func TestEmbeddedAgentMetadataLoaderEdges(t *testing.T) { } } -func TestManualAgentSelectionRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageManualAgentSelectionRemainingEdges(t *testing.T) { baseBound := manualAgentSelectionBoundFixture() baseHints := manualAgentHintSetFixture() for _, tc := range []struct { @@ -239,7 +239,7 @@ func cloneManualAgentTools(source map[string]ManualAgentToolHint) map[string]Man return out } -func TestHintDirectoryLoaderRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageHintDirectoryLoaderRemainingEdges(t *testing.T) { directoryJSON := fstest.MapFS{"bad.json": {Mode: fs.ModeDir}} invalidJSON := fstest.MapFS{"bad.json": {Data: []byte("{")}} if _, err := loadParameterCommandsFromMetadata(fstest.MapFS{}, "["); err == nil { @@ -292,7 +292,7 @@ func TestHintDirectoryLoaderRemainingEdges(t *testing.T) { } } -func TestInterfaceRegistryRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageInterfaceRegistryRemainingEdges(t *testing.T) { ref := &embeddedMCPInterfaceRef{ProductID: "sample", RPCName: "get"} for _, tools := range []map[string]embeddedMCPToolMetadata{ {" ": {InterfaceRef: ref}}, @@ -326,7 +326,7 @@ func TestInterfaceRegistryRemainingEdges(t *testing.T) { } } -func TestReviewedDryRunCapabilityRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageReviewedDryRunCapabilityRemainingEdges(t *testing.T) { originalGroups := reviewedDryRunCapabilityGroups t.Cleanup(func() { reviewedDryRunCapabilityGroups = originalGroups @@ -382,7 +382,7 @@ func resetReviewedDryRunCapabilitiesForTest() { reviewedDryRunCapabilitiesLazy.err = nil } -func TestSchemaSnapshotAdapterRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageSchemaSnapshotAdapterRemainingEdges(t *testing.T) { if _, err := schemaToolSpecFromPayload(map[string]any{"bad": make(chan int)}); err == nil { t.Fatal("unmarshalable tool payload succeeded") } diff --git a/internal/cli/stdin_permissions_unix_test.go b/internal/cli/stdin_permissions_unix_test.go index fb4727da..d626dddd 100644 --- a/internal/cli/stdin_permissions_unix_test.go +++ b/internal/cli/stdin_permissions_unix_test.go @@ -21,7 +21,7 @@ import ( "testing" ) -func TestReadFileBoundedPermissionDenied(t *testing.T) { +func TestCrossPlatformCoverageReadFileBoundedPermissionDenied(t *testing.T) { t.Parallel() path := filepath.Join(t.TempDir(), "noperm.txt") writeTestFile(t, path, []byte("secret")) diff --git a/internal/errors/coverage_edges_test.go b/internal/errors/coverage_edges_test.go index 332522a8..6047a05f 100644 --- a/internal/errors/coverage_edges_test.go +++ b/internal/errors/coverage_edges_test.go @@ -11,7 +11,7 @@ import ( "testing" ) -func TestDiagnosticsAndErrorRenderingEdges(t *testing.T) { +func TestCrossPlatformCoverageDiagnosticsAndErrorRenderingEdges(t *testing.T) { retryable := false err := NewAPI("message", nil, @@ -72,7 +72,7 @@ func TestDiagnosticsAndErrorRenderingEdges(t *testing.T) { } } -func TestValidationCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageValidationCoverageEdges(t *testing.T) { for _, name := range []string{"", strings.Repeat("a", 129), "1startsWithDigit", "bad name"} { if ResourceName(name) == nil { t.Errorf("ResourceName(%q) should fail", name) @@ -147,7 +147,7 @@ func TestValidationCoverageEdges(t *testing.T) { } } -func TestPATURLAndMutationCoverageEdges(t *testing.T) { +func TestCrossPlatformCoveragePATURLAndMutationCoverageEdges(t *testing.T) { oldHost := hostControlProvider oldBrowser := patBrowserProvider t.Cleanup(func() { @@ -216,7 +216,7 @@ func mustParseURLForTest(t *testing.T, raw string) *url.URL { return parsed } -func TestInvalidRPCDataIsOmitted(t *testing.T) { +func TestCrossPlatformCoverageInvalidRPCDataIsOmitted(t *testing.T) { err := NewAPI("bad rpc", WithRPCData(json.RawMessage(`{`))) var out bytes.Buffer if printErr := PrintJSON(&out, err); printErr != nil { diff --git a/internal/event/bus/coverage_edges_test.go b/internal/event/bus/coverage_edges_test.go index 80e4cb28..24761bc2 100644 --- a/internal/event/bus/coverage_edges_test.go +++ b/internal/event/bus/coverage_edges_test.go @@ -20,7 +20,7 @@ import ( var errBusInjected = errors.New("injected bus failure") -func TestMatcherConsumerAndCounterEdges(t *testing.T) { +func TestCrossPlatformCoverageMatcherConsumerAndCounterEdges(t *testing.T) { m, err := compileMatcher([]string{"", "*", "im.*", "prefix*", "exact"}, "^im", " sub ") if err != nil { t.Fatal(err) @@ -100,7 +100,7 @@ func TestMatcherConsumerAndCounterEdges(t *testing.T) { } } -func TestDropWarningScanEdges(t *testing.T) { +func TestCrossPlatformCoverageDropWarningScanEdges(t *testing.T) { origInterval := dropWarnTickInterval t.Cleanup(func() { dropWarnTickInterval = origInterval }) ctx, cancel := context.WithCancel(context.Background()) @@ -140,7 +140,7 @@ func TestDropWarningScanEdges(t *testing.T) { dropWarnWatcher(ctx, c, logger, 25) } -func TestLockFailureInjection(t *testing.T) { +func TestCrossPlatformCoverageLockFailureInjection(t *testing.T) { origTry := busTryAcquire origSeek := busSeek origRead := busReadAll @@ -231,7 +231,7 @@ func TestLockFailureInjection(t *testing.T) { } } -func TestMetaFailureInjection(t *testing.T) { +func TestCrossPlatformCoverageMetaFailureInjection(t *testing.T) { origMarshal := metaMarshalIndent origWrite := metaWriteFile origRename := metaRename @@ -266,7 +266,7 @@ type edgeSource struct { func (s edgeSource) Start(ctx context.Context, emit dwsevent.EmitFn) error { return s.start(ctx, emit) } -func TestRunStartupAndSourceEdges(t *testing.T) { +func TestCrossPlatformCoverageRunStartupAndSourceEdges(t *testing.T) { if err := Run(context.Background(), Config{}); err == nil { t.Fatal("source validation expected") } @@ -333,7 +333,7 @@ func (l *scriptedListener) Accept() (net.Conn, error) { return l.accept() } func (l *scriptedListener) Close() error { l.closed = true; return nil } func (*scriptedListener) Endpoint() string { return "edge" } -func TestDaemonMethodEdges(t *testing.T) { +func TestCrossPlatformCoverageDaemonMethodEdges(t *testing.T) { logger := slog.New(slog.NewTextHandler(io.Discard, nil)) calls := 0 l := &scriptedListener{accept: func() (net.Conn, error) { @@ -400,7 +400,7 @@ func TestDaemonMethodEdges(t *testing.T) { } } -func TestHandleConnectionProtocolEdges(t *testing.T) { +func TestCrossPlatformCoverageHandleConnectionProtocolEdges(t *testing.T) { logger := slog.New(slog.NewTextHandler(io.Discard, nil)) newDaemon := func() *daemon { return &daemon{ diff --git a/internal/event/busctl/coverage_edges_test.go b/internal/event/busctl/coverage_edges_test.go index 53ca3037..f84ed54e 100644 --- a/internal/event/busctl/coverage_edges_test.go +++ b/internal/event/busctl/coverage_edges_test.go @@ -16,7 +16,7 @@ import ( var errBusctlInjected = errors.New("injected busctl failure") -func TestDiscoverValidationAndFailures(t *testing.T) { +func TestCrossPlatformCoverageDiscoverValidationAndFailures(t *testing.T) { for name, cfg := range map[string]DiscoverConfig{ "workdir": {IPCEndpoint: "endpoint", ClientID: "id"}, "endpoint": {WorkDir: t.TempDir(), ClientID: "id"}, @@ -53,7 +53,7 @@ func TestDiscoverValidationAndFailures(t *testing.T) { } } -func TestWaitReadyRejectsShortSuccessfulRead(t *testing.T) { +func TestCrossPlatformCoverageWaitReadyRejectsShortSuccessfulRead(t *testing.T) { original := busctlReadFull t.Cleanup(func() { busctlReadFull = original }) busctlReadFull = func(io.Reader, []byte) (int, error) { return 0, nil } @@ -68,7 +68,7 @@ func TestWaitReadyRejectsShortSuccessfulRead(t *testing.T) { } } -func TestSpawnAndReadyFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageSpawnAndReadyFailureEdges(t *testing.T) { origExecutable := spawnExecutable origPipe := spawnPipe origTimeout := ReadyTimeout @@ -147,7 +147,7 @@ func TestSpawnAndReadyFailureEdges(t *testing.T) { _ = pw.Close() } -func TestStatusFilesystemEdges(t *testing.T) { +func TestCrossPlatformCoverageStatusFilesystemEdges(t *testing.T) { origReadDir := statusReadDir origStat := statusStat t.Cleanup(func() { statusReadDir = origReadDir; statusStat = origStat }) @@ -249,7 +249,7 @@ type dummyAddr string func (a dummyAddr) Network() string { return string(a) } func (a dummyAddr) String() string { return string(a) } -func TestQueryStatusAndEntryEdges(t *testing.T) { +func TestCrossPlatformCoverageQueryStatusAndEntryEdges(t *testing.T) { origDial := statusDial origQuery := queryStatus t.Cleanup(func() { statusDial = origDial; queryStatus = origQuery }) @@ -282,7 +282,7 @@ func TestQueryStatusAndEntryEdges(t *testing.T) { } } -func TestStopInjectedEdges(t *testing.T) { +func TestCrossPlatformCoverageStopInjectedEdges(t *testing.T) { origRead := stopReadHolderPID origAlive := stopAlive origFind := stopFindProcess diff --git a/internal/event/busctl/portable_defaults_test.go b/internal/event/busctl/portable_defaults_test.go index b3c18e54..de0afadc 100644 --- a/internal/event/busctl/portable_defaults_test.go +++ b/internal/event/busctl/portable_defaults_test.go @@ -20,7 +20,7 @@ import ( "testing" ) -func TestPortableDefaultFunctionCoverage(t *testing.T) { +func TestCrossPlatformCoveragePortableDefaultFunctionCoverage(t *testing.T) { originalDiscoverDial := discoverDial client, server := net.Pipe() t.Cleanup(func() { diff --git a/internal/event/consume/coverage_edges_test.go b/internal/event/consume/coverage_edges_test.go index 6baf06f8..8b30ed3f 100644 --- a/internal/event/consume/coverage_edges_test.go +++ b/internal/event/consume/coverage_edges_test.go @@ -27,7 +27,7 @@ type errorSink struct{ err error } func (s errorSink) Write(transport.Event, []byte) error { return s.err } func (s errorSink) Close() error { return s.err } -func TestFormatterPipelineRouterAndSinkEdges(t *testing.T) { +func TestCrossPlatformCoverageFormatterPipelineRouterAndSinkEdges(t *testing.T) { wantErr := errors.New("synthetic failure") oldMarshal, oldIndent, oldCompact := marshalEvent, marshalEventIndent, marshalCompact oldMkdir, oldWrite, oldRename, oldRemove := mkdirSinkDir, writeSinkFile, renameSinkFile, removeSinkFile @@ -103,7 +103,7 @@ func validRunConfig() Config { return Config{WorkDir: "work", IPCEndpoint: "endpoint", ClientID: "client", Stdout: io.Discard, Stderr: io.Discard, Format: FormatNDJSON} } -func TestRunSetupAndDiscoveryEdges(t *testing.T) { +func TestCrossPlatformCoverageRunSetupAndDiscoveryEdges(t *testing.T) { if err := Run(context.Background(), Config{}); err == nil { t.Fatal("missing required run config should fail") } @@ -139,7 +139,7 @@ func TestRunSetupAndDiscoveryEdges(t *testing.T) { } } -func TestRunFrameAndDeliveryEdges(t *testing.T) { +func TestCrossPlatformCoverageRunFrameAndDeliveryEdges(t *testing.T) { oldDiscover := discoverBus t.Cleanup(func() { discoverBus = oldDiscover }) ack := mustJSONFrame(t, transport.HelloAck{Type: transport.FrameTypeHelloAck, BusPID: 1}) @@ -282,7 +282,7 @@ type consumeAddr string func (a consumeAddr) Network() string { return "test" } func (a consumeAddr) String() string { return string(a) } -func TestWatchStdinEOFCancelledAfterData(t *testing.T) { +func TestCrossPlatformCoverageWatchStdinEOFCancelledAfterData(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() called := false diff --git a/internal/event/endpoint_portable_test.go b/internal/event/endpoint_portable_test.go index 60529f68..3968910e 100644 --- a/internal/event/endpoint_portable_test.go +++ b/internal/event/endpoint_portable_test.go @@ -19,7 +19,7 @@ import ( "testing" ) -func TestEndpointPortableCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageEndpointPortableCoverageEdges(t *testing.T) { if got := MaxUnixSocketPath(); got != 103 && got != 107 { t.Fatalf("MaxUnixSocketPath() = %d", got) } diff --git a/internal/event/lock/lock_test.go b/internal/event/lock/lock_test.go index 6cf00772..ba61db4c 100644 --- a/internal/event/lock/lock_test.go +++ b/internal/event/lock/lock_test.go @@ -21,7 +21,7 @@ import ( "testing" ) -func TestTryAcquireErrorBranchesAndEmptyPath(t *testing.T) { +func TestCrossPlatformCoverageTryAcquireErrorBranchesAndEmptyPath(t *testing.T) { if lock, err := TryAcquire(filepath.Join(t.TempDir(), "missing", "lock")); err == nil || lock != nil { t.Fatalf("TryAcquire missing parent = %#v, %v", lock, err) } @@ -38,7 +38,7 @@ func TestTryAcquireErrorBranchesAndEmptyPath(t *testing.T) { } } -func TestTryAcquire_FirstCallerWins(t *testing.T) { +func TestCrossPlatformCoverageTryAcquire_FirstCallerWins(t *testing.T) { path := filepath.Join(t.TempDir(), "bus.lock") l, err := TryAcquire(path) if err != nil { @@ -50,7 +50,7 @@ func TestTryAcquire_FirstCallerWins(t *testing.T) { } } -func TestTryAcquire_SecondCallerGetsBusy(t *testing.T) { +func TestCrossPlatformCoverageTryAcquire_SecondCallerGetsBusy(t *testing.T) { path := filepath.Join(t.TempDir(), "bus.lock") l1, err := TryAcquire(path) if err != nil { @@ -67,7 +67,7 @@ func TestTryAcquire_SecondCallerGetsBusy(t *testing.T) { } } -func TestTryAcquire_ReleasedLockIsReacquirable(t *testing.T) { +func TestCrossPlatformCoverageTryAcquire_ReleasedLockIsReacquirable(t *testing.T) { path := filepath.Join(t.TempDir(), "bus.lock") l1, err := TryAcquire(path) if err != nil { @@ -84,7 +84,7 @@ func TestTryAcquire_ReleasedLockIsReacquirable(t *testing.T) { defer l2.Close() } -func TestTryAcquire_ContentReadWriteWhileHeld(t *testing.T) { +func TestCrossPlatformCoverageTryAcquire_ContentReadWriteWhileHeld(t *testing.T) { path := filepath.Join(t.TempDir(), "bus.lock") l, err := TryAcquire(path) if err != nil { @@ -111,7 +111,7 @@ func TestTryAcquire_ContentReadWriteWhileHeld(t *testing.T) { } } -func TestClose_NilSafe(t *testing.T) { +func TestCrossPlatformCoverageClose_NilSafe(t *testing.T) { var l *File if err := l.Close(); err != nil { t.Fatalf("nil Close should be no-op, got %v", err) diff --git a/internal/event/personal/coverage_edges_test.go b/internal/event/personal/coverage_edges_test.go index 9cbafd2f..72f477f5 100644 --- a/internal/event/personal/coverage_edges_test.go +++ b/internal/event/personal/coverage_edges_test.go @@ -49,7 +49,7 @@ func personalHTTPClient(status int, body string) *http.Client { })} } -func TestPersonalClientEdgeCases(t *testing.T) { +func TestCrossPlatformCoveragePersonalClientEdgeCases(t *testing.T) { if got := (Identity{}).Key(); !strings.HasPrefix(got, "unknown\x00") { t.Fatalf("unknown identity key = %q", got) } @@ -143,7 +143,7 @@ func TestPersonalClientEdgeCases(t *testing.T) { } } -func TestPersonalClientHelpersAndOperations(t *testing.T) { +func TestCrossPlatformCoveragePersonalClientHelpersAndOperations(t *testing.T) { trueValue := true if (responseEnvelope{}).apiError() != nil { t.Fatal("empty response envelope returned an error") @@ -247,7 +247,7 @@ func TestPersonalClientHelpersAndOperations(t *testing.T) { } } -func TestPersonalPaginationFiltersAndGuard(t *testing.T) { +func TestCrossPlatformCoveragePersonalPaginationFiltersAndGuard(t *testing.T) { client := &Client{BaseURL: "http://example.test", Identity: Identity{AccessToken: "token"}} items := `[{"subId":"id1","status":2,"eventKey":"target"},{"subId":"id2","status":1,"eventKey":"other"},{"subId":"idx","status":1,"eventKey":"target"},{"subId":"id3","status":1,"eventKey":"target"}]` client.HTTPClient = personalHTTPClient(200, `{"success":true,"result":{"items":`+items+`}}`) @@ -265,7 +265,7 @@ func TestPersonalPaginationFiltersAndGuard(t *testing.T) { } } -func TestPersonalRegistryEdgeCases(t *testing.T) { +func TestCrossPlatformCoveragePersonalRegistryEdgeCases(t *testing.T) { if got := (&SchemaPendingError{EventKey: "pending"}).Error(); !strings.Contains(got, "pending") { t.Fatalf("pending error = %q", got) } @@ -339,7 +339,7 @@ func TestPersonalRegistryEdgeCases(t *testing.T) { } } -func TestRunStateEdgeCases(t *testing.T) { +func TestCrossPlatformCoverageRunStateEdgeCases(t *testing.T) { workDir := t.TempDir() if err := UpsertRunState(workDir, RunState{}); err != nil { t.Fatal(err) @@ -370,7 +370,7 @@ func TestRunStateEdgeCases(t *testing.T) { } } -func TestRunStateInjectedFailures(t *testing.T) { +func TestCrossPlatformCoverageRunStateInjectedFailures(t *testing.T) { originalRead := runStateReadFile originalMkdir := runStateMkdirAll originalAcquire := runStateTryAcquire diff --git a/internal/event/process/process_alive_unix_test.go b/internal/event/process/process_alive_unix_test.go index 36dbf638..0b33924c 100644 --- a/internal/event/process/process_alive_unix_test.go +++ b/internal/event/process/process_alive_unix_test.go @@ -8,7 +8,7 @@ import ( "testing" ) -func TestAliveUnixErrorClassification(t *testing.T) { +func TestCrossPlatformCoverageAliveUnixErrorClassification(t *testing.T) { previous := killProcess t.Cleanup(func() { killProcess = previous }) for _, tc := range []struct { diff --git a/internal/event/source/coverage_edges_test.go b/internal/event/source/coverage_edges_test.go index 71829e10..9849ef74 100644 --- a/internal/event/source/coverage_edges_test.go +++ b/internal/event/source/coverage_edges_test.go @@ -31,7 +31,7 @@ func (c *fakeStreamClient) RegisterAllEventRouter(h handler.IFrameHandler) { c.h func (c *fakeStreamClient) Start(context.Context) error { return c.startErr } func (c *fakeStreamClient) Close() { c.closed = true } -func TestDingtalkStartEdges(t *testing.T) { +func TestCrossPlatformCoverageDingtalkStartEdges(t *testing.T) { s, err := New(Config{ClientID: "id", ClientSecret: "secret"}) if err != nil { t.Fatal(err) @@ -42,7 +42,7 @@ func TestDingtalkStartEdges(t *testing.T) { } } -func TestDingtalkStartInjected(t *testing.T) { +func TestCrossPlatformCoverageDingtalkStartInjected(t *testing.T) { origNew := newStreamClient t.Cleanup(func() { newStreamClient = origNew }) _ = origNew() @@ -78,7 +78,7 @@ func staticPersonalTicketClient(endpoint, body string) *http.Client { })} } -func TestPersonalRunAttemptAndFrameFailures(t *testing.T) { +func TestCrossPlatformCoveragePersonalRunAttemptAndFrameFailures(t *testing.T) { base := PersonalConfig{ AccessToken: "token", ClientID: "id", SourceID: "source", TicketURL: "https://ticket", ReconnectMin: time.Millisecond, ReconnectMax: time.Millisecond, @@ -164,7 +164,7 @@ func TestPersonalRunAttemptAndFrameFailures(t *testing.T) { } } -func TestNewAndPersonalValidationEdges(t *testing.T) { +func TestCrossPlatformCoverageNewAndPersonalValidationEdges(t *testing.T) { invalidPortal := &PortalTicketConfig{} if _, err := New(Config{PortalTicket: invalidPortal}); err == nil { t.Fatal("invalid portal expected") @@ -221,7 +221,7 @@ type errorReadCloser struct{} func (errorReadCloser) Read([]byte) (int, error) { return 0, errSourceInjected } func (errorReadCloser) Close() error { return nil } -func TestPersonalTicketAndHelperEdges(t *testing.T) { +func TestCrossPlatformCoveragePersonalTicketAndHelperEdges(t *testing.T) { clientWith := func(fn func(*http.Request) (*http.Response, error)) *http.Client { return &http.Client{Transport: roundTripFunc(fn)} } @@ -326,7 +326,7 @@ func TestPersonalTicketAndHelperEdges(t *testing.T) { } } -func TestPortalConfigAndRequestEdges(t *testing.T) { +func TestCrossPlatformCoveragePortalConfigAndRequestEdges(t *testing.T) { for name, cfg := range map[string]*PortalTicketConfig{ "nil": nil, "url": {AccessToken: "t", SourceID: "s"}, @@ -405,7 +405,7 @@ func TestPortalConfigAndRequestEdges(t *testing.T) { _ = truncatePortalTicketLog(" long value ", 4) } -func TestPortalStartEndToEndAndFailures(t *testing.T) { +func TestCrossPlatformCoveragePortalStartEndToEndAndFailures(t *testing.T) { makeSource := func(cfg *PortalTicketConfig) *DingtalkSource { s, err := New(Config{PortalTicket: cfg}) if err != nil { @@ -477,7 +477,7 @@ func TestPortalStartEndToEndAndFailures(t *testing.T) { } } -func TestPortalStartHandshakeReadAndAckErrors(t *testing.T) { +func TestCrossPlatformCoveragePortalStartHandshakeReadAndAckErrors(t *testing.T) { origWriteMessage := portalWriteMessage t.Cleanup(func() { portalWriteMessage = origWriteMessage }) makeSource := func(endpoint string) *DingtalkSource { diff --git a/internal/event/transport/coverage_edges_test.go b/internal/event/transport/coverage_edges_test.go index df54832f..bfc97e9a 100644 --- a/internal/event/transport/coverage_edges_test.go +++ b/internal/event/transport/coverage_edges_test.go @@ -13,7 +13,7 @@ import ( "testing" ) -func TestFrameCodecCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageFrameCodecCoverageEdges(t *testing.T) { if _, err := NewReader(strings.NewReader("partial")).Read(); !errors.Is(err, io.EOF) { t.Fatalf("partial frame error = %v, want EOF", err) } @@ -25,13 +25,18 @@ func TestFrameCodecCoverageEdges(t *testing.T) { } } -func TestUnixListenErrorCoverage(t *testing.T) { +func TestCrossPlatformCoverageUnixListenErrorCoverage(t *testing.T) { oldStat, oldRemove, oldListen, oldChmod := statSocket, removeSocket, listenUnix, chmodSocket t.Cleanup(func() { statSocket, removeSocket, listenUnix, chmodSocket = oldStat, oldRemove, oldListen, oldChmod }) wantErr := errors.New("synthetic failure") - path := filepath.Join(t.TempDir(), "bus.sock") + tempDir, err := os.MkdirTemp("", "dws-et-") + if err != nil { + t.Fatalf("create short socket temp dir: %v", err) + } + t.Cleanup(func() { _ = os.RemoveAll(tempDir) }) + path := filepath.Join(tempDir, "bus.sock") if _, err := listen(strings.Repeat("x", 512)); err == nil { t.Fatal("overlong socket path should fail") } diff --git a/internal/event/transport/frame_portable_test.go b/internal/event/transport/frame_portable_test.go index f49e474f..9a847941 100644 --- a/internal/event/transport/frame_portable_test.go +++ b/internal/event/transport/frame_portable_test.go @@ -20,7 +20,7 @@ import ( "testing" ) -func TestFramePartialEOFPortable(t *testing.T) { +func TestCrossPlatformCoverageFramePartialEOFPortable(t *testing.T) { frame, err := NewReader(strings.NewReader("partial")).Read() if frame != nil || !errors.Is(err, io.EOF) { t.Fatalf("partial frame = %q, %v; want nil, EOF", frame, err) diff --git a/internal/executor/invocation_test.go b/internal/executor/invocation_test.go index ee730a44..b90b0781 100644 --- a/internal/executor/invocation_test.go +++ b/internal/executor/invocation_test.go @@ -6,7 +6,7 @@ import ( "testing" ) -func TestInvocationBuildersAndEchoRunner(t *testing.T) { +func TestCrossPlatformCoverageInvocationBuildersAndEchoRunner(t *testing.T) { params := map[string]any{"name": "value"} compat := NewCompatibilityInvocation("old path", "doc", "read", params) if compat.Kind != "compat_invocation" || compat.CanonicalPath != "doc.read" || !reflect.DeepEqual(compat.Params, params) { @@ -41,7 +41,7 @@ func TestInvocationBuildersAndEchoRunner(t *testing.T) { } } -func TestMergePayloadsAndToolCallRequest(t *testing.T) { +func TestCrossPlatformCoverageMergePayloadsAndToolCallRequest(t *testing.T) { merged, err := MergePayloads(`{"a":1,"same":"json"}`, `{"b":2,"same":"params"}`, map[string]any{"c": 3, "same": "override"}) if err != nil { t.Fatalf("MergePayloads() error = %v", err) diff --git a/internal/generator/agentmetadata/hints_coverage_test.go b/internal/generator/agentmetadata/hints_coverage_test.go index d34ba823..7031301f 100644 --- a/internal/generator/agentmetadata/hints_coverage_test.go +++ b/internal/generator/agentmetadata/hints_coverage_test.go @@ -28,7 +28,7 @@ func validCoverageIndex(metadataPath, selectionPath string) string { return `{"version":1,"format":"dws-agent-hint-index","source":{"kind":"explicit"},"metadata":{"sample":"` + metadataPath + `"},"selection":{"sample":"` + selectionPath + `"}}` } -func TestHintUnmarshalAndIndexValidationEdges(t *testing.T) { +func TestCrossPlatformCoverageHintUnmarshalAndIndexValidationEdges(t *testing.T) { if err := json.Unmarshal([]byte(`{`), &HintProduct{}); err == nil { t.Fatal("invalid HintProduct succeeded") } @@ -76,7 +76,7 @@ func TestHintUnmarshalAndIndexValidationEdges(t *testing.T) { } } -func TestHintFileAndRoleValidationEdges(t *testing.T) { +func TestCrossPlatformCoverageHintFileAndRoleValidationEdges(t *testing.T) { root := t.TempDir() tests := []struct { name string @@ -128,7 +128,7 @@ func TestHintFileAndRoleValidationEdges(t *testing.T) { } } -func TestHintHelperRemainingBranches(t *testing.T) { +func TestCrossPlatformCoverageHintHelperRemainingBranches(t *testing.T) { falseValue := false if got := hintSelectionRank(HintSource{}, &falseValue); got != selectionRankUnreviewedExplicit { t.Fatalf("unreviewed rank = %d", got) @@ -150,7 +150,7 @@ func TestHintHelperRemainingBranches(t *testing.T) { } } -func TestHintParsingAndApplicationConflictEdges(t *testing.T) { +func TestCrossPlatformCoverageHintParsingAndApplicationConflictEdges(t *testing.T) { var product HintProduct if err := product.UnmarshalJSON([]byte(`{`)); err == nil { t.Fatal("direct invalid HintProduct succeeded") diff --git a/internal/generator/agentmetadata/interface_coverage_test.go b/internal/generator/agentmetadata/interface_coverage_test.go index 8fb5e2ae..d10e5c05 100644 --- a/internal/generator/agentmetadata/interface_coverage_test.go +++ b/internal/generator/agentmetadata/interface_coverage_test.go @@ -9,7 +9,7 @@ import ( "testing" ) -func TestInterfaceMetadataFailureAndConflictEdges(t *testing.T) { +func TestCrossPlatformCoverageInterfaceMetadataFailureAndConflictEdges(t *testing.T) { root := t.TempDir() display := filepath.ToSlash("interface.json") opts := Options{Root: root, InterfaceMetadataPath: "interface.json", ToolPaths: map[string]string{"sample.tool": "sample tool"}} @@ -53,7 +53,7 @@ func TestInterfaceMetadataFailureAndConflictEdges(t *testing.T) { } } -func TestInterfaceSummaryRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageInterfaceSummaryRemainingEdges(t *testing.T) { if got := summarizeInterfaceDescription("\n\nusable summary", 0); got != "usable summary" { t.Fatalf("default max summary = %q", got) } diff --git a/internal/generator/agentmetadata/manual_hints_coverage_test.go b/internal/generator/agentmetadata/manual_hints_coverage_test.go index 9f9f7137..26406c9c 100644 --- a/internal/generator/agentmetadata/manual_hints_coverage_test.go +++ b/internal/generator/agentmetadata/manual_hints_coverage_test.go @@ -10,7 +10,7 @@ import ( "testing" ) -func TestReviewedSelectionRetentionAndDeliveryFailures(t *testing.T) { +func TestCrossPlatformCoverageReviewedSelectionRetentionAndDeliveryFailures(t *testing.T) { retainReviewedSelectionCandidates(nil) file := File{ Products: map[string]ProductMetadata{"sample": {}}, @@ -74,7 +74,7 @@ func TestReviewedSelectionRetentionAndDeliveryFailures(t *testing.T) { } } -func TestExpectedCanonicalToolHelpersRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageExpectedCanonicalToolHelpersRemainingEdges(t *testing.T) { paths := expectedCanonicalToolPaths(Options{CanonicalToolPaths: map[string]string{ " sample.tool ": " sample item get ", "": "blank", @@ -104,7 +104,7 @@ func TestExpectedCanonicalToolHelpersRemainingEdges(t *testing.T) { } } -func TestSelectionAuthoringLoadFailure(t *testing.T) { +func TestCrossPlatformCoverageSelectionAuthoringLoadFailure(t *testing.T) { root := t.TempDir() if err := os.MkdirAll(filepath.Join(root, "hints"), 0o700); err != nil { t.Fatal(err) @@ -121,7 +121,7 @@ func TestSelectionAuthoringLoadFailure(t *testing.T) { } } -func TestSelectionAuthoringSelectionContractFailure(t *testing.T) { +func TestCrossPlatformCoverageSelectionAuthoringSelectionContractFailure(t *testing.T) { root := t.TempDir() writeSelectionFixture(t, root, true, `["dws sample item search --query value"]`) path := filepath.Join(root, "internal/cli/schema_hints/selection/sample.json") diff --git a/internal/generator/agentmetadata/metadata_helpers_coverage_test.go b/internal/generator/agentmetadata/metadata_helpers_coverage_test.go index a8f2ea05..b034faf9 100644 --- a/internal/generator/agentmetadata/metadata_helpers_coverage_test.go +++ b/internal/generator/agentmetadata/metadata_helpers_coverage_test.go @@ -11,7 +11,7 @@ import ( "testing" ) -func TestMetadataMarshalAndProjectionEdges(t *testing.T) { +func TestCrossPlatformCoverageMetadataMarshalAndProjectionEdges(t *testing.T) { bad := map[string]FieldProvenance{"bad": {Value: make(chan int)}} if _, err := json.Marshal(ProductMetadata{FieldProvenance: bad}); err == nil { t.Fatal("product metadata with unsupported provenance value succeeded") @@ -46,7 +46,7 @@ func TestMetadataMarshalAndProjectionEdges(t *testing.T) { } } -func TestMetadataCandidateAndMergeEdges(t *testing.T) { +func TestCrossPlatformCoverageMetadataCandidateAndMergeEdges(t *testing.T) { seedToolFieldCandidates(nil) effectiveSelectionScalarRank("", true, selectionRankDefault) effectiveSelectionListRank(nil, true, selectionRankDefault) @@ -117,7 +117,7 @@ func TestMetadataCandidateAndMergeEdges(t *testing.T) { } } -func TestMetadataConflictAndProvenanceEdges(t *testing.T) { +func TestCrossPlatformCoverageMetadataConflictAndProvenanceEdges(t *testing.T) { conflict := map[string][]FieldCandidateProvenance{ "field": { {Value: "b", Source: "same", Precedence: selectionPrecedenceSkill}, @@ -262,7 +262,7 @@ func TestMetadataConflictAndProvenanceEdges(t *testing.T) { } } -func TestMetadataSourceAndPathEdges(t *testing.T) { +func TestCrossPlatformCoverageMetadataSourceAndPathEdges(t *testing.T) { if _, _, err := generateFromSources(Options{ProductsDir: "definitely-missing-agentmetadata-products"}); err == nil { t.Fatal("default-root missing products succeeded") } @@ -341,7 +341,7 @@ func TestMetadataSourceAndPathEdges(t *testing.T) { } } -func TestMetadataListAndDispositionEdges(t *testing.T) { +func TestCrossPlatformCoverageMetadataListAndDispositionEdges(t *testing.T) { var values []string present := false rank := 0 @@ -428,7 +428,7 @@ func TestMetadataListAndDispositionEdges(t *testing.T) { } } -func TestMetadataParserConflictEdges(t *testing.T) { +func TestCrossPlatformCoverageMetadataParserConflictEdges(t *testing.T) { out := &File{Products: map[string]ProductMetadata{}, Tools: map[string]ToolMetadata{}} parseProductRouting(out, "## 意图判断决策树\n用户提到“empty” → `dws`", "source") @@ -479,7 +479,7 @@ func TestMetadataParserConflictEdges(t *testing.T) { } } -func TestGenerateFromSourcesFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageGenerateFromSourcesFailureEdges(t *testing.T) { base := func(t *testing.T) (string, Options) { t.Helper() root := t.TempDir() diff --git a/internal/generator/agentmetadata/production_pipeline_external_test.go b/internal/generator/agentmetadata/production_pipeline_external_test.go index 2970002d..b2824d69 100644 --- a/internal/generator/agentmetadata/production_pipeline_external_test.go +++ b/internal/generator/agentmetadata/production_pipeline_external_test.go @@ -13,7 +13,7 @@ import ( "github.com/DingTalk-Real-AI/dingtalk-workspace-cli/internal/generator/agentmetadata" ) -func TestGenerateProductionAgentMetadataPipeline(t *testing.T) { +func TestCrossPlatformCoverageGenerateProductionAgentMetadataPipeline(t *testing.T) { repositoryRoot, err := filepath.Abs(filepath.Join("..", "..", "..")) if err != nil { t.Fatal(err) diff --git a/internal/generator/cmd_schema_agent_metadata/coverage_more_test.go b/internal/generator/cmd_schema_agent_metadata/coverage_more_test.go index c79746bd..cb6f4eb8 100644 --- a/internal/generator/cmd_schema_agent_metadata/coverage_more_test.go +++ b/internal/generator/cmd_schema_agent_metadata/coverage_more_test.go @@ -19,7 +19,7 @@ import ( "github.com/spf13/cobra" ) -func TestMetadataMainReportsEveryStageFailure(t *testing.T) { +func TestCrossPlatformCoverageMetadataMainReportsEveryStageFailure(t *testing.T) { originalArgs, originalFlags := os.Args, flag.CommandLine originalIsolation := validateMetadataIsolation originalAllowlist := validateMetadataAllowlist @@ -114,7 +114,7 @@ func TestMetadataMainReportsEveryStageFailure(t *testing.T) { }) } -func TestMetadataWriterFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageMetadataWriterFailureEdges(t *testing.T) { originalMkdir := makeMetadataDirectory originalRead := readMetadataDirectory originalRemove := removeMetadataFile @@ -226,7 +226,7 @@ func TestMetadataWriterFailureEdges(t *testing.T) { } } -func TestMetadataRegistryAndSelectionFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageMetadataRegistryAndSelectionFailureEdges(t *testing.T) { originalRoot := newMetadataRoot originalBuild := buildEffectiveMetadata originalBind := bindEffectiveMetadata diff --git a/internal/generator/cmd_schema_catalog/main_test.go b/internal/generator/cmd_schema_catalog/main_test.go index 542b694c..f4df7f7c 100644 --- a/internal/generator/cmd_schema_catalog/main_test.go +++ b/internal/generator/cmd_schema_catalog/main_test.go @@ -17,7 +17,7 @@ import ( "github.com/spf13/cobra" ) -func TestMainGeneratesCatalogToTemporaryFile(t *testing.T) { +func TestCrossPlatformCoverageMainGeneratesCatalogToTemporaryFile(t *testing.T) { repositoryRoot, err := filepath.Abs(filepath.Join("..", "..", "..")) if err != nil { t.Fatal(err) @@ -31,7 +31,7 @@ func TestMainGeneratesCatalogToTemporaryFile(t *testing.T) { main() } -func TestCatalogMainReportsIsolationAndGenerationFailures(t *testing.T) { +func TestCrossPlatformCoverageCatalogMainReportsIsolationAndGenerationFailures(t *testing.T) { originalArgs, originalFlags := os.Args, flag.CommandLine originalValidate := validateCatalogParameterBindings originalExit := exitCatalogProcess @@ -61,7 +61,7 @@ func TestCatalogMainReportsIsolationAndGenerationFailures(t *testing.T) { invoke("-root", repositoryRoot, "-output", filepath.Join(t.TempDir(), "catalog.json")) } -func TestGenerateSchemaCatalogFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageGenerateSchemaCatalogFailureEdges(t *testing.T) { originalValidate := validateCatalogParameterBindings originalSnapshot := buildCatalogSnapshot originalMkdir := makeCatalogDirectory @@ -130,7 +130,7 @@ func TestGenerateSchemaCatalogFailureEdges(t *testing.T) { } } -func TestGenerateSchemaCatalogResolvesBuildExactlyOnce(t *testing.T) { +func TestCrossPlatformCoverageGenerateSchemaCatalogResolvesBuildExactlyOnce(t *testing.T) { root := app.NewRootCommand() resolveCalls := 0 resolvedRegistryHash := "" @@ -165,14 +165,14 @@ func TestGenerateSchemaCatalogResolvesBuildExactlyOnce(t *testing.T) { } } -func TestValidateDeprecatedSurfaceAcceptsEmbeddedRegistrySource(t *testing.T) { +func TestCrossPlatformCoverageValidateDeprecatedSurfaceAcceptsEmbeddedRegistrySource(t *testing.T) { path := filepath.Join("..", "..", "cli", "schema_command_registry.json") if err := validateDeprecatedSurface(path); err != nil { t.Fatalf("validateDeprecatedSurface() error = %v", err) } } -func TestValidateDeprecatedSurfaceRejectsDifferentIdentitySource(t *testing.T) { +func TestCrossPlatformCoverageValidateDeprecatedSurfaceRejectsDifferentIdentitySource(t *testing.T) { sourcePath := filepath.Join("..", "..", "cli", "schema_command_registry.json") data, err := os.ReadFile(sourcePath) if err != nil { @@ -193,13 +193,13 @@ func TestValidateDeprecatedSurfaceRejectsDifferentIdentitySource(t *testing.T) { } } -func TestValidateDeprecatedSurfaceAllowsOmittedCompatibilityFlag(t *testing.T) { +func TestCrossPlatformCoverageValidateDeprecatedSurfaceAllowsOmittedCompatibilityFlag(t *testing.T) { if err := validateDeprecatedSurface(""); err != nil { t.Fatalf("validateDeprecatedSurface() error = %v", err) } } -func TestValidateCatalogOutputIsolationProtectsEveryInputLayer(t *testing.T) { +func TestCrossPlatformCoverageValidateCatalogOutputIsolationProtectsEveryInputLayer(t *testing.T) { root := t.TempDir() files := []string{ "skills/mono/SKILL.md", diff --git a/internal/generator/cmd_schema_registry_smoke/main_test.go b/internal/generator/cmd_schema_registry_smoke/main_test.go index b372250a..c04b45a2 100644 --- a/internal/generator/cmd_schema_registry_smoke/main_test.go +++ b/internal/generator/cmd_schema_registry_smoke/main_test.go @@ -14,7 +14,7 @@ import ( "github.com/spf13/cobra" ) -func TestMainWritesProductionSmokeRegistry(t *testing.T) { +func TestCrossPlatformCoverageMainWritesProductionSmokeRegistry(t *testing.T) { outputFile, err := os.CreateTemp(t.TempDir(), "schema-registry-smoke-*.json") if err != nil { t.Fatal(err) @@ -39,7 +39,7 @@ func TestMainWritesProductionSmokeRegistry(t *testing.T) { } } -func TestMainReportsSmokeRegistryFailures(t *testing.T) { +func TestCrossPlatformCoverageMainReportsSmokeRegistryFailures(t *testing.T) { originalRoot := newSmokeRoot originalBuild := buildEffectiveSmokeRegistry originalBind := bindEffectiveSmokeRegistry @@ -100,7 +100,7 @@ func TestMainReportsSmokeRegistryFailures(t *testing.T) { } } -func TestBuildSmokeRegistryIncludesEveryPublicPathDeterministically(t *testing.T) { +func TestCrossPlatformCoverageBuildSmokeRegistryIncludesEveryPublicPathDeterministically(t *testing.T) { registry := cli.EffectiveCommandRegistry{Commands: []cli.CommandSpec{ { CanonicalPath: "internal.hidden", @@ -136,7 +136,7 @@ func TestBuildSmokeRegistryIncludesEveryPublicPathDeterministically(t *testing.T } } -func TestBuildSmokeRegistryRejectsRegistryWithoutPublicCommands(t *testing.T) { +func TestCrossPlatformCoverageBuildSmokeRegistryRejectsRegistryWithoutPublicCommands(t *testing.T) { _, err := buildSmokeRegistry(cli.EffectiveCommandRegistry{Commands: []cli.CommandSpec{{ CanonicalPath: "sample.run", PrimaryCLIPath: "sample run", diff --git a/internal/generator/outputguard/outputguard_test.go b/internal/generator/outputguard/outputguard_test.go index 551b6d61..0b6ab183 100644 --- a/internal/generator/outputguard/outputguard_test.go +++ b/internal/generator/outputguard/outputguard_test.go @@ -11,7 +11,7 @@ import ( "testing" ) -func TestFilesystemSeamFailures(t *testing.T) { +func TestCrossPlatformCoverageFilesystemSeamFailures(t *testing.T) { originalAbs, originalEval, originalRel := guardAbs, guardEvalSymlinks, guardRel originalStat, originalWalk := guardStat, guardWalk t.Cleanup(func() { @@ -66,7 +66,7 @@ func TestFilesystemSeamFailures(t *testing.T) { } } -func TestValidateCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageValidateCoverageEdges(t *testing.T) { root := t.TempDir() inputFile := filepath.Join(root, "input.json") if err := os.WriteFile(inputFile, []byte("{}"), 0o600); err != nil { @@ -148,7 +148,7 @@ func TestValidateCoverageEdges(t *testing.T) { } } -func TestValidateRejectsHardLinkToProtectedDirectoryMember(t *testing.T) { +func TestCrossPlatformCoverageValidateRejectsHardLinkToProtectedDirectoryMember(t *testing.T) { root := t.TempDir() protectedDir := filepath.Join(root, "inputs") if err := os.MkdirAll(protectedDir, 0o755); err != nil { @@ -171,7 +171,7 @@ func TestValidateRejectsHardLinkToProtectedDirectoryMember(t *testing.T) { } } -func TestValidateRepoTargetAllowlist(t *testing.T) { +func TestCrossPlatformCoverageValidateRepoTargetAllowlist(t *testing.T) { root := t.TempDir() allowed := filepath.Join(root, "internal/cli/schema_catalog.json") if err := os.MkdirAll(filepath.Dir(allowed), 0o755); err != nil { diff --git a/internal/helpers/agoal_coverage_more_test.go b/internal/helpers/agoal_coverage_more_test.go index 27883999..27953901 100644 --- a/internal/helpers/agoal_coverage_more_test.go +++ b/internal/helpers/agoal_coverage_more_test.go @@ -6,7 +6,7 @@ import ( "time" ) -func TestAgoalUpdateRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageAgoalUpdateRemainingCoverage(t *testing.T) { installScriptedCaller(t, &scriptedToolCaller{dry: true}) if err := executeFilterCoverage(t, newAgoalCommand(), "strategy", "update", "--profile-id", "profile", "--content", `[]`, "--request-id", "request", @@ -33,7 +33,7 @@ func TestAgoalUpdateRemainingCoverage(t *testing.T) { } } -func TestAgoalLocationFallbackCoverage(t *testing.T) { +func TestCrossPlatformCoverageAgoalLocationFallbackCoverage(t *testing.T) { original := agoalLoadLocation agoalLoadLocation = func(string) (*time.Location, error) { return nil, errors.New("zoneinfo unavailable") } t.Cleanup(func() { agoalLoadLocation = original }) diff --git a/internal/helpers/aisearch_coverage_more_test.go b/internal/helpers/aisearch_coverage_more_test.go index f4841d5a..a92d38b4 100644 --- a/internal/helpers/aisearch_coverage_more_test.go +++ b/internal/helpers/aisearch_coverage_more_test.go @@ -6,7 +6,7 @@ import ( "github.com/spf13/cobra" ) -func TestAISearchRemainingFallbackBranches(t *testing.T) { +func TestCrossPlatformCoverageAISearchRemainingFallbackBranches(t *testing.T) { if got := flagValue(&cobra.Command{Use: "empty"}, "missing"); got != "" { t.Fatalf("missing flag=%q", got) } diff --git a/internal/helpers/aitable_command_edges_test.go b/internal/helpers/aitable_command_edges_test.go index 4c5f29f2..986dc6fd 100644 --- a/internal/helpers/aitable_command_edges_test.go +++ b/internal/helpers/aitable_command_edges_test.go @@ -63,7 +63,7 @@ func runAitableCoverageCommand(t *testing.T, caller edition.ToolCaller, args ... return root.ExecuteContext(context.Background()) } -func TestAitableRetryWrappersExhaustAndRecover(t *testing.T) { +func TestCrossPlatformCoverageAitableRetryWrappersExhaustAndRecover(t *testing.T) { oldDeps, oldSleep := deps, helperSleep t.Cleanup(func() { deps, helperSleep = oldDeps, oldSleep }) helperSleep = func(time.Duration) {} @@ -88,7 +88,7 @@ func TestAitableRetryWrappersExhaustAndRecover(t *testing.T) { } } -func TestAitableCommandValidationEdges(t *testing.T) { +func TestCrossPlatformCoverageAitableCommandValidationEdges(t *testing.T) { oldDeps, oldArgs, oldStdin, oldSleep := deps, os.Args, os.Stdin, helperSleep t.Cleanup(func() { deps, os.Args, os.Stdin, helperSleep = oldDeps, oldArgs, oldStdin, oldSleep @@ -189,7 +189,7 @@ func TestAitableCommandValidationEdges(t *testing.T) { _ = runAitableCoverageCommand(t, caller, formGet...) } -func TestAitableViewCommandEdges(t *testing.T) { +func TestCrossPlatformCoverageAitableViewCommandEdges(t *testing.T) { oldDeps, oldArgs, oldSleep := deps, os.Args, helperSleep t.Cleanup(func() { deps, os.Args, helperSleep = oldDeps, oldArgs, oldSleep }) helperSleep = func(time.Duration) {} @@ -263,7 +263,7 @@ func TestAitableViewCommandEdges(t *testing.T) { _ = runAitableCoverageCommand(t, &aitableCommandCoverageCaller{err: fmt.Errorf("transport")}, with([]string{"view", "update", "card"}, "--no-cover")...) } -func TestAitableDeleteCancellationEdges(t *testing.T) { +func TestCrossPlatformCoverageAitableDeleteCancellationEdges(t *testing.T) { oldDeps, oldArgs, oldStdin := deps, os.Args, os.Stdin t.Cleanup(func() { deps, os.Args, os.Stdin = oldDeps, oldArgs, oldStdin }) os.Args = []string{"dws", "aitable"} diff --git a/internal/helpers/aitable_core_test.go b/internal/helpers/aitable_core_test.go index e6567eec..b8628ec9 100644 --- a/internal/helpers/aitable_core_test.go +++ b/internal/helpers/aitable_core_test.go @@ -54,7 +54,7 @@ func installAitableDeps(t *testing.T, caller *aitableTestCaller) *bytes.Buffer { return out } -func TestAitableFlagAndJSONNormalizers(t *testing.T) { +func TestCrossPlatformCoverageAitableFlagAndJSONNormalizers(t *testing.T) { cmd := &cobra.Command{Use: "test"} cmd.Flags().String("enabled", "", "") cmd.Flags().String("records", "", "") @@ -152,7 +152,7 @@ func TestAitableFlagAndJSONNormalizers(t *testing.T) { } } -func TestAitableViewConfigAndHelpers(t *testing.T) { +func TestCrossPlatformCoverageAitableViewConfigAndHelpers(t *testing.T) { config := map[string]any{ "filter": map[string]any{"operator": "and", "operands": []any{}}, "sort": map[string]any{"fieldId": "f"}, "group": []any{}, @@ -259,7 +259,7 @@ func TestAitableViewConfigAndHelpers(t *testing.T) { } } -func TestAitableToolResponseAndPaginationHelpers(t *testing.T) { +func TestCrossPlatformCoverageAitableToolResponseAndPaginationHelpers(t *testing.T) { caller := &aitableTestCaller{responses: []string{`{"data":{"views":[{"viewId":"v","viewType":"Grid"}]}}`}} installAitableDeps(t, caller) view, viewType, err := getViewRaw(context.Background(), "b", "t", "v") diff --git a/internal/helpers/atomicwrite_coverage_more_test.go b/internal/helpers/atomicwrite_coverage_more_test.go index 02b7a598..428b407e 100644 --- a/internal/helpers/atomicwrite_coverage_more_test.go +++ b/internal/helpers/atomicwrite_coverage_more_test.go @@ -26,7 +26,7 @@ type atomicErrorReader struct{} func (atomicErrorReader) Read([]byte) (int, error) { return 0, errors.New("read") } -func TestAtomicWriteRemainingFailures(t *testing.T) { +func TestCrossPlatformCoverageAtomicWriteRemainingFailures(t *testing.T) { origMkdir, origCreate := atomicMkdirAll, atomicCreateTemp origRemove, origRename := atomicRemove, atomicRename t.Cleanup(func() { diff --git a/internal/helpers/attendance_command_edges_test.go b/internal/helpers/attendance_command_edges_test.go index b6989948..57183f49 100644 --- a/internal/helpers/attendance_command_edges_test.go +++ b/internal/helpers/attendance_command_edges_test.go @@ -118,7 +118,7 @@ func attendanceInput(t *testing.T, text string) *os.File { return file } -func TestAttendanceCommandEdgeValidation(t *testing.T) { +func TestCrossPlatformCoverageAttendanceCommandEdgeValidation(t *testing.T) { previousDeps, previousArgs, previousStdin := deps, os.Args, os.Stdin os.Args = []string{"dws", "attendance"} InitDeps(&productExampleCaller{}) @@ -150,7 +150,7 @@ func TestAttendanceCommandEdgeValidation(t *testing.T) { } } -func TestAttendanceConfirmedMutationEdges(t *testing.T) { +func TestCrossPlatformCoverageAttendanceConfirmedMutationEdges(t *testing.T) { previousDeps, previousArgs, previousStdin := deps, os.Args, os.Stdin os.Args = []string{"dws", "attendance"} t.Cleanup(func() { deps, os.Args, os.Stdin = previousDeps, previousArgs, previousStdin }) @@ -198,7 +198,7 @@ func TestAttendanceConfirmedMutationEdges(t *testing.T) { _ = root.Execute() } -func TestAttendanceConfirmedMutationSuccessCoverage(t *testing.T) { +func TestCrossPlatformCoverageAttendanceConfirmedMutationSuccessCoverage(t *testing.T) { previousDeps, previousArgs := deps, os.Args os.Args = []string{"dws", "attendance"} t.Cleanup(func() { deps, os.Args = previousDeps, previousArgs }) @@ -297,7 +297,7 @@ func TestAttendanceConfirmedMutationSuccessCoverage(t *testing.T) { } } -func TestAttendanceVacationAndScheduleEdges(t *testing.T) { +func TestCrossPlatformCoverageAttendanceVacationAndScheduleEdges(t *testing.T) { previousDeps, previousArgs, previousStdin := deps, os.Args, os.Stdin os.Args = []string{"dws", "attendance"} t.Cleanup(func() { deps, os.Args, os.Stdin = previousDeps, previousArgs, previousStdin }) diff --git a/internal/helpers/attendance_coverage_more_test.go b/internal/helpers/attendance_coverage_more_test.go index 15544332..fef3b340 100644 --- a/internal/helpers/attendance_coverage_more_test.go +++ b/internal/helpers/attendance_coverage_more_test.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" ) -func TestAttendanceResponseAndDateCoverage(t *testing.T) { +func TestCrossPlatformCoverageAttendanceResponseAndDateCoverage(t *testing.T) { previous := deps InitDeps(&productExampleCaller{}) deps.Out.w = io.Discard @@ -42,7 +42,7 @@ func TestAttendanceResponseAndDateCoverage(t *testing.T) { } } -func TestAttendanceFlagFallbackCoverage(t *testing.T) { +func TestCrossPlatformCoverageAttendanceFlagFallbackCoverage(t *testing.T) { newCommand := func() *cobra.Command { cmd := &cobra.Command{Use: "flags"} cmd.Flags().Int64("primary64", 7, "") @@ -84,7 +84,7 @@ func TestAttendanceFlagFallbackCoverage(t *testing.T) { } } -func TestConvertClassCheckTimeCoverage(t *testing.T) { +func TestCrossPlatformCoverageConvertClassCheckTimeCoverage(t *testing.T) { class := map[string]any{ "sections": []any{ "bad", @@ -115,7 +115,7 @@ func validAttendanceFlagValue(valueType string) string { } } -func TestSelfSettingSaveCoverage(t *testing.T) { +func TestCrossPlatformCoverageSelfSettingSaveCoverage(t *testing.T) { for _, spec := range selfSettingSaveFlagSpecs { cmd := &cobra.Command{Use: "self"} registerSelfSettingSaveFlags(cmd) @@ -147,7 +147,7 @@ func TestSelfSettingSaveCoverage(t *testing.T) { } } -func TestGlobalSettingSaveCoverage(t *testing.T) { +func TestCrossPlatformCoverageGlobalSettingSaveCoverage(t *testing.T) { for _, spec := range globalSettingSaveFlagSpecs { cmd := &cobra.Command{Use: "global"} registerGlobalSettingSaveFlags(cmd) diff --git a/internal/helpers/calendar_command_coverage_more_test.go b/internal/helpers/calendar_command_coverage_more_test.go index df1ad194..98e44817 100644 --- a/internal/helpers/calendar_command_coverage_more_test.go +++ b/internal/helpers/calendar_command_coverage_more_test.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" ) -func TestCalendarOptionalFlagsRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageCalendarOptionalFlagsRemainingCoverage(t *testing.T) { installScriptedCaller(t, &scriptedToolCaller{dry: true}) start := "2030-01-01T09:00:00+08:00" end := "2030-01-01T10:00:00+08:00" @@ -44,7 +44,7 @@ func TestCalendarOptionalFlagsRemainingCoverage(t *testing.T) { } } -func TestCalendarUnknownFlagAndSuggestionRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageCalendarUnknownFlagAndSuggestionRemainingCoverage(t *testing.T) { root := &cobra.Command{Use: "calendar"} group := &cobra.Command{Use: "room"} group.SuggestionsMinimumDistance = 3 diff --git a/internal/helpers/calendar_coverage_more_test.go b/internal/helpers/calendar_coverage_more_test.go index 57e358fc..5c552e09 100644 --- a/internal/helpers/calendar_coverage_more_test.go +++ b/internal/helpers/calendar_coverage_more_test.go @@ -25,7 +25,7 @@ func newRecurrenceTestCommand() *cobra.Command { return cmd } -func TestCalendarMeetingRoomHintCoverage(t *testing.T) { +func TestCrossPlatformCoverageCalendarMeetingRoomHintCoverage(t *testing.T) { for _, message := range []string{"plain", "所选组织不支持预定钉钉会议室", `{"errorCode": "400056"}`, `{"errorCode":"400056"}`} { _ = isMeetingRoomDisabledError(message) } @@ -49,7 +49,7 @@ func installCalendarCaller(t *testing.T, caller *helpersCoreCaller) { t.Cleanup(func() { os.Args = oldArgs }) } -func TestCalendarSearchResponseCoverage(t *testing.T) { +func TestCrossPlatformCoverageCalendarSearchResponseCoverage(t *testing.T) { caller := &helpersCoreCaller{format: "json", result: textToolResult(`{"result":{"rooms":[]}}`)} installCalendarCaller(t, caller) cmd := &cobra.Command{Use: "search"} @@ -70,7 +70,7 @@ func TestCalendarSearchResponseCoverage(t *testing.T) { _ = callMeetingRoomSearchResult(cmd, args, true, true, true) } -func TestCalendarRangeAttachmentCoverage(t *testing.T) { +func TestCrossPlatformCoverageCalendarRangeAttachmentCoverage(t *testing.T) { now := time.Now().UnixMilli() for _, tc := range []struct{ start, end, corrected bool }{ {false, false, false}, {false, true, false}, {true, false, false}, {true, true, false}, {true, true, true}, @@ -104,7 +104,7 @@ func TestCalendarRangeAttachmentCoverage(t *testing.T) { attachCalendarSearchRange(map[string]any{}, nil, map[string]any{"startTime": now}) } -func TestCalendarBusyAndEventResponseCoverage(t *testing.T) { +func TestCrossPlatformCoverageCalendarBusyAndEventResponseCoverage(t *testing.T) { caller := &helpersCoreCaller{format: "json"} installCalendarCaller(t, caller) cmd := &cobra.Command{Use: "events"} @@ -142,7 +142,7 @@ func TestCalendarBusyAndEventResponseCoverage(t *testing.T) { } } -func TestBuildRecurrenceCoverage(t *testing.T) { +func TestCrossPlatformCoverageBuildRecurrenceCoverage(t *testing.T) { _ = buildReminders("5,bad,0,10") if recurrence, err := buildRecurrence(newRecurrenceTestCommand()); err != nil || recurrence != nil { t.Fatalf("empty recurrence = %#v, %v", recurrence, err) @@ -173,7 +173,7 @@ func TestBuildRecurrenceCoverage(t *testing.T) { } } -func TestCalendarUnknownFallbackCoverage(t *testing.T) { +func TestCrossPlatformCoverageCalendarUnknownFallbackCoverage(t *testing.T) { root := &cobra.Command{Use: "calendar"} group := &cobra.Command{Use: "room", RunE: func(*cobra.Command, []string) error { return errors.New("previous") }} known := &cobra.Command{Use: "search", Aliases: []string{"find"}} diff --git a/internal/helpers/chat_command_edges_test.go b/internal/helpers/chat_command_edges_test.go index 4d6eca09..4d2ac03a 100644 --- a/internal/helpers/chat_command_edges_test.go +++ b/internal/helpers/chat_command_edges_test.go @@ -43,7 +43,7 @@ func runChatCoverageDirect(t *testing.T, path []string, flags map[string]string) return command.RunE(command, nil) } -func TestChatCommandValidationAndSuccessEdges(t *testing.T) { +func TestCrossPlatformCoverageChatCommandValidationAndSuccessEdges(t *testing.T) { previousDeps, previousArgs := deps, os.Args os.Args = []string{"dws", "chat"} t.Cleanup(func() { deps, os.Args = previousDeps, previousArgs }) @@ -107,7 +107,7 @@ func TestChatCommandValidationAndSuccessEdges(t *testing.T) { _ = runChatCoverageCommand(t, &scriptedToolCaller{steps: []scriptedToolStep{{text: `{"result":[{"userId":"u1","openDingTalkId":"D1"}]}`}, {text: `{}`}}}, "group-mute-member", "--group=cid", "--users=u1", "--off") } -func TestChatCreateAndMessageSendEdges(t *testing.T) { +func TestCrossPlatformCoverageChatCreateAndMessageSendEdges(t *testing.T) { previousDeps, previousArgs := deps, os.Args os.Args = []string{"dws", "chat", "--debug"} t.Cleanup(func() { deps, os.Args = previousDeps, previousArgs }) @@ -160,7 +160,7 @@ func TestChatCreateAndMessageSendEdges(t *testing.T) { } } -func TestChatWebhookReplyConversationAndDownloadEdges(t *testing.T) { +func TestCrossPlatformCoverageChatWebhookReplyConversationAndDownloadEdges(t *testing.T) { previousDeps, previousArgs := deps, os.Args os.Args = []string{"dws", "chat"} t.Cleanup(func() { deps, os.Args = previousDeps, previousArgs }) diff --git a/internal/helpers/chat_coverage_more_test.go b/internal/helpers/chat_coverage_more_test.go index e7813f1d..8a72c36f 100644 --- a/internal/helpers/chat_coverage_more_test.go +++ b/internal/helpers/chat_coverage_more_test.go @@ -36,7 +36,7 @@ func newChatFlagTestCommand() *cobra.Command { return cmd } -func TestChatDirectionAndScalarCoverage(t *testing.T) { +func TestCrossPlatformCoverageChatDirectionAndScalarCoverage(t *testing.T) { search := &cobra.Command{Use: "search"} search.Flags().String("nicks", "", "") search.Flags().Int("limit", 20, "") @@ -116,7 +116,7 @@ func TestChatDirectionAndScalarCoverage(t *testing.T) { } } -func TestChatContactMappingCoverage(t *testing.T) { +func TestCrossPlatformCoverageChatContactMappingCoverage(t *testing.T) { openIDs := map[string]string{} names := map[string]string{} collectContactUserMappings([]any{ @@ -137,7 +137,7 @@ func TestChatContactMappingCoverage(t *testing.T) { } } -func TestResolveOpenDingTalkIDsCoverage(t *testing.T) { +func TestCrossPlatformCoverageResolveOpenDingTalkIDsCoverage(t *testing.T) { if id, err := resolveOpenDingTalkID(context.Background(), "D-direct"); err != nil || id != "D-direct" { t.Fatalf("direct ID = %q, %v", id, err) } @@ -213,7 +213,7 @@ func TestResolveOpenDingTalkIDsCoverage(t *testing.T) { } } -func TestChatTargetAndGrantCoverage(t *testing.T) { +func TestCrossPlatformCoverageChatTargetAndGrantCoverage(t *testing.T) { for _, configure := range []func(*cobra.Command){ func(c *cobra.Command) { _ = c.Flags().Set("group", "group") }, func(c *cobra.Command) { _ = c.Flags().Set("open-dingtalk-id", "123") }, @@ -277,7 +277,7 @@ func TestChatTargetAndGrantCoverage(t *testing.T) { putChatChmodParam(params, "existing", "new") } -func TestChatFileUtilityCoverage(t *testing.T) { +func TestCrossPlatformCoverageChatFileUtilityCoverage(t *testing.T) { file := filepath.Join(t.TempDir(), "file.txt") if err := os.WriteFile(file, []byte("content"), 0o600); err != nil { t.Fatal(err) @@ -334,7 +334,7 @@ func TestChatFileUtilityCoverage(t *testing.T) { caller.format = "raw" } -func TestUploadConversationLocalFileCoverage(t *testing.T) { +func TestCrossPlatformCoverageUploadConversationLocalFileCoverage(t *testing.T) { oldPut := httpPutFile t.Cleanup(func() { httpPutFile = oldPut }) meta := conversationLocalFileMeta{LocalPath: "file", FileName: "file.txt", FileSize: 4, MD5: "md5"} @@ -358,7 +358,7 @@ func TestUploadConversationLocalFileCoverage(t *testing.T) { } } -func TestGuardGroupOwnerRemovalCoverage(t *testing.T) { +func TestCrossPlatformCoverageGuardGroupOwnerRemovalCoverage(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "chat"} t.Cleanup(func() { os.Args = oldArgs }) diff --git a/internal/helpers/chat_media_upload_coverage_more_test.go b/internal/helpers/chat_media_upload_coverage_more_test.go index 8b1e623b..22e92f98 100644 --- a/internal/helpers/chat_media_upload_coverage_more_test.go +++ b/internal/helpers/chat_media_upload_coverage_more_test.go @@ -13,7 +13,7 @@ import ( "testing" ) -func TestChatMediaUploadCommandRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageChatMediaUploadCommandRemainingCoverage(t *testing.T) { file := filepath.Join(t.TempDir(), "image.png") if err := os.WriteFile(file, []byte("image"), 0o600); err != nil { t.Fatal(err) @@ -51,7 +51,7 @@ func TestChatMediaUploadCommandRemainingCoverage(t *testing.T) { } } -func TestMediaUploadMultipartWriterRemainingFailures(t *testing.T) { +func TestCrossPlatformCoverageMediaUploadMultipartWriterRemainingFailures(t *testing.T) { file := filepath.Join(t.TempDir(), "image.png") if err := os.WriteFile(file, []byte("image"), 0o600); err != nil { t.Fatal(err) diff --git a/internal/helpers/command_matrix_test.go b/internal/helpers/command_matrix_test.go index 6056922d..2d6aee20 100644 --- a/internal/helpers/command_matrix_test.go +++ b/internal/helpers/command_matrix_test.go @@ -17,7 +17,7 @@ import ( // every public product command, including leaves that intentionally have no // Example text. It supplies required flags and a small set of positional/flag // variants, exercising validation, compatibility aliases, and response parsing. -func TestProductCommandMatrixCoverage(t *testing.T) { +func TestCrossPlatformCoverageProductCommandMatrixCoverage(t *testing.T) { workingDirectory, err := os.Getwd() if err != nil { t.Fatal(err) diff --git a/internal/helpers/connect_approval_card_coverage_more_test.go b/internal/helpers/connect_approval_card_coverage_more_test.go index 3ad24469..cb9f33f1 100644 --- a/internal/helpers/connect_approval_card_coverage_more_test.go +++ b/internal/helpers/connect_approval_card_coverage_more_test.go @@ -41,7 +41,7 @@ func (approvalUnimplementedRunner) Run(_ context.Context, inv executor.Invocatio return executor.Result{Invocation: inv}, nil } -func TestSheetAuditSinkRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageSheetAuditSinkRemainingEdges(t *testing.T) { originalSleep := helperSleep helperSleep = func(time.Duration) {} defer func() { helperSleep = originalSleep }() @@ -56,7 +56,7 @@ func TestSheetAuditSinkRemainingEdges(t *testing.T) { (&sheetAuditSink{runner: &approvalSequenceRunner{errors: []error{errors.New("permanent")}}}).record(context.Background(), req) } -func TestApprovalDecisionAndReplyRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageApprovalDecisionAndReplyRemainingEdges(t *testing.T) { o := &approvalOrchestrator{ownerUserID: "owner", confirmPolicy: "remember", remembered: map[string]bool{"todo.create": false}} if got := o.gateDecision("requester", "todo.create"); got != "reject" { t.Fatalf("decision=%q", got) @@ -93,7 +93,7 @@ func TestApprovalDecisionAndReplyRemainingEdges(t *testing.T) { } } -func TestApprovalConcurrentDecisionSeamEdge(t *testing.T) { +func TestCrossPlatformCoverageApprovalConcurrentDecisionSeamEdge(t *testing.T) { original := approvalOwnerDecide defer func() { approvalOwnerDecide = original }() gate := newApprovalGate("") @@ -106,7 +106,7 @@ func TestApprovalConcurrentDecisionSeamEdge(t *testing.T) { } } -func TestApprovalFlushAndExecuteRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageApprovalFlushAndExecuteRemainingEdges(t *testing.T) { gate := newApprovalGate("") notifier := &fakeNotifier{} o := newTextApprovalOrchestrator(gate, &fakeRunner{}, "owner", notifier) @@ -132,7 +132,7 @@ func TestApprovalFlushAndExecuteRemainingEdges(t *testing.T) { } } -func TestApprovalCardFlowRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageApprovalCardFlowRemainingEdges(t *testing.T) { reply := func(context.Context, string, string) error { return nil } req := ApprovalRequest{Requester: "r", Summary: "x", Action: plannedAction{Product: "todo", Tool: "tool"}} @@ -160,7 +160,7 @@ func TestApprovalCardFlowRemainingEdges(t *testing.T) { } } -func TestApprovalCardCallbackRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageApprovalCardCallbackRemainingEdges(t *testing.T) { var nilOrchestrator *approvalOrchestrator if _, err := nilOrchestrator.handleCardCallback(context.Background(), nil); err != nil { t.Fatal(err) @@ -188,7 +188,7 @@ func TestApprovalCardCallbackRemainingEdges(t *testing.T) { } } -func TestDingTalkApprovalCardDeliveryFailureEdge(t *testing.T) { +func TestCrossPlatformCoverageDingTalkApprovalCardDeliveryFailureEdge(t *testing.T) { recorder, server := newCardAPIServer(t) withCardAPIBase(t, server.URL) recorder.fail["POST /v1.0/card/instances/deliver"] = 500 diff --git a/internal/helpers/connect_approval_coverage_more_test.go b/internal/helpers/connect_approval_coverage_more_test.go index 97a53340..b339e05f 100644 --- a/internal/helpers/connect_approval_coverage_more_test.go +++ b/internal/helpers/connect_approval_coverage_more_test.go @@ -45,7 +45,7 @@ func installApprovalIODefaults(t *testing.T) func() { } } -func TestApprovalGateLookupMutationAndAwaitEdges(t *testing.T) { +func TestCrossPlatformCoverageApprovalGateLookupMutationAndAwaitEdges(t *testing.T) { g := newApprovalGate("") g.setOutTrackID("missing", "track") if got := g.findByOutTrackID(" "); got != nil { @@ -93,7 +93,7 @@ func TestApprovalGateLookupMutationAndAwaitEdges(t *testing.T) { } } -func TestApprovalGatePersistFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageApprovalGatePersistFailureEdges(t *testing.T) { t.Setenv("DWS_CONFIG_DIR", t.TempDir()) defaults := installApprovalIODefaults(t) g := &approvalGate{clientID: "io"} @@ -129,7 +129,7 @@ func TestApprovalGatePersistFailureEdges(t *testing.T) { g.persist(req) } -func TestApprovalGateLoadRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageApprovalGateLoadRemainingEdges(t *testing.T) { t.Setenv("DWS_CONFIG_DIR", t.TempDir()) defaults := installApprovalIODefaults(t) g := &approvalGate{clientID: "load", reqs: make(map[string]*ApprovalRequest), waiters: make(map[string]chan struct{})} @@ -166,7 +166,7 @@ func TestApprovalGateLoadRemainingEdges(t *testing.T) { } } -func TestApprovalMarkerAndDueRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageApprovalMarkerAndDueRemainingEdges(t *testing.T) { act, cleaned, found := parseActionMarker(`before [[ACTION:todo.create title='single quoted']] after`) if !found || act.Args["title"] != "single quoted" || strings.Contains(cleaned, "ACTION") { t.Fatalf("action=%+v cleaned=%q found=%v", act, cleaned, found) diff --git a/internal/helpers/connect_at_poll_coverage_more_test.go b/internal/helpers/connect_at_poll_coverage_more_test.go index f99e52f0..54e5a00f 100644 --- a/internal/helpers/connect_at_poll_coverage_more_test.go +++ b/internal/helpers/connect_at_poll_coverage_more_test.go @@ -70,7 +70,7 @@ func newAtPollForTest(fwd forwarder, extras *connectExtras) *atMentionPoller { } } -func TestAtMentionPollerStartAndPollCoverage(t *testing.T) { +func TestCrossPlatformCoverageAtMentionPollerStartAndPollCoverage(t *testing.T) { origAfter := helperAfter origExecutable := atPollExecutable origCommand := atPollCommandContext @@ -132,7 +132,7 @@ func TestAtMentionPollerStartAndPollCoverage(t *testing.T) { } } -func TestAtMentionPollerHandleCoverage(t *testing.T) { +func TestCrossPlatformCoverageAtMentionPollerHandleCoverage(t *testing.T) { base := atMentionMessage{MsgID: "m", OpenConversationID: "conv", SenderStaffID: "user", SenderNick: "nick", Content: `{"text":"hello"}`, ConversationType: "2"} p := newAtPollForTest(&atPollSignalForwarder{done: make(chan struct{}, 1)}, &connectExtras{}) @@ -198,7 +198,7 @@ func TestAtMentionPollerHandleCoverage(t *testing.T) { waitAtPollForward(t, slow) } -func TestAtMentionPollerSendGroupReplyCoverage(t *testing.T) { +func TestCrossPlatformCoverageAtMentionPollerSendGroupReplyCoverage(t *testing.T) { origBase := dingtalkCardAPIBase t.Cleanup(func() { dingtalkCardAPIBase = origBase }) p := newAtPollForTest(&atPollSignalForwarder{done: make(chan struct{}, 1)}, &connectExtras{}) diff --git a/internal/helpers/connect_attachment_prepare_coverage_test.go b/internal/helpers/connect_attachment_prepare_coverage_test.go index 5a32f7da..482e3755 100644 --- a/internal/helpers/connect_attachment_prepare_coverage_test.go +++ b/internal/helpers/connect_attachment_prepare_coverage_test.go @@ -10,7 +10,7 @@ import ( "testing" ) -func TestBuildConnectVideoStoryboardEdges(t *testing.T) { +func TestCrossPlatformCoverageBuildConnectVideoStoryboardEdges(t *testing.T) { originalLookPath := connectStoryboardLookPath originalCommand := connectStoryboardCommand originalMkdir := connectStoryboardMkdirAll diff --git a/internal/helpers/connect_card_coverage_more_test.go b/internal/helpers/connect_card_coverage_more_test.go index 0b0fb0a7..63490dd2 100644 --- a/internal/helpers/connect_card_coverage_more_test.go +++ b/internal/helpers/connect_card_coverage_more_test.go @@ -12,7 +12,7 @@ import ( "github.com/open-dingtalk/dingtalk-stream-sdk-go/chatbot" ) -func TestAICardAccessTokenRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageAICardAccessTokenRemainingEdges(t *testing.T) { originalBase := dingtalkCardAPIBase defer func() { dingtalkCardAPIBase = originalBase }() @@ -55,7 +55,7 @@ func TestAICardAccessTokenRemainingEdges(t *testing.T) { } } -func TestAICardCallRawAndCheckedRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageAICardCallRawAndCheckedRemainingEdges(t *testing.T) { originalBase := dingtalkCardAPIBase defer func() { dingtalkCardAPIBase = originalBase }() cached := func() *aiCardClient { @@ -99,7 +99,7 @@ func TestAICardCallRawAndCheckedRemainingEdges(t *testing.T) { } } -func TestAICardDeliveryStreamingAndSleepEdges(t *testing.T) { +func TestCrossPlatformCoverageAICardDeliveryStreamingAndSleepEdges(t *testing.T) { recorder, server := newCardAPIServer(t) withCardAPIBase(t, server.URL) c := newAICardClient("client", "secret", defaultAICardTemplateID) @@ -145,7 +145,7 @@ func TestAICardDeliveryStreamingAndSleepEdges(t *testing.T) { } } -func TestCardMarkdownRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageCardMarkdownRemainingEdges(t *testing.T) { table := "intro\n| A | B |\n|---|---|\nend" if got := ensureCardTableBlankLines(table); !strings.Contains(got, "intro\n\n| A") { t.Fatalf("table normalization=%q", got) diff --git a/internal/helpers/connect_chatrecord_coverage_test.go b/internal/helpers/connect_chatrecord_coverage_test.go index eb151d9f..4c259533 100644 --- a/internal/helpers/connect_chatrecord_coverage_test.go +++ b/internal/helpers/connect_chatrecord_coverage_test.go @@ -11,7 +11,7 @@ import ( "testing" ) -func TestChatRecordParsingAndRecoveryEdges(t *testing.T) { +func TestCrossPlatformCoverageChatRecordParsingAndRecoveryEdges(t *testing.T) { if chatRecordEntries("not-map") != nil { t.Fatal("chatRecordEntries(non-map) != nil") } @@ -114,7 +114,7 @@ func TestChatRecordParsingAndRecoveryEdges(t *testing.T) { } } -func TestChatRecordDownloadFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageChatRecordDownloadFailureEdges(t *testing.T) { client := &aiCardClient{httpClient: http.DefaultClient} if _, err := client.downloadRecoveredChatRecordFileWithCall(context.Background(), fileInboundInfo{}, nil); err == nil { t.Fatal("download without locator succeeded") diff --git a/internal/helpers/connect_codex_appserver_coverage_more_test.go b/internal/helpers/connect_codex_appserver_coverage_more_test.go index 002d1ce3..1bcee586 100644 --- a/internal/helpers/connect_codex_appserver_coverage_more_test.go +++ b/internal/helpers/connect_codex_appserver_coverage_more_test.go @@ -43,7 +43,7 @@ func unitCodexClient(stdin io.WriteCloser, messages ...codexRPCMessage) *codexAp } } -func TestCodexForwardAppServerFailureAndResumeEdges(t *testing.T) { +func TestCrossPlatformCoverageCodexForwardAppServerFailureAndResumeEdges(t *testing.T) { originalFactory := codexNewAppServerClient defer func() { codexNewAppServerClient = originalFactory }() boom := errors.New("factory") @@ -89,7 +89,7 @@ func TestCodexForwardAppServerFailureAndResumeEdges(t *testing.T) { } } -func TestCodexCwdConstructorAndReadLoopEdges(t *testing.T) { +func TestCrossPlatformCoverageCodexCwdConstructorAndReadLoopEdges(t *testing.T) { originalAbs := codexAbsPath originalExec := codexExecCommandContext defer func() { @@ -130,7 +130,7 @@ func TestCodexCwdConstructorAndReadLoopEdges(t *testing.T) { } } -func TestCodexClientSendInitializeAndRequestEdges(t *testing.T) { +func TestCrossPlatformCoverageCodexClientSendInitializeAndRequestEdges(t *testing.T) { if err := unitCodexClient(&codexNthFailWriter{failAt: 1}).initialize(context.Background()); err == nil { t.Fatal("initialize first send error returned nil") } @@ -155,7 +155,7 @@ func TestCodexClientSendInitializeAndRequestEdges(t *testing.T) { } } -func TestCodexRunTurnRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageCodexRunTurnRemainingEdges(t *testing.T) { serverID := 99 for _, tc := range []struct { name string @@ -185,7 +185,7 @@ func TestCodexRunTurnRemainingEdges(t *testing.T) { } } -func TestCodexWaitResponseAndNextEdges(t *testing.T) { +func TestCrossPlatformCoverageCodexWaitResponseAndNextEdges(t *testing.T) { serverID, otherID, wantID := 99, 2, 1 c := unitCodexClient(&bufferWriteCloser{}, codexRPCMessage{ID: &serverID, Method: "request/input"}, @@ -241,7 +241,7 @@ func TestCodexWaitResponseAndNextEdges(t *testing.T) { } } -func TestCodexResultParsingAndDefaultKeyEdges(t *testing.T) { +func TestCrossPlatformCoverageCodexResultParsingAndDefaultKeyEdges(t *testing.T) { if got := codexConvKey(" "); got != "_default" { t.Fatalf("default key=%q", got) } diff --git a/internal/helpers/connect_coverage_more_test.go b/internal/helpers/connect_coverage_more_test.go index 14c3a812..9aed6cf0 100644 --- a/internal/helpers/connect_coverage_more_test.go +++ b/internal/helpers/connect_coverage_more_test.go @@ -32,7 +32,7 @@ func (r connectResponseRunner) Run(_ context.Context, invocation executor.Invoca return executor.Result{Invocation: invocation, Response: r.response}, r.err } -func TestConnectForwarderPureCoverage(t *testing.T) { +func TestCrossPlatformCoverageConnectForwarderPureCoverage(t *testing.T) { streamSDKLogger{}.Debugf("debug %s", "x") streamSDKLogger{}.Infof("info %s", "x") streamSDKLogger{}.Warningf("warn %s", "x") @@ -120,7 +120,7 @@ func TestConnectForwarderPureCoverage(t *testing.T) { _ = officialChannelGuidance("unknown") } -func TestGeminiAPIForwarderCoverage(t *testing.T) { +func TestCrossPlatformCoverageGeminiAPIForwarderCoverage(t *testing.T) { t.Setenv("GEMINI_API_KEY", "") t.Setenv("GOOGLE_API_KEY", "") if _, err := newGeminiAPIForwarder(0, connectAgentOptions{}); err == nil { @@ -159,7 +159,7 @@ func TestGeminiAPIForwarderCoverage(t *testing.T) { } } -func TestConnectDaemonAndApprovalPureCoverage(t *testing.T) { +func TestCrossPlatformCoverageConnectDaemonAndApprovalPureCoverage(t *testing.T) { oldOverride := connectDaemonDirOverride connectDaemonDirOverride = t.TempDir() t.Cleanup(func() { connectDaemonDirOverride = oldOverride }) @@ -222,7 +222,7 @@ func TestConnectDaemonAndApprovalPureCoverage(t *testing.T) { _ = orchestrator.decorateForActionDetection("prompt") } -func TestAtPollTextAndCancellationCoverage(t *testing.T) { +func TestCrossPlatformCoverageAtPollTextAndCancellationCoverage(t *testing.T) { for _, tc := range []struct{ content, kind string }{ {"", "text"}, {`{"text":" hello "}`, "text"}, @@ -244,7 +244,7 @@ func TestAtPollTextAndCancellationCoverage(t *testing.T) { _ = json.Unmarshal([]byte(`{"ok":true}`), &payload) } -func TestConnectStreamRemainingPureEdges(t *testing.T) { +func TestCrossPlatformCoverageConnectStreamRemainingPureEdges(t *testing.T) { if convSessionKey(" ") != "_default" || convSessionKey(" conv ") != "conv" { t.Fatal("conversation key normalization failed") } @@ -325,7 +325,7 @@ func TestConnectStreamRemainingPureEdges(t *testing.T) { } } -func TestConnectCLIResolutionEdges(t *testing.T) { +func TestCrossPlatformCoverageConnectCLIResolutionEdges(t *testing.T) { clearChannelEnv(t) t.Setenv("DWS_CONNECT_NO_INSTALL", "1") for _, channel := range []string{"openclaw", "hermes", "custom", "unknown"} { diff --git a/internal/helpers/connect_daemon_coverage_more_test.go b/internal/helpers/connect_daemon_coverage_more_test.go index c20f79e0..e62164ca 100644 --- a/internal/helpers/connect_daemon_coverage_more_test.go +++ b/internal/helpers/connect_daemon_coverage_more_test.go @@ -75,7 +75,7 @@ func instantAfter(time.Duration) <-chan time.Time { return ch } -func TestStartDaemonLifecycleEdges(t *testing.T) { +func TestCrossPlatformCoverageStartDaemonLifecycleEdges(t *testing.T) { t.Run("unsupported", func(t *testing.T) { preserveDaemonHooks(t) daemonDetachEnabled = false @@ -194,7 +194,7 @@ func TestStartDaemonLifecycleEdges(t *testing.T) { }) } -func TestDaemonFileOperationEdges(t *testing.T) { +func TestCrossPlatformCoverageDaemonFileOperationEdges(t *testing.T) { t.Run("default config directory", func(t *testing.T) { preserveDaemonHooks(t) t.Setenv("HOME", t.TempDir()) @@ -280,7 +280,7 @@ func TestDaemonFileOperationEdges(t *testing.T) { } } -func TestRunSupervisorLifecycleEdges(t *testing.T) { +func TestCrossPlatformCoverageRunSupervisorLifecycleEdges(t *testing.T) { t.Run("missing key", func(t *testing.T) { preserveDaemonHooks(t) t.Setenv("DWS_CONNECT_DAEMON_DIRKEY", "") @@ -461,7 +461,7 @@ func TestRunSupervisorLifecycleEdges(t *testing.T) { }) } -func TestSuperviseWaitForcedKill(t *testing.T) { +func TestCrossPlatformCoverageSuperviseWaitForcedKill(t *testing.T) { preserveDaemonHooks(t) worker := exec.Command("sh", "-c", "trap '' TERM; sleep 5") if err := worker.Start(); err != nil { @@ -474,7 +474,7 @@ func TestSuperviseWaitForcedKill(t *testing.T) { _ = superviseWait(ctx, worker) } -func TestDaemonNotifyStateChangeEdges(t *testing.T) { +func TestCrossPlatformCoverageDaemonNotifyStateChangeEdges(t *testing.T) { preserveDaemonHooks(t) daemonExecutable = func() (string, error) { return "", errors.New("missing") } daemonNotifyStateChange("staff", "custom", "client", "started", "") @@ -498,7 +498,7 @@ func TestDaemonNotifyStateChangeEdges(t *testing.T) { time.Sleep(50 * time.Millisecond) } -func TestDaemonStatusAndStopEdges(t *testing.T) { +func TestCrossPlatformCoverageDaemonStatusAndStopEdges(t *testing.T) { t.Run("status directory and corrupt files", func(t *testing.T) { preserveDaemonHooks(t) blocked := filepath.Join(t.TempDir(), "blocked") @@ -592,7 +592,7 @@ func TestDaemonStatusAndStopEdges(t *testing.T) { }) } -func TestDaemonStopHookedLifecycleEdges(t *testing.T) { +func TestCrossPlatformCoverageDaemonStopHookedLifecycleEdges(t *testing.T) { const ( supervisorPID = 101 workerPID = 202 @@ -734,7 +734,7 @@ func (r *daemonSequenceRunner) Run(_ context.Context, invocation executor.Invoca return executor.Result{Invocation: invocation, Response: response}, nil } -func TestDaemonListAndNamePaginationEdges(t *testing.T) { +func TestCrossPlatformCoverageDaemonListAndNamePaginationEdges(t *testing.T) { preserveDaemonHooks(t) connectDaemonDirOverride = t.TempDir() cmd := &cobra.Command{Use: "list"} @@ -798,7 +798,7 @@ func TestDaemonListAndNamePaginationEdges(t *testing.T) { } } -func TestDaemonControlCommandEdges(t *testing.T) { +func TestCrossPlatformCoverageDaemonControlCommandEdges(t *testing.T) { preserveDaemonHooks(t) connectDaemonDirOverride = t.TempDir() baseDir := connectDaemonDirOverride diff --git a/internal/helpers/connect_daemon_unix_coverage_more_test.go b/internal/helpers/connect_daemon_unix_coverage_more_test.go index 52d86f71..9e19c763 100644 --- a/internal/helpers/connect_daemon_unix_coverage_more_test.go +++ b/internal/helpers/connect_daemon_unix_coverage_more_test.go @@ -11,7 +11,7 @@ import ( "time" ) -func TestDaemonUnixStatusAndStopEdges(t *testing.T) { +func TestCrossPlatformCoverageDaemonUnixStatusAndStopEdges(t *testing.T) { t.Run("stale supervisor stops orphan", func(t *testing.T) { preserveDaemonHooks(t) connectDaemonDirOverride = t.TempDir() diff --git a/internal/helpers/connect_gemini_api_coverage_test.go b/internal/helpers/connect_gemini_api_coverage_test.go index 96041119..fc34d079 100644 --- a/internal/helpers/connect_gemini_api_coverage_test.go +++ b/internal/helpers/connect_gemini_api_coverage_test.go @@ -20,7 +20,7 @@ func geminiResponse(status int, body string, headers map[string]string) *http.Re return &http.Response{StatusCode: status, Header: header, Body: io.NopCloser(strings.NewReader(body))} } -func TestGeminiAttachmentAndUploadFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageGeminiAttachmentAndUploadFailureEdges(t *testing.T) { f := &geminiAPIForwarder{model: "model", apiKey: "key", baseURL: "https://example.test/v1beta", timeout: time.Second, httpClient: http.DefaultClient} parts, err := f.partsWithAttachments(context.Background(), "text", []connectMediaAttachment{{LocalPath: ""}}) if err != nil || len(parts) != 1 { @@ -108,7 +108,7 @@ func TestGeminiAttachmentAndUploadFailureEdges(t *testing.T) { } } -func TestGeminiUploadedFilePollingEdges(t *testing.T) { +func TestCrossPlatformCoverageGeminiUploadedFilePollingEdges(t *testing.T) { originalInterval := geminiFilePollInterval t.Cleanup(func() { geminiFilePollInterval = originalInterval }) f := &geminiAPIForwarder{apiKey: "key", baseURL: "https://example.test/v1beta", httpClient: http.DefaultClient} diff --git a/internal/helpers/connect_health_coverage_more_test.go b/internal/helpers/connect_health_coverage_more_test.go index 384344ba..f60e68c3 100644 --- a/internal/helpers/connect_health_coverage_more_test.go +++ b/internal/helpers/connect_health_coverage_more_test.go @@ -8,7 +8,7 @@ import ( "time" ) -func TestConnectHealthRemainingIOAndListingBranches(t *testing.T) { +func TestCrossPlatformCoverageConnectHealthRemainingIOAndListingBranches(t *testing.T) { origOverride := connectDaemonDirOverride origReadDir := connectHealthReadDir t.Cleanup(func() { diff --git a/internal/helpers/connect_knowledge_coverage_more_test.go b/internal/helpers/connect_knowledge_coverage_more_test.go index 8252b48e..93a69ae6 100644 --- a/internal/helpers/connect_knowledge_coverage_more_test.go +++ b/internal/helpers/connect_knowledge_coverage_more_test.go @@ -8,7 +8,7 @@ import ( "testing" ) -func TestKnowledgeLoadAndAugmentRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageKnowledgeLoadAndAugmentRemainingCoverage(t *testing.T) { if _, err := loadKnowledgeBase(filepath.Join(t.TempDir(), "missing")); err == nil { t.Fatal("missing knowledge directory returned nil") } diff --git a/internal/helpers/connect_knowledge_wiki_coverage_more_test.go b/internal/helpers/connect_knowledge_wiki_coverage_more_test.go index 252cd485..19ba20c5 100644 --- a/internal/helpers/connect_knowledge_wiki_coverage_more_test.go +++ b/internal/helpers/connect_knowledge_wiki_coverage_more_test.go @@ -7,7 +7,7 @@ import ( "testing" ) -func TestWikiPullRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageWikiPullRemainingCoverage(t *testing.T) { ctx := context.Background() if _, err := pullWikiDocs(ctx, fakeWikiFetcher{readErrFor: map[string]error{"doc": errors.New("read")}}, knowledgeSource{kind: knowledgeSourceDoc, ref: "doc"}); err == nil { t.Fatal("single doc read error returned nil") @@ -33,7 +33,7 @@ func TestWikiPullRemainingCoverage(t *testing.T) { } } -func TestWikiCacheFailureRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageWikiCacheFailureRemainingCoverage(t *testing.T) { originalLoad := wikiLoadKnowledgeBase originalRemove := wikiRemoveAll originalMkdir := wikiMkdirAll diff --git a/internal/helpers/connect_media_coverage_more_test.go b/internal/helpers/connect_media_coverage_more_test.go index 8a740b7a..4138b128 100644 --- a/internal/helpers/connect_media_coverage_more_test.go +++ b/internal/helpers/connect_media_coverage_more_test.go @@ -28,7 +28,7 @@ func mediaCoverageClient(transport roundTripFunc) *aiCardClient { return client } -func TestConnectMediaPureFunctionRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageConnectMediaPureFunctionRemainingCoverage(t *testing.T) { info := parseFileInbound(map[string]interface{}{ "filePath": " /tmp/file ", "fileType": " text/plain ", "dentryID": int64(1), "spaceID": int(2), "size": json.Number("3"), @@ -63,7 +63,7 @@ func TestConnectMediaPureFunctionRemainingCoverage(t *testing.T) { } } -func TestDownloadMessageFileRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageDownloadMessageFileRemainingCoverage(t *testing.T) { withCardAPIBase(t, "https://api.test") boom := errors.New("media failure") originalMkdir := mediaMkdirAll @@ -128,7 +128,7 @@ func TestDownloadMessageFileRemainingCoverage(t *testing.T) { mediaCopy = originalCopy } -func TestDentryMediaRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageDentryMediaRemainingCoverage(t *testing.T) { withCardAPIBase(t, "https://api.test") boom := errors.New("dentry failure") diff --git a/internal/helpers/connect_onboarding_coverage_more_test.go b/internal/helpers/connect_onboarding_coverage_more_test.go index 482fcfce..dc1bbdbb 100644 --- a/internal/helpers/connect_onboarding_coverage_more_test.go +++ b/internal/helpers/connect_onboarding_coverage_more_test.go @@ -32,7 +32,7 @@ func (r *onboardingCoverageRunner) Run(context.Context, executor.Invocation) (ex return executor.Result{}, nil } -func TestConnectOnboardingFailureCoverage(t *testing.T) { +func TestCrossPlatformCoverageConnectOnboardingFailureCoverage(t *testing.T) { boom := errors.New("onboarding failure") originalStat := connectStdinStat originalSleep := connectOnboardingSleep diff --git a/internal/helpers/connect_opencode_coverage_more_test.go b/internal/helpers/connect_opencode_coverage_more_test.go index fedf92e1..21dd4c6c 100644 --- a/internal/helpers/connect_opencode_coverage_more_test.go +++ b/internal/helpers/connect_opencode_coverage_more_test.go @@ -20,7 +20,7 @@ func opencodeTestClient(t *testing.T, handler http.HandlerFunc) (*opencodeHTTPCl return &opencodeHTTPClient{baseURL: server.URL, username: "user", password: "pass", httpClient: server.Client()}, server.Close } -func TestOpencodeForwarderRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageOpencodeForwarderRemainingEdges(t *testing.T) { t.Run("create session error", func(t *testing.T) { client, closeServer := opencodeTestClient(t, func(w http.ResponseWriter, _ *http.Request) { http.Error(w, "failed", http.StatusInternalServerError) }) defer closeServer() @@ -79,7 +79,7 @@ func TestOpencodeForwarderRemainingEdges(t *testing.T) { } } -func TestOpencodeServerEnsureAndCloseEdges(t *testing.T) { +func TestCrossPlatformCoverageOpencodeServerEnsureAndCloseEdges(t *testing.T) { origPort := opencodeFreeLocalPort origCommand := opencodeExecCommand origWait := opencodeServerStartupWait @@ -156,7 +156,7 @@ func TestOpencodeServerEnsureAndCloseEdges(t *testing.T) { } } -func TestOpencodeWaitHealthyRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageOpencodeWaitHealthyRemainingEdges(t *testing.T) { origWait := opencodeServerStartupWait origSleep := helperSleep t.Cleanup(func() { @@ -191,7 +191,7 @@ func TestOpencodeWaitHealthyRemainingEdges(t *testing.T) { } } -func TestOpencodeHTTPClientRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageOpencodeHTTPClientRemainingEdges(t *testing.T) { ctx := context.Background() empty := &opencodeHTTPClient{httpClient: &http.Client{}} if err := empty.health(ctx); err == nil { @@ -240,7 +240,7 @@ func TestOpencodeHTTPClientRemainingEdges(t *testing.T) { } } -func TestOpencodeDoJSONAndPartsEdges(t *testing.T) { +func TestCrossPlatformCoverageOpencodeDoJSONAndPartsEdges(t *testing.T) { ctx := context.Background() client := &opencodeHTTPClient{baseURL: "http://example.invalid", httpClient: &http.Client{}} if err := client.doJSON(ctx, http.MethodPost, "/x", make(chan int), nil); err == nil { @@ -297,7 +297,7 @@ func TestOpencodeDoJSONAndPartsEdges(t *testing.T) { } } -func TestOpencodeSystemHelperEdges(t *testing.T) { +func TestCrossPlatformCoverageOpencodeSystemHelperEdges(t *testing.T) { origPort := opencodeFreeLocalPort origRand := opencodeRandRead origListen := freeLocalPortListen diff --git a/internal/helpers/connect_process_test.go b/internal/helpers/connect_process_test.go index 119a927a..a148aadb 100644 --- a/internal/helpers/connect_process_test.go +++ b/internal/helpers/connect_process_test.go @@ -6,7 +6,7 @@ import ( "testing" ) -func TestProcessAlivePlatformEdges(t *testing.T) { +func TestCrossPlatformCoverageProcessAlivePlatformEdges(t *testing.T) { if processAlive(0) { t.Fatal("pid 0 must not be treated as a managed live process") } diff --git a/internal/helpers/connect_process_windows_test.go b/internal/helpers/connect_process_windows_test.go index 6fd706d0..f8759484 100644 --- a/internal/helpers/connect_process_windows_test.go +++ b/internal/helpers/connect_process_windows_test.go @@ -7,7 +7,7 @@ import ( "time" ) -func TestProcessAliveExitedChildWithRetainedHandle(t *testing.T) { +func TestCrossPlatformCoverageProcessAliveExitedChildWithRetainedHandle(t *testing.T) { child := nativeExitCommand(t) if err := child.Start(); err != nil { t.Fatal(err) diff --git a/internal/helpers/connect_qoder_stream_coverage_more_test.go b/internal/helpers/connect_qoder_stream_coverage_more_test.go index f18d742b..68212bc3 100644 --- a/internal/helpers/connect_qoder_stream_coverage_more_test.go +++ b/internal/helpers/connect_qoder_stream_coverage_more_test.go @@ -40,7 +40,7 @@ func installImmediateQoderAfter(t *testing.T) { t.Cleanup(func() { helperAfter = orig }) } -func TestQoderForwardStreamRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageQoderForwardStreamRemainingEdges(t *testing.T) { installImmediateQoderAfter(t) boom := errors.New("write failed") f := activeQoderForwarder(qoderErrorWriteCloser{err: boom}) @@ -89,7 +89,7 @@ func TestQoderForwardStreamRemainingEdges(t *testing.T) { } } -func TestQoderEnsureLockedRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageQoderEnsureLockedRemainingEdges(t *testing.T) { origExec := qoderExecCommand origAbs := qoderAbsPath t.Cleanup(func() { @@ -149,7 +149,7 @@ func TestQoderEnsureLockedRemainingEdges(t *testing.T) { } } -func TestQoderInitializeAndIOEdges(t *testing.T) { +func TestCrossPlatformCoverageQoderInitializeAndIOEdges(t *testing.T) { installImmediateQoderAfter(t) origUUID := qoderUUIDString qoderUUIDString = func() string { return "fixed" } @@ -226,7 +226,7 @@ func TestQoderInitializeAndIOEdges(t *testing.T) { } } -func TestQoderControlAndParseRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageQoderControlAndParseRemainingEdges(t *testing.T) { f := &qoderStreamForwarder{stdin: &qoderTestWriteCloser{}} for _, line := range []string{ `{`, `{"type":"other"}`, `{"type":"control_request"}`, @@ -273,7 +273,7 @@ func TestQoderControlAndParseRemainingEdges(t *testing.T) { } } -func TestQoderCloseAndScanEdges(t *testing.T) { +func TestCrossPlatformCoverageQoderCloseAndScanEdges(t *testing.T) { installImmediateQoderAfter(t) closer := &qoderCloseRecorder{} f := &qoderStreamForwarder{stdin: closer, done: make(chan error)} diff --git a/internal/helpers/connect_sessions_store_coverage_more_test.go b/internal/helpers/connect_sessions_store_coverage_more_test.go index a17112c6..58fb8e07 100644 --- a/internal/helpers/connect_sessions_store_coverage_more_test.go +++ b/internal/helpers/connect_sessions_store_coverage_more_test.go @@ -22,7 +22,7 @@ func (f *failingSessionTempFile) Write(p []byte) (int, error) { } func (f *failingSessionTempFile) Close() error { return f.closeErr } -func TestConnectSessionStoreFailureCoverage(t *testing.T) { +func TestCrossPlatformCoverageConnectSessionStoreFailureCoverage(t *testing.T) { originalRead := connectSessionReadFile originalMkdir := connectSessionMkdirAll originalCreate := connectSessionCreateTemp diff --git a/internal/helpers/connect_stream_connector_coverage_test.go b/internal/helpers/connect_stream_connector_coverage_test.go index 99eeb268..7e774916 100644 --- a/internal/helpers/connect_stream_connector_coverage_test.go +++ b/internal/helpers/connect_stream_connector_coverage_test.go @@ -279,7 +279,7 @@ func runConnectorScenarioWithCard(t *testing.T, messages []*chatbot.BotCallbackD return replier, stream } -func TestRunStreamConnectorBasicMessageEdges(t *testing.T) { +func TestCrossPlatformCoverageRunStreamConnectorBasicMessageEdges(t *testing.T) { t.Run("blank fallback and missing webhook drop", func(t *testing.T) { fwd := &basicConnectorForwarder{reply: "unused"} blank := connectorMessage("blank", "") @@ -352,7 +352,7 @@ func TestRunStreamConnectorBasicMessageEdges(t *testing.T) { }) } -func TestRunStreamConnectorForwardAndReplyEdges(t *testing.T) { +func TestCrossPlatformCoverageRunStreamConnectorForwardAndReplyEdges(t *testing.T) { t.Run("long markdown and retry success", func(t *testing.T) { fwd := &basicConnectorForwarder{reply: strings.Repeat("long", 80)} replier, _ := runConnectorScenario(t, []*chatbot.BotCallbackDataModel{connectorMessage("long", "question")}, fwd, nil, &connectExtras{persona: "Persona"}, []error{errors.New("one"), errors.New("two"), nil}, 3) @@ -406,7 +406,7 @@ func TestRunStreamConnectorForwardAndReplyEdges(t *testing.T) { }) } -func TestRunStreamConnectorControlAndLifecycleEdges(t *testing.T) { +func TestCrossPlatformCoverageRunStreamConnectorControlAndLifecycleEdges(t *testing.T) { t.Run("asynchronous card repair runner", func(t *testing.T) { done := make(chan struct{}) runConnectCardRepair(func() { close(done) }) @@ -532,7 +532,7 @@ func TestRunStreamConnectorControlAndLifecycleEdges(t *testing.T) { }) } -func TestRunStreamConnectorMediaEdges(t *testing.T) { +func TestCrossPlatformCoverageRunStreamConnectorMediaEdges(t *testing.T) { cases := []struct { name string message *chatbot.BotCallbackDataModel @@ -662,7 +662,7 @@ func TestRunStreamConnectorMediaEdges(t *testing.T) { } } -func TestRunStreamConnectorCardEdges(t *testing.T) { +func TestCrossPlatformCoverageRunStreamConnectorCardEdges(t *testing.T) { t.Run("card client without template", func(t *testing.T) { rec, srv := newCardAPIServer(t) withCardAPIBase(t, srv.URL) diff --git a/internal/helpers/connect_stream_edges_coverage_test.go b/internal/helpers/connect_stream_edges_coverage_test.go index 1798ed73..c84db7b5 100644 --- a/internal/helpers/connect_stream_edges_coverage_test.go +++ b/internal/helpers/connect_stream_edges_coverage_test.go @@ -7,7 +7,7 @@ import ( "testing" ) -func TestConnectStreamFinalStatementEdges(t *testing.T) { +func TestCrossPlatformCoverageConnectStreamFinalStatementEdges(t *testing.T) { if got := newConnectMediaClient("client", "secret"); got == nil { t.Fatal("default media client is nil") } @@ -49,7 +49,7 @@ func TestConnectStreamFinalStatementEdges(t *testing.T) { }) } -func TestResolveExecAgentInstallAndForwarderErrors(t *testing.T) { +func TestCrossPlatformCoverageResolveExecAgentInstallAndForwarderErrors(t *testing.T) { clearChannelEnv(t) binDir := t.TempDir() originalPath := os.Getenv("PATH") diff --git a/internal/helpers/connect_streaming_coverage_more_test.go b/internal/helpers/connect_streaming_coverage_more_test.go index b0e815e7..15f5ad9e 100644 --- a/internal/helpers/connect_streaming_coverage_more_test.go +++ b/internal/helpers/connect_streaming_coverage_more_test.go @@ -25,7 +25,7 @@ func streamingExecForwarder(bin string) *execForwarder { } } -func TestExecForwarderStreamingRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageExecForwarderStreamingRemainingCoverage(t *testing.T) { // Streaming-disabled forwarders use their ordinary one-shot command. oneShot := writeStreamingAgent(t, `printf 'one-shot\n'`) f := streamingExecForwarder(oneShot) @@ -96,7 +96,7 @@ printf '%s\n' '{"type":"result","result":"API Error: failed"}'`) } } -func TestParseStreamLineCCInvalidJSON(t *testing.T) { +func TestCrossPlatformCoverageParseStreamLineCCInvalidJSON(t *testing.T) { if delta, final := parseStreamLine("cc", `{not json`); delta != "" || final != "" { t.Fatalf("invalid cc JSON delta=%q final=%q", delta, final) } diff --git a/internal/helpers/contact_coverage_more_test.go b/internal/helpers/contact_coverage_more_test.go index da484221..3579151b 100644 --- a/internal/helpers/contact_coverage_more_test.go +++ b/internal/helpers/contact_coverage_more_test.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" ) -func TestContactRemainingCompatibilityBranches(t *testing.T) { +func TestCrossPlatformCoverageContactRemainingCompatibilityBranches(t *testing.T) { cmd := &cobra.Command{Use: "flags"} cmd.Flags().String("id", "", "") if got := contactFirstSetFlagName(cmd, "id"); got != "id" { diff --git a/internal/helpers/content_splitter_test.go b/internal/helpers/content_splitter_test.go index bbf5c547..3e95fcb6 100644 --- a/internal/helpers/content_splitter_test.go +++ b/internal/helpers/content_splitter_test.go @@ -9,7 +9,7 @@ import ( "github.com/DingTalk-Real-AI/dingtalk-workspace-cli/pkg/edition" ) -func TestSplitMarkdownSafePreservesContentAndLimitsChunks(t *testing.T) { +func TestCrossPlatformCoverageSplitMarkdownSafePreservesContentAndLimitsChunks(t *testing.T) { short := "short 文本" if got := splitMarkdownSafe(short, 100); len(got) != 1 || got[0] != short { t.Fatalf("short split = %#v", got) @@ -33,7 +33,7 @@ func TestSplitMarkdownSafePreservesContentAndLimitsChunks(t *testing.T) { } } -func TestMergeBlocksUsesHeadingsAndHardSplits(t *testing.T) { +func TestCrossPlatformCoverageMergeBlocksUsesHeadingsAndHardSplits(t *testing.T) { blocks := []markdownBlock{ {text: "aaaa", blockType: blockNormal}, {text: "# h\n", blockType: blockH1}, @@ -66,7 +66,7 @@ func TestMergeBlocksUsesHeadingsAndHardSplits(t *testing.T) { } } -func TestHardSplitBlockCoversParagraphAndRuneBoundaries(t *testing.T) { +func TestCrossPlatformCoverageHardSplitBlockCoversParagraphAndRuneBoundaries(t *testing.T) { for _, text := range []string{ "aa\n\nbb\n\ncc", "aa\n\n" + strings.Repeat("x", 12), @@ -85,7 +85,7 @@ func TestHardSplitBlockCoversParagraphAndRuneBoundaries(t *testing.T) { } } -func TestRuntimeDefaultsRegistryValidationAndSnapshot(t *testing.T) { +func TestCrossPlatformCoverageRuntimeDefaultsRegistryValidationAndSnapshot(t *testing.T) { runtimeDefaultsMu.Lock() previous := runtimeDefaults runtimeDefaults = make(map[string]edition.RuntimeDefaultFn) diff --git a/internal/helpers/coverage_pure_more_test.go b/internal/helpers/coverage_pure_more_test.go index 2f66ae72..5384f241 100644 --- a/internal/helpers/coverage_pure_more_test.go +++ b/internal/helpers/coverage_pure_more_test.go @@ -12,7 +12,7 @@ import ( "github.com/spf13/cobra" ) -func TestPureScalarAndCommandHelpersCoverage(t *testing.T) { +func TestCrossPlatformCoveragePureScalarAndCommandHelpersCoverage(t *testing.T) { previousDeps := deps InitDeps(&productExampleCaller{}) deps.Out.w = io.Discard @@ -77,7 +77,7 @@ func TestPureScalarAndCommandHelpersCoverage(t *testing.T) { } } -func TestChartMailAndSheetPureHelpersCoverage(t *testing.T) { +func TestCrossPlatformCoverageChartMailAndSheetPureHelpersCoverage(t *testing.T) { valid := map[string]any{ "position": map[string]any{"row": float64(1), "col": float64(1)}, "dimensions": map[string]any{"width": float64(10), "height": float64(10)}, @@ -234,7 +234,7 @@ func TestChartMailAndSheetPureHelpersCoverage(t *testing.T) { _, _ = findFilterViewByID(views, "missing") } -func TestSheetResponseCleanupCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetResponseCleanupCoverage(t *testing.T) { previous := deps caller := &helpersCoreCaller{format: "json"} InitDeps(caller) @@ -260,7 +260,7 @@ func TestSheetResponseCleanupCoverage(t *testing.T) { _ = callMCPToolSheetInfo(nil) } -func TestSmallHandlerAndFormatterCoverage(t *testing.T) { +func TestCrossPlatformCoverageSmallHandlerAndFormatterCoverage(t *testing.T) { if (Manifest{Vendor: " vendor ", Name: " name "}).FullName() != "vendor/name" { t.Fatal("manifest full name") } diff --git a/internal/helpers/devapp_command_edges_more_test.go b/internal/helpers/devapp_command_edges_more_test.go index f1b5027f..f3e45927 100644 --- a/internal/helpers/devapp_command_edges_more_test.go +++ b/internal/helpers/devapp_command_edges_more_test.go @@ -33,7 +33,7 @@ func executeDevAppEdge(runner executor.Runner, args ...string) (string, error) { return out.String(), err } -func TestDevAppParentHelpCoverage(t *testing.T) { +func TestCrossPlatformCoverageDevAppParentHelpCoverage(t *testing.T) { for _, path := range [][]string{ {}, {"webapp"}, {"permission"}, {"credentials"}, {"member"}, {"security"}, {"robot"}, {"version"}, {"event"}, @@ -44,7 +44,7 @@ func TestDevAppParentHelpCoverage(t *testing.T) { } } -func TestDevAppValidationBranchesCoverage(t *testing.T) { +func TestCrossPlatformCoverageDevAppValidationBranchesCoverage(t *testing.T) { cases := []struct { name string args []string @@ -113,7 +113,7 @@ func TestDevAppValidationBranchesCoverage(t *testing.T) { } } -func TestDevAppOptionalMutationBranchesCoverage(t *testing.T) { +func TestCrossPlatformCoverageDevAppOptionalMutationBranchesCoverage(t *testing.T) { success := [][]string{ {"update", "--dry-run", "--unified-app-id", "app", "--icon-media-id", "media"}, {"delete", "--dry-run", "--unified-app-id", "app"}, @@ -133,7 +133,7 @@ func TestDevAppOptionalMutationBranchesCoverage(t *testing.T) { } } -func TestDevAppRobotCreateRequiredFieldsCoverage(t *testing.T) { +func TestCrossPlatformCoverageDevAppRobotCreateRequiredFieldsCoverage(t *testing.T) { cmd := newDevAppRobotSubmitCommand(&captureRunner{}) if _, err := devAppRobotCreateParams(cmd); err == nil { t.Fatal("missing name returned nil") @@ -148,7 +148,7 @@ func TestDevAppRobotCreateRequiredFieldsCoverage(t *testing.T) { } } -func TestDevAppDeleteFetchErrorCoverage(t *testing.T) { +func TestCrossPlatformCoverageDevAppDeleteFetchErrorCoverage(t *testing.T) { want := errors.New("fetch app failed") _, err := executeDevAppEdge(devAppErrorRunner{err: want}, "delete", "--yes", "--unified-app-id", "app", "--confirm-name", "name") if !errors.Is(err, want) { @@ -156,7 +156,7 @@ func TestDevAppDeleteFetchErrorCoverage(t *testing.T) { } } -func TestDevAppPrettyAndAnnotationEdges(t *testing.T) { +func TestCrossPlatformCoverageDevAppPrettyAndAnnotationEdges(t *testing.T) { cmd := &cobra.Command{Use: "test"} annotateDevAppTool(cmd, "tool") if cmd.Annotations["mcp-tool"] != "tool" { diff --git a/internal/helpers/devapp_connect_coverage_more_test.go b/internal/helpers/devapp_connect_coverage_more_test.go index 4bdbc128..eba7fade 100644 --- a/internal/helpers/devapp_connect_coverage_more_test.go +++ b/internal/helpers/devapp_connect_coverage_more_test.go @@ -54,7 +54,7 @@ func writeKnowledgeFile(t *testing.T, dir, name string) { } } -func TestBuildConnectPlanQoderAndOpencodeCoverage(t *testing.T) { +func TestCrossPlatformCoverageBuildConnectPlanQoderAndOpencodeCoverage(t *testing.T) { for _, ch := range []string{"qoder", "qoderwork", "opencode", "gemini"} { if got := buildConnectPlan(ch, "id", "robot")["method"]; got == "unknown" { t.Fatalf("buildConnectPlan(%q) = unknown", ch) @@ -62,7 +62,7 @@ func TestBuildConnectPlanQoderAndOpencodeCoverage(t *testing.T) { } } -func TestLaunchConnectorExternalAndGuidanceCoverage(t *testing.T) { +func TestCrossPlatformCoverageLaunchConnectorExternalAndGuidanceCoverage(t *testing.T) { cmd, out := connectCoverageCommand(t) binDir := t.TempDir() writeShellExecutable(t, binDir, "connector-ok", "test \"$CID:$SEC:$DWS_AGENT_CHANNEL\" = \"id:secret:hermes\"\n") @@ -85,7 +85,7 @@ func TestLaunchConnectorExternalAndGuidanceCoverage(t *testing.T) { } } -func TestLaunchConnectorValidationAndKnowledgeCoverage(t *testing.T) { +func TestCrossPlatformCoverageLaunchConnectorValidationAndKnowledgeCoverage(t *testing.T) { t.Setenv("DWS_CONNECT_CMD", "") t.Setenv("DWS_AGENT_CMD", "sh -c printf\\ ok") cmd, _ := connectCoverageCommand(t) @@ -119,7 +119,7 @@ func TestLaunchConnectorValidationAndKnowledgeCoverage(t *testing.T) { } } -func TestLaunchConnectorFullStreamAssemblyCoverage(t *testing.T) { +func TestCrossPlatformCoverageLaunchConnectorFullStreamAssemblyCoverage(t *testing.T) { t.Setenv("DWS_CONNECT_CMD", "") t.Setenv("DWS_AGENT_CMD", "sh -c printf\\ ok") t.Setenv("DWS_CONFIG_DIR", t.TempDir()) @@ -200,7 +200,7 @@ func TestLaunchConnectorFullStreamAssemblyCoverage(t *testing.T) { } } -func TestConnectAgentOptionRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageConnectAgentOptionRemainingCoverage(t *testing.T) { clearChannelEnv(t) t.Setenv("DWS_REPLY_CARD", "false") t.Setenv("DWS_AGENT_MODEL", "model") @@ -269,7 +269,7 @@ func TestConnectAgentOptionRemainingCoverage(t *testing.T) { } } -func TestConnectAgentOptionsPayloadRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageConnectAgentOptionsPayloadRemainingCoverage(t *testing.T) { cases := []struct { channel string memory bool @@ -287,7 +287,7 @@ func TestConnectAgentOptionsPayloadRemainingCoverage(t *testing.T) { } } -func TestDevAppConnectCommandRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageDevAppConnectCommandRemainingCoverage(t *testing.T) { origInteractive := devAppConnectStdinInteractive origOnboarding := devAppRunConnectOnboarding origDaemon := devAppStartConnectDaemon @@ -364,7 +364,7 @@ func TestDevAppConnectCommandRemainingCoverage(t *testing.T) { } } -func TestDevAppFetchCredentialsErrorCoverage(t *testing.T) { +func TestCrossPlatformCoverageDevAppFetchCredentialsErrorCoverage(t *testing.T) { cmd, _ := connectCoverageCommand(t) want := errors.New("runner failure") if _, _, err := devAppFetchCredentials(connectCoverageRunner{err: want}, cmd, "app"); !errors.Is(err, want) { diff --git a/internal/helpers/devapp_coverage_edges_test.go b/internal/helpers/devapp_coverage_edges_test.go index dec1b7bd..a56170b8 100644 --- a/internal/helpers/devapp_coverage_edges_test.go +++ b/internal/helpers/devapp_coverage_edges_test.go @@ -17,7 +17,7 @@ func (r devAppErrorRunner) Run(context.Context, executor.Invocation) (executor.R return executor.Result{}, r.err } -func TestDevAppNormalizationEdges(t *testing.T) { +func TestCrossPlatformCoverageDevAppNormalizationEdges(t *testing.T) { for _, response := range []map[string]any{ {}, {"content": "plain"}, @@ -49,7 +49,7 @@ func TestDevAppNormalizationEdges(t *testing.T) { } } -func TestDevAppApprovalNormalizationEdges(t *testing.T) { +func TestCrossPlatformCoverageDevAppApprovalNormalizationEdges(t *testing.T) { for _, content := range []map[string]any{ {}, {"approvalCandidates": "invalid"}, @@ -107,7 +107,7 @@ func TestDevAppApprovalNormalizationEdges(t *testing.T) { } } -func TestDevAppRobotAndStepEdges(t *testing.T) { +func TestCrossPlatformCoverageDevAppRobotAndStepEdges(t *testing.T) { empty := map[string]any{} normalizeDevAppRobotResult(empty) if _, ok := empty["lifecycle"]; ok { @@ -158,7 +158,7 @@ func TestDevAppRobotAndStepEdges(t *testing.T) { } } -func TestDevAppScalarAndScopeEdges(t *testing.T) { +func TestCrossPlatformCoverageDevAppScalarAndScopeEdges(t *testing.T) { content := map[string]any{ "nil": nil, "text": " value ", @@ -200,7 +200,7 @@ func TestDevAppScalarAndScopeEdges(t *testing.T) { } } -func TestDevAppCommandUtilityEdges(t *testing.T) { +func TestCrossPlatformCoverageDevAppCommandUtilityEdges(t *testing.T) { annotated := annotateDevAppTool(&cobra.Command{Use: "leaf"}, "tool") if annotated.Annotations["mcp-tool"] != "tool" || annotated.Annotations["mcp-source"] != "op-app" { t.Fatalf("annotations = %#v", annotated.Annotations) diff --git a/internal/helpers/devapp_pretty_coverage_more_test.go b/internal/helpers/devapp_pretty_coverage_more_test.go index 4dec4a0c..b335ae9a 100644 --- a/internal/helpers/devapp_pretty_coverage_more_test.go +++ b/internal/helpers/devapp_pretty_coverage_more_test.go @@ -5,7 +5,7 @@ import ( "testing" ) -func TestDevAppAsIntRemainingTypes(t *testing.T) { +func TestCrossPlatformCoverageDevAppAsIntRemainingTypes(t *testing.T) { for _, value := range []any{int(1), int64(1), float64(1), json.Number("1"), "1"} { if got, ok := devAppAsInt(value); !ok || got != 1 { t.Fatalf("devAppAsInt(%T(%v))=%d,%v", value, value, got, ok) diff --git a/internal/helpers/doc/doc_jsonml_validate_v2_test.go b/internal/helpers/doc/doc_jsonml_validate_v2_test.go index fd4832e8..65703045 100644 --- a/internal/helpers/doc/doc_jsonml_validate_v2_test.go +++ b/internal/helpers/doc/doc_jsonml_validate_v2_test.go @@ -7,7 +7,7 @@ import ( func floatPtr(value float64) *float64 { return &value } -func TestSchemaLoadingAndLookup(t *testing.T) { +func TestCrossPlatformCoverageSchemaLoadingAndLookup(t *testing.T) { if !schemaV2.IsKnownTag("root") || schemaV2.IsKnownTag("definitely-unknown") { t.Fatal("schema known-tag lookup is incorrect") } @@ -34,7 +34,7 @@ func TestSchemaLoadingAndLookup(t *testing.T) { } } -func TestValidateJSONMLSourceAndShapes(t *testing.T) { +func TestCrossPlatformCoverageValidateJSONMLSourceAndShapes(t *testing.T) { if result := ValidateJsonMLBodyV2(nil); result.HasErrors() || result.Summary() != "" { t.Fatalf("empty body result = %#v", result) } @@ -81,7 +81,7 @@ func TestValidateJSONMLSourceAndShapes(t *testing.T) { } } -func TestTypeValidationCoversEverySchemaType(t *testing.T) { +func TestCrossPlatformCoverageTypeValidationCoversEverySchemaType(t *testing.T) { result := &JsonMLValidationResult{} cases := []struct { value any @@ -130,7 +130,7 @@ func TestTypeValidationCoversEverySchemaType(t *testing.T) { } } -func TestDiagnosticsFormattingAndAggregation(t *testing.T) { +func TestCrossPlatformCoverageDiagnosticsFormattingAndAggregation(t *testing.T) { diagnostics := DiagnosticList{ {Range: Range{Start: Position{Line: 2, Col: 3}}, Severity: SeverityError, Code: "E", Message: "bad", Suggestion: "fix"}, {Severity: SeverityWarning, Code: "W", Message: "warn", Source: SourceJSONMLSchema}, diff --git a/internal/helpers/doc_command_edges_test.go b/internal/helpers/doc_command_edges_test.go index cf3369cd..d781efed 100644 --- a/internal/helpers/doc_command_edges_test.go +++ b/internal/helpers/doc_command_edges_test.go @@ -32,7 +32,7 @@ func runDocCoverageCommand(t *testing.T, caller edition.ToolCaller, args ...stri return root.ExecuteContext(context.Background()) } -func TestDocTransferAndDiffEdges(t *testing.T) { +func TestCrossPlatformCoverageDocTransferAndDiffEdges(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "doc"} t.Cleanup(func() { os.Args = oldArgs }) @@ -68,7 +68,7 @@ func TestDocTransferAndDiffEdges(t *testing.T) { } } -func TestDocUploadAndMediaErrorEdges(t *testing.T) { +func TestCrossPlatformCoverageDocUploadAndMediaErrorEdges(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "doc"} t.Cleanup(func() { os.Args = oldArgs }) @@ -209,7 +209,7 @@ func TestDocUploadAndMediaErrorEdges(t *testing.T) { }) } -func TestDefaultDocHTTPTransportEdges(t *testing.T) { +func TestCrossPlatformCoverageDefaultDocHTTPTransportEdges(t *testing.T) { file := filepath.Join(t.TempDir(), "body") if err := os.WriteFile(file, []byte("body"), 0o600); err != nil { t.Fatal(err) @@ -240,7 +240,7 @@ func TestDefaultDocHTTPTransportEdges(t *testing.T) { } } -func TestDocCreateUpdateAndBlockCommandEdges(t *testing.T) { +func TestCrossPlatformCoverageDocCreateUpdateAndBlockCommandEdges(t *testing.T) { oldDeps, oldArgs, oldPut, oldGet := deps, os.Args, httpPutFile, httpGetFile t.Cleanup(func() { deps, os.Args, httpPutFile, httpGetFile = oldDeps, oldArgs, oldPut, oldGet @@ -330,7 +330,7 @@ func TestDocCreateUpdateAndBlockCommandEdges(t *testing.T) { _, _ = buildBlockElement(newBlockCommand()) } -func TestDocDestructiveCancellationEdges(t *testing.T) { +func TestCrossPlatformCoverageDocDestructiveCancellationEdges(t *testing.T) { oldDeps, oldArgs, oldStdin := deps, os.Args, os.Stdin t.Cleanup(func() { deps, os.Args, os.Stdin = oldDeps, oldArgs, oldStdin }) os.Args = []string{"dws", "doc"} @@ -350,7 +350,7 @@ func TestDocDestructiveCancellationEdges(t *testing.T) { } } -func TestDocExportImportCommandEdges(t *testing.T) { +func TestCrossPlatformCoverageDocExportImportCommandEdges(t *testing.T) { oldDeps, oldArgs, oldPut, oldGet, oldSleep, oldAfter := deps, os.Args, httpPutFile, httpGetFile, helperSleep, helperAfter t.Cleanup(func() { deps, os.Args, httpPutFile, httpGetFile, helperSleep, helperAfter = oldDeps, oldArgs, oldPut, oldGet, oldSleep, oldAfter @@ -463,7 +463,7 @@ func TestDocExportImportCommandEdges(t *testing.T) { } } -func TestDocVersionRevertCommandEdges(t *testing.T) { +func TestCrossPlatformCoverageDocVersionRevertCommandEdges(t *testing.T) { oldDeps, oldArgs, oldStdin := deps, os.Args, os.Stdin t.Cleanup(func() { deps, os.Args, os.Stdin = oldDeps, oldArgs, oldStdin }) diff --git a/internal/helpers/doc_coverage_more_test.go b/internal/helpers/doc_coverage_more_test.go index c7844ac3..078eff98 100644 --- a/internal/helpers/doc_coverage_more_test.go +++ b/internal/helpers/doc_coverage_more_test.go @@ -17,7 +17,7 @@ type docFailingReader struct{} func (docFailingReader) Read([]byte) (int, error) { return 0, errors.New("read failed") } -func TestDocVersionTraversalCoverage(t *testing.T) { +func TestCrossPlatformCoverageDocVersionTraversalCoverage(t *testing.T) { for _, value := range []any{ map[string]any{"hasMore": false, "nextCursor": "ignored"}, map[string]any{"nextCursor": "next"}, map[string]any{"nextToken": "token"}, map[string]any{"cursor": "cursor"}, @@ -55,7 +55,7 @@ func TestDocVersionTraversalCoverage(t *testing.T) { _, _ = docVersionExists(context.Background(), "node", 3) } -func TestDocUploadDownloadParsingCoverage(t *testing.T) { +func TestCrossPlatformCoverageDocUploadDownloadParsingCoverage(t *testing.T) { for _, raw := range []string{ `{`, `{}`, `{"resourceUrl":"https://upload","uploadKey":"key","headers":{"x":"value","bad":1}}`, @@ -80,7 +80,7 @@ func TestDocUploadDownloadParsingCoverage(t *testing.T) { } } -func TestResolveDocContentCoverage(t *testing.T) { +func TestCrossPlatformCoverageResolveDocContentCoverage(t *testing.T) { previous := deps InitDeps(&productExampleCaller{}) deps.Out.w = io.Discard @@ -119,7 +119,7 @@ func TestResolveDocContentCoverage(t *testing.T) { } } -func TestRunDocReadJSONMLCoverage(t *testing.T) { +func TestCrossPlatformCoverageRunDocReadJSONMLCoverage(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "doc"} t.Cleanup(func() { os.Args = oldArgs }) @@ -151,7 +151,7 @@ func TestRunDocReadJSONMLCoverage(t *testing.T) { } } -func TestDocDeprecationWrappersCoverage(t *testing.T) { +func TestCrossPlatformCoverageDocDeprecationWrappersCoverage(t *testing.T) { previous := deps InitDeps(&productExampleCaller{}) deps.Out.w = io.Discard @@ -176,7 +176,7 @@ func TestDocDeprecationWrappersCoverage(t *testing.T) { } } -func TestRunDocUploadDownloadAndMediaCoverage(t *testing.T) { +func TestCrossPlatformCoverageRunDocUploadDownloadAndMediaCoverage(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "doc"} t.Cleanup(func() { os.Args = oldArgs }) diff --git a/internal/helpers/doc_jsonml_pipeline_coverage_more_test.go b/internal/helpers/doc_jsonml_pipeline_coverage_more_test.go index 53a78c03..8e156820 100644 --- a/internal/helpers/doc_jsonml_pipeline_coverage_more_test.go +++ b/internal/helpers/doc_jsonml_pipeline_coverage_more_test.go @@ -6,7 +6,7 @@ import ( "testing" ) -func TestPrepareJSONMLRemainingErrorPaths(t *testing.T) { +func TestCrossPlatformCoveragePrepareJSONMLRemainingErrorPaths(t *testing.T) { strict := jsonMLTestCommand(t, false) fixing := jsonMLTestCommand(t, true) diff --git a/internal/helpers/doc_jsonml_pipeline_test.go b/internal/helpers/doc_jsonml_pipeline_test.go index 694ad62e..30e695d4 100644 --- a/internal/helpers/doc_jsonml_pipeline_test.go +++ b/internal/helpers/doc_jsonml_pipeline_test.go @@ -18,7 +18,7 @@ func jsonMLTestCommand(t *testing.T, fix bool) *cobra.Command { return cmd } -func TestJSONMLInputSanitizingAndShapeCoercion(t *testing.T) { +func TestCrossPlatformCoverageJSONMLInputSanitizingAndShapeCoercion(t *testing.T) { for _, r := range []rune{0x200B, 0x200C, 0x200D, 0xFEFF, 0x202A, 0x202B, 0x202C, 0x202D, 0x202E, 0x2028, 0x2029, 0x2066, 0x2067, 0x2068, 0x2069} { if !isInputDangerousUnicode(r) { t.Errorf("rune %U should be dangerous", r) @@ -73,7 +73,7 @@ func TestJSONMLInputSanitizingAndShapeCoercion(t *testing.T) { emitFixNotes(notes) } -func TestPrepareJSONMLBody(t *testing.T) { +func TestCrossPlatformCoveragePrepareJSONMLBody(t *testing.T) { strict := jsonMLTestCommand(t, false) valid := `{"jsonml":["root",{},["p",{},["span",{},"ok"]]]}` if got, err := prepareJsonMLBody(strict, valid); err != nil || !strings.Contains(got, `"root"`) { @@ -104,7 +104,7 @@ func TestPrepareJSONMLBody(t *testing.T) { } } -func TestPrepareJSONMLNode(t *testing.T) { +func TestCrossPlatformCoveragePrepareJSONMLNode(t *testing.T) { strict := jsonMLTestCommand(t, false) if _, err := prepareJsonMLNode(strict, ""); err == nil { t.Fatal("empty node should fail") diff --git a/internal/helpers/doc_write_pipeline_coverage_more_test.go b/internal/helpers/doc_write_pipeline_coverage_more_test.go index c7ac4382..22a10334 100644 --- a/internal/helpers/doc_write_pipeline_coverage_more_test.go +++ b/internal/helpers/doc_write_pipeline_coverage_more_test.go @@ -19,7 +19,7 @@ func docWriteCoverageCommand() *cobra.Command { return cmd } -func TestDocWritePipelineStrategyRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageDocWritePipelineStrategyRemainingCoverage(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "doc"} t.Cleanup(func() { os.Args = oldArgs }) @@ -53,7 +53,7 @@ func TestDocWritePipelineStrategyRemainingCoverage(t *testing.T) { } } -func TestChunkedWriteAdaptiveRetryRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageChunkedWriteAdaptiveRetryRemainingCoverage(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "doc"} t.Cleanup(func() { os.Args = oldArgs }) diff --git a/internal/helpers/drive_coverage_more_test.go b/internal/helpers/drive_coverage_more_test.go index 44dc79ee..71ed1d00 100644 --- a/internal/helpers/drive_coverage_more_test.go +++ b/internal/helpers/drive_coverage_more_test.go @@ -35,7 +35,7 @@ func executeDriveEdge(t *testing.T, caller *scriptedToolCaller, args ...string) return root.Execute() } -func TestParseDriveUploadInfoRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageParseDriveUploadInfoRemainingCoverage(t *testing.T) { cases := []struct { name string json string @@ -60,7 +60,7 @@ func TestParseDriveUploadInfoRemainingCoverage(t *testing.T) { } } -func TestDriveUploadValidationAndDryRunCoverage(t *testing.T) { +func TestCrossPlatformCoverageDriveUploadValidationAndDryRunCoverage(t *testing.T) { file := filepath.Join(t.TempDir(), "fixture.txt") if err := os.WriteFile(file, []byte("fixture"), 0o600); err != nil { t.Fatal(err) @@ -88,7 +88,7 @@ func TestDriveUploadValidationAndDryRunCoverage(t *testing.T) { } } -func TestDriveUploadTransportCoverage(t *testing.T) { +func TestCrossPlatformCoverageDriveUploadTransportCoverage(t *testing.T) { file := filepath.Join(t.TempDir(), "fixture.txt") if err := os.WriteFile(file, []byte("fixture"), 0o600); err != nil { t.Fatal(err) @@ -154,7 +154,7 @@ func TestDriveUploadTransportCoverage(t *testing.T) { }) } -func TestDriveCommandRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageDriveCommandRemainingEdges(t *testing.T) { file := filepath.Join(t.TempDir(), "fixture.txt") _ = os.WriteFile(file, []byte("fixture"), 0o600) cases := [][]string{ @@ -175,7 +175,7 @@ func TestDriveCommandRemainingEdges(t *testing.T) { } } -func TestDriveDownloadDirectoryCoverage(t *testing.T) { +func TestCrossPlatformCoverageDriveDownloadDirectoryCoverage(t *testing.T) { oldGet := httpGetFile httpGetFile = func(context.Context, string, map[string]string, string) error { return nil } t.Cleanup(func() { httpGetFile = oldGet }) @@ -190,7 +190,7 @@ func TestDriveDownloadDirectoryCoverage(t *testing.T) { } } -func TestDriveConfirmationCancellationCoverage(t *testing.T) { +func TestCrossPlatformCoverageDriveConfirmationCancellationCoverage(t *testing.T) { oldStdin := os.Stdin t.Cleanup(func() { os.Stdin = oldStdin }) for _, args := range [][]string{ @@ -214,7 +214,7 @@ func TestDriveConfirmationCancellationCoverage(t *testing.T) { } } -func TestDriveInfoDocFallbackCoverage(t *testing.T) { +func TestCrossPlatformCoverageDriveInfoDocFallbackCoverage(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "drive", "info"} t.Cleanup(func() { os.Args = oldArgs }) @@ -250,7 +250,7 @@ func TestDriveInfoDocFallbackCoverage(t *testing.T) { } } -func TestDriveSmallHelperEdges(t *testing.T) { +func TestCrossPlatformCoverageDriveSmallHelperEdges(t *testing.T) { for _, ext := range []string{"adoc", "AXLS", "amind", "adraw", "pdf"} { _ = isDingTalkDocExtension(ext) } diff --git a/internal/helpers/errors_test.go b/internal/helpers/errors_test.go index 3ac965c7..35087399 100644 --- a/internal/helpers/errors_test.go +++ b/internal/helpers/errors_test.go @@ -7,7 +7,7 @@ import ( "testing" ) -func TestCLIErrorFormattingExitCodesAndJSON(t *testing.T) { +func TestCrossPlatformCoverageCLIErrorFormattingExitCodesAndJSON(t *testing.T) { cause := errors.New("root cause") err := &CLIError{Code: CodeInvalidParam, Message: "bad input", Suggestion: "fix it", Operation: "doc/read", Cause: cause} if got := err.Error(); !strings.Contains(got, "doc/read") || !strings.Contains(got, "fix it") { @@ -52,7 +52,7 @@ func TestCLIErrorFormattingExitCodesAndJSON(t *testing.T) { } } -func TestWrapErrorClassifiesEveryErrorFamily(t *testing.T) { +func TestCrossPlatformCoverageWrapErrorClassifiesEveryErrorFamily(t *testing.T) { if WrapError(nil) != nil { t.Fatal("WrapError(nil) != nil") } @@ -117,7 +117,7 @@ func TestWrapErrorClassifiesEveryErrorFamily(t *testing.T) { } } -func TestBusinessSuggestionsAndResponseClassification(t *testing.T) { +func TestCrossPlatformCoverageBusinessSuggestionsAndResponseClassification(t *testing.T) { suggestions := map[string]string{ "搜索内容不能为空": "doc search", "User has no permission to access this email": "mailbox list", @@ -182,7 +182,7 @@ func TestBusinessSuggestionsAndResponseClassification(t *testing.T) { } } -func TestPATCleanupAndMatchingHelpers(t *testing.T) { +func TestCrossPlatformCoveragePATCleanupAndMatchingHelpers(t *testing.T) { cleaned := cleanPATJSON(map[string]any{ "code": "PAT_NO_PERMISSION", "data": map[string]any{"class": "secret", "items": []any{map[string]any{"class": "hidden", "keep": true}}}, diff --git a/internal/helpers/helpers_core_test.go b/internal/helpers/helpers_core_test.go index 5ebdcc31..8ebb89ee 100644 --- a/internal/helpers/helpers_core_test.go +++ b/internal/helpers/helpers_core_test.go @@ -46,7 +46,7 @@ func installHelpersCoreDeps(t *testing.T, caller *helpersCoreCaller) (*bytes.Buf return out, errOut } -func TestSharedDependenciesRoutingAndWrappers(t *testing.T) { +func TestCrossPlatformCoverageSharedDependenciesRoutingAndWrappers(t *testing.T) { oldDeps := deps deps = nil if GetCaller() != nil || GetFormatter() == nil { @@ -91,7 +91,7 @@ func TestSharedDependenciesRoutingAndWrappers(t *testing.T) { _ = GroupRunE(root, nil) } -func TestMCPReturnTextClassification(t *testing.T) { +func TestCrossPlatformCoverageMCPReturnTextClassification(t *testing.T) { caller := &helpersCoreCaller{} installHelpersCoreDeps(t, caller) cases := []struct { @@ -129,7 +129,7 @@ func TestMCPReturnTextClassification(t *testing.T) { } } -func TestMCPOutputModesAndDevdocFormatting(t *testing.T) { +func TestCrossPlatformCoverageMCPOutputModesAndDevdocFormatting(t *testing.T) { caller := &helpersCoreCaller{format: "json", result: textToolResult(`{"url":"https://example.test/?a=1&b=2"}`)} out, _ := installHelpersCoreDeps(t, caller) if err := callMCPToolInternalOpts("server", "tool", map[string]any{"x": 1}, true); err != nil { @@ -176,7 +176,7 @@ func TestMCPOutputModesAndDevdocFormatting(t *testing.T) { } } -func TestCurrentUserResponseShapes(t *testing.T) { +func TestCrossPlatformCoverageCurrentUserResponseShapes(t *testing.T) { caller := &helpersCoreCaller{} installHelpersCoreDeps(t, caller) for _, response := range []string{ @@ -198,7 +198,7 @@ func TestCurrentUserResponseShapes(t *testing.T) { } } -func TestCoreClassificationSuggestionsAndConfirmation(t *testing.T) { +func TestCrossPlatformCoverageCoreClassificationSuggestionsAndConfirmation(t *testing.T) { if classifyPATError(map[string]any{"errorCode": "PAT_LOW_RISK_NO_PERMISSION"}) == nil || classifyPATError(map[string]any{"code": "other"}) != nil { t.Fatal("PAT classification mismatch") @@ -257,7 +257,7 @@ func TestCoreClassificationSuggestionsAndConfirmation(t *testing.T) { } } -func TestCamelCaseAliasesAndFlagCopying(t *testing.T) { +func TestCrossPlatformCoverageCamelCaseAliasesAndFlagCopying(t *testing.T) { for input, want := range map[string]string{"base-id": "baseId", "plain": "plain", "a--b": "aB"} { if got := toCamelCase(input); got != want { t.Errorf("toCamelCase(%q) = %q, want %q", input, got, want) diff --git a/internal/helpers/helpers_coverage_more_test.go b/internal/helpers/helpers_coverage_more_test.go index b2a25c93..f7bed71a 100644 --- a/internal/helpers/helpers_coverage_more_test.go +++ b/internal/helpers/helpers_coverage_more_test.go @@ -7,7 +7,7 @@ import ( "testing" ) -func TestMCPInternalClassificationAndUnescapeRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageMCPInternalClassificationAndUnescapeRemainingCoverage(t *testing.T) { caller := &helpersCoreCaller{format: "raw"} out, _ := installHelpersCoreDeps(t, caller) @@ -34,7 +34,7 @@ func TestMCPInternalClassificationAndUnescapeRemainingCoverage(t *testing.T) { } } -func TestCurrentUserMalformedTailFallbackCoverage(t *testing.T) { +func TestCrossPlatformCoverageCurrentUserMalformedTailFallbackCoverage(t *testing.T) { caller := &helpersCoreCaller{result: textToolResult(`{"result":[{"orgEmployeeModel":{"userId":"fallback-user"}},{"orgEmployeeModel":"malformed"}]}`)} installHelpersCoreDeps(t, caller) if got, err := getCurrentUserID(context.Background()); err != nil || got != "fallback-user" { diff --git a/internal/helpers/helpers_final_coverage_test.go b/internal/helpers/helpers_final_coverage_test.go index 39ed5e4b..2c438542 100644 --- a/internal/helpers/helpers_final_coverage_test.go +++ b/internal/helpers/helpers_final_coverage_test.go @@ -12,7 +12,7 @@ import ( "github.com/spf13/cobra" ) -func TestLastPureAndCommandBranches(t *testing.T) { +func TestCrossPlatformCoverageLastPureAndCommandBranches(t *testing.T) { if commandBoolFlag(nil, "dry-run") { t.Fatal("nil command flag is true") } @@ -74,7 +74,7 @@ func TestLastPureAndCommandBranches(t *testing.T) { } } -func TestLastIOAndConfirmationBranches(t *testing.T) { +func TestCrossPlatformCoverageLastIOAndConfirmationBranches(t *testing.T) { origOpen, origRead, origRemove := connectLockOpenFile, connectLockReadFile, connectLockRemove connectLockOpenFile = func(string, int, os.FileMode) (*os.File, error) { return nil, errors.New("open") } if _, err := acquireConnectLock("client"); err == nil || err.Error() != "open" { diff --git a/internal/helpers/helpers_unix_coverage_test.go b/internal/helpers/helpers_unix_coverage_test.go index 68000898..465f4b35 100644 --- a/internal/helpers/helpers_unix_coverage_test.go +++ b/internal/helpers/helpers_unix_coverage_test.go @@ -21,7 +21,7 @@ import ( "testing" ) -func TestUnixConnectProcessAndFDLimitCoverage(t *testing.T) { +func TestCrossPlatformCoverageUnixConnectProcessAndFDLimitCoverage(t *testing.T) { _ = detachSysProcAttr() origGetrlimit := connectGetrlimit diff --git a/internal/helpers/http_coverage_more_test.go b/internal/helpers/http_coverage_more_test.go index 7fa29a70..c6027c53 100644 --- a/internal/helpers/http_coverage_more_test.go +++ b/internal/helpers/http_coverage_more_test.go @@ -20,7 +20,7 @@ type roundTripFunc func(*http.Request) (*http.Response, error) func (f roundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) { return f(req) } -func TestDefaultFileHTTPTransfersCoverage(t *testing.T) { +func TestCrossPlatformCoverageDefaultFileHTTPTransfersCoverage(t *testing.T) { file := filepath.Join(t.TempDir(), "file.txt") if err := os.WriteFile(file, []byte("payload"), 0o600); err != nil { t.Fatal(err) @@ -73,7 +73,7 @@ func TestDefaultFileHTTPTransfersCoverage(t *testing.T) { SetHTTPGetFile(nil) } -func TestMailHTTPTransfersCoverage(t *testing.T) { +func TestCrossPlatformCoverageMailHTTPTransfersCoverage(t *testing.T) { file := filepath.Join(t.TempDir(), "attachment.bin") if err := os.WriteFile(file, []byte("mail"), 0o600); err != nil { t.Fatal(err) @@ -117,7 +117,7 @@ func TestMailHTTPTransfersCoverage(t *testing.T) { } } -func TestChatMediaHTTPAndDocVersionsCoverage(t *testing.T) { +func TestCrossPlatformCoverageChatMediaHTTPAndDocVersionsCoverage(t *testing.T) { previousTransport := http.DefaultTransport mode := "success" var requestQuery url.Values @@ -214,7 +214,7 @@ func TestChatMediaHTTPAndDocVersionsCoverage(t *testing.T) { func jsonNumber(value string) json.Number { return json.Number(value) } -func TestRunDocReadJsonMLCoverage(t *testing.T) { +func TestCrossPlatformCoverageRunDocReadJsonMLCoverage(t *testing.T) { previous := deps t.Cleanup(func() { deps = previous }) caller := &helpersCoreCaller{format: "json"} diff --git a/internal/helpers/import_flow_coverage_more_test.go b/internal/helpers/import_flow_coverage_more_test.go index ba45167b..9c220d64 100644 --- a/internal/helpers/import_flow_coverage_more_test.go +++ b/internal/helpers/import_flow_coverage_more_test.go @@ -36,7 +36,7 @@ func importCoverageCommand(t *testing.T, filePath string) *cobra.Command { return cmd } -func TestImportFlowRemainingBranches(t *testing.T) { +func TestCrossPlatformCoverageImportFlowRemainingBranches(t *testing.T) { t.Run("missing flag aliases are skipped", func(t *testing.T) { cmd := &cobra.Command{Use: "import"} cmd.Flags().String("folder", "", "") diff --git a/internal/helpers/mail_command_edges_more_test.go b/internal/helpers/mail_command_edges_more_test.go index 0fd81ff0..fc2981fb 100644 --- a/internal/helpers/mail_command_edges_more_test.go +++ b/internal/helpers/mail_command_edges_more_test.go @@ -34,7 +34,7 @@ func executeMailEdge(t *testing.T, caller *scriptedToolCaller, args ...string) e return cmd.Execute() } -func TestMailSearchSendAndThreadEdges(t *testing.T) { +func TestCrossPlatformCoverageMailSearchSendAndThreadEdges(t *testing.T) { valid := [][]string{ {"message", "search", "--email", "a@example.com", "--query", "subject:x"}, {"message", "list", "--email", "a@example.com"}, @@ -68,7 +68,7 @@ func TestMailSearchSendAndThreadEdges(t *testing.T) { } } -func TestMailReplyForwardAndDraftEdges(t *testing.T) { +func TestCrossPlatformCoverageMailReplyForwardAndDraftEdges(t *testing.T) { draftSteps := func() []scriptedToolStep { return []scriptedToolStep{{text: `{}`}, {text: `{"result":{"message":{"id":"message"}}}`}, {text: `{}`}} } @@ -112,7 +112,7 @@ func TestMailReplyForwardAndDraftEdges(t *testing.T) { } } -func TestMailRulesRecallAndTemplateEdges(t *testing.T) { +func TestCrossPlatformCoverageMailRulesRecallAndTemplateEdges(t *testing.T) { if err := executeMailEdge(t, &scriptedToolCaller{}, "sent-message", "recall", "--email", "a@example.com", "--id", "1", "--subject", "s"); err == nil { t.Fatal("recall without confirmation returned nil") } @@ -144,7 +144,7 @@ func TestMailRulesRecallAndTemplateEdges(t *testing.T) { } } -func TestMailDraftInlineFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageMailDraftInlineFailureEdges(t *testing.T) { previousArgs := os.Args os.Args = []string{"dws", "mail"} defer func() { os.Args = previousArgs }() @@ -186,7 +186,7 @@ func TestMailDraftInlineFailureEdges(t *testing.T) { deps = previous } -func TestMailDownloadWorkflowEdges(t *testing.T) { +func TestCrossPlatformCoverageMailDownloadWorkflowEdges(t *testing.T) { previousArgs := os.Args os.Args = []string{"dws", "mail"} defer func() { os.Args = previousArgs }() @@ -234,7 +234,7 @@ type mailFailingReadCloser struct{} func (mailFailingReadCloser) Read([]byte) (int, error) { return 0, errors.New("read") } func (mailFailingReadCloser) Close() error { return nil } -func TestMailHTTPAndLimitRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageMailHTTPAndLimitRemainingEdges(t *testing.T) { file := filepath.Join(t.TempDir(), "file.txt") if err := os.WriteFile(file, []byte("data"), 0o600); err != nil { t.Fatal(err) diff --git a/internal/helpers/mail_coverage_more_test.go b/internal/helpers/mail_coverage_more_test.go index 1bc51b20..66bad32e 100644 --- a/internal/helpers/mail_coverage_more_test.go +++ b/internal/helpers/mail_coverage_more_test.go @@ -12,7 +12,7 @@ import ( "github.com/spf13/cobra" ) -func TestMailDraftAttachmentValidationCoverage(t *testing.T) { +func TestCrossPlatformCoverageMailDraftAttachmentValidationCoverage(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "mail"} t.Cleanup(func() { os.Args = oldArgs }) @@ -43,7 +43,7 @@ func TestMailDraftAttachmentValidationCoverage(t *testing.T) { } } -func TestMailDraftAttachmentWorkflowCoverage(t *testing.T) { +func TestCrossPlatformCoverageMailDraftAttachmentWorkflowCoverage(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "mail"} t.Cleanup(func() { os.Args = oldArgs }) @@ -93,7 +93,7 @@ func TestMailDraftAttachmentWorkflowCoverage(t *testing.T) { _, _ = runMailDraftWithAttachment("create_draft", map[string]any{"from": "user@example.com"}, "", "body", []string{attachment}, nil) } -func TestMailParsingAndValidationCoverage(t *testing.T) { +func TestCrossPlatformCoverageMailParsingAndValidationCoverage(t *testing.T) { for _, raw := range []string{`{`, `{}`, `{"messageId":"id"}`, `{"result":{"message":{"id":"nested"}}}`} { _, _ = parseMailDraftId(raw) } diff --git a/internal/helpers/oa_coverage_more_test.go b/internal/helpers/oa_coverage_more_test.go index a663ae9f..8316cb7b 100644 --- a/internal/helpers/oa_coverage_more_test.go +++ b/internal/helpers/oa_coverage_more_test.go @@ -2,7 +2,7 @@ package helpers import "testing" -func TestOARemainingTimeAndRevertBranches(t *testing.T) { +func TestCrossPlatformCoverageOARemainingTimeAndRevertBranches(t *testing.T) { installScriptedCaller(t, &scriptedToolCaller{dry: true}) for _, args := range [][]string{ {"approval", "list-pending", "--start", "bad", "--end", "2030-01-01T10:00:00+08:00"}, diff --git a/internal/helpers/output_coverage_more_test.go b/internal/helpers/output_coverage_more_test.go index 4add0fa7..9c452565 100644 --- a/internal/helpers/output_coverage_more_test.go +++ b/internal/helpers/output_coverage_more_test.go @@ -18,7 +18,7 @@ func (outputFilterCaller) DryRun() bool { return false } func (outputFilterCaller) Fields() string { return "name" } func (outputFilterCaller) JQ() string { return "" } -func TestFormatterRemainingFilterBranches(t *testing.T) { +func TestCrossPlatformCoverageFormatterRemainingFilterBranches(t *testing.T) { origDeps := deps t.Cleanup(func() { deps = origDeps }) var out bytes.Buffer diff --git a/internal/helpers/polling_coverage_more_test.go b/internal/helpers/polling_coverage_more_test.go index fb82c107..c954238b 100644 --- a/internal/helpers/polling_coverage_more_test.go +++ b/internal/helpers/polling_coverage_more_test.go @@ -70,7 +70,7 @@ func installImmediateTiming(t *testing.T) { }) } -func TestDocPollingCoverage(t *testing.T) { +func TestCrossPlatformCoverageDocPollingCoverage(t *testing.T) { installImmediateTiming(t) oldArgs := os.Args os.Args = []string{"dws", "doc"} @@ -119,7 +119,7 @@ func TestDocPollingCoverage(t *testing.T) { _, _ = pollImportTask(cancelled, "task", importConfig) } -func TestSheetExportPollingCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetExportPollingCoverage(t *testing.T) { installImmediateTiming(t) oldArgs := os.Args os.Args = []string{"dws", "sheet"} @@ -156,7 +156,7 @@ func TestSheetExportPollingCoverage(t *testing.T) { } } -func TestChunkedWriteCoverage(t *testing.T) { +func TestCrossPlatformCoverageChunkedWriteCoverage(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "doc"} t.Cleanup(func() { os.Args = oldArgs }) @@ -194,7 +194,7 @@ func TestChunkedWriteCoverage(t *testing.T) { } } -func TestTodoListAutoPageCoverage(t *testing.T) { +func TestCrossPlatformCoverageTodoListAutoPageCoverage(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "todo"} t.Cleanup(func() { os.Args = oldArgs }) @@ -228,7 +228,7 @@ func TestTodoListAutoPageCoverage(t *testing.T) { } } -func TestAitableRetryAndPaginationCoverage(t *testing.T) { +func TestCrossPlatformCoverageAitableRetryAndPaginationCoverage(t *testing.T) { installImmediateTiming(t) oldArgs := os.Args os.Args = []string{"dws", "aitable"} diff --git a/internal/helpers/product_examples_test.go b/internal/helpers/product_examples_test.go index bc93ac8b..2fcf6016 100644 --- a/internal/helpers/product_examples_test.go +++ b/internal/helpers/product_examples_test.go @@ -126,7 +126,7 @@ func (c *productExampleCaller) DryRun() bool { return c.dry } func (*productExampleCaller) Fields() string { return "" } func (*productExampleCaller) JQ() string { return "" } -func TestProductCommandExamplesAreExecutableContracts(t *testing.T) { +func TestCrossPlatformCoverageProductCommandExamplesAreExecutableContracts(t *testing.T) { workingDirectory, err := os.Getwd() if err != nil { t.Fatalf("get working directory: %v", err) diff --git a/internal/helpers/register_products_test.go b/internal/helpers/register_products_test.go index 08a0bb9b..2adf952e 100644 --- a/internal/helpers/register_products_test.go +++ b/internal/helpers/register_products_test.go @@ -6,7 +6,7 @@ import ( "github.com/spf13/cobra" ) -func TestPublicProductCommandsBuildCompleteUniqueTrees(t *testing.T) { +func TestCrossPlatformCoveragePublicProductCommandsBuildCompleteUniqueTrees(t *testing.T) { commands := NewPublicCommands(&captureRunner{}) if len(commands) == 0 { t.Fatal("NewPublicCommands() returned no commands") diff --git a/internal/helpers/remaining_unit_coverage_test.go b/internal/helpers/remaining_unit_coverage_test.go index b1fb0373..2b7affb6 100644 --- a/internal/helpers/remaining_unit_coverage_test.go +++ b/internal/helpers/remaining_unit_coverage_test.go @@ -84,7 +84,7 @@ func (c *coverageMediaClient) downloadDentryFile(_ context.Context, spaceID, den return c.downloadDentry(fileInboundInfo{SpaceID: spaceID, DentryID: dentryID, FileName: name}, unionID) } -func TestConnectMediaParsingRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageConnectMediaParsingRemainingEdges(t *testing.T) { empty := filepath.Join(t.TempDir(), "empty.bin") if err := os.WriteFile(empty, nil, 0o600); err != nil { t.Fatal(err) @@ -154,7 +154,7 @@ func TestConnectMediaParsingRemainingEdges(t *testing.T) { } } -func TestWriteCompleteMediaFileRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageWriteCompleteMediaFileRemainingEdges(t *testing.T) { origCreate, origCopy, origRemove := mediaCreate, mediaCopy, mediaRemove t.Cleanup(func() { mediaCreate, mediaCopy, mediaRemove = origCreate, origCopy, origRemove @@ -197,7 +197,7 @@ func TestWriteCompleteMediaFileRemainingEdges(t *testing.T) { } } -func TestPivotAndInputValidationRemainingEdges(t *testing.T) { +func TestCrossPlatformCoveragePivotAndInputValidationRemainingEdges(t *testing.T) { cases := []map[string]any{ {"values": "not-array"}, {"values": []any{map[string]any{}}}, @@ -229,7 +229,7 @@ func TestPivotAndInputValidationRemainingEdges(t *testing.T) { } } -func TestDangerousConfirmationRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageDangerousConfirmationRemainingEdges(t *testing.T) { if confirmDangerousAction(nil, "publish", "resource") { t.Fatal("nil command confirmed") } @@ -247,7 +247,7 @@ func TestDangerousConfirmationRemainingEdges(t *testing.T) { } } -func TestProtectSheetMutationCommandPanics(t *testing.T) { +func TestCrossPlatformCoverageProtectSheetMutationCommandPanics(t *testing.T) { assertPanic := func(name string, fn func()) { t.Helper() defer func() { @@ -264,7 +264,7 @@ func TestProtectSheetMutationCommandPanics(t *testing.T) { assertPanic("missing RunE", func() { protectSheetMutationCommand(&cobra.Command{Use: "leaf"}, "delete", "target") }) } -func TestOpenCodeAttachmentFallbackNameAndStat(t *testing.T) { +func TestCrossPlatformCoverageOpenCodeAttachmentFallbackNameAndStat(t *testing.T) { orig := generateConnectVideoStoryboard t.Cleanup(func() { generateConnectVideoStoryboard = orig }) video := filepath.Join(t.TempDir(), "video.mp4") @@ -279,7 +279,7 @@ func TestOpenCodeAttachmentFallbackNameAndStat(t *testing.T) { } } -func TestAssembleConnectTurnMediaBranches(t *testing.T) { +func TestCrossPlatformCoverageAssembleConnectTurnMediaBranches(t *testing.T) { origRecover := recoverChatRecordUnknownsForConnect t.Cleanup(func() { recoverChatRecordUnknownsForConnect = origRecover }) fail := errors.New("download failed") @@ -376,7 +376,7 @@ func TestAssembleConnectTurnMediaBranches(t *testing.T) { } } -func TestChatRecordDownloadWrapperAndWriteEdges(t *testing.T) { +func TestCrossPlatformCoverageChatRecordDownloadWrapperAndWriteEdges(t *testing.T) { origCall := chatRecordDownloadToolCall origCreate := mediaCreate t.Cleanup(func() { @@ -408,7 +408,7 @@ func TestChatRecordDownloadWrapperAndWriteEdges(t *testing.T) { } } -func TestChatRecordEnrichmentInvalidConversationResponse(t *testing.T) { +func TestCrossPlatformCoverageChatRecordEnrichmentInvalidConversationResponse(t *testing.T) { resolved := map[string]chatRecordMessage{"wanted": {OpenMessageID: "wanted", Content: "[文件] old"}} all := []chatRecordMessage{{OpenMessageID: "wanted", OpenConversationID: "conv", CreateTime: "2026-01-01 00:00:00"}} enrichForwardedFileLocators(context.Background(), all, resolved, func(context.Context, string, string, map[string]any) (string, error) { @@ -416,7 +416,7 @@ func TestChatRecordEnrichmentInvalidConversationResponse(t *testing.T) { }) } -func TestGeminiRemainingAttachmentEdges(t *testing.T) { +func TestCrossPlatformCoverageGeminiRemainingAttachmentEdges(t *testing.T) { origPollInterval := geminiFilePollInterval t.Cleanup(func() { geminiFilePollInterval = origPollInterval }) f := &geminiAPIForwarder{model: "model", apiKey: "key", baseURL: "https://example.test/v1beta", timeout: 1, httpClient: http.DefaultClient} @@ -453,7 +453,7 @@ func TestGeminiRemainingAttachmentEdges(t *testing.T) { } } -func TestCallbackMediaCrossSourceDeduplication(t *testing.T) { +func TestCrossPlatformCoverageCallbackMediaCrossSourceDeduplication(t *testing.T) { content := map[string]any{ "downloadCode": "same", "fileName": "top.txt", @@ -471,7 +471,7 @@ func TestCallbackMediaCrossSourceDeduplication(t *testing.T) { } } -func TestForwarderAttachmentDispatchRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageForwarderAttachmentDispatchRemainingEdges(t *testing.T) { streaming := &coverageStreamingAttachmentForwarder{} if reply, err := forwardConnectTurn(context.Background(), streaming, "conv", "prompt", nil, func(string) {}); err != nil || reply != "streamed" || !streaming.called { t.Fatalf("streaming attachment dispatch = %q, %v, called=%v", reply, err, streaming.called) @@ -506,7 +506,7 @@ func TestForwarderAttachmentDispatchRemainingEdges(t *testing.T) { } } -func TestQoderAttachmentForwardingRemainingEdges(t *testing.T) { +func TestCrossPlatformCoverageQoderAttachmentForwardingRemainingEdges(t *testing.T) { cancelled, cancel := context.WithCancel(context.Background()) cancel() fwd := &qoderStreamForwarder{name: "qoder", bin: "missing-qoder", timeout: 1} @@ -540,7 +540,7 @@ func TestQoderAttachmentForwardingRemainingEdges(t *testing.T) { } } -func TestOpenCodeAndCodexAttachmentWrappers(t *testing.T) { +func TestCrossPlatformCoverageOpenCodeAndCodexAttachmentWrappers(t *testing.T) { var requestBody string server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { raw, _ := io.ReadAll(r.Body) @@ -567,7 +567,7 @@ func TestOpenCodeAndCodexAttachmentWrappers(t *testing.T) { } } -func TestRunStreamConnectorChatRecordLookupBranches(t *testing.T) { +func TestCrossPlatformCoverageRunStreamConnectorChatRecordLookupBranches(t *testing.T) { origRecover := recoverChatRecordUnknownsForConnect t.Cleanup(func() { recoverChatRecordUnknownsForConnect = origRecover }) recoverChatRecordUnknownsForConnect = func(context.Context, chatRecordLookup, chatRecordToolCall) (chatRecordEnrichment, error) { @@ -587,7 +587,7 @@ func TestRunStreamConnectorChatRecordLookupBranches(t *testing.T) { } } -func TestRemainingCommandExecutionBranches(t *testing.T) { +func TestCrossPlatformCoverageRemainingCommandExecutionBranches(t *testing.T) { t.Run("aitable view with timeout", func(t *testing.T) { caller, err := runAitableExportCommand(t, "--base-id", "base", "--scope", "view", "--table-id", "table", "--view-id", "view", @@ -649,7 +649,7 @@ func TestRemainingCommandExecutionBranches(t *testing.T) { }) } -func TestAttachSheetConfirmationGuardMissingPath(t *testing.T) { +func TestCrossPlatformCoverageAttachSheetConfirmationGuardMissingPath(t *testing.T) { defer func() { if recover() == nil { t.Fatal("missing Sheet path did not panic") @@ -658,7 +658,7 @@ func TestAttachSheetConfirmationGuardMissingPath(t *testing.T) { attachSheetConfirmationGuard(&cobra.Command{Use: "sheet"}, "missing leaf", "delete", "target") } -func TestDentryDownloadRejectsDeclaredOversize(t *testing.T) { +func TestCrossPlatformCoverageDentryDownloadRejectsDeclaredOversize(t *testing.T) { orig := connectMediaCallRaw t.Cleanup(func() { connectMediaCallRaw = orig }) connectMediaCallRaw = func(*aiCardClient, context.Context, string, string, map[string]any) (string, error) { diff --git a/internal/helpers/report_coverage_more_test.go b/internal/helpers/report_coverage_more_test.go index 7b52d8bd..849bed5f 100644 --- a/internal/helpers/report_coverage_more_test.go +++ b/internal/helpers/report_coverage_more_test.go @@ -41,7 +41,7 @@ func reportListCoverageCommand(t *testing.T, sent bool, values map[string]string return cmd } -func TestReportHandlerRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageReportHandlerRemainingCoverage(t *testing.T) { caller := &reportTestCaller{dry: true, format: "json"} installReportTestDeps(t, caller) validContents := `[{"key":"Done","sort":"0","content":"work","contentType":"markdown","type":"1"}]` @@ -82,7 +82,7 @@ func TestReportHandlerRemainingCoverage(t *testing.T) { } } -func TestReportReadableRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageReportReadableRemainingCoverage(t *testing.T) { caller := &reportTestCaller{format: "json", response: "{"} installReportTestDeps(t, caller) if got := reportDetailForListRow(context.Background(), "report", true); got.markdownLink != "查看详情" { @@ -108,7 +108,7 @@ func TestReportReadableRemainingCoverage(t *testing.T) { } } -func TestReportFilesystemFailureCoverage(t *testing.T) { +func TestCrossPlatformCoverageReportFilesystemFailureCoverage(t *testing.T) { originalOpen := reportOpenFile originalAbs := reportAbsPath originalGetwd := reportGetwd diff --git a/internal/helpers/report_test.go b/internal/helpers/report_test.go index 3560b486..cdfdc589 100644 --- a/internal/helpers/report_test.go +++ b/internal/helpers/report_test.go @@ -49,7 +49,7 @@ func installReportTestDeps(t *testing.T, caller *reportTestCaller) (*bytes.Buffe return out, errOut } -func TestReportReadableListEnrichment(t *testing.T) { +func TestCrossPlatformCoverageReportReadableListEnrichment(t *testing.T) { caller := &reportTestCaller{format: "json", response: `{ "result":{"reportName":"Detail","creatorName":"Alice","createTime":1700000000000,"readStatus":true,"url":"dingtalk://detail","contents":[{"key":"Done","content":"A|B"}]}} `} @@ -92,7 +92,7 @@ func TestReportReadableListEnrichment(t *testing.T) { } } -func TestReportReadableValueFormatting(t *testing.T) { +func TestCrossPlatformCoverageReportReadableValueFormatting(t *testing.T) { columns := reportListDisplayColumns("sent") if len(columns) != 6 || len(reportListDisplayColumns("list")) != 5 { t.Fatal("display columns changed") @@ -169,7 +169,7 @@ func TestReportReadableValueFormatting(t *testing.T) { } } -func TestReportResponseTraversalAndLinks(t *testing.T) { +func TestCrossPlatformCoverageReportResponseTraversalAndLinks(t *testing.T) { detail := map[string]any{"result": map[string]any{ "report_name": "Title", "creatorName": "Alice", "createTime": "2026-01-02T03:04:05Z", "readStatus": "read", "contents": []any{map[string]any{"key": "Done", "content": "work"}}, @@ -216,7 +216,7 @@ func TestReportResponseTraversalAndLinks(t *testing.T) { } } -func TestReportCreateEnrichmentBranches(t *testing.T) { +func TestCrossPlatformCoverageReportCreateEnrichmentBranches(t *testing.T) { caller := &reportTestCaller{format: "json", response: `{"result":{"url":"dingtalk://detail"}}`} out, _ := installReportTestDeps(t, caller) if enrichReportCreateWithDetailURL(context.Background(), []any{"unchanged"}) == nil { @@ -263,7 +263,7 @@ func TestReportCreateEnrichmentBranches(t *testing.T) { } } -func TestCallReportCreateWithDetailURLCoverage(t *testing.T) { +func TestCrossPlatformCoverageCallReportCreateWithDetailURLCoverage(t *testing.T) { caller := &reportTestCaller{dry: true, format: "json", response: `{"ok":true}`} installReportTestDeps(t, caller) _ = callReportCreateWithDetailURL(map[string]any{"template_id": "template"}) @@ -279,7 +279,7 @@ func TestCallReportCreateWithDetailURLCoverage(t *testing.T) { } } -func TestReportContentsValidationMatrix(t *testing.T) { +func TestCrossPlatformCoverageReportContentsValidationMatrix(t *testing.T) { valid := map[string]any{"key": " Done ", "sort": 1, "content": "", "type": "text", "contentType": "text"} if err := validateAndNormalizeReportContents([]map[string]any{valid}); err != nil { t.Fatalf("valid contents error = %v", err) @@ -329,7 +329,7 @@ type failingReader struct{} func (failingReader) Read([]byte) (int, error) { return 0, errors.New("read failed") } -func TestReportContentsSourcesAndSafePaths(t *testing.T) { +func TestCrossPlatformCoverageReportContentsSourcesAndSafePaths(t *testing.T) { dir := t.TempDir() previousWD, err := os.Getwd() if err != nil { @@ -410,7 +410,7 @@ func TestReportContentsSourcesAndSafePaths(t *testing.T) { } } -func TestReportDispatchHintsAndDeprecation(t *testing.T) { +func TestCrossPlatformCoverageReportDispatchHintsAndDeprecation(t *testing.T) { caller := &reportTestCaller{format: "table"} out, _ := installReportTestDeps(t, caller) for _, operation := range []string{"template-list", "template-detail", "detail", "stats", "list", "sent", "create", "unknown"} { diff --git a/internal/helpers/sheet_batch_test.go b/internal/helpers/sheet_batch_test.go index 2c43c856..f7038d08 100644 --- a/internal/helpers/sheet_batch_test.go +++ b/internal/helpers/sheet_batch_test.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/cobra" ) -func TestSheetBatchOperationTranslationCoversEveryMapping(t *testing.T) { +func TestCrossPlatformCoverageSheetBatchOperationTranslationCoversEveryMapping(t *testing.T) { input := map[string]any{ "sheet-id": "Sheet1", "range": "A1:B2", "type": "all", "values": []any{"value"}, "merge-type": "mergeRows", "source-range": "A1", "target-range": "B2", @@ -43,7 +43,7 @@ func TestSheetBatchOperationTranslationCoversEveryMapping(t *testing.T) { } } -func TestSheetBatchValueConversionsAndDefaults(t *testing.T) { +func TestCrossPlatformCoverageSheetBatchValueConversionsAndDefaults(t *testing.T) { if got := batchStr(map[string]any{"second": 42}, "first", "second"); got != "42" { t.Fatalf("batchStr() = %q", got) } @@ -92,7 +92,7 @@ func TestSheetBatchValueConversionsAndDefaults(t *testing.T) { } } -func TestResolveCSVContent(t *testing.T) { +func TestCrossPlatformCoverageResolveCSVContent(t *testing.T) { dir := t.TempDir() path := filepath.Join(dir, "input.csv") if err := os.WriteFile(path, []byte("\xef\xbb\xbfhead\r\nvalue"), 0o600); err != nil { @@ -175,7 +175,7 @@ func rangeBatchClearCoverageCommand() *cobra.Command { return cmd } -func TestSheetBatchUpdateCommandRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetBatchUpdateCommandRemainingCoverage(t *testing.T) { for _, args := range [][]string{ nil, {"--node", "node", "--operations", "["}, @@ -208,7 +208,7 @@ func TestSheetBatchUpdateCommandRemainingCoverage(t *testing.T) { } } -func TestSheetRangeBatchClearCommandRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetRangeBatchClearCommandRemainingCoverage(t *testing.T) { for _, args := range [][]string{ nil, {"--node", "node", "--ranges", "["}, diff --git a/internal/helpers/sheet_chart_coverage_more_test.go b/internal/helpers/sheet_chart_coverage_more_test.go index 203bf06d..10353a3b 100644 --- a/internal/helpers/sheet_chart_coverage_more_test.go +++ b/internal/helpers/sheet_chart_coverage_more_test.go @@ -8,7 +8,7 @@ import ( const validChartPropertiesCoverage = `{"position":{"row":0,"col":"A"},"dimensions":{"width":100,"height":100},"chart":{"type":"line","series":[{"value":["A1:A2"]}]}}` -func TestSheetChartCommandRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetChartCommandRemainingCoverage(t *testing.T) { installScriptedCaller(t, &scriptedToolCaller{dry: true}) base := []string{"--node", "node", "--sheet-id", "sheet"} for _, args := range [][]string{ diff --git a/internal/helpers/sheet_cond_format_coverage_more_test.go b/internal/helpers/sheet_cond_format_coverage_more_test.go index 084921ed..b73d53fa 100644 --- a/internal/helpers/sheet_cond_format_coverage_more_test.go +++ b/internal/helpers/sheet_cond_format_coverage_more_test.go @@ -2,7 +2,7 @@ package helpers import "testing" -func TestCondFormatRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageCondFormatRemainingCoverage(t *testing.T) { installScriptedCaller(t, &scriptedToolCaller{dry: true}) base := []string{"create", "--node", "node", "--sheet-id", "sheet"} for _, extra := range [][]string{ diff --git a/internal/helpers/sheet_dimension_coverage_more_test.go b/internal/helpers/sheet_dimension_coverage_more_test.go index 720e9c50..f6a409cd 100644 --- a/internal/helpers/sheet_dimension_coverage_more_test.go +++ b/internal/helpers/sheet_dimension_coverage_more_test.go @@ -29,7 +29,7 @@ func executeDimensionCoverage(t *testing.T, name string, args ...string) error { return cmd.Execute() } -func TestDimensionValidationRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageDimensionValidationRemainingCoverage(t *testing.T) { installScriptedCaller(t, &scriptedToolCaller{dry: true}) common := []string{"--node", "node", "--sheet-id", "sheet"} if err := executeDimensionCoverage(t, "insert-dimension", append(common, "--dimension", "ROWS", "--position", "1", "--length", "5001")...); err == nil { @@ -74,7 +74,7 @@ func TestDimensionValidationRemainingCoverage(t *testing.T) { } } -func TestDropdownValidationRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageDropdownValidationRemainingCoverage(t *testing.T) { installScriptedCaller(t, &scriptedToolCaller{dry: true}) base := []string{"--node", "node", "--sheet-id", "sheet", "--range", "A1"} for _, options := range []string{"[]", `[{"value":"a,b"}]`} { diff --git a/internal/helpers/sheet_export_coverage_more_test.go b/internal/helpers/sheet_export_coverage_more_test.go index e42aa496..8af613cc 100644 --- a/internal/helpers/sheet_export_coverage_more_test.go +++ b/internal/helpers/sheet_export_coverage_more_test.go @@ -23,7 +23,7 @@ func executeSheetExportCoverage(t *testing.T, caller *scriptedToolCaller, args . return runSheetExport(cmd, nil) } -func TestSheetExportCommandRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetExportCommandRemainingCoverage(t *testing.T) { installImmediateTiming(t) if err := executeSheetExportCoverage(t, &scriptedToolCaller{}); err == nil { t.Fatal("missing node returned nil") @@ -80,7 +80,7 @@ func TestSheetExportCommandRemainingCoverage(t *testing.T) { } } -func TestSheetExportFilenameDotCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetExportFilenameDotCoverage(t *testing.T) { if got := inferSheetExportFilename("https://example.test/."); got != "" { t.Fatalf("dot filename = %q", got) } diff --git a/internal/helpers/sheet_filter_view_coverage_more_test.go b/internal/helpers/sheet_filter_view_coverage_more_test.go index dbc4aec6..236788fc 100644 --- a/internal/helpers/sheet_filter_view_coverage_more_test.go +++ b/internal/helpers/sheet_filter_view_coverage_more_test.go @@ -50,7 +50,7 @@ func findCoverageSubcommand(t *testing.T, root *cobra.Command, name string) *cob return nil } -func TestFilterViewFetchAndHandlerRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageFilterViewFetchAndHandlerRemainingCoverage(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "sheet"} t.Cleanup(func() { os.Args = oldArgs }) @@ -121,7 +121,7 @@ func TestFilterViewFetchAndHandlerRemainingCoverage(t *testing.T) { } } -func TestFilterCommandOptionalArgumentRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageFilterCommandOptionalArgumentRemainingCoverage(t *testing.T) { installScriptedCaller(t, &scriptedToolCaller{dry: true}) common := []string{"--node", "node", "--sheet-id", "sheet"} if err := executeFilterCoverage(t, newFilterCmd(), append([]string{"create"}, append(common, "--range", "A1:B2", "--criteria", "[]")...)...); err != nil { diff --git a/internal/helpers/sheet_info_coverage_more_test.go b/internal/helpers/sheet_info_coverage_more_test.go index 94614823..1ad3b3a2 100644 --- a/internal/helpers/sheet_info_coverage_more_test.go +++ b/internal/helpers/sheet_info_coverage_more_test.go @@ -5,7 +5,7 @@ import ( "testing" ) -func TestSheetCellInfoCleanupRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetCellInfoCleanupRemainingCoverage(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "sheet"} t.Cleanup(func() { os.Args = oldArgs }) diff --git a/internal/helpers/sheet_media_coverage_more_test.go b/internal/helpers/sheet_media_coverage_more_test.go index f62e523a..316f8f9e 100644 --- a/internal/helpers/sheet_media_coverage_more_test.go +++ b/internal/helpers/sheet_media_coverage_more_test.go @@ -29,7 +29,7 @@ func executeSheetMediaEdge(t *testing.T, index int, caller *scriptedToolCaller, return cmd.Execute() } -func TestSheetMediaUploadRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetMediaUploadRemainingCoverage(t *testing.T) { file := filepath.Join(t.TempDir(), "photo.png") if err := os.WriteFile(file, []byte("image"), 0o600); err != nil { t.Fatal(err) @@ -78,7 +78,7 @@ func TestSheetMediaUploadRemainingCoverage(t *testing.T) { } } -func TestSheetWriteImageRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetWriteImageRemainingCoverage(t *testing.T) { file := filepath.Join(t.TempDir(), "photo.png") if err := os.WriteFile(file, []byte("image"), 0o600); err != nil { t.Fatal(err) @@ -136,7 +136,7 @@ func TestSheetWriteImageRemainingCoverage(t *testing.T) { } } -func TestSheetMediaCommandDefinitionsCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetMediaCommandDefinitionsCoverage(t *testing.T) { for _, cmd := range newMediaCmds() { if cmd.RunE == nil || cmd.Name() == "" { t.Fatalf("invalid media command %#v", cmd) diff --git a/internal/helpers/sheet_range_ops_coverage_more_test.go b/internal/helpers/sheet_range_ops_coverage_more_test.go index bfe179d0..25630897 100644 --- a/internal/helpers/sheet_range_ops_coverage_more_test.go +++ b/internal/helpers/sheet_range_ops_coverage_more_test.go @@ -2,7 +2,7 @@ package helpers import "testing" -func TestSheetRangeUpdateAndSortRemainingCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetRangeUpdateAndSortRemainingCoverage(t *testing.T) { installScriptedCaller(t, &scriptedToolCaller{dry: true}) base := []string{"update", "--node", "node", "--sheet-id", "sheet", "--range", "A1", "--values"} for _, raw := range []string{ diff --git a/internal/helpers/sheet_style_coverage_more_test.go b/internal/helpers/sheet_style_coverage_more_test.go index d20b4ac2..3665d27c 100644 --- a/internal/helpers/sheet_style_coverage_more_test.go +++ b/internal/helpers/sheet_style_coverage_more_test.go @@ -8,7 +8,7 @@ import ( "testing" ) -func TestSheetStyleRangeAndFontCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetStyleRangeAndFontCoverage(t *testing.T) { for _, raw := range []string{"", "Sheet1!A1:B2", "B2:A1", "A1", "A", "1", "A0", "A-1", "A1:bad"} { _, _, _ = parseA1Range(raw) } @@ -51,7 +51,7 @@ func TestSheetStyleRangeAndFontCoverage(t *testing.T) { } } -func TestSheetBatchSetStyleCoverage(t *testing.T) { +func TestCrossPlatformCoverageSheetBatchSetStyleCoverage(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "sheet"} t.Cleanup(func() { os.Args = oldArgs }) diff --git a/internal/helpers/sheet_validate_test.go b/internal/helpers/sheet_validate_test.go index f709c329..10beb9a7 100644 --- a/internal/helpers/sheet_validate_test.go +++ b/internal/helpers/sheet_validate_test.go @@ -2,7 +2,7 @@ package helpers import "testing" -func TestValidateComplexValueStyle(t *testing.T) { +func TestCrossPlatformCoverageValidateComplexValueStyle(t *testing.T) { valid := map[string]any{"bold": true, "italic": false, "underline": true, "strike": false, "color": "#fff", "size": float64(12)} if err := validateComplexValueStyle(valid, "style"); err != nil { t.Fatalf("valid style error = %v", err) @@ -16,7 +16,7 @@ func TestValidateComplexValueStyle(t *testing.T) { } } -func TestValidateRichTextItems(t *testing.T) { +func TestCrossPlatformCoverageValidateRichTextItems(t *testing.T) { valid := []map[string]any{ {"type": "text", "text": "hello", "style": map[string]any{"bold": true}}, {"type": "link", "text": "site", "link": "https://example.test", "style": map[string]any{"color": "#fff"}}, @@ -47,7 +47,7 @@ func TestValidateRichTextItems(t *testing.T) { } } -func TestValidateComplexValueCells(t *testing.T) { +func TestCrossPlatformCoverageValidateComplexValueCells(t *testing.T) { valid := []map[string]any{ {"dataValidation": map[string]any{"type": "none"}}, {"cellStyles": map[string]any{}}, @@ -80,7 +80,7 @@ func TestValidateComplexValueCells(t *testing.T) { } } -func TestValidateCellHyperlinks(t *testing.T) { +func TestCrossPlatformCoverageValidateCellHyperlinks(t *testing.T) { for _, value := range []any{ nil, map[string]any{"type": "none"}, @@ -104,7 +104,7 @@ func TestValidateCellHyperlinks(t *testing.T) { } } -func TestValidateDataValidations(t *testing.T) { +func TestCrossPlatformCoverageValidateDataValidations(t *testing.T) { valid := []any{ map[string]any{"type": "dropdown", "options": []any{map[string]any{"value": "one"}}}, map[string]any{"type": "checkbox"}, map[string]any{"type": "checkbox", "checked": true}, diff --git a/internal/helpers/small_remaining_coverage_test.go b/internal/helpers/small_remaining_coverage_test.go index 6f6cf477..e95b1c08 100644 --- a/internal/helpers/small_remaining_coverage_test.go +++ b/internal/helpers/small_remaining_coverage_test.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/cobra" ) -func TestSheetAndMinutesSmallRemainingBranches(t *testing.T) { +func TestCrossPlatformCoverageSheetAndMinutesSmallRemainingBranches(t *testing.T) { if err := applyStyleSpec(&styleSpec{FontColorsJSON: "{"}, 1, 1, map[string]any{}); err == nil { t.Fatal("invalid font colors JSON returned nil") } @@ -34,7 +34,7 @@ func TestSheetAndMinutesSmallRemainingBranches(t *testing.T) { } } -func TestGeminiForwardRemainingFailures(t *testing.T) { +func TestCrossPlatformCoverageGeminiForwardRemainingFailures(t *testing.T) { invalid := &geminiAPIForwarder{baseURL: "%", model: "model", timeout: time.Second} if _, err := invalid.forward(context.Background(), "", "text"); err == nil { t.Fatal("invalid Gemini endpoint returned nil") diff --git a/internal/helpers/todo_command_edges_more_test.go b/internal/helpers/todo_command_edges_more_test.go index 5897a35a..fa584872 100644 --- a/internal/helpers/todo_command_edges_more_test.go +++ b/internal/helpers/todo_command_edges_more_test.go @@ -31,7 +31,7 @@ func executeTodoEdge(t *testing.T, caller *scriptedToolCaller, args ...string) e return cmd.Execute() } -func TestTodoCreateAndListCommandEdges(t *testing.T) { +func TestCrossPlatformCoverageTodoCreateAndListCommandEdges(t *testing.T) { validDate := "2026-03-10T18:00:00+08:00" errorCases := [][]string{ {"task", "create", "--title", "x", "--executors", "u", "--remind-at", validDate}, @@ -67,7 +67,7 @@ func TestTodoCreateAndListCommandEdges(t *testing.T) { } } -func TestTodoSimpleCommandValidationAndSuccessEdges(t *testing.T) { +func TestCrossPlatformCoverageTodoSimpleCommandValidationAndSuccessEdges(t *testing.T) { errorCases := [][]string{ {"task", "create"}, {"task", "create", "--title", "x"}, @@ -130,7 +130,7 @@ func TestTodoSimpleCommandValidationAndSuccessEdges(t *testing.T) { } } -func TestTodoUpdateReminderAndDetailEdges(t *testing.T) { +func TestCrossPlatformCoverageTodoUpdateReminderAndDetailEdges(t *testing.T) { validDate := "2026-03-10T18:00:00+08:00" errorCases := [][]string{ {"task", "update", "--task-id", "1", "--remind-at", validDate}, @@ -173,7 +173,7 @@ func TestTodoUpdateReminderAndDetailEdges(t *testing.T) { } } -func TestTodoAttachmentCommandEdges(t *testing.T) { +func TestCrossPlatformCoverageTodoAttachmentCommandEdges(t *testing.T) { file := filepath.Join(t.TempDir(), "attachment.txt") if err := os.WriteFile(file, []byte("data"), 0o600); err != nil { t.Fatal(err) @@ -208,7 +208,7 @@ func TestTodoAttachmentCommandEdges(t *testing.T) { } } -func TestTodoDeleteCancellationAndConfirmationEdges(t *testing.T) { +func TestCrossPlatformCoverageTodoDeleteCancellationAndConfirmationEdges(t *testing.T) { originalArgs, originalStdin := os.Args, os.Stdin defer func() { os.Args = originalArgs @@ -248,7 +248,7 @@ func TestTodoDeleteCancellationAndConfirmationEdges(t *testing.T) { } } -func TestTodoMD5AndEmptyListEdges(t *testing.T) { +func TestCrossPlatformCoverageTodoMD5AndEmptyListEdges(t *testing.T) { file := filepath.Join(t.TempDir(), "file.txt") if err := os.WriteFile(file, []byte("data"), 0o600); err != nil { t.Fatal(err) diff --git a/internal/helpers/todo_coverage_more_test.go b/internal/helpers/todo_coverage_more_test.go index 4980ed52..e25e0840 100644 --- a/internal/helpers/todo_coverage_more_test.go +++ b/internal/helpers/todo_coverage_more_test.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -func TestTodoPureUtilityCoverage(t *testing.T) { +func TestCrossPlatformCoverageTodoPureUtilityCoverage(t *testing.T) { cmd := &cobra.Command{Use: "todo"} cmd.Flags().String("remind-at", "", "") _ = rejectUnsupportedTodoReminderFlags(cmd) @@ -30,7 +30,7 @@ func TestTodoPureUtilityCoverage(t *testing.T) { } } -func TestTodoFileUtilityCoverage(t *testing.T) { +func TestCrossPlatformCoverageTodoFileUtilityCoverage(t *testing.T) { file := filepath.Join(t.TempDir(), "file.txt") if err := os.WriteFile(file, []byte("content"), 0o600); err != nil { t.Fatal(err) @@ -48,7 +48,7 @@ func TestTodoFileUtilityCoverage(t *testing.T) { } } -func TestUploadTodoLocalFileCoverage(t *testing.T) { +func TestCrossPlatformCoverageUploadTodoLocalFileCoverage(t *testing.T) { oldPut := httpPutFile t.Cleanup(func() { httpPutFile = oldPut }) meta := todoLocalFileMeta{LocalPath: "file", FileName: "file.txt", FileSize: 4, MD5: "md5"} @@ -72,7 +72,7 @@ func TestUploadTodoLocalFileCoverage(t *testing.T) { } } -func TestTodoAutoPageStopsAtWantedSize(t *testing.T) { +func TestCrossPlatformCoverageTodoAutoPageStopsAtWantedSize(t *testing.T) { oldArgs := os.Args os.Args = []string{"dws", "todo"} t.Cleanup(func() { os.Args = oldArgs }) diff --git a/internal/helpers/wiki_coverage_more_test.go b/internal/helpers/wiki_coverage_more_test.go index 9340c258..62cd48a8 100644 --- a/internal/helpers/wiki_coverage_more_test.go +++ b/internal/helpers/wiki_coverage_more_test.go @@ -18,7 +18,7 @@ func newProxyTestRoot(proxy *cobra.Command, target *cobra.Command) *cobra.Comman return root } -func TestProxySubCommandCoverage(t *testing.T) { +func TestCrossPlatformCoverageProxySubCommandCoverage(t *testing.T) { t.Run("missing product", func(t *testing.T) { proxy := proxySubCmd("proxy", "doc", "read", nil) newProxyTestRoot(proxy, nil) @@ -127,7 +127,7 @@ func executeWikiEdge(t *testing.T, args ...string) error { return root.Execute() } -func TestWikiRoutingAndValidationEdges(t *testing.T) { +func TestCrossPlatformCoverageWikiRoutingAndValidationEdges(t *testing.T) { for _, args := range [][]string{ {"space", "list", "--type", "orgSpace", "--limit", "3", "--cursor", "next"}, {"space", "list", "--type", "mySpace", "--limit", "not-a-number"}, @@ -149,7 +149,7 @@ func TestWikiRoutingAndValidationEdges(t *testing.T) { } } -func TestWikiDeleteCancellationEdges(t *testing.T) { +func TestCrossPlatformCoverageWikiDeleteCancellationEdges(t *testing.T) { oldStdin := os.Stdin t.Cleanup(func() { os.Stdin = oldStdin }) for _, args := range [][]string{ diff --git a/internal/helpers/zero_coverage_more_test.go b/internal/helpers/zero_coverage_more_test.go index 44d1da45..19a3c81f 100644 --- a/internal/helpers/zero_coverage_more_test.go +++ b/internal/helpers/zero_coverage_more_test.go @@ -8,7 +8,7 @@ import ( "testing" ) -func TestLookupOpenDingTalkIDsByAisearchPersonCoverage(t *testing.T) { +func TestCrossPlatformCoverageLookupOpenDingTalkIDsByAisearchPersonCoverage(t *testing.T) { caller := &helpersCoreCaller{result: textToolResult(`{"result":[{"userId":"u1","openDingTalkId":"open1","name":"Alice"}]}`)} installHelpersCoreDeps(t, caller) openIDs := map[string]string{} @@ -29,7 +29,7 @@ func TestLookupOpenDingTalkIDsByAisearchPersonCoverage(t *testing.T) { } } -func TestOpencodeWaitHealthyCoverage(t *testing.T) { +func TestCrossPlatformCoverageOpencodeWaitHealthyCoverage(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.URL.Path != opencodeServerHealthPath { t.Fatalf("health path = %q", r.URL.Path) diff --git a/internal/i18n/i18n_test.go b/internal/i18n/i18n_test.go index b5cca61d..3962107f 100644 --- a/internal/i18n/i18n_test.go +++ b/internal/i18n/i18n_test.go @@ -7,7 +7,7 @@ import ( "golang.org/x/text/language" ) -func TestLanguageSelectionAndTranslation(t *testing.T) { +func TestCrossPlatformCoverageLanguageSelectionAndTranslation(t *testing.T) { Init() SetLang(" zh_CN.UTF-8 ") if Lang() != "zh" || LangTag() != language.Chinese { @@ -57,7 +57,7 @@ func TestLanguageSelectionAndTranslation(t *testing.T) { } } -func TestLoadCatalogHandlesValidAndInvalidResources(t *testing.T) { +func TestCrossPlatformCoverageLoadCatalogHandlesValidAndInvalidResources(t *testing.T) { if catalog := loadCatalog("en"); len(catalog) == 0 { t.Fatal("loadCatalog(en) returned an empty catalog") } diff --git a/internal/ir/catalog_test.go b/internal/ir/catalog_test.go index 667feed8..cdf45446 100644 --- a/internal/ir/catalog_test.go +++ b/internal/ir/catalog_test.go @@ -2,7 +2,7 @@ package ir import "testing" -func TestCatalogLookupCoverage(t *testing.T) { +func TestCrossPlatformCoverageCatalogLookupCoverage(t *testing.T) { tool := ToolDescriptor{RPCName: "create"} product := CanonicalProduct{ID: "doc", Tools: []ToolDescriptor{tool}} catalog := Catalog{Products: []CanonicalProduct{product}} diff --git a/internal/jsonutil/json_test.go b/internal/jsonutil/json_test.go index 4bc3fbeb..61bede94 100644 --- a/internal/jsonutil/json_test.go +++ b/internal/jsonutil/json_test.go @@ -5,7 +5,7 @@ import ( "testing" ) -func TestMarshalPreservesHTMLCharacters(t *testing.T) { +func TestCrossPlatformCoverageMarshalPreservesHTMLCharacters(t *testing.T) { got, err := Marshal(map[string]string{"url": "https://example.test/?a=1&b="}) if err != nil { t.Fatalf("Marshal() error = %v", err) @@ -23,7 +23,7 @@ func TestMarshalPreservesHTMLCharacters(t *testing.T) { } } -func TestMarshalReturnsEncoderErrors(t *testing.T) { +func TestCrossPlatformCoverageMarshalReturnsEncoderErrors(t *testing.T) { unsupported := make(chan int) if _, err := Marshal(unsupported); err == nil { t.Fatal("Marshal(channel) error = nil") diff --git a/internal/keychain/coverage_edges_test.go b/internal/keychain/coverage_edges_test.go index 81e44b16..c0001374 100644 --- a/internal/keychain/coverage_edges_test.go +++ b/internal/keychain/coverage_edges_test.go @@ -16,7 +16,7 @@ import ( var errKeychainInjected = errors.New("injected keychain failure") -func TestUnavailableErrorEdges(t *testing.T) { +func TestCrossPlatformCoverageUnavailableErrorEdges(t *testing.T) { var nilErr *UnavailableError if nilErr.Error() != "" || nilErr.Unwrap() != nil { t.Fatal("nil unavailable error should be empty") @@ -38,7 +38,7 @@ func TestUnavailableErrorEdges(t *testing.T) { _ = Diagnose() } -func TestFileDEKFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageFileDEKFailureEdges(t *testing.T) { origRead := keychainReadFile origMkdir := keychainMkdirAll origWrite := keychainWriteFile @@ -113,7 +113,7 @@ func TestFileDEKFailureEdges(t *testing.T) { } } -func TestDarwinStorageAndDiagnosticEdges(t *testing.T) { +func TestCrossPlatformCoverageDarwinStorageAndDiagnosticEdges(t *testing.T) { t.Setenv(DisableKeychainEnv, "") origHome := keychainUserHomeDir origReadDefault := readDefaultKeychain @@ -192,7 +192,7 @@ func TestDarwinStorageAndDiagnosticEdges(t *testing.T) { } } -func TestDarwinDEKKeyringEdges(t *testing.T) { +func TestCrossPlatformCoverageDarwinDEKKeyringEdges(t *testing.T) { origReadDefault := readDefaultKeychain origStat := keychainStat origGet := keyringGet @@ -311,7 +311,7 @@ func waitDarwinKeychainWorkerDone(t *testing.T, done <-chan struct{}) { } } -func TestDarwinCryptoAndPlatformFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageDarwinCryptoAndPlatformFailureEdges(t *testing.T) { origRead := keychainReadFile origMkdir := keychainMkdirAll origWrite := keychainWriteFile @@ -420,7 +420,7 @@ func TestDarwinCryptoAndPlatformFailureEdges(t *testing.T) { } } -func TestMigrationEdges(t *testing.T) { +func TestCrossPlatformCoverageMigrationEdges(t *testing.T) { origMAC := migrateGetMACAddress origDecrypt := migrateDecrypt origExists := migrateExists diff --git a/internal/keychain/migrate_portable_test.go b/internal/keychain/migrate_portable_test.go index daa6a169..25839781 100644 --- a/internal/keychain/migrate_portable_test.go +++ b/internal/keychain/migrate_portable_test.go @@ -19,7 +19,7 @@ import ( "testing" ) -func TestMigrateFromLegacyPortableEdges(t *testing.T) { +func TestCrossPlatformCoverageMigrateFromLegacyPortableEdges(t *testing.T) { injectedErr := errors.New("injected migration failure") origMAC := migrateGetMACAddress origDecrypt := migrateDecrypt diff --git a/internal/keychain/remaining_coverage_test.go b/internal/keychain/remaining_coverage_test.go index 0ba1e8f5..53658528 100644 --- a/internal/keychain/remaining_coverage_test.go +++ b/internal/keychain/remaining_coverage_test.go @@ -12,7 +12,7 @@ import ( "testing" ) -func TestAuthTokenCiphertextPathFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageAuthTokenCiphertextPathFailureEdges(t *testing.T) { origReadDir, origInfo := authEntriesReadDir, authEntryInfo t.Cleanup(func() { authEntriesReadDir = origReadDir @@ -56,7 +56,7 @@ func TestAuthTokenCiphertextPathFailureEdges(t *testing.T) { } } -func TestDarwinRemainingValidationAndReadEdges(t *testing.T) { +func TestCrossPlatformCoverageDarwinRemainingValidationAndReadEdges(t *testing.T) { origRead := keychainEntryReadFile origPaths := keychainAuthTokenCiphertextPaths origGet := keyringGet @@ -123,7 +123,7 @@ func TestDarwinRemainingValidationAndReadEdges(t *testing.T) { } } -func TestDarwinFileDEKMigrationFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageDarwinFileDEKMigrationFailureEdges(t *testing.T) { origPaths := migrationAuthTokenCiphertextPaths origRead := migrationReadFile origFileDEK := migrationFileDEK diff --git a/internal/logging/coverage_edges_test.go b/internal/logging/coverage_edges_test.go index e2ad91a5..fa16019a 100644 --- a/internal/logging/coverage_edges_test.go +++ b/internal/logging/coverage_edges_test.go @@ -16,7 +16,7 @@ import ( "github.com/DingTalk-Real-AI/dingtalk-workspace-cli/pkg/config" ) -func TestLoggerFailureAndRecoveryEdges(t *testing.T) { +func TestCrossPlatformCoverageLoggerFailureAndRecoveryEdges(t *testing.T) { if (*FileLogger)(nil).Writer() != io.Discard || (&FileLogger{}).Writer() != io.Discard { t.Fatal("uninitialized Writer should discard") } @@ -110,7 +110,7 @@ func TestLoggerFailureAndRecoveryEdges(t *testing.T) { } } -func TestLoggingTransportOptionalAndNilBranches(t *testing.T) { +func TestCrossPlatformCoverageLoggingTransportOptionalAndNilBranches(t *testing.T) { LogRequest(nil, "", "", "", 0) LogRequestBody(nil, "tools/call", "", "", nil) LogResponse(nil, "", "", "", 0, 0, 0, nil) @@ -135,7 +135,7 @@ func TestLoggingTransportOptionalAndNilBranches(t *testing.T) { } } -func TestRedactionAndMultiHandlerEdges(t *testing.T) { +func TestCrossPlatformCoverageRedactionAndMultiHandlerEdges(t *testing.T) { if got := TruncateBody([]byte{0xff, 0xfe, 'a'}, 2); !strings.Contains(got, "truncated") { t.Fatalf("invalid UTF-8 truncation = %q", got) } diff --git a/internal/output/coverage_edges_test.go b/internal/output/coverage_edges_test.go index 120923a7..97c29a77 100644 --- a/internal/output/coverage_edges_test.go +++ b/internal/output/coverage_edges_test.go @@ -27,7 +27,7 @@ func (w *failNthWriter) Write(p []byte) (int, error) { return len(p), nil } -func TestOutputJSONFailureInjection(t *testing.T) { +func TestCrossPlatformCoverageOutputJSONFailureInjection(t *testing.T) { origMarshal := marshalJSON origUnmarshal := unmarshalJSON origOutput := marshalJSONOutput @@ -93,7 +93,7 @@ func TestOutputJSONFailureInjection(t *testing.T) { } } -func TestOutputFlagEdges(t *testing.T) { +func TestCrossPlatformCoverageOutputFlagEdges(t *testing.T) { if _, ok := formatFromFlagSet(nil, FormatRaw); ok { t.Fatal("nil flag set should not resolve") } @@ -149,7 +149,7 @@ func TestOutputFlagEdges(t *testing.T) { } } -func TestOutputWriterFailures(t *testing.T) { +func TestCrossPlatformCoverageOutputWriterFailures(t *testing.T) { filtered := filterSlice([]any{"scalar", map[string]any{"keep": 1}}, map[string]bool{"keep": true}) if len(filtered) != 2 || filtered[0] != "scalar" { t.Fatalf("filterSlice = %#v", filtered) @@ -192,7 +192,7 @@ func TestOutputWriterFailures(t *testing.T) { } } -func TestCSVFailureAndShapeEdges(t *testing.T) { +func TestCrossPlatformCoverageCSVFailureAndShapeEdges(t *testing.T) { origWrite := writeCSVRecord t.Cleanup(func() { writeCSVRecord = origWrite }) @@ -244,7 +244,7 @@ func TestCSVFailureAndShapeEdges(t *testing.T) { } } -func TestNDJSONFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageNDJSONFailureEdges(t *testing.T) { origEncode := encodeNDJSON t.Cleanup(func() { encodeNDJSON = origEncode }) encodeNDJSON = func(*json.Encoder, any) error { return errOutputInjected } @@ -264,7 +264,7 @@ func TestNDJSONFailureEdges(t *testing.T) { } } -func TestPrettyAndFormattingEdges(t *testing.T) { +func TestCrossPlatformCoveragePrettyAndFormattingEdges(t *testing.T) { forceNoColor(t) for _, payload := range []map[string]any{ {"kind": "schema", "degraded": true, "reason": "offline", "hint": "retry"}, @@ -342,7 +342,7 @@ func TestPrettyAndFormattingEdges(t *testing.T) { } } -func TestExtractRowsNestedMetadataCollision(t *testing.T) { +func TestCrossPlatformCoverageExtractRowsNestedMetadataCollision(t *testing.T) { payload := map[string]any{ "result": map[string]any{ "items": []any{map[string]any{"id": 1}}, diff --git a/internal/pat/coverage_edges_test.go b/internal/pat/coverage_edges_test.go index 739ff895..813da4a3 100644 --- a/internal/pat/coverage_edges_test.go +++ b/internal/pat/coverage_edges_test.go @@ -51,7 +51,7 @@ func patText(text string) *edition.ToolResult { return &edition.ToolResult{Content: []edition.ContentBlock{{Type: "text", Text: text}}} } -func TestBrowserPolicyInjectedEdges(t *testing.T) { +func TestCrossPlatformCoverageBrowserPolicyInjectedEdges(t *testing.T) { originalRead := patPolicyReadFile originalHome := patPolicyUserHomeDir originalMarshal := patPolicyMarshal @@ -138,7 +138,7 @@ func TestBrowserPolicyInjectedEdges(t *testing.T) { } } -func TestBrowserPolicyCommandWriteError(t *testing.T) { +func TestCrossPlatformCoverageBrowserPolicyCommandWriteError(t *testing.T) { t.Setenv("DWS_CONFIG_DIR", t.TempDir()) cmd := newBrowserPolicyCommand() cmd.SetOut(patFailWriter{}) @@ -151,7 +151,7 @@ func TestBrowserPolicyCommandWriteError(t *testing.T) { } } -func TestBrowserPolicyCommandSetError(t *testing.T) { +func TestCrossPlatformCoverageBrowserPolicyCommandSetError(t *testing.T) { badDir := filepath.Join(t.TempDir(), "file") if err := os.WriteFile(badDir, []byte("x"), 0o600); err != nil { t.Fatal(err) @@ -164,7 +164,7 @@ func TestBrowserPolicyCommandSetError(t *testing.T) { } } -func TestPATPureHelperEdges(t *testing.T) { +func TestCrossPlatformCoveragePATPureHelperEdges(t *testing.T) { if got := collectChmodProductCodes([]string{"", "a,a", " b "}, []string{"b", "c"}); strings.Join(got, ",") != "a,b,c" { t.Fatalf("product codes = %#v", got) } @@ -258,7 +258,7 @@ func TestPATPureHelperEdges(t *testing.T) { } } -func TestPATPlanExtractionEdges(t *testing.T) { +func TestCrossPlatformCoveragePATPlanExtractionEdges(t *testing.T) { invalidResults := []*edition.ToolResult{nil, patText(`{`), patText(`{}`)} for _, result := range invalidResults { _, _ = extractLoginRecommendProducts(result) @@ -293,7 +293,7 @@ func TestPATPlanExtractionEdges(t *testing.T) { } } -func TestPATResultAndFlagEdges(t *testing.T) { +func TestCrossPlatformCoveragePATResultAndFlagEdges(t *testing.T) { if err := handleToolResult(nil, nil, nil); err == nil { t.Fatal("nil result accepted") } @@ -365,7 +365,7 @@ func TestPATResultAndFlagEdges(t *testing.T) { } } -func TestPATAuthorizationSummaryEdges(t *testing.T) { +func TestCrossPlatformCoveragePATAuthorizationSummaryEdges(t *testing.T) { if formatPATAuthorizationSummary("not json", nil) != "" || formatPATAuthorizationSummary(`{}`, nil) != "" { t.Fatal("invalid summary payload rendered") } @@ -397,7 +397,7 @@ func TestPATAuthorizationSummaryEdges(t *testing.T) { } } -func TestLoginRecommendWrappers(t *testing.T) { +func TestCrossPlatformCoverageLoginRecommendWrappers(t *testing.T) { if err := RunLoginRecommendAuthorization(t.Context(), nil, io.Discard); err == nil { t.Fatal("nil login recommend caller accepted") } @@ -417,7 +417,7 @@ func TestLoginRecommendWrappers(t *testing.T) { } } -func TestChmodCommandRemainingBranches(t *testing.T) { +func TestCrossPlatformCoverageChmodCommandRemainingBranches(t *testing.T) { cmd := newChmodCommand(nil) if err := cmd.Args(cmd, []string{"scope"}); err != nil { t.Fatal(err) @@ -474,7 +474,7 @@ func TestChmodCommandRemainingBranches(t *testing.T) { } } -func TestLoginRecommendErrorMatrix(t *testing.T) { +func TestCrossPlatformCoverageLoginRecommendErrorMatrix(t *testing.T) { caller := &patEdgeCaller{errs: []error{errors.New("plan failed")}} if _, err := PlanLoginRecommendAuthorization(t.Context(), caller); err == nil { t.Fatal("plan wrapper error did not propagate") @@ -552,7 +552,7 @@ func TestLoginRecommendErrorMatrix(t *testing.T) { } } -func TestLegacySchemaMismatchWithoutValidationKeyword(t *testing.T) { +func TestCrossPlatformCoverageLegacySchemaMismatchWithoutValidationKeyword(t *testing.T) { canonical := map[string]any{"scopes": []string{"a"}} legacy := map[string]any{"scope": "a"} if isLegacyGrantSchemaMismatchError(errors.New("scope problem"), canonical, legacy) { diff --git a/internal/pipeline/cobra_test.go b/internal/pipeline/cobra_test.go index b83620d8..8a059776 100644 --- a/internal/pipeline/cobra_test.go +++ b/internal/pipeline/cobra_test.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/cobra" ) -func TestFlagInfoFromCommandIncludesLocalInheritedAndAnnotations(t *testing.T) { +func TestCrossPlatformCoverageFlagInfoFromCommandIncludesLocalInheritedAndAnnotations(t *testing.T) { if FlagInfoFromCommand(nil) != nil { t.Fatal("FlagInfoFromCommand(nil) != nil") } @@ -46,7 +46,7 @@ func TestFlagInfoFromCommandIncludesLocalInheritedAndAnnotations(t *testing.T) { } } -func TestRunPreParseGuardAndTraversalBranches(t *testing.T) { +func TestCrossPlatformCoverageRunPreParseGuardAndTraversalBranches(t *testing.T) { previousArgs := os.Args t.Cleanup(func() { os.Args = previousArgs }) root := &cobra.Command{Use: "root"} @@ -67,7 +67,7 @@ func TestRunPreParseGuardAndTraversalBranches(t *testing.T) { RunPreParse(root, engine) } -func TestRunPreParseAppliesCorrectionsOnlyOnSuccess(t *testing.T) { +func TestCrossPlatformCoverageRunPreParseAppliesCorrectionsOnlyOnSuccess(t *testing.T) { previousArgs := os.Args t.Cleanup(func() { os.Args = previousArgs }) diff --git a/internal/pipeline/handlers/coverage_edges_test.go b/internal/pipeline/handlers/coverage_edges_test.go index cc002113..2bb9e3b3 100644 --- a/internal/pipeline/handlers/coverage_edges_test.go +++ b/internal/pipeline/handlers/coverage_edges_test.go @@ -6,7 +6,7 @@ import ( "github.com/DingTalk-Real-AI/dingtalk-workspace-cli/internal/pipeline" ) -func TestParamValueCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageParamValueCoverageEdges(t *testing.T) { ctx := &pipeline.Context{ Params: map[string]any{"ignored": "value", "unknown": "value"}, Schema: makeSchema(map[string]any{"ignored": "not-a-schema"}), @@ -46,7 +46,7 @@ func TestParamValueCoverageEdges(t *testing.T) { } } -func TestNameAndStickyCoverageEdges(t *testing.T) { +func TestCrossPlatformCoverageNameAndStickyCoverageEdges(t *testing.T) { if _, ok := tryFuzzyMatch("--", map[string]bool{}, nil); ok { t.Fatal("bare -- should not fuzzy match") } diff --git a/internal/plugin/coverage_edges_test.go b/internal/plugin/coverage_edges_test.go index 98a3942a..c40a67fd 100644 --- a/internal/plugin/coverage_edges_test.go +++ b/internal/plugin/coverage_edges_test.go @@ -93,7 +93,7 @@ func buildFakeGit(t *testing.T) string { return binDir } -func TestPluginConverterEdges(t *testing.T) { +func TestCrossPlatformCoveragePluginConverterEdges(t *testing.T) { root := filepath.Join(t.TempDir(), "user", "sample-plugin") t.Setenv("PLUGIN_TOKEN", "secret") p := &Plugin{ @@ -154,7 +154,7 @@ func TestPluginConverterEdges(t *testing.T) { } } -func TestHookAdapterEdges(t *testing.T) { +func TestCrossPlatformCoverageHookAdapterEdges(t *testing.T) { phases := map[string]pipeline.Phase{ " PRE-PARSE ": pipeline.PreParse, "post-parse": pipeline.PostParse, @@ -202,7 +202,7 @@ func TestHookAdapterEdges(t *testing.T) { } } -func TestManifestEdges(t *testing.T) { +func TestCrossPlatformCoverageManifestEdges(t *testing.T) { dir := t.TempDir() if _, err := ParseManifest(filepath.Join(dir, "missing.json")); err == nil { t.Fatal("expected missing manifest error") @@ -297,7 +297,7 @@ func TestManifestEdges(t *testing.T) { } } -func TestLoaderDiscoveryLifecycle(t *testing.T) { +func TestCrossPlatformCoverageLoaderDiscoveryLifecycle(t *testing.T) { oldHome := pluginUserHomeDir t.Cleanup(func() { pluginUserHomeDir = oldHome }) home := t.TempDir() @@ -413,7 +413,7 @@ func configPluginDataDirForTest() string { return "data" } -func TestLoaderDevAndConfigEdges(t *testing.T) { +func TestCrossPlatformCoverageLoaderDevAndConfigEdges(t *testing.T) { root := t.TempDir() l := &Loader{PluginsDir: root, CLIVersion: "1.0.0"} if got := l.LoadDev(); got != nil { @@ -473,7 +473,7 @@ func TestLoaderDevAndConfigEdges(t *testing.T) { empty.saveSettings(nil) } -func TestLoaderInstallBuildAndGit(t *testing.T) { +func TestCrossPlatformCoverageLoaderInstallBuildAndGit(t *testing.T) { root := t.TempDir() l := &Loader{PluginsDir: root, CLIVersion: "1.0.0"} if _, err := l.InstallFromDir(filepath.Join(t.TempDir(), "missing")); err == nil { @@ -604,7 +604,7 @@ func TestLoaderInstallBuildAndGit(t *testing.T) { } } -func TestLoaderSystemCallEdges(t *testing.T) { +func TestCrossPlatformCoverageLoaderSystemCallEdges(t *testing.T) { oldReadDir := pluginReadDir oldMkdirTemp := pluginMkdirTemp oldRemoveAll := pluginRemoveAll @@ -699,7 +699,7 @@ func TestLoaderSystemCallEdges(t *testing.T) { pluginMkdirTemp = oldMkdirTemp } -func TestInstallFromGitValidationAndBuildEdges(t *testing.T) { +func TestCrossPlatformCoverageInstallFromGitValidationAndBuildEdges(t *testing.T) { oldCopyDir := pluginCopyDir oldRunBuild := pluginRunBuild t.Cleanup(func() { @@ -730,7 +730,7 @@ func TestInstallFromGitValidationAndBuildEdges(t *testing.T) { } } -func TestParseGitURLEdges(t *testing.T) { +func TestCrossPlatformCoverageParseGitURLEdges(t *testing.T) { for _, raw := range []string{"/tmp/x", "./x", "git@host", "git@host:single", "ftp://host/org/repo", "://bad"} { if _, _, err := parseGitURL(raw); err == nil { t.Errorf("parseGitURL(%q) unexpectedly succeeded", raw) @@ -741,7 +741,7 @@ func TestParseGitURLEdges(t *testing.T) { } } -func TestSyncSkillsEdges(t *testing.T) { +func TestCrossPlatformCoverageSyncSkillsEdges(t *testing.T) { oldHome := pluginUserHomeDir t.Cleanup(func() { pluginUserHomeDir = oldHome }) SyncSkills(nil) @@ -780,7 +780,7 @@ func TestSyncSkillsEdges(t *testing.T) { } } -func TestCopyAndStaleEdges(t *testing.T) { +func TestCrossPlatformCoverageCopyAndStaleEdges(t *testing.T) { src := t.TempDir() dst := t.TempDir() if err := os.MkdirAll(filepath.Join(src, "nested"), 0o750); err != nil { @@ -832,7 +832,7 @@ func TestCopyAndStaleEdges(t *testing.T) { removeStaleFiles(filepath.Join(src, "missing"), filepath.Join(dst, "missing")) } -func TestCopyAndStaleSystemCallEdges(t *testing.T) { +func TestCrossPlatformCoverageCopyAndStaleSystemCallEdges(t *testing.T) { oldMkdirAll := pluginMkdirAll oldReadFile := pluginReadFile oldWriteFile := pluginWriteFile @@ -929,7 +929,7 @@ func TestCopyAndStaleSystemCallEdges(t *testing.T) { removeStaleFiles(src, staleDst) } -func TestCopyAndStaleSystemCallEdgesDuplicate(t *testing.T) { +func TestCrossPlatformCoverageCopyAndStaleSystemCallEdgesDuplicate(t *testing.T) { oldMkdirAll := pluginMkdirAll oldReadFile := pluginReadFile oldWriteFile := pluginWriteFile diff --git a/internal/recovery/coverage_edges_test.go b/internal/recovery/coverage_edges_test.go index b61ce482..fcf6b6b2 100644 --- a/internal/recovery/coverage_edges_test.go +++ b/internal/recovery/coverage_edges_test.go @@ -14,7 +14,7 @@ import ( "github.com/DingTalk-Real-AI/dingtalk-workspace-cli/internal/transport" ) -func TestRecoveryModelEdges(t *testing.T) { +func TestCrossPlatformCoverageRecoveryModelEdges(t *testing.T) { typedCases := []struct { name string err error @@ -146,7 +146,7 @@ func TestRecoveryModelEdges(t *testing.T) { } } -func TestPlannerRuleAndSearchEdges(t *testing.T) { +func TestCrossPlatformCoveragePlannerRuleAndSearchEdges(t *testing.T) { rules := []struct { name string rc RecoveryContext @@ -286,7 +286,7 @@ func (f fakeRecoveryInvoker) CallToolDirect(context.Context, string, string, map return f.result, f.err } -func TestExecutorAndProbeEdges(t *testing.T) { +func TestCrossPlatformCoverageExecutorAndProbeEdges(t *testing.T) { last := LastError{ EventID: "evt-1", Context: RecoveryContext{ @@ -408,7 +408,7 @@ func TestExecutorAndProbeEdges(t *testing.T) { } } -func TestStoreRuntimeAndPruningEdges(t *testing.T) { +func TestCrossPlatformCoverageStoreRuntimeAndPruningEdges(t *testing.T) { ResetRuntimeState() if LatestCapture() != nil { t.Fatal("latest capture should start nil") @@ -578,7 +578,7 @@ func TestStoreRuntimeAndPruningEdges(t *testing.T) { } } -func TestStoreMarshalErrors(t *testing.T) { +func TestCrossPlatformCoverageStoreMarshalErrors(t *testing.T) { store := NewStore(t.TempDir()) if err := store.writeJSON(filepath.Join(store.dir(), "bad.json"), map[string]any{"bad": func() {}}); err == nil { t.Fatal("expected writeJSON marshal error") @@ -594,7 +594,7 @@ func TestStoreMarshalErrors(t *testing.T) { } } -func TestLoadErrorByEventFallback(t *testing.T) { +func TestCrossPlatformCoverageLoadErrorByEventFallback(t *testing.T) { store := NewStore(t.TempDir()) last := LastError{EventID: "fallback", RecordedAt: time.Now().UTC().Format(time.RFC3339Nano)} data, err := json.Marshal(last) @@ -627,7 +627,7 @@ func TestLoadErrorByEventFallback(t *testing.T) { } } -func TestStoreSystemCallEdges(t *testing.T) { +func TestCrossPlatformCoverageStoreSystemCallEdges(t *testing.T) { oldReadFile := recoveryReadFile oldWriteFile := recoveryWriteFile oldOpen := recoveryOpen diff --git a/internal/registry/embed_test.go b/internal/registry/embed_test.go index 7f0d7c98..6e36736a 100644 --- a/internal/registry/embed_test.go +++ b/internal/registry/embed_test.go @@ -5,7 +5,7 @@ import ( "testing" ) -func TestEmbeddedRegistryDataReturnsDefensiveCopies(t *testing.T) { +func TestCrossPlatformCoverageEmbeddedRegistryDataReturnsDefensiveCopies(t *testing.T) { personas := PersonasYAML() recipes := RecipesYAML() if len(personas) == 0 || len(recipes) == 0 { diff --git a/internal/safety/content_scan_test.go b/internal/safety/content_scan_test.go index 31830d16..ef92e589 100644 --- a/internal/safety/content_scan_test.go +++ b/internal/safety/content_scan_test.go @@ -18,7 +18,7 @@ import ( "testing" ) -func TestContentScannerDetectsNestedPatterns(t *testing.T) { +func TestCrossPlatformCoverageContentScannerDetectsNestedPatterns(t *testing.T) { t.Parallel() payload := map[string]any{ @@ -42,7 +42,7 @@ func TestContentScannerDetectsNestedPatterns(t *testing.T) { } } -func TestContentScannerIgnoresBenignPayload(t *testing.T) { +func TestCrossPlatformCoverageContentScannerIgnoresBenignPayload(t *testing.T) { t.Parallel() payload := map[string]any{ @@ -60,7 +60,7 @@ func TestContentScannerIgnoresBenignPayload(t *testing.T) { } } -func TestContentScannerCapsFindings(t *testing.T) { +func TestCrossPlatformCoverageContentScannerCapsFindings(t *testing.T) { t.Parallel() items := make([]any, 0, 30) @@ -74,7 +74,7 @@ func TestContentScannerCapsFindings(t *testing.T) { } } -func TestContentScannerNilReceiverDoesNotScan(t *testing.T) { +func TestCrossPlatformCoverageContentScannerNilReceiverDoesNotScan(t *testing.T) { t.Parallel() var scanner *ContentScanner @@ -87,7 +87,7 @@ func TestContentScannerNilReceiverDoesNotScan(t *testing.T) { } } -func TestSanitizeSnippetNormalizesWhitespaceAndLength(t *testing.T) { +func TestCrossPlatformCoverageSanitizeSnippetNormalizesWhitespaceAndLength(t *testing.T) { t.Parallel() value := sanitizeSnippet("line1\r\nline2\t line3\n" + strings.Repeat("a", 200)) @@ -102,7 +102,7 @@ func TestSanitizeSnippetNormalizesWhitespaceAndLength(t *testing.T) { } } -func TestContentScannerInternalNilAndEmptyGuards(t *testing.T) { +func TestCrossPlatformCoverageContentScannerInternalNilAndEmptyGuards(t *testing.T) { t.Parallel() var scanner *ContentScanner findings := []Finding{} diff --git a/internal/security/coverage_edges_test.go b/internal/security/coverage_edges_test.go index 895d710e..87b7c89f 100644 --- a/internal/security/coverage_edges_test.go +++ b/internal/security/coverage_edges_test.go @@ -14,7 +14,7 @@ type alwaysErrorReader struct{ err error } func (r alwaysErrorReader) Read([]byte) (int, error) { return 0, r.err } -func TestEncryptRandomSourceErrors(t *testing.T) { +func TestCrossPlatformCoverageEncryptRandomSourceErrors(t *testing.T) { old := cryptoRandReader t.Cleanup(func() { cryptoRandReader = old }) wantErr := errors.New("entropy unavailable") @@ -28,7 +28,7 @@ func TestEncryptRandomSourceErrors(t *testing.T) { } } -func TestGetMACAddressEnumerationError(t *testing.T) { +func TestCrossPlatformCoverageGetMACAddressEnumerationError(t *testing.T) { old := networkInterfaces t.Cleanup(func() { networkInterfaces = old }) wantErr := errors.New("enumeration failed") @@ -53,7 +53,7 @@ func (f *scriptedTokenTempFile) Write(p []byte) (int, error) { func (f *scriptedTokenTempFile) Sync() error { return f.syncErr } func (f *scriptedTokenTempFile) Close() error { return f.closeErr } -func TestSecureTokenStorageFailureBoundaries(t *testing.T) { +func TestCrossPlatformCoverageSecureTokenStorageFailureBoundaries(t *testing.T) { oldMkdir, oldMarshal, oldEncrypt := mkdirTokenDir, marshalTokenData, encryptTokenData oldOpen, oldRemove, oldRename := openTokenTempFile, removeTokenFile, renameTokenFile oldRead, oldDecrypt, oldUnmarshal := readTokenFile, decryptTokenData, unmarshalTokenData diff --git a/internal/syncdata/syncdata_test.go b/internal/syncdata/syncdata_test.go index f65c9168..910898a0 100644 --- a/internal/syncdata/syncdata_test.go +++ b/internal/syncdata/syncdata_test.go @@ -2,7 +2,7 @@ package syncdata import "testing" -func TestGeneratedSyncDataIsSelfConsistent(t *testing.T) { +func TestCrossPlatformCoverageGeneratedSyncDataIsSelfConsistent(t *testing.T) { servers := StaticServers() routes := CmdToProduct() if len(servers) == 0 || len(routes) == 0 { diff --git a/internal/transport/coverage_edges_test.go b/internal/transport/coverage_edges_test.go index aca88868..40a0ccd1 100644 --- a/internal/transport/coverage_edges_test.go +++ b/internal/transport/coverage_edges_test.go @@ -64,7 +64,7 @@ func edgeClient(fn roundTripFunc) *Client { return c } -func TestCallErrorAndRedirectEdges(t *testing.T) { +func TestCrossPlatformCoverageCallErrorAndRedirectEdges(t *testing.T) { httpClient := &http.Client{} if got := NewClient(httpClient); got.HTTPClient.Transport == nil || got.HTTPClient.CheckRedirect == nil { t.Fatalf("NewClient did not fill HTTP defaults: %#v", got.HTTPClient) @@ -129,7 +129,7 @@ func TestCallErrorAndRedirectEdges(t *testing.T) { } } -func TestToolCallResultUnmarshalEdges(t *testing.T) { +func TestCrossPlatformCoverageToolCallResultUnmarshalEdges(t *testing.T) { for _, raw := range []string{"[]", `{"content":42}`} { var result ToolCallResult if err := json.Unmarshal([]byte(raw), &result); err == nil { @@ -157,7 +157,7 @@ func TestToolCallResultUnmarshalEdges(t *testing.T) { } } -func TestClientProtocolAndValidationEdges(t *testing.T) { +func TestCrossPlatformCoverageClientProtocolAndValidationEdges(t *testing.T) { original := supportedProtocolVersions supportedProtocolVersions = nil if _, err := edgeClient(func(*http.Request) (*http.Response, error) { return edgeResponse(http.StatusOK, "{}"), nil }).Initialize(context.Background(), "https://x.test"); err == nil { @@ -201,7 +201,7 @@ func TestClientProtocolAndValidationEdges(t *testing.T) { } } -func TestCallJSONRPCEdges(t *testing.T) { +func TestCrossPlatformCoverageCallJSONRPCEdges(t *testing.T) { c := edgeClient(func(*http.Request) (*http.Response, error) { return edgeResponse(http.StatusOK, "{}"), nil }) if err := c.callJSONRPC(context.Background(), "https://x.test", requestEnvelope{Method: "x", Params: func() {}}, true, nil); err == nil { t.Fatal("unencodable request succeeded") @@ -239,7 +239,7 @@ func TestCallJSONRPCEdges(t *testing.T) { } } -func TestRetryAndFailureEdges(t *testing.T) { +func TestCrossPlatformCoverageRetryAndFailureEdges(t *testing.T) { if _, err := edgeClient(func(*http.Request) (*http.Response, error) { return nil, nil }).doWithRetry(context.Background(), "://", nil, ""); err == nil { t.Fatal("invalid endpoint succeeded") } @@ -300,7 +300,7 @@ func TestRetryAndFailureEdges(t *testing.T) { } } -func TestRetryHelperAndTrustEdges(t *testing.T) { +func TestCrossPlatformCoverageRetryHelperAndTrustEdges(t *testing.T) { for _, err := range []error{nil, context.DeadlineExceeded, context.Canceled, os.ErrDeadlineExceeded, errors.New("Client.Timeout exceeded"), errors.New("TLS handshake timeout"), errors.New("other")} { _ = isTimeoutError(err) _, _ = classifyRequestFailure(err) @@ -383,7 +383,7 @@ func TestRetryHelperAndTrustEdges(t *testing.T) { } } -func TestHTTPStatusAndDiagnosticsEdges(t *testing.T) { +func TestCrossPlatformCoverageHTTPStatusAndDiagnosticsEdges(t *testing.T) { for _, tc := range []struct { method string code int @@ -425,7 +425,7 @@ func TestHTTPStatusAndDiagnosticsEdges(t *testing.T) { } } -func TestStdioCallAndStartEdges(t *testing.T) { +func TestCrossPlatformCoverageStdioCallAndStartEdges(t *testing.T) { makeClient := func(response string) (*StdioClient, *edgeWriteCloser) { stdin := &edgeWriteCloser{} return &StdioClient{started: true, stdin: stdin, stdout: bufio.NewReader(strings.NewReader(response))}, stdin @@ -521,7 +521,7 @@ func TestStdioCallAndStartEdges(t *testing.T) { stderr.drainStderr() } -func TestDiagnosticsRecursiveArraysAndStdioInitializationCoverage(t *testing.T) { +func TestCrossPlatformCoverageDiagnosticsRecursiveArraysAndStdioInitializationCoverage(t *testing.T) { content := map[string]any{ "errorCode": "ERROR", "content": []any{ @@ -552,7 +552,7 @@ func TestDiagnosticsRecursiveArraysAndStdioInitializationCoverage(t *testing.T) } } -func TestEnsureInitializedReturnsStartError(t *testing.T) { +func TestCrossPlatformCoverageEnsureInitializedReturnsStartError(t *testing.T) { client := NewStdioClient(filepath.Join(t.TempDir(), "missing"), nil, nil) if err := client.EnsureInitialized(context.Background()); err == nil { t.Fatal("EnsureInitialized() error = nil") diff --git a/internal/tui/coverage_edges_test.go b/internal/tui/coverage_edges_test.go index bedd501f..01287478 100644 --- a/internal/tui/coverage_edges_test.go +++ b/internal/tui/coverage_edges_test.go @@ -7,7 +7,7 @@ import ( "testing" ) -func TestThemePresentationHelpers(t *testing.T) { +func TestCrossPlatformCoverageThemePresentationHelpers(t *testing.T) { for name, render := range map[string]func(string) string{ "brand": Brand, "blue": Blue, "cyan": Cyan, "white": White, "gray": Gray, "success": Success, "warning": Warning, "danger": Danger, "bold": Bold, "dim": Dim, @@ -50,7 +50,7 @@ func TestThemePresentationHelpers(t *testing.T) { } } -func TestPanelSuccessAndWriteFailures(t *testing.T) { +func TestCrossPlatformCoveragePanelSuccessAndWriteFailures(t *testing.T) { var out bytes.Buffer if err := Panel(&out, "Title", []string{"line", strings.Repeat("wide", MaxPanelWidth)}); err != nil { t.Fatalf("Panel(): %v", err) diff --git a/internal/upgrade/coverage_edges_test.go b/internal/upgrade/coverage_edges_test.go index ff5073fb..9333e95e 100644 --- a/internal/upgrade/coverage_edges_test.go +++ b/internal/upgrade/coverage_edges_test.go @@ -29,7 +29,7 @@ type upgradeFailWriter struct{} func (upgradeFailWriter) Write([]byte) (int, error) { return 0, errors.New("write failed") } -func TestDownloaderEdgeCases(t *testing.T) { +func TestCrossPlatformCoverageDownloaderEdgeCases(t *testing.T) { badParent := filepath.Join(t.TempDir(), "file") if err := os.WriteFile(badParent, []byte("x"), 0o600); err != nil { t.Fatal(err) @@ -117,7 +117,7 @@ func TestDownloaderEdgeCases(t *testing.T) { } } -func TestGitHubClientEdgeCases(t *testing.T) { +func TestCrossPlatformCoverageGitHubClientEdgeCases(t *testing.T) { t.Setenv("DWS_UPGRADE_URL", "http://mirror.test/") t.Setenv("DWS_UPGRADE_REPOSITORY", "owner/repo") client := NewClient() @@ -204,7 +204,7 @@ func TestGitHubClientEdgeCases(t *testing.T) { } } -func TestGitHubGetJSONMatrix(t *testing.T) { +func TestCrossPlatformCoverageGitHubGetJSONMatrix(t *testing.T) { client := NewClientWithBaseURL("") if err := client.getJSON(":", &map[string]any{}); err == nil { t.Fatal("invalid request URL accepted") @@ -237,7 +237,7 @@ func TestGitHubGetJSONMatrix(t *testing.T) { } } -func TestUpgradePathsAndSkillsEdges(t *testing.T) { +func TestCrossPlatformCoverageUpgradePathsAndSkillsEdges(t *testing.T) { originalHome := upgradeUserHomeDir originalDirs := append([]string(nil), knownSkillDirs...) t.Cleanup(func() { @@ -298,7 +298,7 @@ func TestUpgradePathsAndSkillsEdges(t *testing.T) { } } -func TestExecutablePathEdges(t *testing.T) { +func TestCrossPlatformCoverageExecutablePathEdges(t *testing.T) { originalExecutable := upgradeExecutable originalEval := upgradeEvalSymlinks t.Cleanup(func() { @@ -317,7 +317,7 @@ func TestExecutablePathEdges(t *testing.T) { } } -func TestReplacerAndZipEdges(t *testing.T) { +func TestCrossPlatformCoverageReplacerAndZipEdges(t *testing.T) { originalExecutable := upgradeExecutable originalEval := upgradeEvalSymlinks originalRename := upgradeRename @@ -431,7 +431,7 @@ func TestReplacerAndZipEdges(t *testing.T) { syncParentDir("/definitely/missing/file") } -func TestRollbackLifecycleEdges(t *testing.T) { +func TestCrossPlatformCoverageRollbackLifecycleEdges(t *testing.T) { originalExecutable := upgradeExecutable originalEval := upgradeEvalSymlinks originalHome := upgradeUserHomeDir @@ -501,7 +501,7 @@ func TestRollbackLifecycleEdges(t *testing.T) { syncFileData("/missing/file") } -func TestVersionPrereleaseEdges(t *testing.T) { +func TestCrossPlatformCoverageVersionPrereleaseEdges(t *testing.T) { cases := []struct { a, b string want int @@ -522,7 +522,7 @@ func TestVersionPrereleaseEdges(t *testing.T) { } } -func TestDownloaderRetryControlEdges(t *testing.T) { +func TestCrossPlatformCoverageDownloaderRetryControlEdges(t *testing.T) { originalAfter := downloadAfter t.Cleanup(func() { downloadAfter = originalAfter }) @@ -556,7 +556,7 @@ func TestDownloaderRetryControlEdges(t *testing.T) { } } -func TestGitHubFetchReleasesError(t *testing.T) { +func TestCrossPlatformCoverageGitHubFetchReleasesError(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { http.Error(w, "failure", http.StatusInternalServerError) })) @@ -566,7 +566,7 @@ func TestGitHubFetchReleasesError(t *testing.T) { } } -func TestUpgradePathInjectedFailures(t *testing.T) { +func TestCrossPlatformCoverageUpgradePathInjectedFailures(t *testing.T) { originalHome := upgradeUserHomeDir originalDirs := append([]string(nil), knownSkillDirs...) originalCopy := upgradeCopyDir @@ -603,7 +603,7 @@ func TestUpgradePathInjectedFailures(t *testing.T) { } } -func TestReplacerInjectedIOEdges(t *testing.T) { +func TestCrossPlatformCoverageReplacerInjectedIOEdges(t *testing.T) { originalExecutable := upgradeExecutable originalEval := upgradeEvalSymlinks originalRename := upgradeRename @@ -726,7 +726,7 @@ func TestReplacerInjectedIOEdges(t *testing.T) { } } -func TestRollbackInjectedFailures(t *testing.T) { +func TestCrossPlatformCoverageRollbackInjectedFailures(t *testing.T) { originalExecutable := upgradeExecutable originalEval := upgradeEvalSymlinks originalStat := rollbackStat @@ -829,7 +829,7 @@ func TestRollbackInjectedFailures(t *testing.T) { } } -func TestCopyDirAndVerifyErrors(t *testing.T) { +func TestCrossPlatformCoverageCopyDirAndVerifyErrors(t *testing.T) { if err := copyDir("missing", t.TempDir()); err == nil { t.Fatal("missing source directory accepted") } @@ -857,7 +857,7 @@ func TestCopyDirAndVerifyErrors(t *testing.T) { } } -func TestCopyDirAndBackupEntryInjectedEdges(t *testing.T) { +func TestCrossPlatformCoverageCopyDirAndBackupEntryInjectedEdges(t *testing.T) { originalRollbackInfo := rollbackEntryInfo originalStat := upgradeDirStat originalMkdir := upgradeDirMkdirAll diff --git a/internal/upgrade/replacer_permissions_unix_test.go b/internal/upgrade/replacer_permissions_unix_test.go index caeb87f6..dd614359 100644 --- a/internal/upgrade/replacer_permissions_unix_test.go +++ b/internal/upgrade/replacer_permissions_unix_test.go @@ -11,7 +11,7 @@ import ( "testing" ) -func TestCopyFileExecutablePermissions(t *testing.T) { +func TestCrossPlatformCoverageCopyFileExecutablePermissions(t *testing.T) { dir := t.TempDir() src := filepath.Join(dir, "src") dst := filepath.Join(dir, "dst")