Skip to content

[OSDEV-1913] Fix an error downloading results from the main search.#675

Merged
Innavin369 merged 5 commits intomainfrom
OSDEV-1913-fix-path-length-in-db
Jul 4, 2025
Merged

[OSDEV-1913] Fix an error downloading results from the main search.#675
Innavin369 merged 5 commits intomainfrom
OSDEV-1913-fix-path-length-in-db

Conversation

@Innavin369
Copy link
Contributor

@Innavin369 Innavin369 commented Jul 2, 2025

OSDEV-1913 Error downloading results from main search.

The max_length for the path field in the DownloadLog model has been increased from 2083 to 4096 to fix the too long value error.
Added migration 0172_increase_path_max_length which increases max_length for the path field in the DownloadLog model.

@Innavin369 Innavin369 self-assigned this Jul 2, 2025
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:54 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:54 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:54 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:54 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:54 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:54 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:54 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:54 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:54 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:54 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:54 — with GitHub Actions Inactive
@Innavin369 Innavin369 had a problem deploying to Quality Environment July 2, 2025 22:54 — with GitHub Actions Failure
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:54 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:54 — with GitHub Actions Inactive
@Innavin369 Innavin369 marked this pull request as ready for review July 2, 2025 22:54
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 22:57 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Jul 2, 2025

React App | Jest test suite - Code coverage report

Total: 34.44%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@coderabbitai
Copy link

coderabbitai bot commented Jul 2, 2025

📝 Walkthrough

Walkthrough

The changes increase the maximum allowed length of the path field in the DownloadLog model from 2083 to 4096 characters. This update is reflected in the model, database migration, serializer validation, and associated tests. Documentation in the release notes is updated to describe the migration and clarify related bugfixes.

Changes

File(s) Change Summary
doc/release/RELEASE-NOTES.md Updated release notes for version 2.8.0 to describe the migration, bugfixes, and made minor edits.
src/django/api/migrations/0172_increase_path_max_length.py Added migration to increase DownloadLog.path max_length to 4096.
src/django/api/models/download_log.py Increased DownloadLog.path field max_length from 2083 to 4096.
src/django/api/serializers/log_download_query_params.py Added validate_path method to enforce new max_length in serializer validation.
src/django/api/tests/test_log_download.py Added test for path max_length validation and response handling.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    participant Serializer
    participant Model
    participant Database

    Client->>API: POST /log_download (with path)
    API->>Serializer: Validate input
    Serializer->>Model: Get path max_length (4096)
    alt path length <= 4096
        Serializer-->>API: Validated data
        API->>Database: Save DownloadLog (path)
        API-->>Client: 204 No Content
    else path length > 4096
        Serializer-->>API: ValidationError (path too long)
        API-->>Client: 400 Bad Request (error message)
    end
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d02699 and dc4ad6b.

