Repository navigation
feat: enhance import logging - #3510
TheTisiboth wants to merge 7 commits into
Conversation
Test Results 12 files 604 suites 2m 35s ⏱️ Results for commit b6befe4. ♻️ This comment has been updated with latest results. |
9ff8dc5 to
8efea9f
Compare
Add structured logging throughout the recipe import pipeline:
- Tag ImportExceptions with a step property (download/parse_html/extract_recipe)
- Log per-parser failures with reasons in RecipeExtractionService
- Add debug logs in HTML parsers (JSON-LD element count, decode errors, microdata itemscope count)
- Log HTTP status, content-type, and response size after download
- Return structured {msg, step} error responses from the import API
- Remove file/line leak from all error responses (import, update, create)
- Catch generic exceptions as HTTP 500 with safe translated message
Assisted-by: Claude Code (claude-opus-4-6)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Léo Jan <leo.jan@doctolib.com>
8efea9f to
e3dc968
Compare
…-logging Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Léo Jan <leo.jan@doctolib.com>
Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Léo Jan <leo.jan@doctolib.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Major · Apply the generic import handler to cache insertion. · RecipeImplementation.php:326-328
lib/Controller/Implementation/RecipeImplementation.php:326-328
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winApply the generic import handler to cache insertion.
DbCacheService::addRecipe()remains outside the new generic handler. Its database and cache-update operations can raise exceptions that escapeRecipeImplementation::import()and bypass the documented generic{msg}response.This block existed before the PR, but the PR adds a broad contract that unexpected import errors return HTTP 500 with a generic message. Extend that handling to cache insertion while preserving the existing
InvalidJSONFileExceptioncleanup.

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4df5fdd1-4015-410b-899d-507f8b67f401
Files selected for processing: 18-
docs/dev/api/changelog/0.mddocs/dev/api/trunk/internal-cookbook.yamldocs/dev/api/trunk/objects.yamldocs/dev/api/trunk/openapi-cookbook.yamllib/Controller/Implementation/RecipeImplementation.phplib/Exception/ImportException.phplib/Helper/HTMLParser/AbstractHtmlParser.phplib/Helper/HTMLParser/HttpJsonLdParser.phplib/Helper/HTMLParser/HttpMicrodataParser.phplib/Helper/HtmlToDomParser.phplib/Service/HtmlDownloadService.phplib/Service/RecipeExtractionService.phplib/Service/RecipeService.phpsrc/components/AppNavi.vuetests/Unit/Controller/Implementation/RecipeImplementationTest.phptests/Unit/Helper/HTMLParser/HttpJsonLdParserTest.phptests/Unit/Helper/HTMLParser/HttpMicrodataParserTest.phptests/Unit/Service/RecipeExtractionServiceTest.php
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.
-
Also document that invalid recipe JSON still returns a plain-string 400. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Léo Jan <leo.jan@doctolib.com>
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a8fbf4f0-0f2a-4b91-b528-de93acd6c9b0
Files selected for processing: 5-
docs/dev/api/changelog/0.mddocs/dev/api/trunk/internal-cookbook.yamldocs/dev/api/trunk/openapi-cookbook.yamllib/Controller/Implementation/RecipeImplementation.phptests/Unit/Controller/Implementation/RecipeImplementationTest.php
Files skipped from review as they are similar to previous changes: 3-
- docs/dev/api/changelog/0.md
- docs/dev/api/trunk/openapi-cookbook.yaml
- docs/dev/api/trunk/internal-cookbook.yaml
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
-
Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Léo Jan <leo.jan@doctolib.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🔇 Additional comments: 2
lib/Service/RecipeService.php-358-358: 1
358-358:Minor · Security & Privacy · Quick win
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.Do not log the recipe name.
The parsed
nameis user content. This new info log retains it on every successful extraction, including when the name contains private details. Log extraction success without the name. (raw.githubusercontent.com)lib/Helper/UrlRedactionHelper.php-23-23: 1
23-23:Major · Security & Privacy · Quick win
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.Remove the path from logged URLs.
If an import URL contains a token in its path,
redact()retains that token. Download and parser logs then persist it. Return the scheme and host, with the port if needed, but not the path. (raw.githubusercontent.com)Based on learnings, full URLs can embed API keys or tokens in the path.
Source: Learnings

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c3b03ef5-3e0e-49b9-a772-3add014cab91
Files selected for processing: 8-
lib/Controller/Implementation/RecipeImplementation.phplib/Helper/HTMLParser/HttpJsonLdParser.phplib/Helper/HTMLParser/HttpMicrodataParser.phplib/Helper/UrlRedactionHelper.phplib/Service/HtmlDownloadService.phplib/Service/RecipeExtractionService.phplib/Service/RecipeService.phptests/Unit/Helper/UrlRedactionHelperTest.php
Files skipped from review as they are similar to previous changes: 1-
- lib/Service/HtmlDownloadService.php
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.
-
Validation errors of the extracted recipe returned a generic 500 instead of a 400 with the extract_recipe step. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Léo Jan <leo.jan@doctolib.com>
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2a7d43ac-5502-4fcc-9fa4-02886edc6737
Files selected for processing: 2-
lib/Service/RecipeService.phptests/Unit/Controller/Implementation/RecipeImplementationTest.php
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.
-
Keep this change focused on import logging. Response format, API docs and frontend handling follow in a stacked PR. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Léo Jan <leo.jan@doctolib.com>
Addresses #3279
Followed by #3538 (stacked).
Topic and Scope
Adds logging throughout the recipe import pipeline so admins can see in
nextcloud.logwhy an import failed. No change to API responses.ImportExceptioncarries the failingstep(download,parse_html,extract_recipe), logged on failureUrlRedactionHelper)Concerns/issues
ImportExceptionnew last paramstring $step = ''is backward-compatibleFormal requirements
Note
This PR was created with the assistance of AI tools.
Assisted-by: Claude Code (claude-opus-4-6, claude-opus-5-5)
🤖 Generated with Claude Code