Archive experimental OpenSpec changes

This commit is contained in:
AI Bot
2026-04-17 19:35:25 +02:00
committed by Riyyi
parent b4b12b39b6
commit 01338cb671
39 changed files with 0 additions and 0 deletions
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-04-17
@@ -0,0 +1,44 @@
## Context
Current `Resolve` in `pkg/fetch/fetch.go`:
1. Initialize all packages with `Exists: true`
2. Check local DB, set `Installed: true` if found
3. Check sync DBs, set `Installed: false`
4. Check AUR, set `InAUR: true`
5. Error if not found anywhere
Bug: wrong default + wrong order + conflates two concerns.
## Goals / Non-Goals
**Goals:**
- Fix Resolve algorithm to correctly classify packages
- Separate "available" from "installed" concerns
**Non-Goals:**
- No new APIs or features
- No refactoring outside Resolve function
## Decisions
**Decision 1: Start with Exists: false**
- Default `Exists: false` (unknown) instead of `true`
- Only set true when confirmed in sync DBs
**Decision 2: Check sync DBs first**
- Order: sync → local → AUR
- First determine if package exists (anywhere)
- Then determine if installed (local only)
**Decision 3: Two-phase classification**
| Phase | Check | Sets |
|------|-------|-----|
| 1. Availability | sync DBs | Exists: true/false |
| 2. Installation | local DB | Installed: true/false |
| 3. Fallback | AUR | InAUR: true if not in sync |
## Risks / Trade-offs
- Minimal risk: localized fix only
- Trade-off: slight performance cost (check sync before local) - acceptable for correctness
@@ -0,0 +1,26 @@
## Why
The `Resolve` function in `pkg/fetch/fetch.go` has incorrect logic flow. It
initializes all packages with `Exists: true`, then checks local DB first, then
sync DBs, then AUR. This wrong order causes incorrect package state
classification - packages that exist only in AUR may be incorrectly marked as
found.
## What Changes
- Fix initialization: packages should start with `Exists: false` (unknown), not `true`
- Fix order: check sync DBs BEFORE local DB to determine availability
- Separate independent concerns: "available" (sync/AUR) from "installed" (local)
- All packages must validate: either `Exists: true` or `InAUR: true`
## Capabilities
### New Capabilities
- `package-resolve-logic`: Correct resolution algorithm for pacman packages
### Modified Capabilities
- None
## Impact
- `pkg/fetch/fetch.go`: `Resolve` function
@@ -0,0 +1,7 @@
## 1. Fix Resolve Function Logic
- [x] 1.1 Change initialization: start packages with Exists: false instead of true
- [x] 1.2 Reorder to check sync DBs BEFORE local DB
- [x] 1.3 Separate availability check (sync DBs) from installation check (local DB)
- [x] 1.4 Add AUR fallback for packages not in sync DBs
- [x] 1.5 Validate all packages have either Exists or InAUR before returning