feat(weekly-brief): BFF route, controller, service with mock/live switch#776
feat(weekly-brief): BFF route, controller, service with mock/live switch#776manishdixitlfx wants to merge 4 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
PR titles must follow Conventional Commits. Love from, Your reviewers ❤️.
There was a problem hiding this comment.
Pull request overview
Adds a new Express BFF surface area for the WG Weekly Brief feature, providing committee-scoped endpoints and a service layer that can run in mock mode locally or proxy to committee-service in “live” mode.
Changes:
- Introduces
weekly-briefExpress route + controller wiring for current/generate/save endpoints. - Adds a
WeeklyBriefServicethat serves mock fixtures by default and proxies toLFX_V2_SERVICEwhenWEEKLY_BRIEF_BACKEND=live. - Documents the new
WEEKLY_BRIEF_BACKENDenv var in.env.example.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/lfx-one/src/server/services/weekly-brief.service.ts | Implements mock/live switching and upstream proxying for weekly brief operations. |
| apps/lfx-one/src/server/controllers/weekly-brief.controller.ts | Adds request handlers with logging and param validation for weekly brief endpoints. |
| apps/lfx-one/src/server/routes/weekly-brief.route.ts | Defines the /committees/:committeeId/weekly-briefs/* routes. |
| apps/lfx-one/src/server/server.ts | Registers the new weekly brief router under /api/committees. |
| apps/lfx-one/.env.example | Adds WEEKLY_BRIEF_BACKEND configuration example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Introduce a closed `WeeklyBriefSourceType` union and use it on WeeklyBriefSourceRef.source_type instead of `string` with an inline comment listing the values (per copilot-pull-request-reviewer). Both the BFF and the Angular service consume this type, so widening it to a real union restores type-safety at every call site without runtime cost. Resolves 1 review thread. Signed-off-by: Manish Dixit <mdixit@linuxfoundation.org>
… switch Signed-off-by: Manish Dixit <mdixit@linuxfoundation.org>
…vice Signed-off-by: Manish Dixit <mdixit@linuxfoundation.org>
Address copilot-pull-request-reviewer comments:
- apps/lfx-one/src/server/controllers/weekly-brief.controller.ts:
* saveBrief now validates req.body via validateSaveBriefBody before
handing off to the service. Surfaces ServiceValidationError with
per-field reasons on invalid input. Without this, e.g. a string
"1" for revision would concatenate ("1" + 1 = "11") in downstream
revision math.
- apps/lfx-one/src/server/services/weekly-brief.service.ts:
* Narrowed the 404 catch to `error instanceof MicroserviceError`
instead of loose `error.status` / `error.statusCode` checks.
Matches the convention used in cdp.service.ts, impersonation
.service.ts, etc.
- apps/lfx-one/.env.example:
* Moved the WEEKLY_BRIEF_BACKEND comment above the assignment with
a note about dotenv inline-comment parsing — the previous form
risked producing values like `live # ...` that wouldn't match
the strict === 'live' check in code.
Resolves 5 review threads (3 unique findings — two pairs were
duplicates flagging the same code on different lines).
Signed-off-by: Manish Dixit <mdixit@linuxfoundation.org>
666d056 to
501f263
Compare
Review Feedback AddressedCommit: 501f263 Changes Made (per copilot-pull-request-reviewer)
Threads Resolved5 of 5 unresolved threads addressed in this iteration (3 unique findings; two pairs were duplicates flagging the same code on different lines). |
Address copilot-pull-request-reviewer comments:
- apps/lfx-one/src/server/controllers/weekly-brief.controller.ts:
* saveBrief now validates req.body via validateSaveBriefBody before
handing off to the service. Surfaces ServiceValidationError with
per-field reasons on invalid input. Without this, e.g. a string
"1" for revision would concatenate ("1" + 1 = "11") in downstream
revision math.
- apps/lfx-one/src/server/services/weekly-brief.service.ts:
* Narrowed the 404 catch to `error instanceof MicroserviceError`
instead of loose `error.status` / `error.statusCode` checks.
Matches the convention used in cdp.service.ts, impersonation
.service.ts, etc.
- apps/lfx-one/.env.example:
* Moved the WEEKLY_BRIEF_BACKEND comment above the assignment with
a note about dotenv inline-comment parsing — the previous form
risked producing values like `live # ...` that wouldn't match
the strict === 'live' check in code.
Resolves 5 review threads (3 unique findings — two pairs were
duplicates flagging the same code on different lines).
Signed-off-by: Manish Dixit <mdixit@linuxfoundation.org>
Refs: LFXV2-1982
Signed-off-by: Manish Dixit <mdixit@linuxfoundation.org>
cc5c4af to
88e4d63
Compare
501f263 to
a5f4885
Compare
Tracking: LFXV2-1982 (part of Epic LFXV2-1976)
Summary
Express BFF for the WG Weekly Brief: route + controller + service. Switches between mock data (default for local UI iteration) and live committee-service proxy via
WEEKLY_BRIEF_BACKEND=live.What's new
apps/lfx-one/src/server/routes/weekly-brief.route.ts— 3 endpoints: GET current, POST generate, PUT saveapps/lfx-one/src/server/controllers/weekly-brief.controller.tsapps/lfx-one/src/server/services/weekly-brief.service.ts— mock fixtures + proxy passthroughapps/lfx-one/.env.example— addsWEEKLY_BRIEF_BACKENDNotes
{ brief: null, throttle: defaultThrottle() }— matches committee-service's 200/null contract.apps/lfx-one/src/server/server.ts(protected file) — registers the new route only.Stack
PR 2/4 on lfx-self-serve. Base = PR #775 (shared-interfaces).
Test plan
yarn lint/yarn buildgreen (verified)MicroserviceProxyService