Skip to content

Bugfix/questions 6mb payload limit - #47

Open
ivan5355 wants to merge 446 commits into
run-llama:devfrom
MichaelWalker-git:bugfix/questions-6mb-payload-limit
Open

Bugfix/questions 6mb payload limit#47
ivan5355 wants to merge 446 commits into
run-llama:devfrom
MichaelWalker-git:bugfix/questions-6mb-payload-limit

Conversation

@ivan5355

Copy link
Copy Markdown

Previously, the query fetched questions by project ID, which caused all questions across multiple opportunities to be loaded into the Lambda response, exceeding payload limits.

MichaelWalker-git and others added 30 commits January 29, 2026 12:28
Resolve merge conflicts:
- organization.spec.ts: Use simplified unauthenticated tests (auth tests in .auth.spec.ts)
- playwright.config.ts: Include cleanup project and proper comments
Remove unauthenticated test files that duplicate the authenticated
tests merged from PRs #57-67:

- knowledge-base.spec.ts → knowledge-base.auth.spec.ts
- projects.spec.ts → project-crud.auth.spec.ts
- proposals.spec.ts → proposal-generation.auth.spec.ts
- samgov.spec.ts → samgov-search.auth.spec.ts

The authenticated tests provide better coverage and the duplicates
were causing Playwright version conflicts.
The globalSetup option conflicts with the setup project that uses
testMatch for global-setup.ts. Remove the redundant globalSetup
option to match develop branch configuration.
…t-features

test(e2e): Add comprehensive e2e tests for recent features
* feat: Add Win/Loss Tracking data model and core APIs (Phase 1)

Add comprehensive Zod schemas for project outcome tracking:
- ProjectOutcome: WON, LOST, NO_BID, WITHDRAWN, PENDING statuses
- Debriefing: Post-loss debriefing workflow with deadline calculation
- FOIA: Freedom of Information Act request tracking
- Analytics: Monthly aggregation with win rate calculations

Add Lambda handlers for project outcome management:
- get-outcome: Retrieve project outcome by orgId and projectId
- set-outcome: Create/update project outcome with validation

Infrastructure updates:
- Add DynamoDB partition keys for new entities
- Update Jest config for CJS shared package compatibility
- Add DB types for project outcome entities

Test coverage:
- 240 tests for shared schemas (Vitest)
- 18 tests for Lambda handlers (Jest)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: Add comprehensive Sentry observability enhancements

- Add user identity context (id, email, orgId, role) to all errors
- Add custom breadcrumbs for key user actions (documents, answers, proposals, briefs)
- Enable feedback widget for bug reporting
- Add org/project context for error filtering
- Increase session replay rate (50% dev, 10% prod)
- Wrap remaining Lambda handlers with Sentry
- Enable profiling on client and server
- Configure distributed tracing between frontend and Lambda

New files:
- lib/sentry.ts: Centralized Sentry helpers and breadcrumb functions
- lib/hooks/use-sentry-context.ts: Hooks for setting org/project context

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
…kages

The browserProfilingIntegration and nodeProfilingIntegration require
@sentry/profiling-node package which is not installed. This was causing
Internal Server Errors in E2E tests.

Removed:
- nodeProfilingIntegration() from server config
- browserProfilingIntegration() from client config
- profilesSampleRate configuration

The other Sentry observability features (user context, breadcrumbs,
feedback widget, replay, distributed tracing) remain intact.
Replace `any` types with proper TypeScript interfaces in deadlines.ts:
- Add `Deadline` type export to shared package
- Type `deadlinesData` param as `DeadlinesSection`
- Type local `deadlineData` as `Partial<DeadlinesSection>`
- Type map callback param as `Deadline`

