Skip to content

feat(taskrecord): introduce DAG task record and replay test framework - #924

Merged
kyasbal merged 5 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-noytrxzmxypu
Aug 31, 2026
Merged

kyasbal merged 5 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-noytrxzmxypu

Conversation

@kyasbal

@kyasbal kyasbal commented Aug 30, 2026

Copy link
Copy Markdown
Member

Summary

Introduces the taskrecord test utility framework, enabling recording and replaying of DAG task outputs for isolated unit testing, regression testing, and microbenchmarks.

Key Changes

  • Task Result Codec (pkg/testutil/taskrecord/codec.go): Serializes/deserializes task results with gzip compression.
  • Job Test Harness (pkg/testutil/taskrecord/harness.go, recorder.go, replayer.go):
    • JobTestHarness: Runs tasks in record mode or replay mode using recorded fixtures.
    • Automatically loads upstream dependency outputs without re-executing prerequisite DAG tasks.
  • Test Flags (internal/testflags): Adds -record-task-result, -replay-task-result, and -fixture-dir test flags.
  • Skill & Tooling:
    • Adds .agents/skills/task_record_replay/SKILL.md documenting fixture usage and pprof profiling recipes.
    • Adds make sync-task-fixtures in scripts/make/testing.mk.
  • Benchmark Integration: Implements fixture-based benchmark in googlecloudlogk8saudit/impl/parser_test.go.

Verification

  • go test ./pkg/testutil/taskrecord/... ./internal/testflags/...
  • All unit tests pass cleanly.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a task record and replay framework for benchmarking and profiling KHI DAG tasks, including a detailed guide, test flags, utility files, tests, and GCS sync scripts. The review feedback highlights critical issues in the replay interceptor, specifically a deadlock risk on panic or early return due to missing state cleanup, and high profiling overhead/file truncation from running profiling on every benchmark iteration. The reviewer suggested using defer blocks for state cleanup and managing profiling initialization and cleanup exactly once using sync.Once and t.Cleanup.

Comment thread pkg/testutil/taskrecord/harness.go Resolved
Comment thread pkg/testutil/taskrecord/harness.go Resolved
Comment thread pkg/testutil/taskrecord/replayer.go Resolved
@kyasbal kyasbal added type:refactor Code refactoring without behavioral change area:devenv Development environment, Makefile, and build tooling labels Aug 31, 2026
@kyasbal
kyasbal merged commit 5affdd6 into GoogleCloudPlatform:main Aug 31, 2026
16 checks passed
@kyasbal
kyasbal deleted the push-noytrxzmxypu branch August 31, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:devenv Development environment, Makefile, and build tooling type:refactor Code refactoring without behavioral change

1 participant