docs(openspec): backfill missing proposals

This commit is contained in:
Draculabo committed 2026-02-08 01:12:17 +08:00
1 parent a93c6d0cea
commit 287e848b32
16 files changed
+451

No files matched your search

@@ -0,0 +1,35 @@
## Context
The stability of account injection and detection differs across platforms, with risks concentrated in:
- DB lock conflicts causing unstable writes.
- Version-detection failures causing incorrect injection-path routing.
- Compatibility boundaries introduced by OS behavior differences.
## Goals / Non-Goals
- Goals:
- Improve cross-platform write and switching stability.
- Define clear priority between version detection and capability probing.
- Improve observability and troubleshooting efficiency.
- Non-Goals:
- Extend support to non-default runtime configuration path parsing.
- Introduce new business strategies.
## Decisions
- Decision: Transactionalize the write flow to reduce partial-success risk.
- Decision: Add DB busy retry and `busy_timeout`.
- Decision: On version-detection failure, use `package.json` as Windows fallback source.
- Decision: Give capability probing higher priority than version detection; prefer new format when a new-format key is detected.
## Risks / Trade-offs
- A stricter write flow may add minor latency.
- Running capability probing and version detection together increases implementation complexity.
## Migration Plan
1. Complete transactional writes and retry mechanisms.
2. Add version-detection cache and fallback.
3. Introduce strategy-based injection and capability probing.
4. Add corresponding tests and regression verification.
@@ -0,0 +1,35 @@
# Change: Cross-Platform Stability and Robustness Improvements (P0+P1+P2)
## Why
- Account injection and detection across platforms are vulnerable to DB locks, version-detection failures, and OS-level differences.
- Stability, diagnosability, and maintainability must improve without changing business semantics.
## What Changes
- Make the write flow atomic (transaction-wrapped).
- Add DB lock retry and `busy_timeout`.
- Add cache and lower-noise logging for version detection.
- Add a more robust Windows fallback for version detection (read from `package.json`).
- Introduce strategy-based injection routing (new/legacy/dual-write).
- Add capability probing: prefer new format when new-format keys are detected.
## Impact
- Affected specs: `ide-auth-compat`
- Affected code:
- `src/ipc/database/cloudHandler.ts`
- `src/ipc/database/handler.ts`
- `src/utils/antigravityVersion.ts`
- `src/utils/paths.ts` (this stage covers default runtime configuration path only)
- `src/types/db.ts`
## Constraints
- Do not change existing business semantics; only improve stability and structure.
- This stage only covers the default runtime configuration path.
## Risks
- Transaction and retry logic may change when errors surface.
- Capability probing may conflict with version detection unless priority is clearly defined.
@@ -0,0 +1,42 @@
## ADDED Requirements
### Requirement: Atomic Injection Writes
The system SHALL use transactions when writing IDE state to ensure atomic updates.
#### Scenario: Injection write consistency
- **WHEN** injecting new/legacy token formats
- **THEN** related keys are committed in a single transaction to avoid partial writes
### Requirement: DB Lock Retry
The system SHALL perform short backoff retries on SQLITE_BUSY or SQLITE_LOCKED.
#### Scenario: Successful DB lock retry
- **WHEN** a write encounters a lock
- **THEN** the system retries for a limited number of attempts and records logs
### Requirement: Version Detection Cache
The system SHALL cache IDE version-detection results in-process to reduce repeated system calls.
#### Scenario: Version cache hit
- **WHEN** IDE version is requested multiple times
- **THEN** the system call is executed only once
### Requirement: Windows Version Detection Fallback
The system SHALL read `package.json` as a fallback source when Windows version detection fails.
#### Scenario: Windows version detection failure
- **WHEN** PowerShell fails to read version
- **THEN** version is obtained by falling back to `package.json`
### Requirement: Strategy-Based Injection
The system SHALL use a strategy pattern to split new/legacy/dual-write injection paths for clearer structure.
#### Scenario: Strategy selection
- **WHEN** version-based and capability-based routing differ
- **THEN** the system selects the corresponding injection implementation via strategy objects
### Requirement: Prefer New Format via Capability Probing
The system SHALL prefer new-format injection when new-format keys are detected.
#### Scenario: New-format key exists
- **WHEN** `antigravityUnifiedStateSync.oauthToken` exists
- **THEN** injection uses new format with higher priority
@@ -0,0 +1,17 @@
## 1. Scope and Planning Confirmation
- [ ] 1.1 Review `proposal.md`.
- [ ] 1.2 Finalize priority: capability probing vs version detection.
- [ ] 1.3 Confirm this stage covers default runtime configuration path only.
## 2. Implementation
- [x] 2.1 Make write flow transactional (atomic).
- [x] 2.2 Add DB lock retry and `busy_timeout`.
- [x] 2.3 Add version-detection cache and lower-noise logs.
- [x] 2.4 Add Windows fallback for version detection (`package.json`).
- [x] 2.5 Split injection path by strategy pattern.
- [x] 2.6 Add capability probing: prefer new format when new key is detected.
## 3. Verification
- [x] 3.1 Simulate SQLITE_BUSY/LOCKED retry behavior.
- [x] 3.2 Verify fallback path for version-detection failure.
- [x] 3.3 Verify capability-probing priority behavior.