Skip to content

fix: k8sinit handler setters, swallowed init errors, future double resolve, nil service - #1

Merged
RangelReale merged 4 commits into
masterfrom
ccr-d9abf2a7-vkby81
Oct 1, 2026
Merged

RangelReale merged 4 commits into
masterfrom
ccr-d9abf2a7-vkby81

Conversation

@RangelReale

Copy link
Copy Markdown
Contributor
  • k8sinit: SetHealthHandler/SetTelemetryHandler always failed with
    ErrAlreadyInitialized because New() pre-filled the noop handlers and the
    setters used nil as the "not set" flag. Track "set" with explicit flags.
  • BaseOverloadedTask (and so WrapTask, BaseWrappedTask, futuretask) now
    forwards TaskInitError, so init errors of wrapped tasks are reported by
    Manager.AddTask instead of panicking/failing at runtime.
  • Future: a second Resolve/ResolveError mutated the resolved value before
    panicking, racing with readers. Check for "already resolved" first.
  • Manager.AddService(nil) now reports ErrNilTask instead of panicking in
    the start step.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01CLyyJx24FhyAuthMeMuKPx

claude added 4 commits October 1, 2026 10:59
…solve, nil service

- k8sinit: SetHealthHandler/SetTelemetryHandler always failed with
  ErrAlreadyInitialized because New() pre-filled the noop handlers and the
  setters used nil as the "not set" flag. Track "set" with explicit flags.
- BaseOverloadedTask (and so WrapTask, BaseWrappedTask, futuretask) now
  forwards TaskInitError, so init errors of wrapped tasks are reported by
  Manager.AddTask instead of panicking/failing at runtime.
- Future: a second Resolve/ResolveError mutated the resolved value before
  panicking, racing with readers. Check for "already resolved" first.
- Manager.AddService(nil) now reports ErrNilTask instead of panicking in
  the start step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CLyyJx24FhyAuthMeMuKPx
- New() rejects duplicate stage names (they made each task run its steps
  twice and fail with ErrInvalidStepOrder).
- Stages(), WithStages() and DefaultTaskSteps() no longer share slices with
  callers; DefaultTaskSteps() exposed the package-level step order.
- BuildTask(WithParent(p)) with no own step callbacks is valid again
  (previously ErrNilTask), and SetParent no longer drops the nil-step init
  error. Simplify taskBuild.Run to load the parent once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CLyyJx24FhyAuthMeMuKPx
- Remove unused helpers (sliceMap, sliceFilter, stringerIter,
  instancetask runStep, k8sinit nullLogger); move ptr to tests.
- multiErrorBuilder.build reuses buildMultiErrors; nullLogger is a plain var.
- run.go: drop redundant SSM check, pass the step logger instead of
  rebuilding it; task callbacks no longer allocate a concatenated slice.
- AddTask validates the stage before building the wrapper.
- instancetask loads task data once per step.
- health_http: one helper builds the three probe handlers; drop the
  default server handler that was always overwritten.
- Fix go vet unkeyed-field warning in futuretask and a wrong interface
  assertion in default.go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CLyyJx24FhyAuthMeMuKPx
…, use 503

- New optional TaskWithNotRun interface: Manager.Run notifies tasks in
  stages that will never run (after a setup failure, or when Run returns
  before any stage runs). futuretask resolves its future with
  ErrTaskNotRun, so Value() waiters no longer block forever and hold up
  shutdown. BaseOverloadedTask forwards it, so wrapped tasks keep working.
- AddInitError after Run started now starts the shutdown with the error as
  cause, like AddTask, instead of silently dropping it.
- health_http: readiness probe returns 503 Service Unavailable while
  terminating instead of the non-standard 499. Add handler tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CLyyJx24FhyAuthMeMuKPx
@RangelReale
RangelReale merged commit cd9367d into master Oct 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants