init
This commit is contained in:
20
openspec/config.yaml
Normal file
20
openspec/config.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
schema: spec-driven
|
||||
|
||||
# Project context (optional)
|
||||
# This is shown to AI when creating artifacts.
|
||||
# Add your tech stack, conventions, style guides, domain knowledge, etc.
|
||||
# Example:
|
||||
# context: |
|
||||
# Tech stack: TypeScript, React, Node.js
|
||||
# We use conventional commits
|
||||
# Domain: e-commerce platform
|
||||
|
||||
# Per-artifact rules (optional)
|
||||
# Add custom rules for specific artifacts.
|
||||
# Example:
|
||||
# rules:
|
||||
# proposal:
|
||||
# - Keep proposals under 500 words
|
||||
# - Always include a "Non-goals" section
|
||||
# tasks:
|
||||
# - Break tasks into chunks of max 2 hours
|
||||
10
openspec/specs/excel-service-write-long/spec.md
Normal file
10
openspec/specs/excel-service-write-long/spec.md
Normal file
@@ -0,0 +1,10 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: ExcelService shall support writing long values
|
||||
The `ExcelService` class SHALL provide a `WriteExcel` overload that accepts a `long` value.
|
||||
|
||||
#### Scenario: WriteExcel with valid long value
|
||||
- **WHEN** `WriteExcel(string fileName, long value, int row, int column)` is called with valid parameters
|
||||
- **THEN** the system SHALL write the numeric `long` value to the specified cell
|
||||
- **AND** the cell type in Excel SHALL be numeric
|
||||
- **AND** the file SHALL be saved successfully
|
||||
39
openspec/specs/file-overwrite-control/spec.md
Normal file
39
openspec/specs/file-overwrite-control/spec.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# file-overwrite-control Specification
|
||||
|
||||
## Purpose
|
||||
TBD - created by archiving change add-file-overwrite-control. Update Purpose after archive.
|
||||
## Requirements
|
||||
### Requirement: ExcelService provides file overwrite control
|
||||
The ExcelService SHALL provide explicit control over whether existing files should be overwritten during initialization.
|
||||
|
||||
#### Scenario: Create new file when file does not exist
|
||||
- **WHEN** `InitExcel` is called with `overwrite=true` and file does not exist
|
||||
- **THEN** method creates new file and returns success with file path
|
||||
|
||||
#### Scenario: Overwrite existing file when overwrite is true
|
||||
- **WHEN** `InitExcel` is called with `overwrite=true` and file exists
|
||||
- **THEN** method overwrites existing file and returns success with file path
|
||||
|
||||
#### Scenario: Throw exception when file exists and overwrite is false
|
||||
- **WHEN** `InitExcel` is called with `overwrite=false` and file exists
|
||||
- **THEN** method throws `IOException` with message indicating file already exists
|
||||
|
||||
#### Scenario: Create file when overwrite is false and file does not exist
|
||||
- **WHEN** `InitExcel` is called with `overwrite=false` and file does not exist
|
||||
- **THEN** method creates new file and returns success with file path
|
||||
|
||||
#### Scenario: Preserve existing file behavior when overwrite parameter is not provided
|
||||
- **WHEN** `InitExcel` is called without the `overwrite` parameter
|
||||
- **THEN** method behaves as current implementation (overwrites file)
|
||||
|
||||
### Requirement: ExcelService maintains backward compatibility
|
||||
The ExcelService SHALL maintain existing behavior for all current method signatures and parameters.
|
||||
|
||||
#### Scenario: Existing code continues to work without changes
|
||||
- **WHEN** existing code calls `InitExcel` without the `overwrite` parameter
|
||||
- **THEN** method behaves identically to current implementation (overwrites file)
|
||||
|
||||
#### Scenario: Existing error handling patterns remain valid
|
||||
- **WHEN** existing code checks the result tuple for success/failure
|
||||
- **THEN** method returns same tuple structure and error types as current implementation
|
||||
|
||||
56
openspec/specs/formula-refresh/spec.md
Normal file
56
openspec/specs/formula-refresh/spec.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# Capability: Formula Refresh
|
||||
|
||||
## Purpose
|
||||
The Formula Refresh capability allows the system to recalculate all formulas in an Excel workbook and update their cached values. This is essential when data has been written to the workbook externally and the calculated results need to be persisted within the file itself.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: Refresh all formulas in workbook
|
||||
The ExcelService SHALL provide a public method `RefreshFormulas` that evaluates and recalculates all formulas in an Excel workbook.
|
||||
|
||||
#### Scenario: Successful formula refresh
|
||||
- **WHEN** a valid Excel file containing formulas is provided to `RefreshFormulas`
|
||||
- **THEN** all formulas in the workbook are evaluated
|
||||
- **AND** cached formula values are updated with recalculated results
|
||||
- **AND** the workbook is saved back to the file
|
||||
- **AND** the method returns `(success: true, result: <filePath>, error: null)`
|
||||
|
||||
#### Scenario: File not found
|
||||
- **WHEN** `RefreshFormulas` is called with a file path that does not exist
|
||||
- **THEN** the method returns `(success: false, result: null, error: FileNotFoundException)`
|
||||
|
||||
#### Scenario: Invalid or corrupted workbook
|
||||
- **WHEN** `RefreshFormulas` is called with a file that is not a valid Excel workbook
|
||||
- **THEN** the method returns `(success: false, result: null, error: <exception>)`
|
||||
- **AND** the original file remains unmodified
|
||||
|
||||
#### Scenario: Empty file path
|
||||
- **WHEN** `RefreshFormulas` is called with null or empty file path
|
||||
- **THEN** the method returns `(success: false, result: null, error: ArgumentException)`
|
||||
|
||||
### Requirement: Formula evaluation completeness
|
||||
The `RefreshFormulas` method SHALL evaluate all formula types across all sheets in the workbook.
|
||||
|
||||
#### Scenario: Multiple sheets with formulas
|
||||
- **WHEN** a workbook contains multiple sheets with formulas
|
||||
- **THEN** formulas in all sheets are evaluated
|
||||
- **AND** cross-sheet references are properly resolved
|
||||
|
||||
#### Scenario: Different formula types
|
||||
- **WHEN** a workbook contains various formula types (SUM, AVERAGE, IF, VLOOKUP, etc.)
|
||||
- **THEN** all formula types are evaluated correctly
|
||||
- **AND** formulas dependent on other formulas are evaluated in correct order
|
||||
|
||||
### Requirement: Resource management
|
||||
The `RefreshFormulas` method SHALL properly dispose of all resources including file streams and workbook objects.
|
||||
|
||||
#### Scenario: Proper disposal after successful refresh
|
||||
- **WHEN** formula refresh completes successfully
|
||||
- **THEN** all file streams are closed and disposed
|
||||
- **AND** the workbook object is disposed
|
||||
- **AND** no file locks remain on the Excel file
|
||||
|
||||
#### Scenario: Proper disposal after error
|
||||
- **WHEN** an exception occurs during formula refresh
|
||||
- **THEN** all allocated resources are still disposed
|
||||
- **AND** no file locks remain on the Excel file
|
||||
89
openspec/specs/postgresql-query/spec.md
Normal file
89
openspec/specs/postgresql-query/spec.md
Normal file
@@ -0,0 +1,89 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Configuration loading from appsettings.json
|
||||
The system SHALL load the PostgreSQL connection string from `appsettings.json` using the `ConnectionStrings:DefaultConnection` configuration key.
|
||||
|
||||
#### Scenario: Successful configuration loading
|
||||
- **WHEN** the application starts and `appsettings.json` exists with a valid `ConnectionStrings:DefaultConnection` entry
|
||||
- **THEN** the system shall successfully load the connection string
|
||||
- **AND** the connection string shall be available for database connections
|
||||
|
||||
#### Scenario: Missing connection string
|
||||
- **WHEN** the application starts and `appsettings.json` is missing the `ConnectionStrings:DefaultConnection` entry
|
||||
- **THEN** the system shall throw an `InvalidOperationException` with a clear error message indicating the missing configuration
|
||||
|
||||
#### Scenario: Invalid appsettings.json format
|
||||
- **WHEN** the application starts and `appsettings.json` contains invalid JSON
|
||||
- **THEN** the system shall throw a configuration exception indicating the JSON parsing error
|
||||
|
||||
### Requirement: Database query execution
|
||||
The system SHALL provide a function that accepts a SQL query string and returns the first column of the first row as a string value.
|
||||
|
||||
#### Scenario: Successful query execution with single result
|
||||
- **WHEN** a valid SQL query is executed that returns a single row with a single column
|
||||
- **THEN** the system shall return the value as a string
|
||||
- **AND** the database connection shall be properly opened and closed
|
||||
|
||||
#### Scenario: Query returning NULL value
|
||||
- **WHEN** a SQL query is executed that returns a NULL value in the first column of the first row
|
||||
- **THEN** the system shall return `null` instead of throwing an exception
|
||||
|
||||
#### Scenario: Query returning no rows
|
||||
- **WHEN** a SQL query is executed that returns zero rows
|
||||
- **THEN** the system shall return `null`
|
||||
|
||||
#### Scenario: Invalid SQL syntax
|
||||
- **WHEN** a SQL query with invalid syntax is executed
|
||||
- **THEN** the system shall throw a `PostgresException` with the PostgreSQL error details
|
||||
|
||||
#### Scenario: Database connection failure
|
||||
- **WHEN** the database server is unreachable or credentials are invalid
|
||||
- **THEN** the system shall throw a `PostgresException` or `NpgsqlException` with connection error details
|
||||
|
||||
### Requirement: Connection management
|
||||
The system SHALL properly manage database connections using proper disposal patterns to prevent connection leaks.
|
||||
|
||||
#### Scenario: Connection properly disposed after query
|
||||
- **WHEN** a query is executed successfully
|
||||
- **THEN** the database connection shall be disposed after the query completes
|
||||
- **AND** the connection shall be returned to the connection pool
|
||||
|
||||
#### Scenario: Connection disposed on exception
|
||||
- **WHEN** a query execution throws an exception
|
||||
- **THEN** the database connection shall still be properly disposed
|
||||
- **AND** no connection leak shall occur
|
||||
|
||||
### Requirement: Static Service Initialization
|
||||
The system SHALL provide a static method to initialize the database service with a connection string.
|
||||
|
||||
#### Scenario: Successful static initialization
|
||||
- **WHEN** the `Initialize` method is called with a valid connection string
|
||||
- **THEN** the static internal state shall be updated
|
||||
- **AND** subsequent query calls shall use this connection string
|
||||
|
||||
### Requirement: Synchronous Database Query Execution
|
||||
The system SHALL provide static functions that accept SQL query strings and return results synchronously.
|
||||
|
||||
#### Scenario: Successful synchronous query execution
|
||||
- **WHEN** a valid SQL query is executed via a static method
|
||||
- **THEN** the system shall return the result string synchronously
|
||||
- **AND** the database connection shall be properly opened and closed synchronously
|
||||
|
||||
### Requirement: Static Configuration Access
|
||||
The system SHALL provide static access to configuration properties through a dedicated service.
|
||||
|
||||
#### Scenario: Accessing connection string via static method
|
||||
- **WHEN** the static `GetConnectionString()` method is called
|
||||
- **THEN** it shall return the connection string from the internal static configuration
|
||||
- **AND** it shall throw an `InvalidOperationException` if the configuration is missing the required key
|
||||
|
||||
### Requirement: Static Configuration Initialization
|
||||
The system SHALL provide a way to initialize the static configuration state.
|
||||
|
||||
#### Scenario: Default static initialization
|
||||
- **WHEN** the configuration service is first accessed without explicit initialization
|
||||
- **THEN** it shall automatically load configuration from `appsettings.json`
|
||||
|
||||
#### Scenario: Explicit static initialization
|
||||
- **WHEN** the `Initialize` method is called with a custom `IConfiguration` object
|
||||
- **THEN** the static internal state shall be updated with the provided configuration
|
||||
Reference in New Issue
Block a user