gatecontext

package
v1.55.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package gatecontext owns the authoritative classification of callers that are executing inside an active no-slop validation step.

Index

Constants

View Source
const ErrorCode = "nested_gate_context"

Variables

This section is empty.

Functions

func MarkerPresent

func MarkerPresent() bool

MarkerPresent reports the coarse diagnostic marker emitted by adapters. Classification never rejects on this signal alone.

func RefusalMessage

func RefusalMessage(result Result) string

RefusalMessage is the stable, privacy-safe error contract used at daemon ingress and non-AXI command boundaries.

Types

type Inspector

type Inspector struct {
	DB        *db.DB
	Paths     *paths.Paths
	ParentPID func(int) (int, error)
}

Inspector combines canonical managed Git identity with authenticated IPC peer ancestry. ParentPID exists for deterministic tests; production callers leave it nil to use the platform process table.

func (Inspector) Inspect

func (i Inspector) Inspect(ctx context.Context, req Request) (Result, error)

Inspect classifies a caller without mutating repositories, runs, refs, remotes, worktrees, or the database.

type Request

type Request struct {
	CWD            string
	PeerPID        int
	DaemonPID      int
	MarkerPresent  bool
	SkipManagedGit bool
}

Request contains the independently observable signals for one caller. MarkerPresent is diagnostic only. SkipManagedGit is reserved for managed Git hooks, whose cwd is necessarily the gate itself and therefore cannot identify the process that initiated the push.

type Result

type Result struct {
	Nested           bool
	ManagedGit       bool
	AgentDescendant  bool
	DaemonDescendant bool
	MarkerPresent    bool
	RunID            string
	Phase            types.StepName
}

Result is safe to render to an agent. It intentionally carries no paths or process details.

Jump to

Keyboard shortcuts

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