Resolve archives through Studio's contents_sha256 index before upload

Open
#745 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
api, backend

Research direction

Start with TreeManager.get_file_diff and do_file_upload in ricecooker/managers/tree.py, then trace FileMetadata and get_filename() in ricecooker/classes/files.py and archive sealing in ricecooker/utils/pipeline/convert.py. Check config.get_storage_url and the zlib-ng guard in ricecooker/utils/zip.py. Done means cache hits and fresh conversions resolve valid contents_sha256 matches, while misses and failed checks retain local-MD5 upload behavior and the listed CI/content cases pass.

Written by the indexing model from the issue text.

Description

P0 - critical TAG: tech update / debt

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

ricecooker should resolve each archive through Studio's contents_sha256/ index before uploading, so content Studio already holds keeps its existing MD5 whatever zlib build produced the local bytes. With that in place, the zlib-ng guard added in #720 should be removed. Part of #722.

Complexity: Medium
Target branch: main

Context
The Change
  • ArchiveProcessingBaseHandler should record contents_sha256 (learningequality/le-utils#241) of the sealed archive as optional FileMetadata, preserved on pipeline cache hits.
  • Before the HEAD diff, ricecooker should GET {domain}/content/contents_sha256/<hash>.<ext>, on the host get_storage_url uses, for each file carrying that metadata.
  • On a hit whose target passes the HEAD check, the file should take the canonical <md5>.<ext>, so it is neither uploaded nor referenced under its local MD5.
  • Anything that reads the local file by its filename, such as the size lookup, should keep working after the rename.
Acceptance Criteria
  • On a zlib-ng interpreter, archives whose content Studio holds under other MD5s are not uploaded, and the created nodes reference the existing MD5s.
  • A pipeline cache hit resolves through the index the same as a fresh conversion.
  • A lookup 404, a network error, or an index hit whose target fails the HEAD check uploads the file under its local MD5.
  • Files without contents_sha256 metadata make no index request.
  • HTML5, ePub, KPUB, H5P and Bloom content process on zlib-ng interpreters.
  • windows-latest, 3.14 is in the CI matrix and passing.

AI usage

I chose the design, including computing the hash in the archive handler; Claude Code traced the upload path and drafted the sections.

Dominant language
Python
Stars
33
Forks
83
Avg merge
5d 16h
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from learningequality/ricecooker

All issues in learningequality/ricecooker

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.