MCPcopy Create free account
hub / github.com/compozy/agh / enrichTaskSummaryFromState

Method enrichTaskSummaryFromState

internal/task/manager.go:1667–1702  ·  view source on GitHub ↗
(
	ctx context.Context,
	record Task,
	childCount int,
	dependencies []Dependency,
	runs []Run,
	events []Event,
)

Source from the content-addressed store, hash-verified

1665}
1666
1667func (m *Service) enrichTaskSummaryFromState(
1668 ctx context.Context,
1669 record Task,
1670 childCount int,
1671 dependencies []Dependency,
1672 runs []Run,
1673 events []Event,
1674) (Summary, error) {
1675 status, err := m.canonicalTaskStatus(ctx, record, dependencies, runs)
1676 if err != nil {
1677 return Summary{}, err
1678 }
1679
1680 summary := summaryFromTaskRecord(record)
1681 summary.Status = status
1682 summary.Draft = status == TaskStatusDraft
1683 summary.ChildCount = ClampSummaryCount(childCount)
1684 summary.DependencyCount = ClampSummaryCount(len(dependencies))
1685 summary.ActiveRun = activeRunSummary(runs, record.MaxAttempts)
1686 summary.LastActivityAt = latestTaskActivityAt(record, runs, events)
1687 blockedReasons, err := m.blockedReasonsForSnapshot(ctx, record, dependencies)
1688 if err != nil {
1689 return Summary{}, err
1690 }
1691 if len(blockedReasons) > 0 {
1692 summary.BlockedReasons = &blockedReasons
1693 }
1694 if err := m.applyEffectivePauseToSummary(ctx, &summary); err != nil {
1695 return Summary{}, err
1696 }
1697 summary.Dependencies, err = m.buildDependencyReferences(ctx, dependencies)
1698 if err != nil {
1699 return Summary{}, err
1700 }
1701 return summary, nil
1702}
1703
1704func (m *Service) buildDependencyReferences(
1705 ctx context.Context,

Callers 4

inspectTaskRecordMethod · 0.95
GetTaskMethod · 0.95
enrichTaskSummaryMethod · 0.95
buildTreeNodeMethod · 0.95

Calls 8

canonicalTaskStatusMethod · 0.95
summaryFromTaskRecordFunction · 0.85
ClampSummaryCountFunction · 0.85
activeRunSummaryFunction · 0.85
latestTaskActivityAtFunction · 0.85

Tested by

no test coverage detected