Skip to content

feat: add OpenAI Projects as first-class assets (Phase 1)#31

Open
ori129 wants to merge 5 commits intomainfrom
feat/projects-phase1
Open

feat: add OpenAI Projects as first-class assets (Phase 1)#31
ori129 wants to merge 5 commits intomainfrom
feat/projects-phase1

Conversation

@ori129
Copy link
Owner

@ori129 ori129 commented Mar 17, 2026

Summary

  • Migration 012: adds asset_type VARCHAR(32) DEFAULT 'gpt' to gpts table + index, plus conversation_count / last_conversation_at placeholder columns for Phase 2
  • Compliance API: extracted _fetch_paginated() DRY helper; added fetch_all_projects() + _normalize_project() for the /projects endpoint
  • Pipeline: GPTs and Projects are now fetched in parallel with asyncio.gather; Projects fetch failure is non-fatal (logs warning, continues with GPTs only)
  • Mock data: 12 enterprise mock Projects across tier 1/2/3 (Sales, Legal, Engineering, HR, Finance, Marketing, Data + 5 abandoned)
  • Frontend: asset_type propagated to GPTItem type; Overview KPI card shows mini SVG ring chart (GPTs vs Projects breakdown); Employee Portal gets [ All ] [ GPTs ] [ Projects ] filter chip (hidden when no projects exist)
  • Tests: 10 new pipeline tests covering _normalize_project() edge cases (no config, no instructions, nested config), mock client, partial failure, and API propagation

Pre-Landing Review

No issues found.

Eval Results

No prompt-related files changed — evals skipped.

Test plan

  • All ruff lint checks pass
  • ruff format --check passes
  • TypeScript tsc --noEmit passes
  • 10 new backend tests for Projects phase 1 (TP1–TP10)
  • Existing auth tests (T1–T20) unchanged

What's next

  • [CONV-1] Conversation Intelligence Layer — Conversations/Messages API (tracked in TODOS.md)
    • conversation_count + last_conversation_at columns already in place from this PR

🤖 Generated with Claude Code

ori129 and others added 5 commits March 17, 2026 20:43
- VARCHAR(32) DEFAULT 'gpt' — supports 'gpt' | 'project'
- conversation_count + last_conversation_at placeholder columns for Phase 2
- Index ix_gpts_asset_type on asset_type
- GPT model + GPTRead schema updated with asset_type field

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Extract _fetch_paginated() helper: DRY pagination logic shared by GPTs and Projects
- Add fetch_all_projects() on ComplianceAPIClient using the /projects endpoint
- Add _normalize_project() static method: flattens Projects API envelope,
  handles nested/flat latest_config variants, always sets asset_type='project'
- Add fetch_all_projects() to MockComplianceAPIClient with 12 enterprise mock
  projects (3 tier-3 production, 4 tier-2 functional, 5 tier-1 experimental)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Use asyncio.gather(return_exceptions=True) to fetch GPTs and Projects concurrently
- GPT fetch failure propagates (required); Projects failure logs a warning and
  continues with GPTs only (non-fatal — partial results are better than none)
- Set asset_type on each GPT row during the store step
- Update log messages to say 'assets' instead of 'GPTs' where appropriate

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- types/index.ts: add asset_type field to GPTItem
- Overview.tsx: page subtitle shows GPT+Project breakdown; KPI 'Total Assets'
  card renders a mini SVG ring chart when projects exist
- Portal.tsx: [ All ] [ GPTs ] [ Projects ] filter chip appears when the
  registry contains at least one project (hidden when GPTs only)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers _normalize_project() edge cases (no latest_config, no instructions,
nested config variant, unix timestamp conversion), MockComplianceAPIClient
project fetch, partial failure handling via asyncio.gather, and end-to-end
asset_type propagation through the API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant