Skip to content

refactor(context): extract shared worker-compat metadata helper - #232

Merged
yeongseon merged 1 commit into
mainfrom
chore/shared-metadata-helper-216
Jul 20, 2026
Merged

refactor(context): extract shared worker-compat metadata helper#232
yeongseon merged 1 commit into
mainfrom
chore/shared-metadata-helper-216

Conversation

@yeongseon

Copy link
Copy Markdown
Owner

Context

Final item of #216. The _copy_safe_metadata pattern (copy identity attrs onto a decorator wrapper without setting __wrapped__ or aliasing __dict__, so the Azure Functions worker indexes the wrapper rather than the original handler) is duplicated in azure-functions-validation. This extracts the genuinely-shared primitive into a canonical home.

Changes

  • Add _metadata_helpers.py with copy_identity_attrs() + SAFE_IDENTITY_ATTRS — a small, dependency-free primitive documented as the canonical shape to mirror across sibling packages (independent PyPI distributions with no shared base dependency, so "shared" = canonical synced definition, not a common import).
  • _decorator.py now delegates identity-attribute copying to the primitive, keeping its package-specific __signature__ / __annotations__ mirroring (logging preserves params; validation hides them — intentionally not unified).
  • Add TestCopyIdentityAttrs asserting no __wrapped__ and no __dict__ aliasing.

Follow-up to adopt the canonical helper in validation: yeongseon/azure-functions-validation-python#231.

Verification

  • make lint clean, make typecheck clean.
  • Full suite green; coverage 96.33% (gate 95%).

Closes #216

Introduce _metadata_helpers.py housing the canonical copy_identity_attrs
primitive and SAFE_IDENTITY_ATTRS tuple — the genuinely duplicated
worker-compat logic shared with azure-functions-validation. _decorator.py now
delegates identity-attribute copying to this primitive while keeping its
package-specific signature/annotation mirroring.

Closes #216
@yeongseon
yeongseon merged commit a2d9020 into main Jul 20, 2026
22 of 23 checks passed
@yeongseon
yeongseon deleted the chore/shared-metadata-helper-216 branch July 20, 2026 14:18
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.

refactor(context): unify injection strategy, harden factory, and type cross-package metadata

2 participants