Raise on failed individual asset generation to prevent incorrect cache updates#1130
Raise on failed individual asset generation to prevent incorrect cache updates#1130
Conversation
…havior - In generate.py, each individual_* function now logs an error and raises an Exception when core does not produce the expected output file. This ensures the failure propagates up through generate_assets() so the asset type is not added to the successful_assets list and the cache is not incorrectly updated. - Add tests/test_generate.py with 8 tests covering all four individual_* functions, verifying both the failure case (raises) and success case (no raise). Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/7b12f474-b534-45aa-813c-9a2f75f4d8c3
oscarlevin
left a comment
There was a problem hiding this comment.
@copilot , rebase on main and try this again. Make sure you format at follow the new instructions.
* Initial plan * Fix: print targets get better links in pelican generated site When output_filename is not set for single-file output formats (PDF, EPUB, KINDLE, BRAILLE), deploy_path() now scans the output directory for the actual output file and returns a path including the filename. This allows the pelican-generated landing page to link directly to the PDF (or other single-file output) rather than the directory containing it. Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/870d27e1-a45a-439c-943b-f8852da66683 * format * add copilot instructions --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Co-authored-by: Oscar Levin <oscar.levin@unco.edu>
* Initial plan * Change default Asymptote method from 'server' to 'local' Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/57b3c51d-7f85-4024-9514-b1082a883308 * Add tests for default asy_method and update CHANGELOG Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/b107aac6-d62b-4650-a90e-ca20aaa6c619 * Skip asy-dependent tests when asy is not installed Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/a4c5f475-ee41-4903-89ed-fc37a07c1868 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com>
* Initial plan * Add tests for utility functions: working_directory, format_docstring_as_help_str, is_earlier_version, hash_path, xml_syntax_is_valid Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com>
* Initial plan * Add test_build_generate to test pretext build -g behavior Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/782c1d2c-2645-447a-9a8d-371f40e95808 * update core commit * update tests * remove passagemath as dev dependency * commit new test example files --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Co-authored-by: Oscar Levin <oscar.levin@unco.edu>
* Initial plan * Add test for pretext generate datafile Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/2dcc278a-da1e-4d0d-9c35-f17aa1fa7f57 * Fix pelican landing page links for print/single-file targets (#1128) * Initial plan * Fix: print targets get better links in pelican generated site When output_filename is not set for single-file output formats (PDF, EPUB, KINDLE, BRAILLE), deploy_path() now scans the output directory for the actual output file and returns a path including the filename. This allows the pelican-generated landing page to link directly to the PDF (or other single-file output) rather than the directory containing it. Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/870d27e1-a45a-439c-943b-f8852da66683 * format * add copilot instructions --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Co-authored-by: Oscar Levin <oscar.levin@unco.edu> * Initial plan * Fix formatting with black and rebase onto main Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/2aff3401-df98-4e89-ad7d-d303784b6b77 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Co-authored-by: Oscar Levin <oscar.levin@unco.edu>
- Rebased on origin/main (includes new tests and changes from #1124-#1128) - Ran `poetry run black .` for formatting (reformatted test_generate.py) - Added Fixed entry in CHANGELOG.md under [Unreleased] Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/72d5b309-fec0-4dad-8af0-1cbe035c2679
oscarlevin
left a comment
There was a problem hiding this comment.
@copilot , why are all the other commits here part of this pr. Shouldn't a rebase just fast forward the changes from this pr on top of the other commits?
You're right — the PR history is messy. The original clone was shallow (grafted at The actual file diff vs Fixing the commit history requires a force-push of a clean branch, which I'm unable to do with the tools available. If you want a clean history, you could run: git fetch origin copilot/add-tests-for-image-generation-errors
git checkout copilot/add-tests-for-image-generation-errors
git rebase --onto main eb5bb3a HEAD --empty=drop
# skip any conflicting "from-main" commits with: git rebase --skip
git push --force origin copilot/add-tests-for-image-generation-errors |
generate.pyto log an error and raise an exception when individual asset generation fails (output file not created)individual_prefigure: raise error when output file doesn't exist after conversionindividual_asymptote: raise error when output file doesn't exist after conversionindividual_sage: raise error when output file doesn't exist after conversionindividual_latex_image: raise error when output file doesn't exist after conversiontests/test_generate.pyto verify failed image generation is not reported as successmainpoetry run black .for formattingCHANGELOG.mdentry under[Unreleased]>FixedOriginal prompt
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.