Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
3999bd6
refactor(csharp): make CloudFetch pipeline protocol-agnostic
Oct 31, 2025
d4bf907
fix(test): remove obsolete IDownloadResult.Link mock setup
Nov 6, 2025
ecb98f7
fix: remove license header from .sln file and exclude .sln from RAT
Nov 6, 2025
4c76034
refactor(csharp): make CloudFetch pipeline protocol-agnostic
Nov 7, 2025
8e5330c
refactor(csharp): make CloudFetch base classes protocol-agnostic
Nov 7, 2025
03e6de0
refactor
Nov 11, 2025
064dde9
refactor
Nov 11, 2025
4abda04
modify the design doc
Nov 12, 2025
e45211a
address comments
Nov 12, 2025
2d7d1ae
change trace method
Nov 13, 2025
dfc1042
feat(csharp): implement StatementExecutionResultFetcher for REST API
Nov 4, 2025
7077bb6
refactor(csharp): update StatementExecutionResultFetcher for late ini…
Nov 7, 2025
1944e4c
fix(csharp): handle HttpClient timeout when already used
Nov 7, 2025
ef62d2e
refactor(csharp): use separate HttpClient for CloudFetch downloads
Nov 7, 2025
318277c
fix(csharp): use GetStatementResponse.Result and follow next_chunk_in…
Nov 7, 2025
7ee918e
fix(csharp): handle HttpClient timeout when already used
Nov 7, 2025
e342483
refactor(csharp): use separate HttpClient for CloudFetch downloads
Nov 7, 2025
5a64421
fix(csharp): handle HttpClient timeout when already used
Nov 7, 2025
1d90aab
refactor(csharp): use separate HttpClient for CloudFetch downloads
Nov 7, 2025
dc86270
change design doc to split the work item
Nov 4, 2025
66f7736
feat(csharp): implement StatementExecutionStatement with CloudFetch s…
Nov 7, 2025
5ac2a9c
fix(csharp): handle HttpClient timeout when already used
Nov 7, 2025
1b54c1d
refactor(csharp): use separate HttpClient for CloudFetch downloads
Nov 7, 2025
4a604e3
fix(csharp): handle HttpClient timeout when already used
Nov 7, 2025
b7a705d
refactor(csharp): use separate HttpClient for CloudFetch downloads
Nov 7, 2025
cfc8ad7
add statement execution connection
Nov 4, 2025
d9ba980
feat(csharp): make StatementExecutionConnection inherit from AdbcConn…
Nov 4, 2025
200314f
fix(csharp): handle HttpClient timeout when already used
Nov 7, 2025
8fad980
refactor(csharp): use separate HttpClient for CloudFetch downloads
Nov 7, 2025
66bb062
fix(csharp): handle HttpClient timeout when already used
Nov 7, 2025
3ffe074
refactor(csharp): use separate HttpClient for CloudFetch downloads
Nov 7, 2025
f1edfb7
feat(csharp): implement InlineReader for inline result disposition
Nov 4, 2025
5ba7482
fix(csharp): handle HttpClient timeout when already used
Nov 7, 2025
41a2626
refactor(csharp): use separate HttpClient for CloudFetch downloads
Nov 7, 2025
43842f4
fix(csharp): use GetStatementResponse.Result and follow next_chunk_in…
Nov 7, 2025
fdfb28a
fix(csharp): handle HttpClient timeout when already used
Nov 7, 2025
9aa514e
refactor(csharp): use separate HttpClient for CloudFetch downloads
Nov 7, 2025
4daf2ed
feat(csharp): implement StatementExecutionStatement with CloudFetch s…
Nov 7, 2025
b40b48f
feat(csharp): implement protocol selection for REST API support
Nov 4, 2025
641f3ac
fix(csharp): use case-insensitive comparer when merging connection pr…
Nov 6, 2025
bd63247
fix(csharp): handle HttpClient timeout when already used
Nov 7, 2025
c49fb05
refactor(csharp): use separate HttpClient for CloudFetch downloads
Nov 7, 2025
90a8db2
fix(csharp): use GetStatementResponse.Result and follow next_chunk_in…
Nov 7, 2025
bc9f25f
fix(csharp): handle HttpClient timeout when already used
Nov 7, 2025
b4ddaeb
refactor(csharp): use separate HttpClient for CloudFetch downloads
Nov 7, 2025
1c69c67
feat(csharp): implement StatementExecutionStatement with CloudFetch s…
Nov 7, 2025
afc4e5a
feat(csharp): implement StatementExecutionStatement with CloudFetch s…
Nov 7, 2025
aaee5a8
feat(csharp): implement StatementExecutionStatement with hybrid dispo…
Nov 4, 2025
6f5994f
fix(csharp): use uppercase for API parameter values (disposition, for…
Nov 6, 2025
d6ee4df
fix(csharp): ensure wait_timeout is always set when not in direct res…
Nov 6, 2025
0b5062b
use external correct external link to determine cloudfetch result
Nov 7, 2025
8f5cca8
fix(csharp): implement RefreshUrlsAsync for REST API with 1-hour URL …
Nov 7, 2025
356693f
fix(csharp): update StatementExecutionStatement to use protocol-agnos…
Nov 7, 2025
816e621
fix(csharp): handle HttpClient timeout when already used
Nov 7, 2025
06f90db
refactor(csharp): use separate HttpClient for CloudFetch downloads
Nov 7, 2025
fd74266
fix(csharp): use GetStatementResponse.Result and follow next_chunk_in…
Nov 7, 2025
57648a7
fix(csharp): handle HttpClient timeout when already used
Nov 7, 2025
edae6c5
refactor(csharp): use separate HttpClient for CloudFetch downloads
Nov 7, 2025
3ac4a26
feat(csharp): implement StatementExecutionStatement with CloudFetch s…
Nov 7, 2025
ed1f41f
feat(csharp): implement StatementExecutionStatement with CloudFetch s…
Nov 7, 2025
17e16e5
feat(csharp): implement StatementExecutionStatement with hybrid dispo…
Nov 4, 2025
f1a5b6d
fix(csharp): implement RefreshUrlsAsync for REST API with 1-hour URL …
Nov 7, 2025
4892526
fix(csharp): update StatementExecutionStatement to use protocol-agnos…
Nov 7, 2025
00d2231
feat(csharp): implement StatementExecutionStatement with CloudFetch s…
Nov 7, 2025
fdeff60
feat(csharp): implement StatementExecutionStatement with hybrid dispo…
Nov 4, 2025
7b3c442
fix(csharp): implement RefreshUrlsAsync for REST API with 1-hour URL …
Nov 7, 2025
ee089ff
fix(csharp): update StatementExecutionStatement to use protocol-agnos…
Nov 7, 2025
3cd9832
feat(csharp): add JSON_ARRAY format support and complete GetObjects i…
Nov 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
325 changes: 325 additions & 0 deletions .claude/commands/PECO.Design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,325 @@
---
description: You are a senior developer and in this session, you need create a detailed design for a feature.
---

### User Input
```text
$ARGUMENTS
```

You **MUST** consider the user input before proceeding. If empty, ask the user for what to work on.

# Collect requirement from user

always collect enough information from user, this might be one or more of the following

## an existing design doc
in this case, we are working an existing doc either addressing review comments or change some of the designs.

## an PM requirement document
you will need review the doc and reconcile with existing design doc if there is one to make sure everything is in sync, if not, working on the change of design

## conversation with user
always good to ask a lot of clarification questions and probe users on overall requirement and corner cases



# Start the design by following below best practises

## Overview
This guide outlines best practices for writing technical design documents, based on lessons learned from code reviews.

---
## 1. Use Visual Diagrams Over Text

### βœ… DO:
- Use **mermaid diagrams** for all architectural illustrations
- Include **class diagrams** to show relationships between components
- Use **sequence diagrams** to illustrate data flow and interactions
- Render diagrams inline in markdown using mermaid code blocks

### ❌ DON'T:
- Use ASCII art for diagrams
- Describe flows in long text paragraphs
- Include large blocks of code to explain architecture

### Example:
```markdown
## Architecture
```mermaid
classDiagram
class TelemetryCollector {
+Record(event: TelemetryEvent)
+Flush()
}
class TelemetryExporter {
+Export(events: List~Event~)
}
TelemetryCollector --> TelemetryExporter
```
```

---

## 2. Focus on Interfaces and Contracts

### βœ… DO:
- Document **public APIs** and **interfaces**
- Show **contracts between components**
- Specify **input/output** parameters
- Define **error handling contracts**
- Document **async/await patterns** where applicable

### ❌ DON'T:
- Include detailed implementation code
- Show private method implementations
- Include complete class implementations

### Example:
```markdown
## ITelemetryCollector Interface

```csharp
public interface ITelemetryCollector
{
// Records a telemetry event asynchronously
Task RecordAsync(TelemetryEvent event, CancellationToken ct);

// Flushes pending events
Task FlushAsync(CancellationToken ct);
}
```

**Contract:**
- RecordAsync: Must be non-blocking, returns immediately
- FlushAsync: Waits for all pending events to export
- Both methods must never throw exceptions to caller
```

---

## 3. Remove Implementation Details

### βœ… DO:
- Focus on **what** the system does
- Explain **why** design decisions were made
- Document **integration points**
- Describe **configuration options**

### ❌ DON'T:
- Include internal implementation details
- Show vendor-specific backend implementations
- Document internal database schemas (unless part of public contract)
- Include proprietary or confidential information

---

## 4. Simplify Code Examples

### βœ… DO:
- Use **minimal code snippets** to illustrate concepts
- Show only **signature changes** to existing APIs
- Replace code with **diagrams** where possible
- Use **pseudocode** for complex flows

### ❌ DON'T:
- Include complete class implementations
- Show detailed algorithm implementations
- Copy-paste large code blocks

### Example:
```markdown
## DatabricksConnection Changes

**Modified Methods:**
```csharp
// Add telemetry initialization
public override async Task OpenAsync(CancellationToken ct)
{
// ... existing code ...
await InitializeTelemetryAsync(ct); // NEW
}
```

**New Fields:**
- `_telemetryCollector`: Optional collector instance
- `_telemetryConfig`: Configuration from connection string
```

---

## 5. Simplify Test Sections

### βœ… DO:
- List **test case names** with brief descriptions
- Group tests by **category** (unit, integration, performance)
- Document **test strategy** and coverage goals
- Include **edge cases** to be tested

### ❌ DON'T:
- Include complete test code implementations
- Show detailed assertion logic
- Copy test method bodies

### Example:
```markdown
## Test Strategy

### Unit Tests
- `TelemetryCollector_RecordEvent_AddsToQueue`
- `TelemetryCollector_Flush_ExportsAllEvents`
- `CircuitBreaker_OpensAfter_ConsecutiveFailures`

### Integration Tests
- `Telemetry_EndToEnd_ConnectionToExport`
- `Telemetry_WithFeatureFlag_RespectsServerSide`
```

---

## 6. Consider Existing Infrastructure

### βœ… DO:
- **Research existing solutions** before designing new ones
- Document how your design **integrates with existing systems**
- Explain why existing solutions are **insufficient** (if creating new)
- **Reuse components** where possible

### ❌ DON'T:
- Reinvent the wheel without justification
- Ignore existing patterns in the codebase
- Create parallel systems without explaining why

### Example:
```markdown
## Alternatives Considered

### Option 1: Extend Existing ActivityTrace Framework (PR #3315)
**Pros:** Reuses existing infrastructure, familiar patterns
**Cons:** ActivityTrace is designed for tracing, not metrics aggregation

### Option 2: New Telemetry System (Chosen)
**Rationale:** Requires aggregation across statements, batching, and different export format than traces
```

---

## 7. Address Concurrency and Async Patterns

### βœ… DO:
- Clearly mark **async operations** in interfaces
- Document **thread-safety** guarantees
- Explain **blocking vs non-blocking** operations
- Show **cancellation token** usage

### ❌ DON'T:
- Mix sync and async without explanation
- Leave thread-safety unspecified
- Ignore backpressure and resource exhaustion scenarios

### Example:
```markdown
## Concurrency Model

### Thread Safety
- `TelemetryCollector.RecordAsync()`: Thread-safe, non-blocking
- `TelemetryExporter.ExportAsync()`: Called from background thread only

### Async Operations
All telemetry operations are async to avoid blocking driver operations:
```mermaid
sequenceDiagram
Driver->>+Collector: RecordAsync(event)
Collector->>Queue: Enqueue(event)
Collector-->>-Driver: Task completed (non-blocking)
Collector->>+Exporter: ExportAsync(batch)
Exporter-->>-Collector: Task completed
```
```

---

## 8. Document Edge Cases and Failure Modes

### βœ… DO:
- Explain what happens during **failures**
- Document **circuit breaker** or retry logic
- Address **data loss** scenarios
- Show how **duplicate events** are handled

### ❌ DON'T:
- Only show happy path
- Ignore error scenarios
- Leave failure behavior undefined

### Example:
```markdown
## Error Handling

### Circuit Breaker Behavior
When export fails 5 consecutive times:
1. Circuit opens, drops new events (avoids memory exhaustion)
2. Sends circuit breaker event to server
3. Attempts recovery after 60s

### Duplicate Handling
If same statement reported multiple times:
- Backend merges by `statement_id`
- Uses latest timestamp for each metric type
```

---

## 9. Include Configuration Options

### βœ… DO:
- Document **all configuration parameters**
- Show **default values** and acceptable ranges
- Explain **opt-out mechanisms**
- Document **feature flags** and server-side controls

### Example:
```markdown
## Configuration

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `telemetry.enabled` | bool | `true` | Enable/disable telemetry |
| `telemetry.batch_size` | int | `100` | Events per batch (1-1000) |
| `telemetry.flush_interval_ms` | int | `5000` | Flush interval (1000-30000) |

**Feature Flag:** `spark.databricks.adbc.telemetry.enabled` (server-side)
```

---

## 10. Keep Sections Focused

### βœ… DO:
- Include only **necessary sections**
- Each section should answer **specific questions**
- Remove sections that don't add value

### ❌ DON'T:
- Include boilerplate sections "just because"
- Add sections that duplicate information
- Keep sections that reviewers flag as unnecessary

---

## Summary Checklist

Before submitting your design doc:

- [ ] All diagrams are in **mermaid format**
- [ ] Focus is on **interfaces, not implementations**
- [ ] **Internal details** removed
- [ ] Code examples are **minimal and relevant**
- [ ] Test sections show **case names, not code**
- [ ] **Existing infrastructure** considered and discussed
- [ ] **Async/thread-safety** clearly documented
- [ ] **Edge cases and failures** addressed
- [ ] **Configuration options** fully documented
- [ ] All sections are **necessary and focused**
- [ ] Design explains **why**, not just **what**

51 changes: 51 additions & 0 deletions .claude/commands/PECO.SprintPlanning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
description: Sprint planning assistant that creates a story and sub-tasks for a 2-week sprint based on high-level and detailed design documents.
---

### User Input
```text
$ARGUMENTS
```

You **MUST** consider the user input before proceeding. If empty, ask the user for a ticket number or task description to work on.

## Goal
Create a comprehensive sprint plan including a JIRA story and sub-tasks for a 2-week sprint cycle.

## Required Information
- High-level design document
- Detailed design document(s)
- Current project status and past tickets

You can ask for the exact path to design documents, or search the current folder based on a task description provided by the user.

## Steps

### Step 1: Gather Required Information
Ensure you have all necessary documents and context. Ask for additional details if needed:
- Design document paths or descriptions
- Related EPIC or parent ticket information
- Any specific constraints or requirements

### Step 2: Understand the Problem
Analyze the current state of the project:
- Read through the design documents thoroughly
- Review past tickets and their status
- Examine the current codebase to understand implementation status
- Identify what has been completed and what remains to be done

### Step 3: Define the Sprint Goal
Based on your analysis, propose a realistic goal for the 2-week sprint. Discuss the proposed goal with the user to ensure alignment and feasibility before proceeding.

### Step 4: Break Down Work into Sub-Tasks
After goal confirmation, create a detailed breakdown of work items:
- Each task should ideally be scoped to ~2 days of work
- Focus strictly on items within the sprint goal scope
- Ensure tasks are concrete and actionable

### Step 5: Create JIRA Tickets
After user confirmation of the task breakdown, create:
- One parent story for the sprint goal
- Individual sub-tasks for each work item identified in Step 4


Loading
Loading