Files
dataset-uploader/features/google_sheets_tracker/dynamic_column_range.feature

73 lines
3.4 KiB
Gherkin

Feature: Dynamic Column Range Calculation
As a developer
I want the tracker to calculate the optimal column range dynamically
So that API calls are efficient and don't fetch unnecessary data
Background:
Given an authenticated sheets tracker
Scenario: Calculate range for standard 3-column sheet
Given a sheet with headers "Dataset Name, Status, Error"
When I get the status of "wordnet"
Then the API should use range "Sheet1!A:C" instead of "Sheet1!A:Z"
Scenario: Calculate range with checkpoint columns
Given a sheet with headers "Dataset Name, Status, Error, Last Shard, Total Rows"
When I get the status of "wordnet"
Then the API should use range "Sheet1!A:E" instead of "Sheet1!A:Z"
Scenario: Calculate range with all columns including last updated
Given a sheet with headers "Dataset Name, Status, Error, Last Shard, Total Rows, Skip Descriptions, Last Updated"
When I get the status of "wordnet"
Then the API should use range "Sheet1!A:G" instead of "Sheet1!A:Z"
Scenario: Fallback to Z when no columns identified
Given a sheet with headers "Unknown1, Unknown2, Unknown3"
When I get the status of "wordnet"
Then the API should use range "Sheet1!A:Z" as fallback
Scenario: Calculate range for get_checkpoint with checkpoint columns
Given a sheet with headers "Dataset Name, Status, Last Shard, Total Rows, Skip Descriptions, Last Updated"
And a sheet with the following datasets
| Dataset Name | Status | Last Shard | Total Rows | Skip Descriptions | Last Updated |
| wordnet | IN PROGRESS | 5 | 1000 | 50 | 2026-01-30 |
When I get checkpoint for "wordnet" at row 2
Then the checkpoint API should use range "Sheet1!A2:F2" instead of "Sheet1!A2:Z2"
Scenario: Dynamic range for sparse column layout
Given a sheet with headers "Dataset Name, Filler1, Filler2, Status, Filler3, Error, Filler4, Last Shard"
When I get the status of "wordnet"
Then the API should calculate max column index correctly
And the API should use range up to column H
Scenario: Dynamic range with only status column
Given a sheet with headers "Dataset Name, Status"
When I get the status of "wordnet"
Then the API should use range "Sheet1!A:B" instead of "Sheet1!A:Z"
Scenario: Dynamic range with only error column
Given a sheet with headers "Dataset Name, Error"
When I get the status of "wordnet"
Then the API should use range "Sheet1!A:B" instead of "Sheet1!A:Z"
Scenario: Range calculation handles None columns gracefully
Given a sheet with headers "Dataset Name"
When I get the status of "wordnet"
Then the API should use range "Sheet1!A:Z" as fallback due to missing columns
Scenario: Range calculation for checkpoint with partial columns
Given a sheet with headers "Dataset Name, Last Shard"
And a sheet with the following datasets
| Dataset Name | Last Shard |
| wordnet | 3 |
When I get checkpoint for "wordnet" at row 2
Then the checkpoint API should use range "Sheet1!A2:B2"
Scenario: Optimize API calls by avoiding unnecessary column fetches
Given a sheet with headers "Dataset Name, Status, Error"
And multiple datasets with data in columns A through C only
When I get the status of "wordnet"
Then no data from columns D through Z should be fetched
And API bandwidth should be optimized