Skip to content

fix(eng-analytics): read stored ci flags as booleans - #131851

Closed
rnegron wants to merge 1 commit into
masterfrom
fix/eng-analytics-stored-bool-flags
Closed

rnegron wants to merge 1 commit into
masterfrom
fix/eng-analytics-stored-bool-flags

Conversation

@rnegron

@rnegron rnegron commented Nov 9, 2026

Copy link
Copy Markdown
Member

Problem

  • Engineering analytics reads that aggregate over a CI flag return a 500 whenever the stored CI views serve them, for example workflow_health.
  • The weekly CI digest lost its slow PR workflows section to this error (run).

Changes

  • Reads from the stored CI views cast is_merge_queue, is_rerun_copy and the other boolean flags back to UInt8.
  • Materialization writes a UInt8 flag to Delta Lake as Int16, and ClickHouse rejects Int16 as an If condition.
  • The cast happens on read, because a change to the view definition forces a full rebuild of both views.

How did you test this code?

  • Not run: the endpoint against production data.

Test rationale: the parity test in test_materialized_ci.py now stores the flags as Int16, like production, and runs countIf over each flag. It fails with the production error before the fix.

Release status

  • This change is behind a feature flag and is not available to users

Docs update

  • None.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Claude Code, claude-opus-5-5

Skills: /writing-tests, /writing-code-comments, /writing-pr-descriptions

More context for AI agents
  • Decisions: cast on read rather than in the view SQL, so no fingerprint change and no full rebuild.
  • Follow-ups: Depot GetUsage also returns 500 for the digest; that is a vendor-side failure this PR does not touch.
  • Read closely: _stored_select in logic/materialized_ci.py.

@rnegron rnegron self-assigned this Nov 9, 2026
@trunk-io

trunk-io Bot commented Nov 9, 2026

Copy link
Copy Markdown

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Trunk lane — backend Python lane (py:product:engineering_analytics)

This PR is assigned to the backend Python lane (py:product:engineering_analytics). It runs backend Python tests and may merge in parallel with PRs in other lanes.

✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

✅ Duplication (TypeScript) — clean

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

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