Documentation
¶
Overview ¶
Package configwarn is where the platform reports a configuration warning (#1898). A warning is a log line and a count: config_validation_warnings_total under a bounded code, so a fleet sees a misconfiguration as a series and not only as a line somebody has to read. It also holds the checks the platform runs over its personas, connections and agent instructions at boot, and again for a persona written through the admin API.
Some warnings are raised while the configuration file is read, before the observability layer exists. Those are counted here and handed to the recorder when Flush runs, so a boot warning is never lost to ordering.
Index ¶
- Constants
- func CheckPendingMigrations(ctx context.Context, db *sql.DB)
- func CheckPersona(ctx context.Context, p *persona.Persona, registered, toolkitTools []string)
- func CheckS3Reach(ctx context.Context, reg *registry.Registry, personas *persona.Registry)
- func CheckStartup(ctx context.Context, s Startup)
- func Flush(ctx context.Context)
- func Warn(ctx context.Context, code, msg string, args ...any)
- type Connection
- type Startup
Constants ¶
const ( // CodePersonaToolUnregistered: a persona's tools.allow names, without a // wildcard, a tool this deployment does not register. CodePersonaToolUnregistered = "persona_tool_unregistered" // CodePersonaIncoherent: a persona grants a capability it cannot complete. CodePersonaIncoherent = "persona_incoherent" // CodeAgentInstructionsUnknownTool: the agent instructions name a tool // this deployment does not register. CodeAgentInstructionsUnknownTool = "agent_instructions_unknown_tool" // CodeUnusedConnection: no persona's connection rules admit a connection. CodeUnusedConnection = "unused_connection" // CodeUnrecognizedKeys: the configuration file carries keys the platform // ignores. CodeUnrecognizedKeys = "unrecognized_keys" // CodeDeprecatedAPIVersion: the configuration names a deprecated apiVersion. CodeDeprecatedAPIVersion = "deprecated_api_version" // CodeDeprecatedKey: the configuration uses a renamed key. CodeDeprecatedKey = "deprecated_key" // CodePlaceholderUnexpanded: a ${...} placeholder named an unset variable. CodePlaceholderUnexpanded = "placeholder_unexpanded" // CodeEphemeralOAuthKey: the OAuth server signs with a per-process key. CodeEphemeralOAuthKey = "ephemeral_oauth_signing_key" // CodePortalNoObjectStorage: the portal has no object storage. CodePortalNoObjectStorage = "portal_no_object_storage" // CodeResourcesNoObjectStorage: managed resources have no object storage. CodeResourcesNoObjectStorage = "resources_no_object_storage" // CodeMemoryNoEmbedding: memory runs without an embedding provider. CodeMemoryNoEmbedding = "memory_no_embedding" // CodeExcludePersonaUnknown: calls.exclude_personas names no persona. CodeExcludePersonaUnknown = "exclude_persona_unknown" // CodeDeploymentIDUnset: an OTLP exporter is on with no deployment id. CodeDeploymentIDUnset = "deployment_id_unset" // CodeLoginRedirectIgnored: portal.login_redirect is set without OIDC // browser sign-in to redirect to. CodeLoginRedirectIgnored = "login_redirect_ignored" // CodeDestinationOutsidePrefix: a script destination names a bucket // outside its S3 connection's bucket_prefix, so every delivery to it is // refused (#2584). CodeDestinationOutsidePrefix = "script_destination_outside_prefix" // CodeSiteReservedLabel: a site's name is two characters, so each of its // <site>--<env> addresses is a label certificate authorities refuse // (#2611). CodeSiteReservedLabel = "site_reserved_label" // CodeSiteEnvironmentRenamed: migration 000239 is about to rename a // site's environment named dev, which has a domain, and give the name to // the site's working copy (#2608). CodeSiteEnvironmentRenamed = "site_environment_renamed" // CodeS3ReachesPlatformBucket: the credentials of an S3 connection a // persona may read buckets through list one of the platform's own // buckets. The S3 tools refuse it; the credentials still reach it (#2616). CodeS3ReachesPlatformBucket = "s3_connection_reaches_platform_bucket" // CodeS3ReachesBackupBucket: the credentials of an S3 connection a persona // may read buckets through list a bucket named for backups (#2616). CodeS3ReachesBackupBucket = "s3_connection_reaches_backup_bucket" // CodeSitePublicWithoutDomain: migration 000245 is about to make a public // site environment with no domain answer only to someone signed in // (#2619). CodeSitePublicWithoutDomain = "site_public_without_domain" )
The warning codes config_validation_warnings_total records. Each names one condition; the log line beside it carries the specifics.
Variables ¶
This section is empty.
Functions ¶
func CheckPendingMigrations ¶ added in v1.159.0
CheckPendingMigrations runs before the migrations do and warns of what a pending one is about to change that its operator cannot undo: each site whose environment named dev has a domain and is renamed by 000239, naming the site, its domains and the name it is given (#2608). A failed read is logged, never startup's failure.
It also warns of each environment public until 000245 that has no domain, which from then on answers only to someone signed in (#2619).
func CheckPersona ¶
CheckPersona runs the persona checks for one persona written through the admin API, so the warning a boot would raise is raised at write time.
func CheckS3Reach ¶ added in v1.159.0
CheckS3Reach warns of each S3 connection a persona may read buckets through whose credentials list a bucket the platform keeps its own data in, or one named for backups (#2616). The S3 tools refuse the platform's buckets whatever the credentials reach; this tells the operator the credentials still reach them, which no tool can take back. It lists over the network, so the caller runs it apart from startup.
func CheckStartup ¶
CheckStartup runs every boot check, logging and counting each finding. Startup-only for the values in force at boot; a persona written later is checked by CheckPersona from the admin API.
Types ¶
type Connection ¶
Connection names one configured connection.
func Connections ¶
func Connections(reg *registry.Registry) []Connection
Connections is every connection the registry's toolkits serve, as the toolkits that list their connections report them, sorted by kind and name.
type Startup ¶
type Startup struct {
// AgentInstructions is the customized agent-instruction layer in force.
AgentInstructions string
// Registered is every tool name the deployment registers, the platform's
// own tools included.
Registered []string
// Toolkits is the toolkit registry: the coherence rules are keyed to the
// tools its toolkits register, and its connections are checked for reach.
Toolkits *registry.Registry
// Personas is the persona registry in force.
Personas *persona.Registry
// Destinations is the configured script destinations; each bucket one is
// checked against its connection's bucket_prefix.
Destinations []script.Destination
}
Startup is what the boot checks read.