Skip to content

Refactor work mixins#924

Open
darinkrauss wants to merge 1 commit intodarin/refactor-ourafrom
darin/refactor-work-mixins
Open

Refactor work mixins#924
darinkrauss wants to merge 1 commit intodarin/refactor-ourafrom
darin/refactor-work-mixins

Conversation

@darinkrauss
Copy link
Copy Markdown
Contributor

  • Refactor work mixins
  • Refactor work base process to allow generic work metadata
  • Automatically encode and decode work metadata when necessary
  • Update work mixins to use generic work metadata
  • Update oura processors to use generic work metadata
  • Split oura processors and process factories into separate files
  • Use interfaces for work mixins to ease usage and testing
  • Add and update many tests

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the work processing framework to support typed/generic work metadata with automatic encode/decode, and updates Oura (and related) processors/mixins to use the new metadata model while reorganizing factories and expanding tests.

Changes:

  • Introduces a generic work/base.Processor[W] that decodes/encodes typed work metadata automatically.
  • Refactors Oura work processors/factories and related provider behavior to use provider-session-centric grouping and typed metadata.
  • Adds/updates a large set of unit tests and test helpers/mocks for new metadata structures and mixin interfaces.

Reviewed changes

Copilot reviewed 92 out of 92 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
work/base/processor_factory_test.go Updates processor factory tests; removes explicit gomock controller finalization.
work/base/processor.go Refactors base processor into a generic processor with typed metadata encode/decode.
work/base/process_result_test.go Renames test suite description.
private/plugin/abbott Updates submodule pointer.
oura/work/work_test.go Adds tests for Oura work domain and group ID helpers.
oura/work/work_suite_test.go Adds Ginkgo suite bootstrap for oura/work.
oura/work/processors/processors_test.go Adds tests for Oura processors dependency validation, factories, and EnsureWork.
oura/work/processors/processors_suite_test.go Adds Ginkgo suite bootstrap for oura/work/processors.
oura/work/processors/processors.go Renames Oura client dependency alias; refactors dependency wiring; adds EnsureWork.
oura/webhook/work/subscribe/subscribe_suite_test.go Adds Ginkgo suite bootstrap for subscribe work.
oura/webhook/work/subscribe/processor_test.go Adds processor tests for subscribe work processor constants and basic processing behavior.
oura/webhook/work/subscribe/processor.go Refactors subscribe processor to new base processor; wires in sync stub step.
oura/webhook/work/subscribe/factory_test.go Adds tests for subscribe processor factory and work-create builder.
oura/webhook/work/subscribe/factory.go Adds factory + work-create builder for webhook subscribe work.
oura/webhook/webhook_suite_test.go Adds Ginkgo suite bootstrap for webhook package.
oura/webhook/webhook.go Refactors event parsing; adds event stringer, constants, and webhook event metadata type.
oura/webhook/test/webhook.go Adds webhook test helpers for event + event metadata objects.
oura/users/work/revoke/revoke_suite_test.go Adds Ginkgo suite bootstrap for revoke work.
oura/users/work/revoke/processor_test.go Adds revoke processor tests for typed metadata + OAuth revoke flows.
oura/users/work/revoke/processor.go Refactors revoke processor to typed metadata processor and removes old metadata mixin usage.
oura/users/work/revoke/factory_test.go Adds tests for revoke factory and typed work-create metadata.
oura/users/work/revoke/factory.go Adds factory + typed metadata encoding for revoke work creation.
oura/test/oura_mocks.go Adds generated GoMock for Oura Client.
oura/test/oura.go Adds Oura domain test helpers (subscriptions, personal info, etc.).
oura/shopify/test/client.go Updates mockgen header comment destination path.
oura/shopify/client/discount.go Switches to platform errors package.
oura/shopify/client.go Updates mockgen output destination path.
oura/service/api/v1/v1.go Builds webhook route paths from shared constants.
oura/provider/provider.go Adjusts work lifecycle to provider-session-centric grouping; creates setup/revoke work with typed metadata.
oura/oura_suite_test.go Adds Ginkgo suite bootstrap for oura.
oura/oura.go Adds partner path constants and time-range constants; adds mockgen directive for Oura client.
oura/jotform/work/reconcile.go Introduces typed metadata for reconcile work and migrates processor to generic processor.
oura/data/work/work_test.go Adds tests for Oura data work domain + serial ID helper.
oura/data/work/work_suite_test.go Adds Ginkgo suite bootstrap for oura/data/work.
oura/data/work/work.go Renames domain and changes serial ID function to provider-session-based.
oura/data/work/setup/setup_suite_test.go Adds Ginkgo suite bootstrap for setup work.
oura/data/work/setup/processor.go Migrates setup processor to typed metadata + updated mixin structure and provider-session workflow.
oura/data/work/setup/factory_test.go Adds tests for setup factory and typed work-create.
oura/data/work/setup/factory.go Adds setup factory + typed metadata encoding and provider-session-based IDs.
oura/data/work/historic/test/processor.go Adds test helpers for historic processor typed metadata.
oura/data/work/historic/processor_test.go Adds extensive tests for historic typed metadata parsing/validation and processor behavior.
oura/data/work/historic/processor.go Migrates historic processor to typed metadata and new mixin structure; updates time range prep.
oura/data/work/historic/historic_suite_test.go Adds Ginkgo suite bootstrap for historic work.
oura/data/work/historic/factory_test.go Adds tests for historic factory + typed metadata and deduplication IDs.
oura/data/work/historic/factory.go Adds historic factory + typed metadata encoding and provider-session-based IDs.
oura/data/work/event/test/processor.go Adds test helpers for event processor typed metadata.
oura/data/work/event/processor_test.go Adds extensive tests for event typed metadata parsing/validation and processor behavior.
oura/data/work/event/processor.go Migrates event processor to typed metadata and new mixin structure.
oura/data/work/event/factory_test.go Adds tests for event factory + typed metadata encoding.
oura/data/work/event/factory.go Adds event factory + typed metadata encoding and provider-session-based IDs.
oura/data/work/event/event_suite_test.go Adds Ginkgo suite bootstrap for event work.
oauth/work/work_suite_test.go Adds Ginkgo suite bootstrap for oauth work.
oauth/work/token_test.go Adds tests for OAuth token metadata parse/validate/serialization.
oauth/work/token.go Adds typed TokenMetadata for OAuth token work metadata.
oauth/work/test/token.go Adds test helpers for OAuth token metadata objects.
oauth/work/test/mixin_mocks.go Adds generated GoMock for OAuth work mixin interface.
oauth/work/mixin_test.go Adds tests for OAuth work mixin behavior with token source update/expire logic.
oauth/work/mixin.go Refactors OAuth mixin into an interface + implementation using work.Provider instead of embedding base processor.
data/work/work_suite_test.go Adds Ginkgo suite bootstrap for data work.
data/work/time_range.go Removes legacy TimeRange type (migrating toward times.TimeRange).
data/work/test/ingestion_offset.go Adds test helpers for ingestion offset metadata.
data/work/test/devices_hashes.go Adds test helpers for device hashes and device hashes metadata.
data/work/ingestion_offset_test.go Adds tests for ingestion offset metadata parse/validate/serialization.
data/work/ingestion_offset.go Adds typed ingestion offset metadata.
data/work/device_hashes_test.go Adds tests for device hashes parsing/validation + metadata wrapper behavior.
data/work/device_hashes.go Adds DeviceHashes implementation and a typed metadata wrapper.
data/test/data_set.go Updates data set test helpers signatures to accept options.
data/source/work/test/mixin.go Adds data source work metadata test helpers.
data/source/work/mixin.go Refactors data source work mixin into interfaces + impl with typed/parsed metadata support.
data/source/service/client/client_test.go Loosens gomock expectations by removing explicit Times(1) calls.
data/set/work/test/mixin_mocks.go Adds generated GoMock for data set work mixin(s).
data/set/work/test/mixin.go Adds data set work metadata test helpers.
data/set/work/mixin.go Refactors data set work mixin into interfaces + impl supporting work-metadata integration.
data/service/service/standard.go Updates Oura dependency wiring and calls EnsureWork during coordinator initialization.
data/raw/work/test/mixin.go Adds data raw work metadata test helpers.
data/raw/work/mixin.go Refactors data raw work mixin into interfaces + impl supporting parsed metadata, content lifecycle, and work-metadata integration.
customerio/work/event/processor.go Migrates customer.io event processor to typed work metadata and encodes work metadata on creation.
auth/providersession/work/test/mixin_mocks.go Adds generated GoMock for provider session work mixin(s).
auth/providersession/work/test/mixin.go Adds provider session work metadata test helpers.
auth/providersession/work/mixin.go Refactors provider session work mixin into interfaces + impl supporting work-metadata integration.
Comments suppressed due to low confidence (3)

work/base/processor.go:1

  • On decode failure, decodeMetadata calls p.Failed(err), but Failed now attempts encodeMetadata() first. That can overwrite p.work.Metadata (and lose the original invalid metadata that caused the decode error) before recording the failure. Consider returning p.processResultBuilder.Failed(p.context, p.work, err) directly (or introducing an internal fail helper that does not encode) so the failing work preserves the original metadata for debugging/retry analysis.
    oura/work/processors/processors.go:1
  • EnsureWork currently only validates dependencies and does not actually ensure any work exists. This is also invoked from data/service/service/standard.go with log messaging implying side effects. Either implement the intended 'ensure' behavior (e.g., create required baseline work items) or rename this function to something like ValidateDependencies to avoid misleading callers and future operators.
    work/base/processor_factory_test.go:1
  • This test previously finalized the gomock controller via AfterEach(mockController.Finish()). With that removed, unmet expectations may no longer fail the test (and mocks may leak across specs depending on setup). If this file uses gomock.NewController, reintroduce a Finish() via AfterEach or DeferCleanup(mockController.Finish) to ensure gomock assertions run reliably.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread data/work/device_hashes.go
Comment thread customerio/work/event/processor.go
Comment thread customerio/work/event/processor.go
Comment thread data/source/work/mixin.go
Comment thread data/work/device_hashes_test.go
Comment thread data/work/device_hashes_test.go
@darinkrauss darinkrauss force-pushed the darin/refactor-work-mixins branch from 104daa2 to b7199d9 Compare March 19, 2026 00:17
- Refactor work mixins
- Refactor work base process to allow generic work metadata
- Automatically encode and decode work metadata when necessary
- Update work mixins to use generic work metadata
- Update oura processors to use generic work metadata
- Split oura processors and process factories into separate files
- Use interfaces for work mixins to ease usage and testing
- Add and update many tests
@darinkrauss darinkrauss force-pushed the darin/refactor-work-mixins branch from b7199d9 to 822feb8 Compare March 19, 2026 00:19
@darinkrauss
Copy link
Copy Markdown
Contributor Author

Updates based upon feedback included in later PR.

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