📒 Files selected for processing (1)
  • src/django/api/serializers/log_download_query_params.py (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
src/django/api/serializers/log_download_query_params.py (14)
Learnt from: mazursasha1990
PR: opensupplyhub/open-supply-hub#488
File: src/django/api/views/v1/opensearch_query_builder/opensearch_query_director.py:114-119
Timestamp: 2025-01-29T08:51:47.803Z
Learning: In the Open Supply Hub codebase, request parameter validation is handled in the serializer layer through:
1. Field-level validation using DRF fields (e.g., IntegerField, CharField)
2. Custom validator classes (e.g., SizeValidator which enforces a maximum limit of 250 records)
Adding validation in query builders or directors would be redundant as it's already handled by the serializer layer.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/models/facility_download_limit.py:64-73
Timestamp: 2025-06-18T12:46:27.549Z
Learning: The validation checks in FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py are insufficient to prevent register_download from receiving more records than the user's available quota. The method only validates against zero total quota on first page and global limits, but doesn't validate records_returned against remaining user quota before calling register_download.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/serializers/v1/opensearch_common_validators/moderation_id_validator.py:20-25
Timestamp: 2024-11-13T07:21:28.686Z
Learning: In the `ModerationIdValidator` class located at `src/django/api/serializers/v1/opensearch_common_validators/moderation_id_validator.py`, it's not necessary to add input size validation for the `moderation_id` list. OpenSearch already imposes a page size limit, which mitigates potential DoS attacks from large inputs.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/views/v1/opensearch_query_builder/opensearch_query_builder.py:12-13
Timestamp: 2024-11-14T11:06:35.337Z
Learning: In `src/django/api/views/v1/opensearch_query_builder/opensearch_query_builder.py`, input validation for methods like `add_from` is performed at a higher level, so additional validation within these methods is unnecessary.
Learnt from: mazursasha1990
PR: opensupplyhub/open-supply-hub#488
File: src/django/api/views/v1/opensearch_query_builder/opensearch_query_director.py:114-119
Timestamp: 2025-01-29T08:51:47.803Z
Learning: In the Open Supply Hub codebase, request parameter validation is handled in the serializer layer through:
1. Field-level validation using DRF fields (e.g., IntegerField, CharField)
2. Custom validator classes (e.g., SizeValidator)
Adding validation in query builders or directors would be redundant as it's already handled by the serializer layer.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/facilities_download_view_set.py:115-119
Timestamp: 2025-06-17T10:55:08.363Z
Learning: In the FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py, the existing validation checks do not prevent paid_download_records from going negative. The validation only checks if the user has zero total quota (free + paid == 0) on the first page, and if the total query results exceed the global limit of 5000, but does not validate the user's remaining quota against the actual records_to_subtract value which is calculated after pagination.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/views/v1/moderation_events.py:41-43
Timestamp: 2024-11-12T11:42:07.768Z
Learning: In the `ModerationEvents` API endpoint, parameter validation is handled in `src/django/api/serializers/v1/moderation_events_serializer.py`.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#420
File: src/django/api/views/v1/opensearch_query_builder/production_locations_query_builder.py:87-92
Timestamp: 2024-11-26T12:24:22.563Z
Learning: In the Open Supply Hub codebase, validation for parameters such as `order_by` is performed in the serializers, specifically in `src/django/api/serializers/v1/moderation_events_serializer.py`, so validation is not needed in the query builder methods like `add_sort`.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/serializers/v1/opensearch_common_validators/date_range_validator.py:9-11
Timestamp: 2024-11-12T11:15:04.794Z
Learning: In `src/django/api/serializers/v1/opensearch_common_validators/date_range_validator.py`, date format validation is not required within the `DateRangeValidator` class, as date validation is handled elsewhere in the codebase.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/views/v1/opensearch_query_builder/opensearch_query_builder.py:61-79
Timestamp: 2024-11-14T11:06:37.772Z
Learning: In the `OpenSearchQueryBuilder` class located at `src/django/api/views/v1/opensearch_query_builder/opensearch_query_builder.py`, date validation is performed at a higher level in the application. Therefore, it's unnecessary to add additional date validation within the `__build_date_range` method.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/tests/test_moderation_events_query_builder.py:86-97
Timestamp: 2024-11-13T07:34:20.109Z
Learning: In our codebase, we raise `ValidationError` instead of `ValueError` to produce an error response with status code 400. Future test cases should reflect this practice.
Learnt from: mazursasha1990
PR: opensupplyhub/open-supply-hub#488
File: src/django/api/views/v1/opensearch_query_builder/opensearch_query_director.py:114-119
Timestamp: 2025-01-29T08:51:47.803Z
Learning: In the Open Supply Hub codebase, request parameter validation should be handled in the serializer classes (e.g., ProductionLocationsSerializer) rather than in the query builders or directors.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/serializers/v1/opensearch_common_validators/request_type_validator.py:10-0
Timestamp: 2024-11-12T11:12:25.832Z
Learning: In `src/django/api/serializers/v1/opensearch_common_validators/request_type_validator.py`, the `request_type` field is optional. The validator should return without errors if `request_type` is missing.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#431
File: src/django/api/tests/test_facility_claim_view_set.py:0-0
Timestamp: 2024-11-28T12:54:16.114Z
Learning: In files not related to v1, such as `src/django/api/tests/test_facility_claim_view_set.py`, error responses use `'message'` instead of `'detail'`.
🧬 Code Graph Analysis (1)
src/django/api/serializers/log_download_query_params.py (1)
src/django/api/models/download_log.py (1)
  • DownloadLog (4-24)
🪛 Pylint (3.3.7)
src/django/api/serializers/log_download_query_params.py

[refactor] 10-10: Too few public methods (1/2)

(R0903)

⏰ Context from checks skipped due to timeout of 90000ms (13)
  • GitHub Check: run-dd-code-quality
  • GitHub Check: run-flake8-linter
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: get-base-branch-countries-cov
  • GitHub Check: get-base-branch-dd-cov
  • GitHub Check: get-base-branch-contricleaner-cov
  • GitHub Check: run-django-code-quality
  • GitHub Check: run-countries-code-quality
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: get-base-branch-fe-cov
  • GitHub Check: run-fe-code-quality
🔇 Additional comments (3)
src/django/api/serializers/log_download_query_params.py (3)

1-1: LGTM! Correct ValidationError import for DRF serializers.

The change to import ValidationError from rest_framework.exceptions is appropriate for Django REST Framework serializers and aligns with DRF best practices.


7-7: LGTM! Model import added for validation consistency.

The import of DownloadLog model is necessary for the dynamic max_length retrieval in the validation method, ensuring consistency with the model definition.


14-21: LGTM! Excellent validation implementation.

The validate_path method correctly implements the validation requirements:

  • Dynamically retrieves max_length from the model field to maintain consistency
  • Provides clear, informative error messaging
  • Follows DRF serializer validation patterns
  • Addresses the PR objective of handling increased path length limits

This implementation aligns with the codebase's pattern of handling validation in serializers and eliminates potential inconsistencies between hardcoded values and model definitions.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
src/django/api/migrations/0172_increase_path_max_length.py (1)

3-3: Remove unused import.

The import django.contrib.postgres.indexes is not used in this migration.

-import django.contrib.postgres.indexes
src/django/api/tests/test_log_download.py (1)

3-3: Remove unused import.

The ValidationError import is not used in this test file since validation is tested through HTTP requests.

-from django.forms import ValidationError
doc/release/RELEASE-NOTES.md (1)

31-32: Fix indentation – violates MD007 (ul-indent)

Static analysis flagged the second-level list as over-indented (4 spaces instead of the project-standard 2). Adjusting keeps Markdown linters quiet and renders consistently.

-    * Adjusted the post-submit popup. Instead of displaying the cleaned and transformed data from ContriCleaner, we now show only the raw input submitted by the user.
+  * Adjusted the post-submit popup. Instead of displaying the cleaned and transformed data from ContriCleaner, we now show only the raw input submitted by the user.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d25df1a and 8c9ce9f.

📒 Files selected for processing (6)
  • doc/release/RELEASE-NOTES.md (3 hunks)
  • src/django/api/migrations/0172_increase_path_max_length.py (1 hunks)
  • src/django/api/models/download_log.py (1 hunks)
  • src/django/api/serializers/log_download_query_params.py (2 hunks)
  • src/django/api/tests/test_log_download.py (2 hunks)
  • src/django/api/views/log_download.py (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/models/facility_download_limit.py:64-73
Timestamp: 2025-06-18T12:46:27.549Z
Learning: The validation checks in FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py are insufficient to prevent register_download from receiving more records than the user's available quota. The method only validates against zero total quota on first page and global limits, but doesn't validate records_returned against remaining user quota before calling register_download.
src/django/api/views/log_download.py (2)
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/facilities_download_view_set.py:115-119
Timestamp: 2025-06-17T10:55:08.363Z
Learning: In the FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py, the existing validation checks do not prevent paid_download_records from going negative. The validation only checks if the user has zero total quota (free + paid == 0) on the first page, and if the total query results exceed the global limit of 5000, but does not validate the user's remaining quota against the actual records_to_subtract value which is calculated after pagination.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/models/facility_download_limit.py:64-73
Timestamp: 2025-06-18T12:46:27.549Z
Learning: The validation checks in FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py are insufficient to prevent register_download from receiving more records than the user's available quota. The method only validates against zero total quota on first page and global limits, but doesn't validate records_returned against remaining user quota before calling register_download.
src/django/api/serializers/log_download_query_params.py (11)
Learnt from: mazursasha1990
PR: opensupplyhub/open-supply-hub#488
File: src/django/api/views/v1/opensearch_query_builder/opensearch_query_director.py:114-119
Timestamp: 2025-01-29T08:51:47.803Z
Learning: In the Open Supply Hub codebase, request parameter validation is handled in the serializer layer through:
1. Field-level validation using DRF fields (e.g., IntegerField, CharField)
2. Custom validator classes (e.g., SizeValidator which enforces a maximum limit of 250 records)
Adding validation in query builders or directors would be redundant as it's already handled by the serializer layer.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/serializers/v1/opensearch_common_validators/moderation_id_validator.py:20-25
Timestamp: 2024-11-13T07:21:28.686Z
Learning: In the `ModerationIdValidator` class located at `src/django/api/serializers/v1/opensearch_common_validators/moderation_id_validator.py`, it's not necessary to add input size validation for the `moderation_id` list. OpenSearch already imposes a page size limit, which mitigates potential DoS attacks from large inputs.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/views/v1/opensearch_query_builder/opensearch_query_builder.py:12-13
Timestamp: 2024-11-14T11:06:35.337Z
Learning: In `src/django/api/views/v1/opensearch_query_builder/opensearch_query_builder.py`, input validation for methods like `add_from` is performed at a higher level, so additional validation within these methods is unnecessary.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/views/v1/moderation_events.py:41-43
Timestamp: 2024-11-12T11:42:07.768Z
Learning: In the `ModerationEvents` API endpoint, parameter validation is handled in `src/django/api/serializers/v1/moderation_events_serializer.py`.
Learnt from: mazursasha1990
PR: opensupplyhub/open-supply-hub#488
File: src/django/api/views/v1/opensearch_query_builder/opensearch_query_director.py:114-119
Timestamp: 2025-01-29T08:51:47.803Z
Learning: In the Open Supply Hub codebase, request parameter validation is handled in the serializer layer through:
1. Field-level validation using DRF fields (e.g., IntegerField, CharField)
2. Custom validator classes (e.g., SizeValidator)
Adding validation in query builders or directors would be redundant as it's already handled by the serializer layer.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/models/facility_download_limit.py:64-73
Timestamp: 2025-06-18T12:46:27.549Z
Learning: The validation checks in FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py are insufficient to prevent register_download from receiving more records than the user's available quota. The method only validates against zero total quota on first page and global limits, but doesn't validate records_returned against remaining user quota before calling register_download.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#420
File: src/django/api/views/v1/opensearch_query_builder/production_locations_query_builder.py:87-92
Timestamp: 2024-11-26T12:24:22.563Z
Learning: In the Open Supply Hub codebase, validation for parameters such as `order_by` is performed in the serializers, specifically in `src/django/api/serializers/v1/moderation_events_serializer.py`, so validation is not needed in the query builder methods like `add_sort`.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/facilities_download_view_set.py:115-119
Timestamp: 2025-06-17T10:55:08.363Z
Learning: In the FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py, the existing validation checks do not prevent paid_download_records from going negative. The validation only checks if the user has zero total quota (free + paid == 0) on the first page, and if the total query results exceed the global limit of 5000, but does not validate the user's remaining quota against the actual records_to_subtract value which is calculated after pagination.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/serializers/v1/opensearch_common_validators/date_range_validator.py:9-11
Timestamp: 2024-11-12T11:15:04.794Z
Learning: In `src/django/api/serializers/v1/opensearch_common_validators/date_range_validator.py`, date format validation is not required within the `DateRangeValidator` class, as date validation is handled elsewhere in the codebase.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/views/v1/opensearch_query_builder/opensearch_query_builder.py:61-79
Timestamp: 2024-11-14T11:06:37.772Z
Learning: In the `OpenSearchQueryBuilder` class located at `src/django/api/views/v1/opensearch_query_builder/opensearch_query_builder.py`, date validation is performed at a higher level in the application. Therefore, it's unnecessary to add additional date validation within the `__build_date_range` method.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/tests/test_moderation_events_query_builder.py:86-97
Timestamp: 2024-11-13T07:34:20.109Z
Learning: In our codebase, we raise `ValidationError` instead of `ValueError` to produce an error response with status code 400. Future test cases should reflect this practice.
src/django/api/tests/test_log_download.py (2)
Learnt from: mazursasha1990
PR: opensupplyhub/open-supply-hub#438
File: src/django/api/tests/test_moderation_events_add_production_location.py:21-65
Timestamp: 2024-12-12T14:59:19.694Z
Learning: In `src/django/api/tests/test_moderation_events_add_production_location.py`, the tests have been refactored, and the use of `POST` methods is intentional. Future suggestions to change HTTP methods in these tests may not be necessary.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/django/api/tests/test_moderation_events_query_builder.py:86-97
Timestamp: 2024-11-13T07:34:20.109Z
Learning: In our codebase, we raise `ValidationError` instead of `ValueError` to produce an error response with status code 400. Future test cases should reflect this practice.
doc/release/RELEASE-NOTES.md (6)

undefined

<retrieved_learning>
Learnt from: VadimKovalenkoSNF
PR: #420
File: doc/release/RELEASE-NOTES.md:38-38
Timestamp: 2024-11-26T04:59:12.296Z
Learning: For endpoints that haven't been released to end users, it's acceptable to document API changes under the 'Bugfix' section in the release notes.
</retrieved_learning>

<retrieved_learning>
Learnt from: VadimKovalenkoSNF
PR: #420
File: doc/release/RELEASE-NOTES.md:47-54
Timestamp: 2024-11-28T06:36:47.122Z
Learning: API changes and migration details are documented in a separate repository with API specifications, rather than in the release notes.
</retrieved_learning>

<retrieved_learning>
Learnt from: VadimKovalenkoSNF
PR: #420
File: doc/release/RELEASE-NOTES.md:47-54
Timestamp: 2024-11-28T06:36:47.122Z
Learning: Endpoints that have not been enabled to end users do not require migration documentation or old vs new format examples in the release notes.
</retrieved_learning>

<retrieved_learning>
Learnt from: VadimKovalenkoSNF
PR: #641
File: doc/release/RELEASE-NOTES.md:6-35
Timestamp: 2025-06-02T13:24:57.659Z
Learning: The Open Supply Hub team keeps placeholders in release notes until code freeze, then fills in the actual content once all changes are finalized for the release.
</retrieved_learning>

<retrieved_learning>
Learnt from: VadimKovalenkoSNF
PR: #420
File: doc/release/RELEASE-NOTES.md:37-37
Timestamp: 2024-11-25T13:28:23.090Z
Learning: When modifying unreleased API endpoints, such as refactoring the search_after parameter into search_after_value and search_after_id in the OpenSearch implementation, it's acceptable to leave the "What's New" section empty since the changes haven't been released to end users.
</retrieved_learning>

<retrieved_learning>
Learnt from: Innavin369
PR: #431
File: src/django/api/serializers/v1/opensearch_common_validators/countries_validator.py:23-24
Timestamp: 2024-11-28T11:29:28.139Z
Learning: The files src/django/api/tests/test_facility_claim_view_set.py, src/django/api/views/facility/facilities_view_set.py, and src/django/api/facility_actions/processing_facility_api.py are not part of the V1 codebase in the Open Supply Hub project.
</retrieved_learning>

🧬 Code Graph Analysis (2)
src/django/api/views/log_download.py (1)
src/django/api/constants.py (1)
  • LogDownloadQueryParams (147-149)
src/django/api/tests/test_log_download.py (2)
src/django/api/models/download_log.py (1)
  • DownloadLog (4-24)
src/django/api/constants.py (1)
  • LogDownloadQueryParams (147-149)
🪛 Flake8 (7.2.0)
src/django/api/migrations/0172_increase_path_max_length.py

[error] 3-3: 'django.contrib.postgres.indexes' imported but unused

(F401)

src/django/api/tests/test_log_download.py

[error] 3-3: 'django.forms.ValidationError' imported but unused

(F401)

🪛 Ruff (0.11.9)
src/django/api/migrations/0172_increase_path_max_length.py

3-3: django.contrib.postgres.indexes imported but unused

Remove unused import: django.contrib.postgres.indexes

(F401)

src/django/api/tests/test_log_download.py

3-3: django.forms.ValidationError imported but unused

Remove unused import: django.forms.ValidationError

(F401)

🪛 markdownlint-cli2 (0.17.2)
doc/release/RELEASE-NOTES.md

31-31: Unordered list indentation
Expected: 2; Actual: 4

(MD007, ul-indent)

⏰ Context from checks skipped due to timeout of 90000ms (13)
  • GitHub Check: run-flake8-linter
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-dd-code-quality
  • GitHub Check: get-base-branch-dd-cov
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: run-countries-code-quality
  • GitHub Check: get-base-branch-contricleaner-cov
  • GitHub Check: get-base-branch-countries-cov
  • GitHub Check: run-fe-code-quality
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: get-base-branch-fe-cov
  • GitHub Check: run-django-code-quality
🔇 Additional comments (5)
src/django/api/views/log_download.py (1)

27-31: Formatting improvement looks good.

The added blank lines improve readability around the variable assignments.

src/django/api/models/download_log.py (1)

15-15: Model field update correctly addresses the issue.

Increasing max_length from 2083 to 4096 characters should resolve the "too long value" errors for path downloads as described in OSDEV-1913.

src/django/api/migrations/0172_increase_path_max_length.py (1)

14-18: Migration correctly updates the field constraint.

The AlterField operation properly increases the max_length to 4096 characters to match the model change.

src/django/api/tests/test_log_download.py (1)

68-98: Excellent test coverage for the path length validation.

The test comprehensively covers both valid and invalid cases:

  • Dynamically retrieves max_length from the model field
  • Tests path exactly at the limit (should succeed)
  • Tests path exceeding the limit (should fail with appropriate error)
  • Verifies the specific error message
doc/release/RELEASE-NOTES.md (1)

15-16: Migration entry looks good

The new migration note is concise and follows the existing format.

@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 23:01 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Jul 2, 2025

Dedupe Hub App | Unittest test suite - Code coverage report

Total: 55.73%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 23:02 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Jul 2, 2025

Contricleaner App | Unittest test suite - Code coverage report

Total: 98.75%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 23:02 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Jul 2, 2025

Countries App | Unittest test suite - Code coverage report

Total: 100%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@Innavin369 Innavin369 temporarily deployed to Quality Environment July 2, 2025 23:12 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Jul 2, 2025

Django App | Unittest test suite - Code coverage report

Total: 80.8%

Your code coverage diff: 0.02% ▴

✅ All code changes are covered

@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:04 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:04 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:04 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:04 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:04 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:04 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:04 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:04 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:04 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:04 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:07 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:11 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:12 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:12 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 3, 2025 12:22 — with GitHub Actions Inactive
Copy link
Contributor

@vladsha-dev vladsha-dev left a comment

Choose a reason for hiding this comment

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

Could you please provide the PR title in a format that follows our Engineering playbook? Something like: “Fixed issue when…”

@Innavin369 Innavin369 changed the title [OSDEV-1913] Error downloading results from main search. [OSDEV-1913] Fix an error downloading results from the main search. Jul 3, 2025
Copy link
Contributor

@VadimKovalenkoSNF VadimKovalenkoSNF left a comment

Choose a reason for hiding this comment

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

Pls, apply minor fix.

@Innavin369 Innavin369 temporarily deployed to Quality Environment July 4, 2025 07:55 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 4, 2025 07:55 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 4, 2025 07:55 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 4, 2025 07:55 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 4, 2025 07:55 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment July 4, 2025 07:55 — with GitHub Actions Inactive
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 4, 2025

Copy link
Contributor

@vladsha-dev vladsha-dev left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@VadimKovalenkoSNF VadimKovalenkoSNF left a comment

Choose a reason for hiding this comment

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

Re-approved.

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.

3 participants