feat: add job manager support for background job execution [AP-68]#544
Open
dougmartin wants to merge 4 commits intomasterfrom
Open
feat: add job manager support for background job execution [AP-68]#544dougmartin wants to merge 4 commits intomasterfrom
dougmartin wants to merge 4 commits intomasterfrom
Conversation
Implement IJobExecutor backed by Firebase so iframed interactives can create and track background jobs via the LARA interactive API. Includes a Firestore listener for real-time status updates, backfill on page reload via getJobs, and support for both authenticated and anonymous users. Wires JobManager into iframe-runtime.tsx following the existing PubSubManager pattern. - Add src/firebase-job-executor.ts with FirebaseJobExecutor singleton - Export getFirestoreDb() from firebase-db.ts; add emulator support - Wire JobManager into iframe-runtime.tsx (addInteractive/removeInteractive) - Call configure() in app.tsx for authenticated learners and anonymous users - Bump interactive-api-host to ^0.11.0-pre.0, lara-interactive-api to 1.13.0-pre.2 - Add unit tests (21 tests covering all executor methods)
… peer conflict @concord-consortium/dynamic-text@1.0.6 requires lara-interactive-api@">=1.8.0" as a peer dependency, but npm 7+ excludes pre-release versions from semver ranges, causing CI to fail on npm ci. legacy-peer-deps restores the old resolution behavior until stable versions of interactive-api-host and lara-interactive-api ship.
There was a problem hiding this comment.
Pull request overview
Adds host-side background job execution support to Activity Player by implementing an IJobExecutor backed by Firebase Cloud Functions + Firestore, and wiring it into the iframe runtime via the JobManager so iframed interactives can create/cancel/backfill jobs with real-time status updates.
Changes:
- Add
FirebaseJobExecutor(Cloud Function submit + Firestore onSnapshot listeners) and comprehensive unit tests. - Export
getFirestoreDb()and add Firestore emulator support via?emulator=true. - Wire
JobManagerintoiframe-runtime.tsxand configure the executor fromapp.tsxfor authenticated and anonymous learners; update related package versions.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/firebase-job-executor.ts |
New Firebase-backed IJobExecutor implementation with create/cancel/getJobs + Firestore listeners. |
src/firebase-job-executor.test.ts |
Unit tests covering executor methods and listener behavior. |
src/firebase-db.ts |
Exports getFirestoreDb() and enables Firestore emulator support. |
src/components/app.tsx |
Configures the job executor once portal/anonymous data resolves. |
src/components/activity-page/managed-interactive/managed-interactive.test.tsx |
Updates mocks to include JobManager. |
src/components/activity-page/managed-interactive/iframe-runtime.tsx |
Creates a module-level JobManager, calls addInteractive/removeInteractive, and passes job context. |
specs/AP-68-add-job-manager-support.md |
Design/requirements spec for AP-68 implementation. |
package.json |
Bumps interactive-api-host and lara-interactive-api versions. |
package-lock.json |
Lockfile updates to match dependency bumps. |
.npmrc |
Adds legacy-peer-deps=true. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
activity-player
|
||||||||||||||||||||||||||||
| Project |
activity-player
|
| Branch Review |
AP-68-add-job-manager-support
|
| Run status |
|
| Run duration | 05m 22s |
| Commit |
|
| Committer | Doug Martin |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
2
|
|
|
0
|
|
|
96
|
| View all changes introduced in this branch ↗︎ | |
- Guard useEmulator with typeof window check for non-browser safety - Return [] from getJobs when no valid user scope (user_type + identity field) is present to prevent cross-user job data exposure - Filter out documents missing jobInfo before sorting in getJobs - Guard snapshot handler against missing/incomplete jobInfo - Add clear error message to getFirestoreDb when app not initialized - Update tests to pass complete user context to getJobs
…d users Firestore's emulator evaluates list security rules using query constraints rather than document field values. The learnerOwner() rule checks platform_user_id and platform_id; adding both (plus context_id to match the getAnswerDocsQuery pattern) gives the emulator enough constraint to approve the query without hitting "Property X is undefined" errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement IJobExecutor backed by Firebase so iframed interactives can create and track background jobs via the LARA interactive API. Includes a Firestore listener for real-time status updates, backfill on page reload via getJobs, and support for both authenticated and anonymous users. Wires JobManager into iframe-runtime.tsx following the existing PubSubManager pattern.