fix(govern): send the sync_type of the path that syncs the session

Description

glab govern audit sync always sent sync_type: hook when creating a session, so GitLab could not tell sessions the hooks synced from sessions the fallback periodic sync picked up. That is the first server-side signal of whether the hooks are missing sessions.

This MR sends the sync_type of the path that first syncs the session:

  • fallback for --all, which the fallback periodic sync runs.
  • hook for the Stop and SessionEnd hooks, which are the only callers that pass --silent without --all.
  • manual when the command is run directly.

GitLab keeps the value sent when it creates the session, so a session first synced by a hook stays hook when --all later syncs it.

Resolves gitlab#633669 (closed)

Related to gitlab-org/gitlab#633647 and gitlab-org/gitlab#633649.

How has this been tested?

  • TestSyncAll_UploadsRecordedSession now asserts that --all sends fallback.
  • New TestSyncSession_ReportsSyncType covers hook (with --silent) and manual (without). Both assertions fail on main, which sends hook for every path.
  • go test ./internal/commands/govern/... passes, golangci-lint (pinned 2.14.0) reports 0 issues, and the comment-overlap gate and generated-docs check pass.

🤖 Generated with Claude Code

Merge request reports

Loading
Loading