Skip to content

Move ActivityCollector from packages/core to packages/browser#1474

Merged
carterworks merged 17 commits intomainfrom
feat/move-activity-collector-to-browser
Apr 2, 2026
Merged

Move ActivityCollector from packages/core to packages/browser#1474
carterworks merged 17 commits intomainfrom
feat/move-activity-collector-to-browser

Conversation

@carterworks
Copy link
Copy Markdown
Collaborator

@carterworks carterworks commented Mar 31, 2026

Description

ActivityCollector is for automatic click tracking. That doesn't make sense outside of a browser context.

This is also a proof-of-concept/lay-the-groundwork for moving other components from core to browser.

It also includes an automated test, scripts/customBuild.spec.js that runs custom build.

To validate

Generate two custom builds

  • One with ActivityCollector - node packages/browser/scripts/alloyBuilder.js build --no-minify -o /tmp/alloy-build
  • One without - node packages/browser/scripts/alloyBuilder.js build --exclude activityCollector --no-minify -o /tmp/alloy-build-no-activity

Verify that the first is bigger (filesize) and has ActivityCollector and that the second is smaller and does not contain it.

Related Issue

Motivation and Context

Screenshots (if appropriate):

Checklist:

  • I have signed the Adobe Open Source CLA or I'm an Adobe employee.
  • I have made any necessary test changes and all tests pass.
  • I have run the Sandbox successfully.
  • I have added a Changeset (pnpm changeset) or it is not necessary because this PR is not consumer-facing.

carterworks and others added 8 commits March 31, 2026 07:42
Structural assertions describing the desired end state of moving
ActivityCollector from core to browser package. All 6 migration
tests fail initially (TDD red phase).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These tree-shakable barrel exports allow ActivityCollector (and future
browser-package components) to import core utilities via package specifiers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- componentCreators.js: browser component registry (activityCollector)
- allOptionalComponents.js: combined re-exports from core + browser
- componentMetadata.js: combined metadata for the build CLI

These files won't resolve yet since ActivityCollector hasn't moved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- git mv ActivityCollector source tree to packages/browser/src/components/
- Update imports to use @adobe/alloy-core/utils and /utils/validation
- Inline CLICK_ACTIVITY_DATA constant (only used by ActivityCollector)
- Remove activityCollector from core componentCreators.js
- Delete now-unused sessionDataKeys.js
- Update build system: standalone.js, index.js, entryPointGenerator,
  and alloyBuilder all source components through allOptionalComponents.js
