Skip to content

test(ai): cover nested config mutation in the cache-pollution test - #802

Merged
jurajmajerik merged 2 commits into
mainfrom
prompt-config-nested-test
Jul 30, 2026
Merged

test(ai): cover nested config mutation in the cache-pollution test#802
jurajmajerik merged 2 commits into
mainfrom
prompt-config-nested-test

Conversation

@jurajmajerik

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Follow-up to #801, mirroring a review suggestion from PostHog/posthog-js#4329. The cache-pollution test only mutated top-level config values, so swapping copy.deepcopy for a shallow .copy() would pass the test while quietly sharing nested objects (tools, schemas) with the cache. The test now also mutates a nested value, so that swap fails the test.

💚 How did you test it?

test_prompts.py, 68 tests green. Test-only change, no changeset needed.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran sampo add to generate a changeset file (test-only, no release)

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude Code authored this under my direction as the Python mirror of the test hardening suggested on the JS PR.

@jurajmajerik
jurajmajerik requested a review from a team as a code ownerJuly 30, 2026 12:51
@jurajmajerikjurajmajerik self-assigned this Jul 30, 2026
@greptile-apps

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "test(ai): cover nested config mutation i..." | Re-trigger Greptile

@github-actions

github-actionsBot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

posthog-python Compliance Report

Date: 2026-07-30 13:05:30 UTC
Duration: 338795ms

✅ All Tests Passed!

111/111 tests passed


Capture_V1 Tests

94/94 tests passed

View Details
TestStatusDuration
Endpoint And Method.Targets V1 Endpoint516ms
Endpoint And Method.Does Not Use Legacy Endpoints1009ms
Required Headers.Has Authorization Bearer Header1008ms
Required Headers.Has Content Type Json1008ms
Required Headers.Has Posthog Sdk Info Format1008ms
Required Headers.Has Posthog Attempt Header1009ms
Required Headers.Has Posthog Request Id1008ms
Required Headers.Has Posthog Request Timestamp1008ms
Required Headers.Has User Agent1009ms
Body Format.Body Has Created At And Batch1008ms
Body Format.No Api Key In Body1009ms
Body Format.No Sent At In Body1008ms
Event Format.Event Has Required Root Fields1009ms
Event Format.Event Uuid Is Valid1009ms
Event Format.Event Timestamp Is Rfc33391008ms
Event Format.Distinct Id Is String1009ms
Event Format.Distinct Id At Root Not Properties1009ms
Event Format.Custom Properties Preserved1008ms
Event Format.Set Properties Preserved1009ms
Event Format.Set Once Properties Preserved1009ms
Event Format.Groups Properties Preserved1009ms
Event Format.Sdk Generates Uuid If Not Provided1009ms
Event Format.Event Has Required Root Fields Batch1012ms
Event Format.Event Uuid Is Valid Batch1013ms
Event Format.Event Timestamp Is Rfc3339 Batch1011ms
Event Format.Distinct Id Is String Batch1013ms
Event Format.Distinct Id At Root Not Properties Batch1012ms
Event Format.Custom Properties Preserved Batch1012ms
Event Format.Set Properties Preserved Batch1011ms
Event Format.Set Once Properties Preserved Batch1012ms
Event Format.Groups Properties Preserved Batch1012ms
Event Format.Sdk Generates Uuid If Not Provided Batch1011ms
Batch Behavior.Multiple Events In Single Batch1507ms
Batch Behavior.Batch Envelope Smoke1013ms
Batch Behavior.Flush With No Events Sends Nothing1005ms
Batch Behavior.Flush At Triggers Batch1508ms
Batch Behavior.Created At Reflects Batch Creation Time1010ms
Deduplication.Generates Unique Uuids1507ms
Deduplication.Different Events Same Content Different Uuids1507ms
Deduplication.Preserves Uuid On Retry7515ms
Deduplication.Preserves Timestamp On Retry7507ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry7516ms
Deduplication.No Duplicate Events In Batch1503ms
Header Behavior On Retry.Attempt Header Starts At One1008ms
Header Behavior On Retry.Attempt Header Increments On Retry14523ms
Header Behavior On Retry.Request Id Preserved On Retry7508ms
Header Behavior On Retry.Different Requests Have Different Request Ids3514ms
Header Behavior On Retry.Request Timestamp Changes On Retry7514ms
Response Format Validation.Success Response Has Uuid Keyed Results1006ms
Response Format Validation.Success Response Has Ok For Each Event1506ms
Response Format Validation.Success No Retry After When All Ok1507ms
Response Format Validation.Success Retry After Present When Retry Events2510ms
Response Format Validation.Success No Retry After When Drop Only1507ms
Response Format Validation.Response Echoes Request Id1009ms
Retry Behavior.Retries On 4087514ms
Retry Behavior.Retries On 5007511ms
Retry Behavior.Retries On 5039515ms
Retry Behavior.Retries On 5047507ms
Retry Behavior.Retryable Errors Have Retry After4513ms
Retry Behavior.Respects Retry After On Retryable Error12510ms
Retry Behavior.Does Not Retry On 4003509ms
Retry Behavior.Does Not Retry On 4013508ms
Retry Behavior.Does Not Retry On 4023508ms
Retry Behavior.Does Not Retry On 4133506ms
Retry Behavior.Does Not Retry On 4153507ms
Retry Behavior.Non Retryable Errors Have No Retry After3509ms
Retry Behavior.Implements Backoff23530ms
Retry Behavior.Max Retries Respected23512ms
Partial Batch Handling.Handles 200 Full Success3010ms
Partial Batch Handling.Handles 200 With All Ok4508ms
Partial Batch Handling.Does Not Retry Dropped Events4507ms
Partial Batch Handling.Does Not Retry Limited Events4510ms
Partial Batch Handling.Prunes Ok Events On Partial Retry7512ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry7513ms
Partial Batch Handling.Retries Only Retry Events From Partial7511ms
Partial Batch Handling.Partial Retry Preserves Uuids7512ms
Partial Batch Handling.Partial Retry Attempt Header Increments7512ms
Partial Batch Handling.Partial Retry Request Id Preserved7512ms
Partial Batch Handling.Respects Retry After On Partial9511ms
Partial Batch Handling.Unknown Result Treated As Terminal4506ms
Partial Batch Handling.Mixed Ok Drop Limited No Retry4505ms
Compression.Sends Gzip Content Encoding1010ms
Compression.No Content Encoding When Disabled1008ms
Compression.Compressed Body Is Decompressible1008ms
Error Handling.Does Not Retry On Unknown 4Xx3509ms
Event Options.Cookieless Mode Override1007ms
Event Options.Disable Skew Correction Override1008ms
Event Options.Process Person Profile Override1009ms
Event Options.Product Tour Id Override1007ms
Event Options.Unset Options Omitted1009ms
Event Options.Options Override In Batch1012ms
Geoip And Historical Migration.Geoip Disable Injected Into Properties1008ms
Geoip And Historical Migration.Historical Migration Set In Body1008ms
Geoip And Historical Migration.Historical Migration Absent By Default1009ms

Feature_Flags Tests

17/17 tests passed

View Details
TestStatusDuration
Request Payload.Request With Person Properties Device Id1007ms
Request Payload.Flags Request Uses V2 Query Param1007ms
Request Payload.Flags Request Hits Flags Path Not Decide1006ms
Request Payload.Flags Request Omits Authorization Header1007ms
Request Payload.Token In Flags Body Matches Init1006ms
Request Payload.Groups Round Trip1006ms
Request Payload.Groups Default To Empty Object1007ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False1006ms
Request Payload.Disable Geoip Omitted Defaults To False1007ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key1006ms
Request Lifecycle.No Flags Request On Init Alone503ms
Request Lifecycle.No Flags Request On Normal Capture1507ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests1010ms
Request Lifecycle.Mock Response Value Is Returned To Caller1003ms
Retry Behavior.Retries Flags On 5021006ms
Retry Behavior.Retries Flags On 5041007ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event1509ms

@marandaneto

Copy link
Copy Markdown
Member

@jurajmajerikhttps://github.com/PostHog/posthog-python/actions/runs/30528065883/job/90826261323?pr=801
you have to regenerate the public api file since your last pr changed a public api

@jurajmajerik
jurajmajerik merged commit 904d568 into mainJul 30, 2026
37 checks passed
@jurajmajerik
jurajmajerik deleted the prompt-config-nested-test branch July 30, 2026 13:25
Sign up for freeto 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

@jurajmajerik@marandaneto