passcheck

package
v0.0.0-...-40cbffd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package passcheck provides functionality for checking and displaying pass/fail results for distributions.

Package passcheck exposes the passcheck flow to the app layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfigLoadError

func NewConfigLoadError(distributionName string, cause error) error

NewConfigLoadError creates an error for config loading failures.

func NewCredentialsResolveError

func NewCredentialsResolveError(targetName string, cause error) error

NewCredentialsResolveError creates an error for credential resolution failures.

func NewDistributionDetectionError

func NewDistributionDetectionError(cause error) error

NewDistributionDetectionError creates an error for distribution detection failures.

func NewDistributionNotFoundError

func NewDistributionNotFoundError(distributionName string) error

NewDistributionNotFoundError creates an error for missing distribution.

func NewEvaluationPipelineNotEnabledError

func NewEvaluationPipelineNotEnabledError(distributionName string) error

NewEvaluationPipelineNotEnabledError creates an error when the evaluation pipeline is not enabled.

func NewEvaluationPipelineValidationError

func NewEvaluationPipelineValidationError(distributionName string, cause error) error

NewEvaluationPipelineValidationError creates an error for evaluation pipeline validation failures.

func NewOptionsNilError

func NewOptionsNilError() error

NewOptionsNilError creates an error for nil options.

func NewOutputPathError

func NewOutputPathError(path string, cause error) error

NewOutputPathError creates an error for invalid output path.

func NewRemotesLoadError

func NewRemotesLoadError(distributionName string, cause error) error

NewRemotesLoadError creates an error for remotes loading failures.

func NewReportGenerationError

func NewReportGenerationError(cause error) error

NewReportGenerationError creates an error for report generation failures.

func NewTestResultsFetchError

func NewTestResultsFetchError(repository string, cause error) error

NewTestResultsFetchError creates an error for test results fetching failures.

func NewTestResultsParseError

func NewTestResultsParseError(repository string, cause error) error

NewTestResultsParseError creates an error for test results parsing failures.

func NewWorkingDirectoryError

func NewWorkingDirectoryError(cause error) error

NewWorkingDirectoryError creates an error for working directory failures.

Types

type CategoryStats

type CategoryStats struct {
	CategoryName           string
	TotalTests             int
	PassedTests            int
	FailedTests            int
	StudentsWithCategory   int
	StudentsPassedCategory int
}

CategoryStats represents statistics for a specific test category

type CommandHandler

type CommandHandler struct {
	SecurityService   security.Service
	RepositoryService repositories.RepositoryService
	// contains filtered or unexported fields
}

CommandHandler manages the passcheck command

func NewCommandHandler

func NewCommandHandler(options *CommandHandlerOptions, deps ...*Deps) (*CommandHandler, error)

NewCommandHandler creates a new passcheck handler. Tests can inject mocked dependencies via the optional deps parameter. In production, call with only options (no deps) to use real implementations.

func (*CommandHandler) Cleanup

func (h *CommandHandler) Cleanup() error

Cleanup performs cleanup tasks

func (*CommandHandler) Execute

func (h *CommandHandler) Execute(ctx context.Context) error

Execute runs the main passcheck logic

func (*CommandHandler) Setup

func (h *CommandHandler) Setup(ctx context.Context) error

Setup initializes the handler

type CommandHandlerOptions

type CommandHandlerOptions struct {
	DistributionName string
	Args             []string
	DetailMode       bool
	GenerateReport   bool
	OutputPath       string
	Token            string
	BaseURL          string
	ReportFormats    []string // e.g., ["excel","csv","html","md"]; empty => all
	ForceProgress    bool
}

CommandHandlerOptions contains the parameters for the passcheck command

type Config

type Config struct {
	TestsToIgnore      []string `json:"tests_to_ignore"`
	CategoriesToIgnore []string `json:"categories_to_ignore"`
	OutputPath         string   `json:"output_path"`
}

Config represents the configuration for pass checking

type Deps

type Deps struct {
	GetProjectRoot           func() (string, error)
	GetDivekitHome           func() (string, error)
	SelectDistribution       func(ctx context.Context, workingDir string, distributionName string) (string, error)
	ResolveTargetCredentials func(originCfg *config.OriginConfig, token string, baseURL string, divekitHome string, targetName string) (string, string, error)
	ResolveMembersPath       func(path string, divekitHome string) (string, error)
	NewGitLabProvider        func(baseURL, token string) (dataprovider.ContentManager, error)

	// Utilities
	SleepWithContext func(ctx context.Context, d time.Duration) error
	Now              func() time.Time

	// Filesystem helpers
	ReadFile func(path string) ([]byte, error)
	ReadDir  func(path string) ([]os.DirEntry, error)
	MkdirAll func(path string, perm os.FileMode) error
	Create   func(path string) (io.WriteCloser, error)

	GetTerminalWidth func() int
}

Deps bundles injectable dependencies for testability

type Error

Error is a type alias for the generic CommandError.

func NewError

func NewError(errorType ErrorType, message string, err error) *Error

NewError creates a new Error (kept for backward compatibility).

type ErrorType

type ErrorType int

ErrorType defines domain-based error categories for the passcheck package.

const (
	// ErrValidation indicates validation errors.
	ErrValidation ErrorType = iota
	// ErrConfig indicates configuration errors.
	ErrConfig
	// ErrProcess indicates processing errors.
	ErrProcess
	// ErrResource indicates missing resources.
	ErrResource
)

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler orchestrates passcheck execution.

func NewHandler

func NewHandler(opts *HandlerOptions) *Handler

NewHandler constructs a passcheck handler with default dependencies.

func (*Handler) Execute

func (h *Handler) Execute(ctx context.Context, req Request) (Result, error)

Execute validates and runs passcheck.

type HandlerOptions

type HandlerOptions struct {
	NewInternalHandler newInternalHandlerFunc
}

HandlerOptions configures how the passcheck handler creates its internal command handler.

type Request

type Request struct {
	DistributionName string
	Args             []string
	DetailMode       bool
	GenerateReport   bool
	ReportFormats    []string
	OutputPath       string
	Token            string
	BaseURL          string
	ForceProgress    bool
}

Request contains the input for a passcheck run.

type Result

type Result struct{}

Result is returned after passcheck completed successfully.

type StudentTestResults

type StudentTestResults struct {
	UUID           string
	Students       []string
	TestRepository string
	Results        []TestResult
	PassedCount    int
	FailedCount    int
	TotalCount     int
	HasStarted     bool
	HasPassed      bool
}

StudentTestResults represents test results for a single student

type Summary

type Summary struct {
	TotalStudents      int
	PassedStudents     int
	FailedStudents     int
	StartedStudents    int
	NotStartedStudents int
	StudentResults     []StudentTestResults
	CategorySummary    map[string]*CategoryStats
	TestSummary        map[string]*TestStats
}

Summary represents the overall summary

type TestResult

type TestResult struct {
	Name      string `json:"name"`
	Category  string `json:"category"`
	Status    string `json:"status"`
	IssueType string `json:"-"`
}

TestResult represents a single test result

type TestStats

type TestStats struct {
	Name     string
	Category string
	Passed   int
	Failed   int
	Total    int
}

TestStats represents aggregated statistics for a single test across all students

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL