fix(files): index generated docs without compiling and fix the docx sandbox bundle - #7386
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR changes workspace-file indexing to resolve generated documents without compiling them, adds parser fallback and cancellation handling, validates regenerated document sandbox bundles, and synchronizes document-runtime storage configuration.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains in the eligible follow-up scope. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/workspace-files/search/extract.ts | Adds bounded, cancellation-aware resolution and text extraction without compiling generated documents. |
| apps/sim/lib/workspace-files/search/indexing.ts | Replaces the compile-or-load indexing path with the new read-only extraction helpers. |
| apps/sim/lib/uploads/contexts/workspace/workspace-file-manager.ts | Forwards abort signals to storage downloads and preserves cancellation errors. |
| apps/sim/lib/execution/sandbox/bundles/_polyfills.ts | Defines the missing sandbox bundle runtime helper with a fail-closed dynamic-require implementation. |
| apps/sim/lib/execution/sandbox/bundles/build.ts | Evaluates each generated bundle in a bare VM context before writing it. |
| apps/sim/lib/execution/sandbox/bundles/verify.ts | Adds reusable bare-context bundle evaluation and export-registration validation. |
| apps/sim/trigger.config.ts | Synchronizes document-sandbox templates and copilot artifact storage settings to workers. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
I[Workspace file indexer] --> R[Read stored bytes]
R --> D{Generated document?}
D -->|Compiled artifact exists| A[Read artifact]
D -->|Artifact unavailable| S[Index generation source as text]
D -->|Ordinary file| P[Parse stored bytes]
A --> P
P -->|Parsed content| X[Bound and index text]
P -->|Parser rejects UTF-8| T[Index raw text]
P -->|Parser rejects binary| K[Mark revision skipped]
Reviews (2): Last reviewed commit: "fix(files): surface download aborts and ..." | Re-trigger Greptile
There was a problem hiding this comment.
All reported issues were addressed across 12 files
Not reviewed (too large): apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs (~125 lines), apps/sim/lib/execution/sandbox/bundles/docx.cjs (~42 lines), apps/sim/lib/execution/sandbox/bundles/pdf-lib.cjs (~42 lines) - if these are generated or fixture files, add them to ignored paths to exclude them from future reviews.
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@icecrasher321 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 13 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Not reviewed (too large): apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs (~125 lines), apps/sim/lib/execution/sandbox/bundles/docx.cjs (~42 lines), apps/sim/lib/execution/sandbox/bundles/pdf-lib.cjs (~42 lines) - if these are generated or fixture files, add them to ignored paths to exclude them from future reviews.
Summary
.jsonfile wrapped in a markdown code fence, for example) falls back to raw text, and rejecting binary bytes marks the revision skipped instead of retrying three times and failing it.ReferenceError: __require is not definedon load since the docx 9.7.x bump: docx inlines JSZip's UMD together with esbuild's__requirehelper, and Bun's browser/iife build rewrites the barerequirereferences inside it to a runtime helper it never emits._polyfills.tsdefines the stub,build.tsevaluates every bundle in a barenode:vmcontext before writing it, and a test loads the checked-in bundles the same way. All three bundles are regenerated.trigger.config.tssyncs the doc-sandbox template variables and the copilot artifact bucket, so workers read generated documents through the compiler the app authored them for and can load the compiled artifacts. The values still have to exist in the Trigger.dev environment.Type of Change
Testing
bun run testfor the newextract.test.ts,verify.test.ts, andworkspace-file-manager-download.test.ts, plus the uploads, doc-compile, serve-route, and workspace-files suitesnode:vmsmoke: real docx, pdf, and pptx documents generated through the rebuilt bundlestype-check, lint,check:audits, boundary and egress checksRevisions that already failed are terminal (the dispatcher only re-claims
pending), so once the fixed worker is live and the worker environment has the doc template and copilot bucket, re-drive them:Checklist
🤖 Generated with Claude Code