Skip to content

refactor!: make Provide* return Hookable and take Invoker in hooks - #69

Merged
zhulik merged 1 commit into
mainfrom
breaking/interface-first-hookable
Jul 27, 2026
Merged

zhulik merged 1 commit into
mainfrom
breaking/interface-first-hookable

Conversation

@zhulik

@zhulik zhulik commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

Make the default public API interface-first while keeping concrete wrappers and Container importable for advanced/hackable use.

Changes

  • Provide / ProvideFn (and named variants) return Hookable[T]; factories/runner/list return ServiceDef
  • LifecycleHook takes Invoker instead of *Pal; ProvideFn gains ToInit with hook priority
  • Unexport parseTag and context key plumbing (WithPal / FromContext only)
  • Add Pal.TreeJSON() / GraphToJSON; inspect uses TreeJSON() instead of Container().Graph()
  • Godoc/README: primary path vs Advanced escape hatches; concretes stay exported

How To Test

task lint-fix
go test ./...

Checklist

  • Tests are green when ran locally
  • I updated documentation/examples when needed
  • I considered backward compatibility and migration impact

Migration: update hook signatures to pal.Invoker; stop naming concrete Provide return types (or type-assert); use FromContext instead of CtxValue; prefer Pal.TreeJSON() over inspect+Container for the dependency UI.

Prefer an interface-first default API while keeping concrete wrappers and
Container exported for advanced use. Add Pal.TreeJSON for inspect and
unexport low-value plumbing (parseTag, context keys).
@cursor

cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 31.91489% with 64 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.73%. Comparing base (0ed42a0) to head (46f04e4).

Files with missing lines Patch % Lines
tree_json.go 0.00% 54 Missing ⚠️
service_fn_singleton.go 23.07% 9 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #69      +/-   ##
==========================================
- Coverage   78.72%   74.73%   -4.00%     
==========================================
  Files          23       24       +1     
  Lines        1236     1302      +66     
==========================================
  Hits          973      973              
- Misses        236      302      +66     
  Partials       27       27              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zhulik
zhulik merged commit d6b1058 into main Jul 27, 2026
4 checks 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