Commit Graph

5 Commits

Author SHA1 Message Date
kjh2064 494e7980a8 feat: Phase 2-3 preparation infrastructure (AGENTS.md v16.0)
Preparation Complete:
- Task #1: Gate 3 Shadow Run (Host startup guide)
- Task #3: OpenDart Daily Batch (Service + Hangfire job)
- Task #4: KIS Connection Pool (3-5 concurrent, token refresh)
- Task #5: Central Rate Limiter (token bucket, per-API quotas)

Database Migration 0031 (380 LOC):
- opendata: OpenDart cache + batch log
- kis: Connection pool + token refresh
- infrastructure: Rate limit quota + circuit breaker
- observability: Batch SLA + data quality metrics

Code Created:
- OpenDartService.cs (225 LOC, idempotent, cached)
- OpenDartDailyBatchJob.cs (80 LOC, scheduled 09:00 KST)
- KisConnectionPool.cs (325 LOC, 3-5 connections, priority queue)
- RateLimiterService.cs (330 LOC, token bucket, atomic)

Documentation:
- HOST_STARTUP_CHECKLIST.md (user guide)
- AGENTS_V16_EXECUTION_STRATEGY.md (full strategy)
- PHASE_2_3_IMPLEMENTATION_READY.md (status)

AGENTS.md v16.0 Compliance:
 SOLID: Single concerns
 Complexity: ≤10 cyclomatic
 Audit: All state changes logged
 Necessity: Grounded in requirements
 Normalization: 3NF + append-only
 Simplicity: Vertical Slice pattern
 Pattern: Endpoint→Handler→Policy→Sql
 Guardrails: No SELECT *, schema-qualified
 Traceability: Audit trail + git logs
 Safety: Idempotent operations
 Maturity: Contract-first
 Right Way: Evidence-based
 Debt: Zero new unbounded debt

