Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
59 changes: 59 additions & 0 deletions .agentic-prompts/sprint_25_prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Summit Sprint 25+ Strategic Work — Next Priority Prompt

You are an autonomous agent assigned to Sprint 25+ for the BrianCLong/summit platform. The current system consists of:
- Full stack enterprise platform (React UI, Node/Express + GraphQL backend, Neo4j/PostgreSQL/TimescaleDB, Redis)
- Background orchestration with Maestro
- Golden Path CI (lint, smoke, quality gates)
- Active governance and security policies

Your mission this sprint is to concretely deliver the following prioritized work items while respecting existing architectural constraints, governance policies, and CI requirements.

## Deliverables

### 1. **Provenance & Lineage System**
- Extend the data model to capture **full data/AI provenance** for ingested telemetry, AI inferences, and analytic outputs.
- Implement an **immutable event log** (append-only) in TimescaleDB + Neo4j for traceability.
- Provide API endpoints and UI components to visualize provenance graphs centered on entity lifecycle.

### 2. **Predictive Analytics Module**
- Define schema and ingestion pipeline for predictive telemetry features (time series, anomaly scores, forecasting).
- Build a service module for **forecasting outcomes** (e.g., suspicious activity, entity risk score) using modular plug-in ML models with versioned metadata.
- Expose GraphQL queries tailored for predictive analytics and integrate them into the React UI dashboards.

### 3. **Agent-Driven Test Data Generator**
- Create a modular generator service that produces **realistic synthetic data** for key Summit domains (entities, events, metrics).
- Ensure generated data exercises **edge cases** and triggers CI test coverage across backend, API, and analytics layers.

### 4. **Governance & Policy Automation**
- Encode governance rules in machine-readable policies (e.g., Open Policy Agent) for:
• Data access
• CI pipeline enforcement
• AI outputs validation
• Provenance integrity constraints
- Implement automated enforcement and reporting hooks tied into the Golden Path CI.

### 5. **Golden Path CI Enhancements**
- Expand automated quality gates with:
• Security scanning for new dependencies
• ML model evaluation benchmarks
• Provenance completeness validation
- Update CI workflows with policy checks and automated rollback triggers on failure.

## Requirements & Constraints
- All deliverables must pass the Golden Path (`make smoke`) end-to-end test.
- Updates must include unit, integration, and governance policy tests.
- Deliverables must include **schema migration plans** and performance considerations.
- All APIs must be documented with schema and usage examples.
- Agent prompts and workflows must be captured in versioned prompt files under `.agentic-prompts/`.

## Outputs
For each deliverable:
1. A clear **task list** broken down into atomic work units (ready for sprint planning).
2. Proposed **APIs / schemas / UI designs** draft (Markdown + JSON/YAML).
3. **Testing blueprint** covering edge cases and golden path criteria.
4. CI configuration updates with required checks.

Start with a concise summary of design decisions (architecture, data flow, governance alignment) and then produce structured work items ready for PRs.

---
**Status**: Executed. Plan generated in `docs/sprints/sprint_25_plan.md`.
297 changes: 297 additions & 0 deletions .agentic-prompts/task-11847-fix-jest-esm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
# 🎯 CODEX TASK: Fix Jest ESM Configuration (#11847)

**Priority:** 1️⃣ BLOCKING - Must complete first
**Branch:** `agentic/fix-jest-esm-config`
**Estimate:** 2 hours
**Agent:** Claude Code (Infrastructure Track)

---

## 🎯 OBJECTIVE

Resolve all Jest ESM/CommonJS configuration mismatches for 100% passing tests.

---

## ✅ REQUIREMENTS

### 1. Create TypeScript Test Configuration
- [ ] Create `tsconfig.test.json` with CommonJS module settings
- [ ] Set `module: "commonjs"` for Jest compatibility
- [ ] Extend from base `tsconfig.json`
- [ ] Configure paths for test files

### 2. Update Jest Configuration
- [ ] Modify `jest.config.ts` to use `tsconfig.test.json`
- [ ] Configure proper ESM transform settings
- [ ] Remove `transformIgnorePatterns` warnings
- [ ] Enable correct preset for TypeScript + ESM

### 3. Fix Mock Implementations
- [ ] Fix `server/tests/mcp-client.test.ts` mock types
- [ ] Ensure mock return values match expected types
- [ ] Update all test files with `import.meta` errors

### 4. Update CI Workflow
- [ ] Modify `.github/workflows/ci-main.yml` to use test config
- [ ] Add explicit `--project tsconfig.test.json` flag
- [ ] Verify CI uses correct configuration

### 5. Validate All 510 Test Files
- [ ] Run full test suite: `pnpm test`
- [ ] Ensure zero failures
- [ ] Verify no ESM/CommonJS warnings

---

## 📦 OUTPUT FILES

### New Files
```
tsconfig.test.json
```

### Modified Files
```
jest.config.ts
server/tests/mcp-client.test.ts
.github/workflows/ci-main.yml
package.json (if test scripts need updates)
```

---

## 🧪 VALIDATION CRITERIA

### Must All Pass:
```bash
pnpm test # ✅ 0 failures, all tests passing
pnpm typecheck # ✅ 0 errors
pnpm lint # ✅ 0 errors
pnpm build # ✅ Success
```

### Specific Checks:
- ✅ No "import.meta not allowed" errors
- ✅ No mock implementation type errors
- ✅ No transformIgnorePatterns warnings
- ✅ All 510 test files execute successfully
- ✅ CI pipeline stays green

---

## 📝 IMPLEMENTATION GUIDE