- Add componentMetadata.js to browser package.json files array

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- git mv test tree from core to browser
- Inline CLICK_ACTIVITY_DATA constant in createClickActivityStorage.spec.js
- Fix createEvent cross-package import path
- Expand vitest unit test include to packages/*/test/unit/**
- Add packages/browser/src/** to coverage include

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Copy flushPromiseChains and testConfigValidators helpers to browser
  test tree (shared by ActivityCollector tests)
- Fix createEvent import to use correct relative path through packages/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add packages/browser/src/input.js to .gitignore (build artifact)
- Replace dynamic import in validation test with static file reads
- Fix createEvent import path in moved test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add createEvent.js helper that re-exports from core via relative path,
avoiding Vite browser mode resolution issues with unexported subpaths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@carterworks carterworks self-assigned this Mar 31, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 31, 2026

⚠️ No Changeset found

Latest commit: 45b1610

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@carterworks carterworks changed the title WIP: placeholder title Move ActivityCollector from packages/core to packages/browser Mar 31, 2026
carterworks and others added 5 commits April 1, 2026 14:04
clickHandler() returns a promise that resolves after the full
.then()/.catch() chain — no need for the microtask-flushing hack.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update vitest, @vitest/browser-playwright, and @vitest/coverage-v8
from ^4.0.16 to ^4.1.2. Refactor componentMigration.spec.js to use
vitest 4.1 builder pattern fixtures with onCleanup, async buildAndRead
with AbortSignal support, and os.tmpdir for build output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move scripts/specs/componentMigration.spec.js to
scripts/customBuild.spec.js. Add defaultBundle fixture derived from
buildAlloy, use memoized build with cache-busting tmpdir, and add
bundle size comparison assertion for exclusion test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread packages/browser/scripts/helpers/componentMetadata.js
@carterworks carterworks merged commit cc4c51c into main Apr 2, 2026
6 checks passed
@carterworks carterworks deleted the feat/move-activity-collector-to-browser branch April 2, 2026 21:10
carterworks added a commit that referenced this pull request Apr 6, 2026
* test: add RED validation tests for ActivityCollector migration

Structural assertions describing the desired end state of moving
ActivityCollector from core to browser package. All 6 migration
tests fail initially (TDD red phase).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: add ./utils and ./utils/validation subpath exports to core

These tree-shakable barrel exports allow ActivityCollector (and future
browser-package components) to import core utilities via package specifiers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: create browser component infrastructure

- componentCreators.js: browser component registry (activityCollector)
- allOptionalComponents.js: combined re-exports from core + browser
- componentMetadata.js: combined metadata for the build CLI

These files won't resolve yet since ActivityCollector hasn't moved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: move ActivityCollector from core to browser package

- git mv ActivityCollector source tree to packages/browser/src/components/
- Update imports to use @adobe/alloy-core/utils and /utils/validation
- Inline CLICK_ACTIVITY_DATA constant (only used by ActivityCollector)
- Remove activityCollector from core componentCreators.js
- Delete now-unused sessionDataKeys.js
- Update build system: standalone.js, index.js, entryPointGenerator,
  and alloyBuilder all source components through allOptionalComponents.js
- Add componentMetadata.js to browser package.json files array

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: move ActivityCollector tests to browser package

- git mv test tree from core to browser
- Inline CLICK_ACTIVITY_DATA constant in createClickActivityStorage.spec.js
- Fix createEvent cross-package import path
- Expand vitest unit test include to packages/*/test/unit/**
- Add packages/browser/src/** to coverage include

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: resolve test helper and cross-package import paths

- Copy flushPromiseChains and testConfigValidators helpers to browser
  test tree (shared by ActivityCollector tests)
- Fix createEvent import to use correct relative path through packages/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: fix lint, gitignore build artifact, and test import paths

- Add packages/browser/src/input.js to .gitignore (build artifact)
- Replace dynamic import in validation test with static file reads
- Fix createEvent import path in moved test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: resolve createEvent cross-package import for browser tests

Add createEvent.js helper that re-exports from core via relative path,
avoiding Vite browser mode resolution issues with unexported subpaths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: increase custom build migration test timeouts

* test: replace flushPromiseChains with async/await

clickHandler() returns a promise that resolves after the full
.then()/.catch() chain — no need for the microtask-flushing hack.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: remove unnecessary comments

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: upgrade vitest to 4.1.2 and refactor custom build tests

Update vitest, @vitest/browser-playwright, and @vitest/coverage-v8
from ^4.0.16 to ^4.1.2. Refactor componentMigration.spec.js to use
vitest 4.1 builder pattern fixtures with onCleanup, async buildAndRead
with AbortSignal support, and os.tmpdir for build output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: rename and reorganize custom build test

Move scripts/specs/componentMigration.spec.js to
scripts/customBuild.spec.js. Add defaultBundle fixture derived from
buildAlloy, use memoized build with cache-busting tmpdir, and add
bundle size comparison assertion for exclusion test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Adjust timeout for all custom build tests

* test: add minified bundle test to custom build spec

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Use fs.mkdtempSync

* Add temporary tests for extension custom and standalone builds

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
carterworks added a commit that referenced this pull request Apr 6, 2026
* test: add RED validation tests for ActivityCollector migration

Structural assertions describing the desired end state of moving
ActivityCollector from core to browser package. All 6 migration
tests fail initially (TDD red phase).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: add ./utils and ./utils/validation subpath exports to core

These tree-shakable barrel exports allow ActivityCollector (and future
browser-package components) to import core utilities via package specifiers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: create browser component infrastructure

- componentCreators.js: browser component registry (activityCollector)
- allOptionalComponents.js: combined re-exports from core + browser
- componentMetadata.js: combined metadata for the build CLI

These files won't resolve yet since ActivityCollector hasn't moved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: move ActivityCollector from core to browser package

- git mv ActivityCollector source tree to packages/browser/src/components/
- Update imports to use @adobe/alloy-core/utils and /utils/validation
- Inline CLICK_ACTIVITY_DATA constant (only used by ActivityCollector)
- Remove activityCollector from core componentCreators.js
- Delete now-unused sessionDataKeys.js
- Update build system: standalone.js, index.js, entryPointGenerator,
  and alloyBuilder all source components through allOptionalComponents.js
- Add componentMetadata.js to browser package.json files array

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: move ActivityCollector tests to browser package

- git mv test tree from core to browser
- Inline CLICK_ACTIVITY_DATA constant in createClickActivityStorage.spec.js
- Fix createEvent cross-package import path
- Expand vitest unit test include to packages/*/test/unit/**
- Add packages/browser/src/** to coverage include

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: resolve test helper and cross-package import paths

- Copy flushPromiseChains and testConfigValidators helpers to browser
  test tree (shared by ActivityCollector tests)
- Fix createEvent import to use correct relative path through packages/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: fix lint, gitignore build artifact, and test import paths

- Add packages/browser/src/input.js to .gitignore (build artifact)
- Replace dynamic import in validation test with static file reads
- Fix createEvent import path in moved test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: resolve createEvent cross-package import for browser tests

Add createEvent.js helper that re-exports from core via relative path,
avoiding Vite browser mode resolution issues with unexported subpaths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: increase custom build migration test timeouts

* test: replace flushPromiseChains with async/await

clickHandler() returns a promise that resolves after the full
.then()/.catch() chain — no need for the microtask-flushing hack.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: remove unnecessary comments

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: upgrade vitest to 4.1.2 and refactor custom build tests

Update vitest, @vitest/browser-playwright, and @vitest/coverage-v8
from ^4.0.16 to ^4.1.2. Refactor componentMigration.spec.js to use
vitest 4.1 builder pattern fixtures with onCleanup, async buildAndRead
with AbortSignal support, and os.tmpdir for build output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: rename and reorganize custom build test

Move scripts/specs/componentMigration.spec.js to
scripts/customBuild.spec.js. Add defaultBundle fixture derived from
buildAlloy, use memoized build with cache-busting tmpdir, and add
bundle size comparison assertion for exclusion test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Adjust timeout for all custom build tests

* test: add minified bundle test to custom build spec

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Use fs.mkdtempSync

* Add temporary tests for extension custom and standalone builds

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
carterworks added a commit that referenced this pull request Apr 10, 2026
* Move ActivityCollector from packages/core to packages/browser (#1474)

* test: add RED validation tests for ActivityCollector migration

Structural assertions describing the desired end state of moving
ActivityCollector from core to browser package. All 6 migration
tests fail initially (TDD red phase).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: add ./utils and ./utils/validation subpath exports to core

These tree-shakable barrel exports allow ActivityCollector (and future
browser-package components) to import core utilities via package specifiers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: create browser component infrastructure

- componentCreators.js: browser component registry (activityCollector)
- allOptionalComponents.js: combined re-exports from core + browser
- componentMetadata.js: combined metadata for the build CLI

These files won't resolve yet since ActivityCollector hasn't moved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: move ActivityCollector from core to browser package

- git mv ActivityCollector source tree to packages/browser/src/components/
- Update imports to use @adobe/alloy-core/utils and /utils/validation
- Inline CLICK_ACTIVITY_DATA constant (only used by ActivityCollector)
- Remove activityCollector from core componentCreators.js
- Delete now-unused sessionDataKeys.js
- Update build system: standalone.js, index.js, entryPointGenerator,
  and alloyBuilder all source components through allOptionalComponents.js
- Add componentMetadata.js to browser package.json files array

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: move ActivityCollector tests to browser package

- git mv test tree from core to browser
- Inline CLICK_ACTIVITY_DATA constant in createClickActivityStorage.spec.js
- Fix createEvent cross-package import path
- Expand vitest unit test include to packages/*/test/unit/**
- Add packages/browser/src/** to coverage include

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: resolve test helper and cross-package import paths

- Copy flushPromiseChains and testConfigValidators helpers to browser
  test tree (shared by ActivityCollector tests)
- Fix createEvent import to use correct relative path through packages/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: fix lint, gitignore build artifact, and test import paths

- Add packages/browser/src/input.js to .gitignore (build artifact)
- Replace dynamic import in validation test with static file reads
- Fix createEvent import path in moved test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: resolve createEvent cross-package import for browser tests

Add createEvent.js helper that re-exports from core via relative path,
avoiding Vite browser mode resolution issues with unexported subpaths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: increase custom build migration test timeouts

* test: replace flushPromiseChains with async/await

clickHandler() returns a promise that resolves after the full
.then()/.catch() chain — no need for the microtask-flushing hack.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: remove unnecessary comments

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: upgrade vitest to 4.1.2 and refactor custom build tests

Update vitest, @vitest/browser-playwright, and @vitest/coverage-v8
from ^4.0.16 to ^4.1.2. Refactor componentMigration.spec.js to use
vitest 4.1 builder pattern fixtures with onCleanup, async buildAndRead
with AbortSignal support, and os.tmpdir for build output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: rename and reorganize custom build test

Move scripts/specs/componentMigration.spec.js to
scripts/customBuild.spec.js. Add defaultBundle fixture derived from
buildAlloy, use memoized build with cache-busting tmpdir, and add
bundle size comparison assertion for exclusion test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Adjust timeout for all custom build tests

* test: add minified bundle test to custom build spec

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Use fs.mkdtempSync

* Add temporary tests for extension custom and standalone builds

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Add step to initialize nodejs sdk

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants