Files
Excel-Pajak-Generator-Ak/openspec/specs/file-overwrite-control/spec.md
2026-03-09 08:54:42 +07:00

2.0 KiB

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