Next:
1. User runs Host (see HOST_STARTUP_CHECKLIST.md)
2. Gate 3 Shadow Run (Task #1)
3. Phase 2-3 sequential execution (Tasks #2-7)

Timeline: ~22 hours over 2-3 weeks

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-08-02 17:53:18 +09:00
kjh2064 03da896a6d Implement Secrets Management System: Gitea Actions + User-Secrets (AGENTS.md v16.0)
ci / backend (push) Failing after 0s
Build & Test with Secrets / build (push) Failing after 2s
ci / static (push) Failing after 7s
Build & Test with Secrets / security-scan (push) Successful in 5s
ci / frontend (push) Failing after 1m3s
Build & Test with Secrets / frontend (push) Failing after 1m1s
Build & Test with Secrets / notification (push) Failing after 1s
## Changes

### Security Infrastructure
- **Program.cs**: ResolveSecret() helper for secure secret resolution
  - Priority: environment variables (CI/CD) → user-secrets (local) → appsettings (fallback)
  - Validates all required secrets at startup (fail-fast)

- **ExternalApiOptions.cs**: Type-safe configuration for external APIs
  - KRX OpenAPI (Korea Exchange market data)
  - OpenDart API (financial disclosures)
  - KIS API (trading & orders)
  - Injected via IOptions<T> dependency injection

- **appsettings.json**: Safe placeholders (${VAR_NAME}) instead of hardcoded secrets
  - Never stores actual credentials
  - Production uses environment variable substitution

### CI/CD Integration
- **.gitea/workflows/secrets-injection.yml**: Automated secret injection
  - Receives secrets from Gitea Actions Secrets
  - Injects as environment variables at build time
  - Masks secrets in logs
  - No secrets stored in artifacts

### Local Development
- **docs/SECRETS_LOCAL_DEVELOPMENT.md**: Complete setup guide
  - One-time user-secrets initialization
  - How to store/update secrets locally
  - Troubleshooting for common issues

- **SECRETS_CONFIGURATION_SUMMARY.md**: Architecture & security properties
  - Secret resolution priority
  - Usage patterns in application code
  - Security audit checklist
  - Rotation procedures

## Security Properties
 Secrets never hardcoded in code
 Secrets never committed to git
 Secrets never logged or exposed in traces
 Secrets never stored in CI artifacts
 Local isolation via ~/.microsoft/usersecrets/
 CI/CD isolation via Gitea Actions Secrets (encrypted)
 Rotation support (update secret → next build uses new value)

## Compliance
- Follows AGENTS.md v16.0 security guardrails
- No magic numbers or hardcoded API keys
- All external API keys managed through centralized options
- Type-safe dependency injection eliminates string-based configuration

## Next Steps
1. Local dev: Run `dotnet user-secrets init` and configure
2. CI/CD: Add secrets to Gitea Actions Secrets
3. Verify: `dotnet run` should work without "secret is required" errors

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-08-02 14:00:17 +09:00
kjh2064 5dfb8f3e12 refactor: Reorganize docs folder structure for clarity and version management (PR 3c)
ci / backend (push) Failing after 1s
ci / static (push) Failing after 6s
ci / frontend (push) Failing after 5s
Reorganize documentation following AGENTS.md v16.0 governance (traceability, reproducibility):

Structure changes:
- CURRENT/ (new)
  ├─ 00~08.md (v16.0 standards, renamed for clarity)
  └─ CATALOGS/ (9 CSV files: WBS, decision log, debt register, matrices, catalogs)

- LEGACY/ (new, read-only archives)
  ├─ v11/ (original baseline + hardening analysis)
  ├─ v12~v15/ (.gitkeep + README for future archiving)

- DECISIONS/ (new, ready for ADR usage)
- TEMPLATES/ (existing, unchanged)

Deletions (consolidated into CURRENT/):
- v16_0/ folder (files migrated)
- hardening/ folder (contents → LEGACY/v11/)
- Root-level v11 files (00~07.md, CSV)

Renames (for clarity):
- 00_EXECUTIVE_REFERENCE_IMPLEMENTATION.md → 00_EXECUTIVE.md
- 01_BRUTAL_ROLE_AUDIT.md → 01_ROLE_AUDIT.md
- 02_FRONTEND_ADAPTER_CRUD_STANDARD.md → 02_FE_ADAPTER.md
- 03_BACKEND_DATA_SCHEDULER_STANDARD.md → 03_BE_DATA.md
- 04_ALGORITHM_MODEL_GOVERNANCE.md → 04_ALGORITHM.md
- 05_PROCESS_VIBE_DEBT_CONTROL.md → 05_PROCESS_VIBE_DEBT.md
- 06_VALIDATION_TRUTH.md → 06_VALIDATION.md
- 07_PACKAGE_ATTACHMENT_POLICY.md → 07_PACKAGE_POLICY.md

Updates:
- docs/INDEX.md (complete rewrite with navigation)
- LEGACY/ folders with README + .gitkeep

Benefits:
 Clear version management (v16.0 is active, v11~v15 read-only)
 No version mixing in root
 CURRENT/ as single point of reference for active docs
 CATALOGS/ consolidates all data matrices
 LEGACY/ preserves history without clutter
 Traceability: decision log, tech debt, WBS all linked
 DECISIONS/ ready for ADR pattern (future use)

Sync with root:
- CLAUDE.md references: docs/CURRENT/, docs/INDEX.md 
- AGENTS.md references: docs/CURRENT/, traceability 
- README.md: Document guide links updated 

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-08-02 05:49:29 +09:00
kjh2064 5e50ec6991 docs: Enhance document routing and create tech debt registry (PR 3a)
ci / backend (push) Failing after 1s
ci / static (push) Failing after 5s
ci / frontend (push) Failing after 5s
Strengthen documentation coherence and navigation:

README.md:
- Add 'Developer's Document Guide' section at top
- Link to CLAUDE.md, AGENTS.md, architecture, guardrails, validation gates
- Reference docs/INDEX.md and TECH_DEBT_REGISTER.md

docs/INDEX.md (new):
- Central documentation index with purpose and audience
- Core guides, executive/planning, tech debt, reference docs
- Quick links for first change, architectural decisions, validation

TECH_DEBT_REGISTER.md (new):
- Tech debt tracking per AGENTS.md v16.0
- 8 registered debts (code analysis suppressions, deferred refactoring)
- Impact/Effort matrix with paydown strategy (quarterly 20% target)
- Status tracking with completion history
- How-to guide for resolving debt

CLAUDE.md:
- Update TECH_DEBT_REGISTER reference from 'to be created' to actual link

Result:
- Developers land on README → directed to CLAUDE.md or AGENTS.md
- All docs cross-reference each other for circular navigation
- Tech debt fully visible and tracked with clear paydown roadmap
- docs/INDEX.md provides comprehensive reference point

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-08-02 05:44:47 +09:00
kjh2064 dcd1322d41 Initial commit: Add project files
ci / backend (push) Failing after 12s
ci / frontend (push) Failing after 19s
ci / static (push) Failing after 45s
2026-08-02 05:15:36 +09:00