Skip to content

fix: log workspace create/update/delete to activity trail#392

Open
Ashutoshx7 wants to merge 1 commit into
LF-Decentralized-Trust-labs:mainfrom
Ashutoshx7:fix/workspace-audit-trail
Open

fix: log workspace create/update/delete to activity trail#392
Ashutoshx7 wants to merge 1 commit into
LF-Decentralized-Trust-labs:mainfrom
Ashutoshx7:fix/workspace-audit-trail

Conversation

@Ashutoshx7

Copy link
Copy Markdown
Contributor

Summary

Workspace mutations under /subprojects/:id/workspaces were completing without writing to activity_log. Every other mutation endpoint in the codebase properly logs to the audit trail, but these three workspace routes were missed when the subproject workspace feature was added.

This is a violation of v1-spec section 15.3: "every mutation writes activity_log."

What changed

Added logActivity() calls to all three workspace mutation routes in subprojects.ts:

Route Action logged
POST /subprojects/:id/workspaces workspace.created
PATCH /subprojects/:id/workspaces/:workspaceId workspace.updated
DELETE /subprojects/:id/workspaces/:workspaceId workspace.deleted

Each entry includes proper actor info (actorType, actorId, agentId), project scoping, and entity tracking - matching the pattern used by parent subproject routes.

Type of Change

  • fix

How Was This Tested?

  • Unit tests
    Added 4 regression tests in workspace-audit-trail.test.ts:
  • Verifies workspace.created is logged on POST
    • Verifies workspace.updated is logged on PATCH
    • Verifies workspace.deleted is logged on DELETE
    • Confirms actor info from session is included in all entries
      All 48 test files pass (205 tests total).

CE & Security Check

  • Targets GitMesh CE only (no EE code)
  • - [x] No secrets or credentials committed

Checklist

  • Code follows project style
  • - [x] Self-reviewed
  • - [x] Tests updated/added where needed

Workspace mutations under /subprojects/:id/workspaces were completing
without writing to activity_log, unlike every other mutation endpoint.
This left a gap in the audit trail for three operations: create, update,
and delete.

Added logActivity calls after each workspace mutation with proper actor
info, project scoping, and entity tracking. Includes four regression
tests confirming the audit entries are written.

Signed-off-by: Ashutoshx7 <as1142120@gmail.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.

1 participant