Skip to content

perf(clickhouse): prepare task event attribute inserts - #14

Open
anurag6569201 wants to merge 1 commit into
qa/agent-triggerdotdev-trigger-dev/pr-09-4860/basefrom
qa/agent-triggerdotdev-trigger-dev/pr-09-4860/head
Open

perf(clickhouse): prepare task event attribute inserts#14
anurag6569201 wants to merge 1 commit into
qa/agent-triggerdotdev-trigger-dev/pr-09-4860/basefrom
qa/agent-triggerdotdev-trigger-dev/pr-09-4860/head

Conversation

@anurag6569201

Copy link
Copy Markdown

Summary

Prepare task event writes for a later storage schema change without changing the table itself. Event attributes continue to be stored and read exactly as before.

Design

The event writer now names every insert column explicitly, ensuring attributes remains part of the input when the column becomes input-only. The remaining native attribute-path queries read the existing attributes_text representation through JSON extraction functions.

This PR does not alter the task_events_v2 schema.

Source merge-base: 43ecf15f80277c0eb931c08ddd89de55179cc795
Source head: 113b0d66f77c81717f28bae50f150227bcc79652

@shipwright-agent

Copy link
Copy Markdown

⚠️ Shipwright · Approve with conditions

Recommendation: approve PR #14 with conditions · Tier T3
Checks: 0 total · 0 needing attention

Next step: an authorized approver must satisfy the approval condition.

Findings (4)

  • HIGH The new TASK_EVENT_V2_INSERT_COLUMNS constant is defined as a bare array with a satisfies tuple constraint, but there is no comment explaining why explicit columns are required or · internal-packages/clickhouse/src/taskEvents.ts:179
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • HIGH The test asserts an exact JSON string for attributes_text, but JavaScript object key ordering is not guaranteed. · internal-packages/clickhouse/src/taskEvents.test.ts:61
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • HIGH The migration from ClickHouse map accessor syntax (attributes.gen_ai.response.model.:String) to JSONExtractString(attributes_text, ...) changes query semantics. · apps/webapp/app/services/admin/missingLlmModels.server.ts:29
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • MEDIUM The test expects attributes_text to be '{"a":"hello","nested":{"enabled":true},"z":1}', but the input attributes object is { z: 1, a: "hello", nested: { enabled: true } }. · internal-packages/clickhouse/src/taskEvents.test.ts:61
    • Fix: Fix the review finding before release.

Conditions

  • human approval required (T3): apply the approval label

Fireworks usage: 10,311 input · 531 output · 10,842 total tokens · $0.0026 · 11s · 0 fix iteration(s)

Open the Shipwright check for full evidence and the audit bundle. Use /shipwright rerun to verify again.

// V2 Table Functions (partitioned by inserted_at instead of start_time)
// ============================================================================

const TASK_EVENT_V2_INSERT_COLUMNS = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shipwright · HIGH

The new TASK_EVENT_V2_INSERT_COLUMNS constant is defined as a bare array with a satisfies tuple constraint, but there is no comment explaining why explicit columns are required or

Impact: The new TASK_EVENT_V2_INSERT_COLUMNS constant is defined as a bare array with a satisfies tuple constraint, but there is no comment explaining why explicit columns are required or what happens if the table schema changes. A future maintainer adding a column to TaskEventV2Input may not realize they must also update this list, causing silent data loss or insert failures.

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

expect(readError).toBeNull();
expect(rows).toEqual([
{
attributes_text: '{"a":"hello","nested":{"enabled":true},"z":1}',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shipwright · HIGH

The test asserts an exact JSON string for attributes_text, but JavaScript object key ordering is not guaranteed.

Impact: The test asserts an exact JSON string for attributes_text, but JavaScript object key ordering is not guaranteed. The input object { z: 1, a: 'hello', nested: { enabled: true } } may serialize in a different order across runtimes or V8 versions, causing intermittent CI failures. The test should parse attributes_text and compare objects.

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

columns: [
{ name: "model", expression: "attributes.gen_ai.response.model.:String" },
{ name: "system", expression: "attributes.gen_ai.system.:String" },
{

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shipwright · HIGH

The migration from ClickHouse map accessor syntax (attributes.gen_ai.response.model.:String) to JSONExtractString(attributes_text, ...) changes query semantics.

Impact: The migration from ClickHouse map accessor syntax (attributes.gen_ai.response.model.:String) to JSONExtractString(attributes_text, ...) changes query semantics. If attributes_text is not populated for older rows or is populated asynchronously, these queries may silently return empty results, causing the missing-model detection to skip spans and potentially under-bill or misreport LLM usage. No backfill or data migra…

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

expect(readError).toBeNull();
expect(rows).toEqual([
{
attributes_text: '{"a":"hello","nested":{"enabled":true},"z":1}',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shipwright · MEDIUM

The test expects attributes_text to be '{"a":"hello","nested":{"enabled":true},"z":1}', but the input attributes object is { z: 1, a: "hello", nested: { enabled: true } }.

Impact: The test expects attributes_text to be '{"a":"hello","nested":{"enabled":true},"z":1}', but the input attributes object is { z: 1, a: "hello", nested: { enabled: true } }. JSON object key ordering is not guaranteed by the JavaScript runtime, so this assertion can fail intermittently depending on insertion order. The test should parse the JSON and compare objects rather than asserting an exact string.

Suggested fix: Fix the review finding before release.

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