Documentation
¶
Overview ¶
Package initreport gives the measures of an init run from init's record alone: files in a capability, shared and unclaimed; PRs and changes placed; PRs in one capability; capabilities with no PR or change; where the rules' reasons came from; consolidation's counts; and spend per phase. It reads the record with no session, no repo files, no forge and no environment. A measure whose inputs are not stored, are stale or cannot be read says why it can't be given and holds no number. It renders the measures as plain text, as a section of the PR body and as JSON, in counts and shares only: no file path, capability name or PR number reaches it.
Index ¶
Constants ¶
const SectionHeading = "## Measures"
SectionHeading is the PR body section's heading line.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AnchorCount ¶
AnchorCount is the rules of one kind of anchor, a share of all rules.
type ConsolidationCounts ¶
type ConsolidationCounts struct {
CapabilityMerges int `json:"capability_merges"`
CapabilitiesMergedAway int `json:"capabilities_merged_away"`
EntriesMergedExact int `json:"entries_merged_exact"`
EntriesMergedNear int `json:"entries_merged_near"`
Moved int `json:"rules_moved"`
Dropped int `json:"questions_dropped"`
Lifted int `json:"rules_lifted"`
Refused int `json:"refused"`
EntriesBefore int `json:"entries_before"`
EntriesAfter int `json:"entries_after"`
ProductRulesAfter int `json:"product_rules_after"`
}
ConsolidationCounts is what the stored consolidation did.
type FileCounts ¶
type FileCounts struct {
SourceFiles int `json:"source_files"`
InCapability Ratio `json:"in_a_capability"`
Unclaimed Ratio `json:"unclaimed"`
}
FileCounts is the areas' source files: owned by one walk capability, shared, or unclaimed, each a share of them all.
type Measure ¶
Measure is a measure's numbers in Value, or, when Value is nil, why it can't be given, marshalled as {"cant_be_given": why} and no number.
func (Measure[T]) MarshalJSON ¶
MarshalJSON writes the numbers, or only the reason they can't be given.
type OneCounts ¶
OneCounts is the gathered PRs whose source files a capability owns all belong to one, of the PRs touching such a file, and the PRs left out.
type PhaseSpend ¶
type PhaseSpend struct {
Phase string `json:"phase"`
Input int64 `json:"input"`
CachedInput int64 `json:"cached_input"`
Output int64 `json:"output"`
WeightedTokens int64 `json:"weighted_tokens"`
MicroUSD *int64 `json:"micro_usd,omitempty"`
Unpriced bool `json:"unpriced,omitempty"`
Cost string `json:"cost"`
}
PhaseSpend is one phase's raw tokens, weighted tokens and cost estimate. MicroUSD is left out when some of it has no price, and Cost says so.
type PlacedCounts ¶
type PlacedCounts struct {
PRs Measure[PlacingCounts] `json:"prs"`
Changes Measure[PlacingCounts] `json:"changes_on_their_own"`
FollowTheirPR int `json:"changes_following_their_pr"`
}
PlacedCounts is the gathered PRs placed, the changes no gathered PR holds placed on their own, and the changes that follow their PR.
type PlacingCounts ¶
PlacingCounts is items placed of those gathered, and those placed nowhere.
type ReasonCounts ¶
type ReasonCounts struct {
Rules int `json:"rules"`
ByAnchor []AnchorCount `json:"by_anchor"`
TestOnlyWithBecause Measure[Ratio] `json:"test_only_with_because"`
ProductRules int `json:"product_rules,omitempty"`
ProductRulesNotCounted int `json:"product_rules_not_counted,omitempty"`
CapabilitiesNotCounted int `json:"capabilities_not_counted,omitempty"`
}
ReasonCounts is the rules `--write` would write by the first kind of anchor that applies, every kind in order; ProductRules are among Rules.
type Report ¶
type Report struct {
Files Measure[FileCounts] `json:"files"`
Placed Measure[PlacedCounts] `json:"placed"`
OneCapability Measure[OneCounts] `json:"prs_in_one_capability"`
Unplaced Measure[Ratio] `json:"capabilities_with_no_pr_or_change"`
Reasons Measure[ReasonCounts] `json:"rules_reasons"`
Consolidation Measure[ConsolidationCounts] `json:"consolidation"`
Spend Measure[SpendCounts] `json:"spend"`
}
Report is every measure of an init run.
type SpendCounts ¶
type SpendCounts struct {
Phases []PhaseSpend `json:"phases"`
Total PhaseSpend `json:"total"`
}
SpendCounts is what each phase spent, in the store's order, and the total.