Documentation
¶
Index ¶
- Constants
- Variables
- func AdmissibleAggregateCurrentPaths(values, trackedPaths []string) ([]string, error)
- func AdmissibleCurrentPaths(values, trackedPaths []string) ([]string, error)
- func AdmissionFailureReason(err error) string
- func CandidateRevisions(root string) ([]string, error)
- func CandidateRevisionsForAppend(root string) ([]string, error)
- func CanonicalArgv(argv []string) ([]byte, error)
- func CountProducers(producers []string) map[string]int
- func Encode(record Record) ([]byte, error)
- func IsDrift(err error) bool
- func IsRecordArtifactPath(path string, objectIDLength int) bool
- func IsTypedJSON(data []byte) bool
- func ParseVerificationArgv(data []byte) ([]string, error)
- func RecordProducers(records []Record) []string
- func RecoverInterruptedAppend(root string, checkStable func() error, validateBeforeMutation func() error) (resultErr error)
- func ReportableProducer(value string) bool
- func StorePath(root, revision string) string
- func TransformLegacy(data []byte, treeRevision, commitRevision string, trackedPaths []string) ([]byte, error)
- func ValidProducer(value string) bool
- func ValidateRecordStatusPaths(root string, paths []string, objectIDLength int, ownedStage string) error
- func VerificationFailureReason(err error) string
- type Input
- type MigrationAuthority
- type MigrationEntry
- type MigrationPlan
- type MigrationResult
- type Record
- type Revision
- type Store
- type VerificationEntry
Constants ¶
const ( ProducerCLI = "cli" ProducerDogfood = "dogfood" ProducerPiTool = "pi-tool" ProducerUnknown = "UNKNOWN" )
The closed producer set. ProducerUnknown is a read-side label for schema-1 and schema-2 rows; it is never stored.
const ( SchemaVersion = 1 MaxTraces = 1_000 MaxTraceFiles = 1_000 MaxTraceRowBytes = 256 * 1_024 MaxTraceStoreBytes = 16 * 1_024 * 1_024 MaxTracePaths = 200 MaxAdmissionCandidates = 200_000 MaxVerificationCommands = 50 MaxCommandCharacters = 512 MaxTaskCharacters = 2_000 )
const ( StateAbsent = "absent" StateReady = "ready" )
const ( SchemaVersionV2 = 2 MaxArgvArguments = 32 MaxArgvBytes = 4096 )
const SchemaVersionV3 = 3
SchemaVersionV3 adds the closed producer member to either verification shape (LTPM-V0-015). Producer is part of the row identity, so the same observation recorded by two producers yields two distinct trace IDs.
Variables ¶
var Producers = []string{ProducerCLI, ProducerDogfood, ProducerPiTool, ProducerUnknown}
Producers lists the closed stored set followed by the read-side label, in report order.
Functions ¶
func AdmissibleAggregateCurrentPaths ¶
AdmissibleAggregateCurrentPaths is the separate nonlearning aggregate policy. ALO-V0-002/003: ordinary trace admission remains capped at MaxTracePaths.
func AdmissibleCurrentPaths ¶
AdmissibleCurrentPaths classifies a bounded complete changed-path set through the same per-path admission primitive NewRecord uses. Malformed input fails; valid paths outside the exact tracked source set are filtered.
func AdmissionFailureReason ¶
AdmissionFailureReason returns the bounded reason for an exact changed-path admission failure. It is empty for errors outside that classifier.
func CandidateRevisions ¶
CandidateRevisions returns the bounded, pinned revision filenames currently in the store.
func CandidateRevisionsForAppend ¶
CandidateRevisionsForAppend permits only the single persistent operation-lock overage that an interrupted exact-cap append can leave after recovery.
func CanonicalArgv ¶
CanonicalArgv returns the compact ASCII-escaped JSON array used in v2 identity and displays. It never joins arguments into an executable command.
func CountProducers ¶
CountProducers returns one count per reportable producer, zeros included (LTPM-V0-016).
func IsDrift ¶
IsDrift reports a candidate-set, file-byte, pathname, or directory-binding change observed while a pinned trace read was in flight.
func IsRecordArtifactPath ¶
IsRecordArtifactPath recognizes only the recorder's exact artifact names. It establishes no ownership, safety, or content validity by itself.
func IsTypedJSON ¶
IsTypedJSON reports only the exact schema-2 or schema-3 discriminator; full admission needs DecodeTyped.
func ParseVerificationArgv ¶
ParseVerificationArgv decodes the public JSON transport without shell parsing. json/v2 rejects invalid UTF-8, unpaired surrogates and trailing JSON values.
func RecordProducers ¶
RecordProducers returns each record's read-side producer, in order.
func RecoverInterruptedAppend ¶
func RecoverInterruptedAppend(root string, checkStable func() error, validateBeforeMutation func() error) (resultErr error)
RecoverInterruptedAppend resolves retention residue for the explicit record path before strict candidate discovery. Read paths never call it. Validation runs only when recovery would mutate the trace store.
func ReportableProducer ¶
ReportableProducer reports whether value names a producer a report may count or exclude: the stored set plus the read-side UNKNOWN label.
func TransformLegacy ¶
func TransformLegacy(data []byte, treeRevision, commitRevision string, trackedPaths []string) ([]byte, error)
TransformLegacy rewrites validated tree-named rows to a commit revision.
func ValidProducer ¶
ValidProducer reports whether value may be stored in a schema-3 row.
func ValidateRecordStatusPaths ¶
func ValidateRecordStatusPaths(root string, paths []string, objectIDLength int, ownedStage string) error
ValidateRecordStatusPaths proves the read-only path prerequisites for ignoring untracked recorder artifacts in source-status admission. Canonical content is still validated by the store. ownedStage is empty except for Append's exact, descriptor-pinned temporary at its final prepublication stability check.
func VerificationFailureReason ¶
VerificationFailureReason returns the bounded reason for an exact verification-command failure. It is empty for other errors.
Types ¶
type Input ¶
type Input struct {
Revision string
TreeRevision string
Task string
OpenedPaths []string
ChangedPaths []string
Verification []string
VerificationArgv [][]string
Outcome string
Producer string
}
Input contains the caller-controlled fields of a new trace record.
type MigrationAuthority ¶
type MigrationAuthority struct {
CommitRevision string
TreeRevision string
ObjectFormat string
DirtyPaths []string
ProfileID string
Commits map[string]Revision
Trees map[string][]string
TrackedPaths func(string) ([]string, error)
// CommitObject reports whether an unreachable name is still a commit
// object, which makes its trace file stranded rather than unknown.
CommitObject func(string) (bool, error)
}
MigrationAuthority is the immutable repository evidence used to classify trace files.
type MigrationEntry ¶
type MigrationEntry struct {
TreeRevision string `json:"tree_revision"`
CommitRevision string `json:"commit_revision"`
SourceSHA256 string `json:"source_sha256"`
TargetSHA256 string `json:"target_sha256"`
RowCount int `json:"row_count"`
// contains filtered or unexported fields
}
MigrationEntry is one legacy tree file and its canonical commit replacement.
type MigrationPlan ¶
type MigrationPlan struct {
Authority MigrationAuthority
Digest string
Entries []MigrationEntry
Candidates []migrationCandidate
}
MigrationPlan is a fully validated, byte-bound trace migration plan.
func ApplyMigration ¶
func ApplyMigration(root string, authority MigrationAuthority, digest string, checkStable func() error) (MigrationPlan, error)
ApplyMigration validates the digest before mutation, locks, replans, and publishes verified files.
func PlanMigration ¶
func PlanMigration(root string, authority MigrationAuthority, checkStable func() error) (MigrationPlan, error)
PlanMigration validates the entire trace store without writing it.
func (MigrationPlan) Result ¶
func (plan MigrationPlan) Result(apply bool) MigrationResult
Result converts a plan to the public command result.
type MigrationResult ¶
type MigrationResult struct {
Mutates bool
Mode string
PlanDigest string
CommitRevision string
TreeRevision string
CandidateTraceFiles int
LegacyTraceFiles int
TraceRows int
Entries []MigrationEntry
StrandedRevisions []string
}
MigrationResult is the Python-compatible public command result.
type Record ¶
type Record struct {
SchemaVersion int
Revision string
TraceID string
Producer string
Task string
OpenedPaths []string
ChangedPaths []string
Verification []string
TypedVerification []VerificationEntry
Outcome string
}
Record holds either the immutable schema-v1 command list or schema-v2 typed entries; schema-v3 holds one of the two shapes plus its producer. Slices are always normalized to non-nil values by constructors and decoders.
func DecodeStore ¶
DecodeStore validates one revision file and preserves its row order.
func DecodeTyped ¶
DecodeTyped validates a schema-2 or schema-3 row's structure, bounds, screening, canonical values and identity. Repository witnesses remain the caller's responsibility.
func NewRecord ¶
NewRecord applies the Python writer's normalization and computes TraceID. Every new record is schema 3 and names its producer.
func WithoutProducers ¶
WithoutProducers returns the records whose producer is not excluded, in order. It copies; the supplied records and the store are never changed.
func (Record) ProducerName ¶
ProducerName returns the stored producer, or ProducerUnknown for rows written before schema 3.
func (Record) VerificationArgv ¶
VerificationArgv returns an owned copy for a second producer validation pass.
func (Record) VerificationCommands ¶
VerificationCommands retains command entries when revalidating a typed input.
func (Record) VerificationDisplay ¶
VerificationDisplay keeps argv explicitly labelled as JSON data.
func (Record) VerificationValue ¶
VerificationValue exposes the version's exact JSON shape for receipt and batch projections; callers use it only on validated records.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store owns bounded, stable reads and appends beneath .context-corvint/traces. checkStable must revalidate the caller's clean commit/tree snapshot.
func (*Store) Append ¶
Append atomically publishes one canonical row. It returns false when the row already exists.
func (*Store) AppendWithStagingCheck ¶
AppendWithStagingCheck supplies the exact owned temporary to the caller only after its descriptor, bytes and surrounding snapshot have been validated. Earlier checks (including recovery) use the ordinary stability callback.
type VerificationEntry ¶
VerificationEntry is a closed schema-v2 union. Exactly the field selected by Kind is populated; Argv retains literal argument boundaries, never shell text.