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

Function TestManagerTaskBlockBreakerCanBeDisabled

internal/task/manager_test.go:5146–5196  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5144}
5145
5146func TestManagerTaskBlockBreakerCanBeDisabled(t *testing.T) {
5147 t.Run(
5148 "Should keep recurrence accounting but skip escalation when disabled",
5149 func(t *testing.T) {
5150 t.Parallel()
5151
5152 store := newInMemoryManagerStore()
5153 manager := newTaskManagerForTestWithOptions(t, store, WithBlockRecurrenceLimit(0))
5154 actor := validActorContext()
5155 taskRecord, err := manager.CreateTask(context.Background(), CreateTask{
5156 Scope: ScopeWorkspace,
5157 WorkspaceID: "ws-block-breaker-disabled",
5158 Title: "Breaker disabled",
5159 }, actor)
5160 if err != nil {
5161 t.Fatalf("CreateTask() error = %v", err)
5162 }
5163
5164 for idx := range 3 {
5165 block, err := manager.BlockTask(context.Background(), BlockRequest{
5166 TaskID: taskRecord.ID,
5167 Kind: BlockKindCapability,
5168 Reason: fmt.Sprintf("missing capability %d", idx),
5169 }, actor)
5170 if err != nil {
5171 t.Fatalf("BlockTask(%d) error = %v", idx, err)
5172 }
5173 if idx < 2 {
5174 if _, err := manager.ClearTaskBlock(
5175 context.Background(),
5176 taskRecord.ID,
5177 block.ID,
5178 "capability restored",
5179 actor,
5180 ); err != nil {
5181 t.Fatalf("ClearTaskBlock(%d) error = %v", idx, err)
5182 }
5183 }
5184 }
5185 if got, want := store.blockRecurrences[blockRecurrenceTestKey(taskRecord.ID, BlockKindCapability)].Count, 2; got != want {
5186 t.Fatalf("recurrence count = %d, want %d", got, want)
5187 }
5188 if store.tasks[taskRecord.ID].NeedsAttention != nil {
5189 t.Fatalf(
5190 "NeedsAttention = %#v, want disabled breaker to skip escalation",
5191 store.tasks[taskRecord.ID].NeedsAttention,
5192 )
5193 }
5194 },
5195 )
5196}
5197
5198func TestManagerExpireTaskBlocksDoesNotIncrementRecurrenceOnClear(t *testing.T) {
5199 t.Run(

Callers

nothing calls this directly

Calls 9

newInMemoryManagerStoreFunction · 0.85
WithBlockRecurrenceLimitFunction · 0.85
validActorContextFunction · 0.85
blockRecurrenceTestKeyFunction · 0.85
RunMethod · 0.65
CreateTaskMethod · 0.65
BlockTaskMethod · 0.65
ClearTaskBlockMethod · 0.65

Tested by

no test coverage detected