Addresses TODO comment and improves type safety for Sentry-related
deadline storage functionality.
Replace `any` types with proper TypeScript interfaces in helpers.ts:
- Export `RiskFlag` type from shared package
- Type `renderFlags` function param as `RiskFlag[]`
- Type `isSectionComplete` param as `ExecutiveBriefItem | null | undefined`
- Type `scoringPrereqsComplete` param as `ExecutiveBriefItem | null | undefined`
- Type `buildSectionsState` param as `ExecutiveBriefItem | null | undefined`

Improves type safety and enables better IDE support for brief helpers.
- Remove TODO comment (implementation is complete)
- Remove debug console.log statements
- Fix error handling to use proper `instanceof Error` check instead of `any` type
- Improve JSON parsing default to empty object

No functional changes - just code cleanup and type safety improvements.
Replace `any` types with proper TypeScript interfaces:
- Type SWR key tuple as `[string, string, string] | null`
- Change error type from `any` to `Error`
- Use generic type parameters for `setSectionField` and `setSubsectionField`
- Type XLSX rows as `(string | null)[][]`
- Use `instanceof Error` for error message extraction
- Add explicit type for filter callback index parameter

Reduces implicit any usage and improves IDE support.
Add proper null checks before spreading objects in:
- handleSectionChange: Check section exists before spreading
- handleSubsectionChange: Check section and subsection exist before spreading

This prevents potential undefined property spread and improves type safety.
* feat: content library update
* feat: docx template upload
The index-document handler was updated to require knowledgeBaseId,
but the test file was not updated accordingly. This caused CI to
fail because tests were missing the required knowledgeBaseId field.

Changes:
- Add knowledgeBaseId to all test events
- Fix mock function name: indexDocToPinecone -> indexChunkToPinecone
- Add getItem mock to return a document (required by handler)
- Add test case for missing knowledgeBaseId
The infrastructure directory uses npm (not pnpm), but a pnpm-lock.yaml
file was incorrectly added. This caused CDK deployment to fail with:

ValidationError: Multiple package lock files found: pnpm-lock.yaml,
package-lock.json. Please specify the desired one with `depsLockFilePath`.

The NodejsFunction construct in CDK auto-detects lock files and fails
when multiple are present.
- Fix project-context.test.tsx: Update mock to use `useCurrentOrganization`
  instead of `useOrganization` to match actual import

- Fix use-content-library.ts: Extract `data` field from API responses in
  fetcher functions. The API wraps responses in `{ data: ... }` but the
  fetchers were returning the full response object.

- Fix use-content-library.test.tsx: Update expected URL from
  `/content-library/items` to `/content-library/create-content-library`
  to match actual API endpoint.

These issues were introduced with the Feature/styled docx generator PR
and caused the Unit Tests workflow to fail.
React hooks must be called in the same order on every render.
The early return at line 43 was causing hooks to be called
conditionally, violating the rules of hooks.

Moved all hook calls to the top of the component before any
conditional returns.
The GitHub Actions cache has propagation delays that cause E2E test
jobs to not find the build artifacts even though the build job
completed successfully.

Switch from actions/cache to actions/upload-artifact and
actions/download-artifact which are more reliable for passing
data between jobs in the same workflow run.
* refactor: server-driven state for CancelPipelineButton

Replace local state management with server-driven UI pattern:

- Remove useState and useEffect from CancelPipelineButton
- Use SWR hook's isMutating state for loading indicators
- Replace onSuccess/onDelete/onRetry callbacks with single onMutate
- Parent components call mutate/refetch after mutations
- Server status is the single source of truth

This eliminates potential state synchronization bugs and follows
the existing SWR patterns used throughout the codebase.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test: add unit tests for CancelPipelineButton and stop-question-pipeline

Add comprehensive unit tests:

CancelPipelineButton (React component):
- Rendering based on status (PROCESSING, CANCELLED, etc.)
- Missing props handling
- Cancel/delete/retry button interactions
- onMutate callback invocation
- Error toast display on failures

stop-question-pipeline (Lambda):
- Request body validation
- Question file lookup (404 handling)
- Execution ARN validation (state machine mismatch)
- StopExecutionCommand integration
- Error handling (ExecutionDoesNotExist, etc.)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: ProjectDocuments fix after merge conflicts

* fix: question file dialog UI update

* fix: update organization context hook references to useCurrentOrganization

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
The upload-artifact action was only capturing 4 files instead of the
full Next.js build. Added:
- Debug step to show what's in the build directories
- Glob patterns (/**) to capture all files recursively
- if-no-files-found: error to fail if upload is incomplete
The .next directory was being ignored because it starts with a dot.
Set include-hidden-files: true to capture the full Next.js build.
Next.js creates files with colons in filenames (e.g., node:inspector)
which are invalid for GitHub artifacts upload. Solve this by:
1. Tar'ing the build directories into a single archive
2. Uploading the tar file as the artifact
3. Extracting the tar in the E2E test job
Document common mistakes and their solutions from recent CI/CD fixes:
- Test synchronization with code changes
- React hooks rules (must call before returns)
- API response handling consistency
- Package manager separation per directory
- GitHub Actions artifacts vs cache
- Next.js build artifacts with special characters
- Mock function naming requirements
…#75)

- Import and use `useKnowledgeBases` hook to fetch knowledge bases for the org
- Get orgId from project data to pass to the hook
- Sync knowledge bases to `availableIndexes` state
- Auto-select all indexes by default when loaded
- Set `organizationConnected` based on whether knowledge bases exist

This enables users to see and select which knowledge bases to use
for answer generation in the questions view.
* feat: Add Win/Loss Tracking data model and core APIs (Phase 1)

Add comprehensive Zod schemas for project outcome tracking:
- ProjectOutcome: WON, LOST, NO_BID, WITHDRAWN, PENDING statuses
- Debriefing: Post-loss debriefing workflow with deadline calculation
- FOIA: Freedom of Information Act request tracking
- Analytics: Monthly aggregation with win rate calculations

Add Lambda handlers for project outcome management:
- get-outcome: Retrieve project outcome by orgId and projectId
- set-outcome: Create/update project outcome with validation

Infrastructure updates:
- Add DynamoDB partition keys for new entities
- Update Jest config for CJS shared package compatibility
- Add DB types for project outcome entities

Test coverage:
- 240 tests for shared schemas (Vitest)
- 18 tests for Lambda handlers (Jest)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: Add Win/Loss Tracking data model and core APIs (Phase 1)

Add comprehensive Zod schemas for project outcome tracking:
- ProjectOutcome: WON, LOST, NO_BID, WITHDRAWN, PENDING statuses
- Debriefing: Post-loss debriefing workflow with deadline calculation
- FOIA: Freedom of Information Act request tracking
- Analytics: Monthly aggregation with win rate calculations

Add Lambda handlers for project outcome management:
- get-outcome: Retrieve project outcome by orgId and projectId
- set-outcome: Create/update project outcome with validation

Infrastructure updates:
- Add DynamoDB partition keys for new entities
- Update Jest config for CJS shared package compatibility
- Add DB types for project outcome entities

Test coverage:
- 240 tests for shared schemas (Vitest)
- 18 tests for Lambda handlers (Jest)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: Win/Loss Tracking - Phase 2: UI Components (#47)

* feat: Add Win/Loss Tracking data model and core APIs (Phase 1)

Add comprehensive Zod schemas for project outcome tracking:
- ProjectOutcome: WON, LOST, NO_BID, WITHDRAWN, PENDING statuses
- Debriefing: Post-loss debriefing workflow with deadline calculation
- FOIA: Freedom of Information Act request tracking
- Analytics: Monthly aggregation with win rate calculations

Add Lambda handlers for project outcome management:
- get-outcome: Retrieve project outcome by orgId and projectId
- set-outcome: Create/update project outcome with validation

Infrastructure updates:
- Add DynamoDB partition keys for new entities
- Update Jest config for CJS shared package compatibility
- Add DB types for project outcome entities

Test coverage:
- 240 tests for shared schemas (Vitest)
- 18 tests for Lambda handlers (Jest)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: Add Win/Loss Tracking UI components (Phase 2)

Add React components for project outcome tracking:
- ProjectOutcomeBadge: Status badge with icons for WON/LOST/PENDING/etc
- ProjectOutcomeCard: Card displaying outcome with win/loss details
- SetProjectOutcomeDialog: Modal form for setting project outcomes

Add SWR hooks for data fetching:
- useProjectOutcome: Fetch project outcome by orgId and projectId
- useSetProjectOutcome: POST to set/update project outcome

Test coverage:
- 34 tests for UI components (Jest + React Testing Library)
- Mock Dialog and Select components to avoid portal issues

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* Feature/win loss analytics phase2 (#80)

* feat: Add Win/Loss Tracking data model and core APIs (Phase 1)

Add comprehensive Zod schemas for project outcome tracking:
- ProjectOutcome: WON, LOST, NO_BID, WITHDRAWN, PENDING statuses
- Debriefing: Post-loss debriefing workflow with deadline calculation
- FOIA: Freedom of Information Act request tracking
- Analytics: Monthly aggregation with win rate calculations

Add Lambda handlers for project outcome management:
- get-outcome: Retrieve project outcome by orgId and projectId
- set-outcome: Create/update project outcome with validation

Infrastructure updates:
- Add DynamoDB partition keys for new entities
- Update Jest config for CJS shared package compatibility
- Add DB types for project outcome entities

Test coverage:
- 240 tests for shared schemas (Vitest)
- 18 tests for Lambda handlers (Jest)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: Add Win/Loss Tracking UI components (Phase 2)

Add React components for project outcome tracking:
- ProjectOutcomeBadge: Status badge with icons for WON/LOST/PENDING/etc
- ProjectOutcomeCard: Card displaying outcome with win/loss details
- SetProjectOutcomeDialog: Modal form for setting project outcomes

Add SWR hooks for data fetching:
- useProjectOutcome: Fetch project outcome by orgId and projectId
- useSetProjectOutcome: POST to set/update project outcome

Test coverage:
- 34 tests for UI components (Jest + React Testing Library)
- Mock Dialog and Select components to avoid portal issues

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: Add Debriefing Workflow (Phase 3) (#48)

Add Lambda handlers for debriefing management:
- create-debriefing: Create debriefing request with deadline calculation
- get-debriefing: Query debriefings for a project
- update-debriefing: Update status, schedule, findings, action items

Add React components for debriefing workflow:
- DebriefingStatusBadge: Badge for NOT_REQUESTED/REQUESTED/SCHEDULED/COMPLETED/DECLINED
- DebriefingCard: Card showing debriefing status with contact info and findings
- RequestDebriefingDialog: Form to submit debriefing request

Add hooks for debriefing data:
- useDebriefings: Fetch debriefings for a project
- useCreateDebriefing: Create new debriefing request
- useUpdateDebriefing: Update existing debriefing

Test coverage:
- 16 tests for Lambda handlers (Jest)
- 20 tests for UI components (Jest + React Testing Library)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* fix: small fix

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* feat: Add Win/Loss Tracking data model and core APIs (Phase 1)

Add comprehensive Zod schemas for project outcome tracking:
- ProjectOutcome: WON, LOST, NO_BID, WITHDRAWN, PENDING statuses
- Debriefing: Post-loss debriefing workflow with deadline calculation
- FOIA: Freedom of Information Act request tracking
- Analytics: Monthly aggregation with win rate calculations

Add Lambda handlers for project outcome management:
- get-outcome: Retrieve project outcome by orgId and projectId
- set-outcome: Create/update project outcome with validation

Infrastructure updates:
- Add DynamoDB partition keys for new entities
- Update Jest config for CJS shared package compatibility
- Add DB types for project outcome entities

Test coverage:
- 240 tests for shared schemas (Vitest)
- 18 tests for Lambda handlers (Jest)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: Add Win/Loss Tracking UI components (Phase 2)

Add React components for project outcome tracking:
- ProjectOutcomeBadge: Status badge with icons for WON/LOST/PENDING/etc
- ProjectOutcomeCard: Card displaying outcome with win/loss details
- SetProjectOutcomeDialog: Modal form for setting project outcomes

Add SWR hooks for data fetching:
- useProjectOutcome: Fetch project outcome by orgId and projectId
- useSetProjectOutcome: POST to set/update project outcome

Test coverage:
- 34 tests for UI components (Jest + React Testing Library)
- Mock Dialog and Select components to avoid portal issues

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: Add Debriefing Workflow (Phase 3)

Add Lambda handlers for debriefing management:
- create-debriefing: Create debriefing request with deadline calculation
- get-debriefing: Query debriefings for a project
- update-debriefing: Update status, schedule, findings, action items

Add React components for debriefing workflow:
- DebriefingStatusBadge: Badge for NOT_REQUESTED/REQUESTED/SCHEDULED/COMPLETED/DECLINED
- DebriefingCard: Card showing debriefing status with contact info and findings
- RequestDebriefingDialog: Form to submit debriefing request

Add hooks for debriefing data:
- useDebriefings: Fetch debriefings for a project
- useCreateDebriefing: Create new debriefing request
- useUpdateDebriefing: Update existing debriefing

Test coverage:
- 16 tests for Lambda handlers (Jest)
- 20 tests for UI components (Jest + React Testing Library)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: Add FOIA Integration (Phase 4)

Phase 4 of Win/Loss Analytics feature - FOIA Integration:

Lambda handlers (4 handlers, 25 tests):
- create-foia-request: Create FOIA requests for LOST projects
- get-foia-requests: Query FOIA requests by project
- update-foia-request: Update status, tracking number, response notes
- generate-foia-letter: Generate formal FOIA letter text

Shared schemas:
- Updated FOIARequestItem with simplified fields
- Added FOIA_DOCUMENT_TYPES constant
- Added CreateFOIARequest/UpdateFOIARequest schemas
- Added GetFOIARequestsQuery schema

UI components (4 components, 49 tests):
- FOIAStatusBadge: Display FOIA request status
- FOIARequestCard: Main card for FOIA management
- CreateFOIARequestDialog: Form to create FOIA requests
- FOIALetterPreview: Preview/download/email FOIA letter

Hooks:
- useFOIARequests: Fetch FOIA requests for a project
- useCreateFOIARequest: Create new FOIA request
- useUpdateFOIARequest: Update existing FOIA request
- useGenerateFOIALetter: Generate FOIA letter text

Features:
- Support for 10 document types (SSEB report, SSDD, etc.)
- 20 business day deadline calculation
- Letter generation with proper statutory references
- Copy/download/email draft functionality

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: update tests

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* feat: implement sam gov api key setting for organizations, bugfix
MichaelWalker-git and others added 28 commits March 25, 2026 11:32
…ntent-library

Approve all q&a button for content library
fix: cluster answers, approve all questions, sentry spans
Avoid using local env for setting up pinecone api key
…ible-after-creation

[HOR-1911] Project not visible after creation fix
…-generated-rfp-documents

[HOR-1910] Export all for generated RFP documents
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
chore: update CLAUDE.md to reflect current monorepo structure
Prevents "Cannot read properties of undefined (reading 'icon')" crash
when status value is undefined or not in the config map.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…fined

fix: add fallback for undefined status in badge components
feat: assign users to project and opportunities
@vercel

vercel Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

@ivan5355 is attempting to deploy a commit to the LlamaIndex Team on Vercel.

A member of the Team first needs to authorize it.

The export.test.ts file tests 4 functions (estimateHeadingPages,
extractHeadingsFromHtml, expandTableOfContents, extractTocTitle) that
haven't been implemented yet, causing 37 test failures in CI.
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.

3 participants