Skip to content

Migrate Cloud Functions calls to v2 HTTP endpoints (Python backend)#121

Merged
dev-mansonthomas merged 5 commits into
masterfrom
feat/cloud-functions-v2-migration
May 15, 2026
Merged

Migrate Cloud Functions calls to v2 HTTP endpoints (Python backend)#121
dev-mansonthomas merged 5 commits into
masterfrom
feat/cloud-functions-v2-migration

Conversation

@dev-mansonthomas
Copy link
Copy Markdown
Owner

Migrate Cloud Functions calls to v2 HTTP endpoints (Python backend)

Context

The backend Cloud Functions are migrating from NodeJS Gen1 Callable to
Python Gen2 HTTP (project rcq-functions-v2). This PR refactors the
Angular client to:

  • call HTTP endpoints with kebab-case names instead of camelCase
    Callables
  • inject Firebase ID tokens via a standard Authorization: Bearer ...
    header through an HttpInterceptor
  • drop the proprietary @angular/fire/functions dependency from
    runtime code

Scope

  • CloudFunctionService rewritten on top of HttpClient (9 methods)
  • AuthTokenInterceptor added, registered in AppModule
  • AngularFireFunctionsModule and REGION provider removed
  • Environment files updated with new kebab-case endpoint names and
    v2 base URL (https://europe-west1-rq-fr-{env}.cloudfunctions.net/)
  • Tests refactored to use HttpClientTestingModule
  • Documentation added: API contracts + security audit plan
  • README setup instructions refreshed
  • Ranking dropdown: dynamic year range 2016 -> current year (desc)

Out of scope

  • Backend implementation (lives in rcq-functions-v2)
  • 401/refresh-token retry logic (skipped, not encountered during E2E)
  • Wave 1 supply-chain remediation (separate PR, plan in
    docs/security-audit-redquest.md)

Validation (D2 - manual E2E on rq-fr-dev)

  • ng serve --configuration dev compiles without errors
  • get-ul-prefs -> 200 OK, Authorization: Bearer eyJ... present,
    CORS headers OK
  • tronc-list-prepared -> 200 OK with Bearer
  • Token automatically injected by interceptor on every CF request
  • Full flow coverage (registration, depart/retour, historique) -
    best-effort manual checks, OK on a clean dev account

Tests

  • ng test --watch=false - Karma suite green
  • ng build --configuration dev - OK

Rollback plan

  • Revert this PR (no DB migration, no destructive change).
  • Cloud Functions v1 NodeJS endpoints remain available on the legacy
    project until both rcq-functions-v2 rollout and this client are
    stable. Reverting the client alone is sufficient to fall back.

Commits

  1. feat(cloud-functions): migrate to HTTP v2 endpoints with Bearer auth
  2. chore(test): repair pre-existing account.component.spec
  3. docs(cloud-functions): API contracts and security audit plan
  4. docs(readme): refresh setup instructions
  5. feat(ranking): dynamic year range 2016 -> current year (descending)

Related

  • Backend project: rcq-functions-v2
  • Migration log + contracts: docs/cloud-functions-endpoints.md
  • Security audit plan: docs/security-audit-redquest.md

Pull Request opened by Augment Code with guidance from the PR author

Backend Cloud Functions are migrating from NodeJS Gen1 Callable to Python Gen2 HTTP (project rcq-functions-v2). This commit refactors the Angular client to call the new endpoints.

- Rewrite CloudFunctionService on top of HttpClient (9 methods, kebab-case URLs).

- Add AuthTokenInterceptor that injects the Firebase ID token as 'Authorization: Bearer <token>' on every Cloud Function request.

- Register the interceptor via HTTP_INTERCEPTORS in AppModule and drop AngularFireFunctionsModule + REGION provider from runtime code.

- Update environment.sample.ts with v2 base URL (https://europe-west1-rq-fr-{env}.cloudfunctions.net/) and kebab-case endpoint names.

- Refactor service spec to use HttpClientTestingModule and add a dedicated spec for the interceptor.
The spec was failing to compile due to outdated imports and an unconfigured TestBed. Replace it with a minimal smoke test stub so the Karma suite is green again; the file is otherwise unrelated to the Cloud Functions migration.
- docs/cloud-functions-endpoints.md: v2 HTTP API contracts (URL, payload, response) used by the migrated CloudFunctionService, plus migration log.

- docs/security-audit-framework.md: generic supply-chain audit methodology (waves).

- docs/security-audit-redquest.md: RedQuest-specific implementation plan derived from the framework (npm audit baseline, IoC scan, remediation waves).
Restructure the README around current project layout: prerequisites (Node, Angular CLI, Firebase CLI, gcloud), Google Cloud / Firebase access, environment files location, and dev/build/deploy commands. No functional change.
Replace the hard-coded year list with an array computed from the current year, so 2025/2026/... appear in the dropdown automatically without code change. Ordered descending (most recent first) to match the default selection.
@dev-mansonthomas dev-mansonthomas marked this pull request as ready for review May 15, 2026 13:28
@dev-mansonthomas dev-mansonthomas merged commit cd36cf4 into master May 15, 2026
@dev-mansonthomas dev-mansonthomas deleted the feat/cloud-functions-v2-migration branch May 15, 2026 13:28
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.

1 participant