### Step 1: Create `tsconfig.test.json`

```json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"types": ["jest", "node"]
},
"include": [
"**/*.test.ts",
"**/*.test.tsx",
"**/*.spec.ts",
"**/*.spec.tsx"
]
}
```

### Step 2: Update `jest.config.ts`

```typescript
import type { Config } from 'jest';

const config: Config = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/server', '<rootDir>/packages'],
testMatch: ['**/*.test.ts', '**/*.spec.ts'],
globals: {
'ts-jest': {
tsconfig: 'tsconfig.test.json',
useESM: false,
},
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/server/src/$1',
},
collectCoverageFrom: [
'server/src/**/*.ts',
'!server/src/**/*.d.ts',
'!server/src/**/*.test.ts',
],
coverageThreshold: {
global: {
branches: 70,
functions: 70,
lines: 70,
statements: 70,
},
},
};

export default config;
```

### Step 3: Fix Mock Implementation in `mcp-client.test.ts`

```typescript
// Before (broken):
const mockClient = {
request: jest.fn().mockResolvedValue({ result: {} }),
};

// After (fixed with correct types):
import { McpClient } from '../types';

const mockClient: jest.Mocked<Pick<McpClient, 'request'>> = {
request: jest.fn().mockResolvedValue({
result: {} as Record<string, unknown>
}),
};
```

### Step 4: Update CI Workflow

```yaml
# .github/workflows/ci-main.yml
- name: Run tests
run: pnpm test --project tsconfig.test.json
```

---

## 🔍 SUCCESS METRICS

- ✅ Zero test failures: `pnpm test` → all passing
- ✅ Zero type errors: `pnpm typecheck` → 0 errors
- ✅ Zero warnings in test output
- ✅ CI pipeline green checkmark
- ✅ All 510 test files execute
- ✅ No breaking changes to existing tests
- ✅ Test execution time ≤ baseline (no performance regression)

---

## 🚀 EXECUTION STEPS

1. **Create branch:**
```bash
git checkout main
git pull origin main
git checkout -b agentic/fix-jest-esm-config
```

2. **Implement solution:**
- Create `tsconfig.test.json`
- Update `jest.config.ts`
- Fix mock implementations
- Update CI workflow

3. **Validate locally:**
```bash
pnpm typecheck # Must pass
pnpm lint # Must pass
pnpm test # Must pass
pnpm build # Must succeed
```

4. **Commit and push:**
```bash
git add .
git commit -m "🤖 Fix #11847: Resolve Jest ESM configuration

- Created tsconfig.test.json with CommonJS settings
- Updated jest.config.ts to use test config
- Fixed mock implementations with proper types
- Updated CI workflow for test execution
- All 510 tests now passing

Validation:
- ✅ TypeScript: 0 errors
- ✅ Lint: 0 errors
- ✅ Tests: All passing (510/510)
- ✅ Build: Success

Agentic execution via Claude Code"

git push origin agentic/fix-jest-esm-config
```

5. **Create PR:**
```bash
gh pr create \
--title "Fix #11847: Resolve Jest ESM configuration issues" \
--body "## 🎯 Task Completion Report

**Issue:** Closes #11847
**Priority:** 1 (BLOCKING)
**Estimated Hours:** 2
**Actual Hours:** [FILL IN]

## ✅ Validation Checklist

- [x] TypeScript compilation: \`pnpm typecheck\` → 0 errors
- [x] Linting: \`pnpm lint\` → 0 errors
- [x] Unit tests: \`pnpm test\` → All passing (510/510)
- [x] Build: \`pnpm build\` → Success
- [x] No ESM/CommonJS warnings
- [x] CI pipeline: Green

## 📦 Files Changed

- \`tsconfig.test.json\` (new)
- \`jest.config.ts\` (updated)
- \`server/tests/mcp-client.test.ts\` (fixed mocks)
- \`.github/workflows/ci-main.yml\` (updated)

## 🧪 Testing Evidence

\`\`\`bash
$ pnpm test
Test Suites: 510 passed, 510 total
Tests: 2,847 passed, 2,847 total
Snapshots: 0 total
Time: 47.123 s
\`\`\`

🤖 **This PR was generated by agentic automation**" \
--assignee @me \
--label "agentic-execution,ready-for-review,priority-1"
```

6. **Monitor CI and merge when green**

---

## 🔧 TROUBLESHOOTING

### If tests still fail:
1. Check `pnpm test --verbose` for detailed errors
2. Verify `tsconfig.test.json` is being used
3. Clear Jest cache: `pnpm test --clearCache`
4. Check for conflicting TypeScript configs

### If type errors persist:
1. Run `pnpm typecheck --project tsconfig.test.json`
2. Check mock type definitions
3. Verify `@types/jest` is installed

---

## 📚 REFERENCES

- Jest ESM Support: https://jestjs.io/docs/ecmascript-modules
- ts-jest Configuration: https://kulshekhar.github.io/ts-jest/
- Issue #11847: https://github.com/brianclong/summit/issues/11847

---

**BEGIN IMPLEMENTATION NOW**
4 changes: 3 additions & 1 deletion .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# actionlint configuration
# https://github.com/rhysd/actionlint/blob/main/usage.md#config-file

self-hosted-runner: true

rules:
# Enforce action pinning by SHA
# This requires custom check or using a plugin if actionlint supports it directly.
Expand All @@ -14,4 +16,4 @@ rules:
# See: https://github.com/rhysd/actionlint/issues/192

# For this task, I'll provide the config that enables relevant checks.
"action-version": true
"action-version": true
Loading