Skip to content

Conversation

hbalty
Copy link
Contributor

@hbalty hbalty commented Aug 19, 2025

No description provided.

@revu-bot revu-bot bot requested a review from revu-bot August 19, 2025 22:15
@hbalty hbalty marked this pull request as ready for review August 19, 2025 22:15
Copy link
Collaborator

@revu-bot revu-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR fixes logging issues in the import functionality with some important corrections: fixes the total count calculation for successful imports, renames log action types for consistency, and improves test quality by removing mocks. However, there's a critical syntax error in the controller method that needs immediate attention.

@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 20.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.91%. Comparing base (49e694b) to head (e24462d).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
.../src/_migrations/1756117243336-manual-migration.ts 20.00% 4 Missing ⚠️
...rc/usagers/controllers/import/import.controller.ts 20.00% 4 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3865      +/-   ##
==========================================
- Coverage   65.92%   65.91%   -0.02%     
==========================================
  Files         971      972       +1     
  Lines       16255    16260       +5     
  Branches     2255     2252       -3     
==========================================
+ Hits        10716    10717       +1     
- Misses       5334     5340       +6     
+ Partials      205      203       -2     
Files with missing lines Coverage Δ
.../modules/general/components/faq/faq.component.html 100.00% <ø> (ø)
.../src/_migrations/1756117243336-manual-migration.ts 20.00% <20.00%> (ø)
...rc/usagers/controllers/import/import.controller.ts 87.87% <20.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 49e694b...e24462d. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hbalty hbalty force-pushed the fix-logs-for-import branch from 0a06bc7 to 824b3d5 Compare August 19, 2025 22:31
@hbalty hbalty temporarily deployed to build-review-auto August 19, 2025 22:32 — with GitHub Actions Inactive
@hbalty hbalty temporarily deployed to build-review-auto August 19, 2025 22:32 — with GitHub Actions Inactive
@hbalty hbalty temporarily deployed to build-review-auto August 19, 2025 22:32 — with GitHub Actions Inactive
@hbalty hbalty temporarily deployed to build-review-auto August 19, 2025 22:32 — with GitHub Actions Inactive
@hbalty hbalty requested a review from pYassine August 19, 2025 22:35
@hbalty hbalty temporarily deployed to build-review-auto August 25, 2025 10:38 — with GitHub Actions Inactive
@hbalty hbalty temporarily deployed to build-review-auto August 25, 2025 10:38 — with GitHub Actions Inactive
@hbalty hbalty temporarily deployed to build-review-auto August 25, 2025 10:38 — with GitHub Actions Inactive
@hbalty hbalty temporarily deployed to build-review-auto August 25, 2025 10:38 — with GitHub Actions Inactive
Copy link

@tokenbureau
Copy link

tokenbureau bot commented Aug 25, 2025

🎉 Deployment for commit e24462d :

Ingresses
Docker images
  • 📦 docker pull harbor.fabrique.social.gouv.fr/domifa/domifa/backend:sha-e24462dd0a15d2be78b00ec1c25ac387949cc50f
  • 📦 docker pull harbor.fabrique.social.gouv.fr/domifa/domifa/frontend:sha-e24462dd0a15d2be78b00ec1c25ac387949cc50f
  • 📦 docker pull harbor.fabrique.social.gouv.fr/domifa/domifa/portail-admins:sha-e24462dd0a15d2be78b00ec1c25ac387949cc50f
  • 📦 docker pull harbor.fabrique.social.gouv.fr/domifa/domifa/portail-usagers:sha-e24462dd0a15d2be78b00ec1c25ac387949cc50f
Debug

@pYassine pYassine requested a review from revu-bot August 25, 2025 15:01
Copy link
Collaborator

@revu-bot revu-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR fixes logging issues by correcting the total count calculation for successful imports and standardizing event naming. The changes improve test quality by replacing mocks with actual database operations and fix a missing user context issue in document download logging. The migration properly handles existing data migration for the renamed events.

expect(logs[0].action).toBe("IMPORT_USAGERS_SUCCESS");
expect(logs[0].context).toEqual({
nombreActifs: 19,
nombreTotal: 19,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated assertion nombreTotal: 19 correctly reflects the fix where total count now represents processed users rather than all preview rows. This aligns with the controller change that uses usagersRows.length instead of importPreviewRows.length.


export class ManualMigration1756117243336 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The migration properly handles the event name changes with proper rollback capability. Consider adding a verification query after the update to ensure the migration succeeded and log the number of affected rows for operational visibility.

@pYassine pYassine merged commit d49cb49 into master Aug 25, 2025
19 checks passed
@pYassine pYassine deleted the fix-logs-for-import branch August 25, 2025 15:04
@tokenbureau
Copy link

tokenbureau bot commented Aug 25, 2025

🎉 This PR is included in version 2.220.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@tokenbureau tokenbureau bot added the released label Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants