Skip to content

feat: implement RecordActivity function and update CallerIdentity struct#1

Merged
pikann merged 3 commits into
masterfrom
feature/implement-record-activity-function
May 12, 2026
Merged

feat: implement RecordActivity function and update CallerIdentity struct#1
pikann merged 3 commits into
masterfrom
feature/implement-record-activity-function

Conversation

@pikann
Copy link
Copy Markdown
Contributor

@pikann pikann commented May 12, 2026

This pull request introduces a new mechanism for recording task-related activities in WASM builds, ensuring that activity events can be persisted and later processed. It also adds support for tracking the authenticated user's UUID in request contexts. The most important changes are:

Activity Recording Infrastructure:

  • Added a new RecordActivity function in wasm_backends.go to emit task-activity events, which are serialized and sent to the paca.activity_record host function for persistence. This function requires task, project, actor, and activity type information, along with JSON-encodable content.
  • Defined the hostActivityRecord WASM import in wasm_imports.go to allow WASM modules to call the host for recording activities.
  • Provided a no-op stub for RecordActivity in native_backends.go to ensure compatibility in non-WASM builds.

Request Context Enhancement:

  • Extended the CallerIdentity struct in request.go to include a UserID field, representing the authenticated user's UUID, which should be used as the actor ID when recording activities.

Copy link
Copy Markdown
Contributor

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

This PR adds a WASM-only activity recording pathway (via a new paca.activity_record host import) and extends request caller identity to include an authenticated user UUID intended to be used as the activity actor.

Changes:

  • Added hostActivityRecord WASM import and a new RecordActivity helper to serialize and emit task-activity records from WASM.
  • Added a native (non-WASM) no-op stub for RecordActivity to keep builds compatible.
  • Extended CallerIdentity with UserID for representing the authenticated user UUID.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
wasm_imports.go Declares the new paca.activity_record host import for WASM builds.
wasm_backends.go Implements RecordActivity and defines the JSON payload shape sent to the host.
native_backends.go Adds a non-WASM no-op RecordActivity stub.
request.go Extends CallerIdentity with UserID to carry authenticated user UUID.

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

Comment thread request.go
Comment thread wasm_backends.go
Comment thread wasm_backends.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot finished work on behalf of pikann May 12, 2026 03:14
Copilot finished work on behalf of pikann May 12, 2026 03:15
@pikann pikann merged commit c98314f into master May 12, 2026
4 checks passed
@pikann pikann deleted the feature/implement-record-activity-function branch May 12, 2026 03:17
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.

3 participants