Skip to content

feat(analytics): allow GA4 city/continent/subContinent aggregate dimensions - #4291

Open
chubes4 wants to merge 1 commit into
mainfrom
feat/ga-aggregate-city-dimension
Open

chubes4 wants to merge 1 commit into
mainfrom
feat/ga-aggregate-city-dimension

Conversation

@chubes4

@chubes4 chubes4 commented Dec 5, 2026

Copy link
Copy Markdown
Member

Summary

Added city, cityId, continent, continentId, subContinent and subContinentId to the allowed dimensions for GA4 aggregate_report, keeping the list alphabetized. The smoke test now checks city and cityId inputs and that an unknown dimension is rejected. Added a PHPUnit unit test and updated the docs list.

What changed

  • inc/Abilities/Analytics/GoogleAnalyticsAbilities.php: AGGREGATE_DIMENSIONS now includes city, cityId, continent, continentId, subContinent and subContinentId, still alphabetized (28 entries).
  • tests/google-analytics-aggregate-schema-smoke.php: new checks that an input with dimensions ['city','region'] passes validation, one with ['cityId'] passes, and an unknown dimension is rejected. The 'assertions passed' count is now computed instead of hard-coded.
  • tests/Unit/Abilities/Analytics/GoogleAnalyticsInputGuardsTest.php: new test that city and cityId are in AGGREGATE_DIMENSIONS and in the aggregateInputSchema dimensions enum. Note that this suite extends WP_UnitTestCase, so it needs the WordPress test environment and is not WP-independent.
  • docs/google-analytics.md: the approved-dimensions list now includes the new geo dimensions. It also adds countryId, which was already allowed in the code but missing from the docs.

Verification

All gates passed on c5d9a53c6655. Base main: gated on 3ad5427b3496, target now 380d7b495ff3, re-verified: yes.

  • ( if git diff --quiet --no-renames 380d7b495ff38a454fae9f385b6586ecc2901492 -- ':(literal)plugins/data-machine'; then :…: passed, 23180 ms; retained gate metadata.
  • cd plugins/data-machine-business && php -r 'define("ABSPATH","/"); require "inc/Abilities/Analytics/GoogleAnalyticsAbil…: passed, 179 ms; retained gate evidence.
  • cd plugins/data-machine-business && php -l inc/Abilities/Analytics/GoogleAnalyticsAbilities.php && php -l tests/google-…: passed, 207 ms; retained gate evidence.
  • ( if git diff --quiet --no-renames 380d7b495ff38a454fae9f385b6586ecc2901492 -- ':(literal)plugins/data-machine'; then :…: passed, 2258 ms; retained gate evidence.
  • repro: verified (the repro gate failed on base and passed on the candidate).
  • CI: pending

Gate 2 output
ok

Gate 3 output
No syntax errors detected in inc/Abilities/Analytics/GoogleAnalyticsAbilities.php
No syntax errors detected in tests/google-analytics-aggregate-schema-smoke.php

Gate 4 output
{
  "schema": "homeboy/command-result/v3",
  "command": "review",
  "operation": "test",
  "success": true,
  "exit_code": 0,
  "status": "succeeded",
  "data": {
    "plan": {
      "base_ref": "HEAD^",
      "changed_files": [
        "plugins/data-machine-business/docs/google-analytics.md",
        "plugins/data-machine-business/inc/Abilities/Analytics/GoogleAnalyticsAbilities.php",
        "plugins/data-machine-business/tests/Unit/Abilities/Analytics/GoogleAnalyticsInputGuardsTest.php",
        "plugins/data-machine-business/tests/google-analytics-aggregate-schema-smoke.php"
      ],
      "commands": [],
      "skipped": [
        {
          "reason": "PR branch filters require GitHub event context",
          "source": {
            "job": null,
            "step": null,
            "workflow": ".github/workflows/data-machine-business.yml"
          }
        },
        {
          "reason": "PR path filters did not match the changed files",
          "source": {
            "job": null,
            "step": null,
            "workflow": ".github/workflows/data-machine-events.yml"
          }
        },
        {
          "reason": "PR path filters did not match the changed files",
          "source": {
            "job": null,
            "step": null,
            "workflow": ".github/workflows/data-machine-socials.yml"
          }
        },
        {
          "reason": "PR path filters did not match the changed files",
          "source": {
            "job": null,
            "step": null,
            "workflow": ".github/workflows/data-machine-test.yml"
          }
        },
        {
          "reason": "PR path filters did not match the changed files",
          "source": {
            "job": null,
            "step": null,
            "workflow": ".github/workflows/data-machine.yml"
          }
        }
      ]
    },
    "results": []
  }
}

Cook run
  • Cook ID: agent-task-62be26bf-3070-4e28-ad9a-e8a3cf3531d0
  • Attempt run ID: agent-task-62be26bf-3070-4e28-ad9a-e8a3cf3531d0-attempt-1-bf5fac21
  • Gate 1: tree f05d19f0eae8714c9967bb45bc2bf01af1b2d5a0
  • Gate 2: tree f05d19f0eae8714c9967bb45bc2bf01af1b2d5a0
  • Gate 3: tree f05d19f0eae8714c9967bb45bc2bf01af1b2d5a0
  • Gate 4: tree f05d19f0eae8714c9967bb45bc2bf01af1b2d5a0

Delivery

  • Delivered: Add GA4 geo dimensions to the allowlist, alphabetized
  • Delivered: Smoke test: city+region and cityId validate, unknown dimension rejected
  • Delivered: PHPUnit unit test for city/cityId in the allowlist and schema enum
  • Delivered: Docs update

Evidence

  • Local check: loaded the class with php -r. AGGREGATE_DIMENSIONS has 28 entries, is still in case-insensitive alphabetical order, and contains city, cityId, region and countryId.
  • Local check: php -l reported no syntax errors in the three changed PHP files.
  • Not run: the WP smoke test (no WP_PATH available here) and the PHPUnit suite (needs the WP test environment). Those results are left to the Homeboy gates.

AI disclosure

Tool: Homeboy Cook. Agent: Homeboy (roadie). Model: roadie · route cook-heavy · served claude-opus-5-5. Cook time: 35m32s.

The AI made the allowlist, test and docs edits and ran the local syntax and list-content checks, under the direction of the Cook requester. Homeboy reports controller verification separately from this account of the AI's work. A human reviews before merge.

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