Skip to content

fix: DI interface follow-ups before v0.8.0 - #35

Merged
jackielii merged 2 commits into
mainfrom
fix/di-interface-followups
Oct 16, 2026
Merged

jackielii merged 2 commits into
mainfrom
fix/di-interface-followups

Conversation

@jackielii

Copy link
Copy Markdown
Owner

Follow-ups to #34, which was squash-merged before these landed. Found by the eos agent and an adversarial review.

Fixes

  • Dead branch removed (fa8ca2f). Registrations are keyed by their dynamic type, so the exact-interface-key lookup in getArg could never hit. The doc line promising "exact registration wins" for interfaces is corrected.
  • Regression fixed: a registered pointer to an interface fills it again.

Docs (review findings)

  • The Mount ambiguity check covers Props and extended ServeHTTP only. Init/Middlewares fail Mount anyway, and Page/component parameters fail at request time.
  • The error names every implementation, not "both".
  • Known edge, documented rather than worked around: the check knows the writer only as http.ResponseWriter.
    • Example: Props(sw io.StringWriter) with two StringWriters registered fails Mount, although the real writer would fill it.
    • Workaround: declare the writer as http.ResponseWriter or io.Writer.

Left as is (intended or contrived)

  • An any parameter beyond the request values now takes a lone registration, and with two registrations it fails Mount. It used to be "not found".
  • A custom selector returning a nil RenderTarget isn't modelled. A broken page can pass Mount; a working one is never rejected.

go test ./..., golangci-lint and gopls are clean.

https://claude.ai/code/session_01Dp3Jmu2ePyCME2yG9yd672

addArg registers each value under its dynamic type, so the registry
never has an interface key and the exact lookup for an interface
parameter could not hit. Correct the doc line that promised it.

Claude-Session: https://claude.ai/code/session_01Dp3Jmu2ePyCME2yG9yd672
Before interface filling, WithArgs(&s) with s of interface type Svc
filled a Svc parameter through the pointer-to-value rule. The new
interface path skipped it, since *Svc doesn't implement Svc. Look for a
registered *Iface first: that restores the old behaviour and gives a
way to pick one implementation when several are registered.

Docs: Mount's ambiguity check covers Props and extended ServeHTTP only
(Page/component params fail at request time), the error names every
implementation, and the check knows the writer only as
http.ResponseWriter.

Claude-Session: https://claude.ai/code/session_01Dp3Jmu2ePyCME2yG9yd672
@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.21%. Comparing base (f2bc9b2) to head (9ebfc1d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #35   +/-   ##
=======================================
  Coverage   95.21%   95.21%           
=======================================
  Files          16       16           
  Lines        1547     1547           
=======================================
  Hits         1473     1473           
  Misses         44       44           
  Partials       30       30           

☔ 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.

@jackielii
jackielii merged commit 0c95b6e into main Oct 16, 2026
16 checks passed
@jackielii
jackielii deleted the fix/di-interface-followups branch October 16, 2026 12:08
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.

1 participant