Skip to content

An import's counts, file name and invalid rows' reasons, and its deletions are counted - #1133

Open
paynejd wants to merge 1 commit into
OpenConceptLab/ocl_online#654-owner-checksfrom
OpenConceptLab/ocl_online#399-import-report
Open

paynejd wants to merge 1 commit into
OpenConceptLab/ocl_online#654-owner-checksfrom
OpenConceptLab/ocl_online#399-import-report

Conversation

@paynejd

@paynejd paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member

Refs OpenConceptLab/ocl_online#399 and OpenConceptLab/ocl_online#749. Built on #1117, which merges first.

What the API does now

  • Counts: a bulk import's summary has created, updated, deleted, invalid, failed, exists, not_found, permission_denied and unchanged beside total and processed, while it runs and after. A parallel import adds up its parts' counts, which it didn't before. A package import's summary has them too, except invalid and not_found: an invalid row of a package counts as failed.
  • Invalid rows: each one in the report has errors, with the required fields it lacks, such as {"concept_class": ["This field is required."]}. A row of an unknown type is invalid too; it was dropped without a word. The one-line summary counts invalid and failed rows.
  • File names: the list of imports gives each one's file_name: the uploaded file's name, or the last part of its URL's path (for a package, its name and version). It's null for pasted text and for older imports.
  • Deletions: the version that an import's deletion saves is left for the count job, as created and updated ones are, so the source's count is right after the import. Only what the row retired counts as deleted: what was retired already is unchanged, and an error fails the row.

Migration: tasks/0015 adds the nullable column file_name to celery_tasks.

Order: #1117, then #1130 and this one in either order. I merged this branch with #1130 and ran the whole suite on the result: no conflicts, and all tests pass. The page that shows these fields is a separate pull request in oclweb3 and works with or without them.

Tests: 4,306 pass, and pylint is clean. I also ran real imports through Celery workers: a file with one bad row, one with deletions and one with every kind of result.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AaZ4qTEw8c6qZh5C69F1V4

…ort's counts, file name and invalid rows' reasons, and its deletions are counted

- A parallel import's summary adds up its parts' counts (created, updated, deleted, invalid, failed and the others), as it runs. A package import's summary has them too.
- Each invalid row in the report has `errors`, with the required fields it lacks. A row of an unknown type is invalid too, and no longer dropped. The one-line summaries count invalid and failed rows, and a parallel import's report has `not_found`.
- A task has `file_name`: the uploaded file's name, the last part of its URL's path, or a package's name and version.
- The version that an import's deletion saves has `_counted=None`, as created and updated ones do, so the count job recounts its source. Only what the row retired counts as deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qTEw8c6qZh5C69F1V4
@paynejd
paynejd requested a review from snyaggarwal December 4, 2026 10:49
@paynejd

paynejd commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Reviews of this branch

Codex (codex-cli 0.171.0) made three passes and two short checks of the fixes after them, and a fresh Claude subagent looked for what could be cut and found nothing. The findings, with an answer to each, are on OpenConceptLab/ocl_online#399.

  • Fixed: a file's name is only the last part of its URL's path, or a package's name and version, whatever the URL looks like. A row of an unknown type is invalid instead of dropped. A row that deletes what's already retired is unchanged, and one whose deletion fails is failed.
  • Accepted: a package's invalid rows count as failed, with the reason. A file that has a row without a type is still refused whole. While a parallel import runs, its progress and its counts can be one update apart.

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed 46cc46f against its base, #1117's head 8ff1a6e. Approving.

  • Open-core: the new counts are results the import already produced: rows created, updated, deleted, invalid, failed and so on. They record what happened and limit nothing. No allowance, limit or plan wording is added anywhere, including tests and the migration.
  • Parallel counts: get_result_counts() adds up its parts' summaries in one read. It treats a part that hasn't started, or an older summary with missing keys, as 0, and it adds the seeding version line's result. test_notify_progress covers all three. The processed total is read separately, so a running import's numbers can be one update apart; the accepted F3.3 says so, and the final numbers are right.
  • Existing clients: every change to summary adds keys. A parallel import's summary still has processed and total, and a package import's detail adds keys beside total, processed, failed and dependencies. file_name is a new nullable field in the list. An invalid row in the report gains an errors key. The inline one-line summary now has | Invalid: N before | Failed:. I found no client that parses that line: oclweb2, oclweb3 and ocldev don't.
  • Deletions:
    • Under master, a deletion's version was saved with _counted=True, which the count job skips. So a source's count stayed stale after an import deleted something.
    • counted=None hands it to the count job. The default True keeps every other caller of retire() as before, since clone() left the model default anyway.
    • An already-retired row is now unchanged, and a failed retire is now failed instead of deleted. test_only_what_a_deletion_retires_is_deleted and test_an_imports_deletions_are_counted cover both.
  • Invalid rows: every importer get_invalid_line_errors() uses is a direct subclass of BaseResourceImporter, so __subclasses__() finds them all. An unknown type is reported only after every known type has hit its continue, so no row counts twice. In a package, False now fails with its reason. Before, it went through the int branch as 0.
  • File names: the scheme, userinfo and host are dropped, and so are the query and fragment. Only the last part of the path is kept, or a package's name and version. The tests include URLs with a token and with userinfo. FC.2 (a share link shaped like a registry path) is reasonable to accept: only the person who ran the import, and staff, see the name.
  • Migration: tasks/0015 is the only new tasks migration in any open PR. It adds a nullable column, so it's safe to run while the old version serves.

Stacking: the base is #1117's branch at its approved head. Once #1117 merges, this PR needs master as its base. GitHub retargets it if #1117's branch is deleted; otherwise change the base by hand before merging.

CI on 46cc46f: Pylint and Tests pass.

This branch has not been deployed

No deployments
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.

2 participants