Skip to content

Prevent log_event metadata keyword mismatches from masking HTTP responses #1112

Description

@paullizer

Issue

Application code can pass unsupported structured-metadata keywords to functions_appinsights.log_event(). In the conversation-fork conflict path, custom_dimensions= raises TypeError, replacing the intended HTTP 409 eligibility conflict with HTTP 500. Additional fork cleanup paths use the similarly unsupported properties= keyword.

Steps to Reproduce

  1. Submit a personal-conversation fork request that correctly raises ConversationForkConflictError.
  2. Let the route attempt to log the conflict with custom_dimensions=.
  3. Observe that the logger call raises before the route can return its intended response.

Expected Behavior

The conflict is logged with canonical structured metadata and the route returns HTTP 409. All application log_event() callers use only supported arguments, with automated coverage preventing future contract drift.

Actual Behavior

The conflict logger raises TypeError: log_event() got an unexpected keyword argument 'custom_dimensions', converting the intended HTTP 409 into HTTP 500. Five cleanup/fallback calls also use unsupported properties= metadata.

Impact

Users receive an incorrect server-error response for a valid eligibility conflict, diagnostics are disrupted, and the same failure class can occur in other exception-handling paths.

Acceptance Criteria

  • Replace all unsupported custom_dimensions= and properties= arguments in application log_event() calls with canonical extra= metadata.
  • Add an app-wide static contract test for log_event() call signatures under application/.
  • Add a route regression proving a fork conflict remains HTTP 409 while structured metadata is logged.
  • Preserve existing logging levels, messages, traceback behavior, and metadata values.

Notes

Current findings are in route_backend_conversations.py and functions_simplechat_operations.py. No duplicate issue was found in the initial repository search. Roadmap triage: priority P1, size M.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingpythonPull requests that update python code

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions