fix: default automation post author to the network bot account (#207)#421
Merged
Conversation
Phase 2 of honest content authorship (extrachill-events#207). EventUpsert::resolvePostAuthor() now resolves genuine automation (no submission context, no explicit author config) to the network bot account via ec_get_network_bot_user_id() instead of falling through to WordPressSettingsResolver's first-administrator fallback — the fallback that historically misattributed ~3k automated events (and 153 wire posts) to uid 1. Resolution order: 1. submission user_id (human submitter, incl. Phase 1 anon-resolved) — highest 2. explicit config (system default_author_id, then per-handler post_author) 3. network bot account via ec_get_network_bot_user_id() — the honest default 4. WordPressSettingsResolver (last resort, only if the helper is unavailable) This is config-driven (no magic 32 literal) and layer-pure: data-machine-events is the EC integration layer, so it owns the EC bot-id default rather than punting the decision into the generic data-machine resolver. The existing extrachill/create-user helper lives in extrachill-users (sibling PR). Existing per-flow post_author=32 handler configs continue to work (explicit config still wins); this hardens the no-config case so automation can never again default to a human admin. Backfill of the existing ~3k uid-1 event rows + 153 wire rows is handled by the extrachill-events backfill-authorship CLI (Phase 3).
Contributor
Homeboy Results —
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of honest content authorship at the source — extrachill-events#207 (Phase 2).
Problem
EventUpsert::resolvePostAuthor()fell through toWordPressSettingsResolver::getPostAuthor(), whose last-resort fallback isgetFirstAdministratorId()→ uid 1 (Chris). That's how ~3k automated events (blog 7) and 153 wire posts (blog 11) ended up authored under a human account — the misattribution the heatmap/points engines can't ignore.Fix
Automation (no submission context, no explicit author config) now resolves to the network bot account via
ec_get_network_bot_user_id()(extrachill-users) instead of the first-admin fallback.Resolution order:
submission['user_id']— human submitter (logged-in or Phase 1 anon-resolved). Unchanged.default_author_id, then per-handlerpost_author. Respected when set.ec_get_network_bot_user_id()— the honest default. ← NEWWordPressSettingsResolver(logged-in user / first admin) — last resort, only if the helper is unavailable.Why this layer
data-machine-events is the EC integration layer, so it owns the EC bot-id default. This is layer-pure: the generic
data-machineresolver is untouched, and the bot id is config-driven (no magic32) via the helper in extrachill-users.Behavior notes
post_author=32handler configs keep working (explicit config still wins).post_author=0) so automation can never again default to a human admin.Verified
php -lclean.EventUpsertTestcases exerciseresolvePostAuthor(verified); isolated private method.Sibling PRs (merge together)
ec_get_network_bot_user_id()+ create-user inputs (dependency)Conventional commits. No CHANGELOG / version bumps.