Files
descrybe/docs/GO_IMPORT_CYCLE_FIX_V13.md
T
2026-10-16 00:34:06 +02:00

38 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Descrybe v13 – Go API/worker import-cycle hotfix
## Cause
`feeds/headers.go` imported `platformsettings` to encrypt authenticated feed HTTP headers. `platformsettings` already imports `processing`, which imports `catalog`, which imports `feeds`. This created a Go dependency cycle and prevented both API and worker builds.
## Correction
- Extracted the unchanged AES-256-GCM secret storage implementation into `internal/secretcrypto`, importing only `internal/config`.
- Updated `feeds/headers.go` to call `secretcrypto` directly.
- Retained `platformsettings.DeriveKey`, `.EncryptSecret`, and `.DecryptSecret` as compatible wrappers for existing callers and stored secrets.
- Preserved `enc:v1:` ciphertext format, key derivation, production fail-closed behavior, and plaintext rejection in production.
- Previous v12 Svelte JSON placeholders remain corrected in the complete ZIP.
No database migration is required, and no existing feed API keys need rotating as long as the encryption environment key stays unchanged.
## Deployment
Merge/copy this hotfix into the project, commit and push, then run `rb` on the server.
For a focused verification before deployment:
```bash
cd /var/www/descrybe/app/apps/api
/usr/local/go/bin/go test ./internal/secretcrypto
/usr/local/go/bin/go build -o /tmp/descrybe-api-verify ./cmd/api
/usr/local/go/bin/go build -o /tmp/descrybe-worker-verify ./cmd/worker
```
`rb` already builds the app and restarts it if preceding stages succeed.
## Tests and limitations
- Isolated Go 1.23 tests passed for encrypted feed header ↔ platform settings compatibility and production key handling.
- Static import graph of 29 internal Go packages: 0 dependency cycles.
- All 667 API Go source files parsed successfully.
- Full Go 1.25 API/worker build and full Svelte production build could not be executed in this environment; run the commands above in the deployment environment before production restart.