fix: preserve supported bounds in ox_import_beat_schedules - #89
Merged
Merged
Conversation
Quote every stored value printed by ox_import_beat_schedules with ascii(), including skipped-row comments, task paths and cron fields. Keep stored text on one physical line in generated settings and calls. Set imported end_time one microsecond before beat's exclusive expiry, stepping back on the UTC instant. Without USE_TZ, resolve expiry in TIME_ZONE and print the adjusted end as local time. Stop on ambiguous or nonexistent naive expiries and on datetime underflow. Classify each row once against one import-time clock reading. List rows whose adjusted end is at or before their start, or the import instant when no start is given, with their own reason instead of a refused call. Stop before printing output when database reads, decoding or date conversion fail. Report one line naming the database, without catching programming errors. Check whether date bounds are NULL so a non-NULL bound decoded as None cannot silently lose its start or expiry. List invalid JSON arguments and non-finite argument or interval numbers with reasons. Keep NULL and empty arguments as no arguments, and retain existing handling for valid JSON with unsupported shapes. Check generated call fields using the printed imports and match reasons to individual row lines. Exercise quoted values and supported calls as a module and through InteractiveConsole. Cover older table layouts without DROP COLUMN and clean up tables after partial setup failures. Test read failures, selected connection zones, database aliases, exact stored bounds and expiry dispatch across SQLite, PostgreSQL and MySQL, including USE_TZ=False and clock changes. Correct the application note for disabled schedules, elapsed bounds, missed ticks, enabling schedules and partial application. Explain bound handling with and without USE_TZ, differences from django-celery-beat 2.9.0 with time-zone support off, and the first-run behavior not reproduced by the importer. Add a Security changelog entry for the quoting bug (CWE-94) in versions 1.2.0-1.4.0. Describe the gap in protection when output is applied, distinguish it from running the importer, and note that there are no reports of it being used. Give upgrade, regeneration and inspection guidance without implying that upgrading removes pasted code or that inspection rules out prior execution. Update the Fixed entry with untranslated rows, bound handling, read errors, application guidance and review of previously imported schedules. Regenerate docs/llms-full.txt from the changelog. Closes oxpull#86
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why:
Preserves supported
start_timeandexpiresbounds when importing schedules fromdjango-celery-beatviaox_import_beat_schedules, without performing database writes.django_celery_beat_periodictaskforone_off,start_time, andexpirescolumns, falling back gracefully if absent on older table versions.start_time=datetime.fromisoformat(...)and future expiries asend_time=datetime.fromisoformat(...)usingrepr-based quoting, omitting past starts.from datetime import datetimein Section 2 imports output.one-off tasks have no equivalent on a stored schedule), expired rows (it has expired), and expiries at or before a future start (its expiry is at or before its start time) under# Not translated, and why:.connection.timezonewhenUSE_TZ=True, and preserves naive local times whenUSE_TZ=False.Tests: ran on SQLite and PostgreSQL (see CONTRIBUTING.md); new behavior is covered.
make_beat_tables()fixture DDL usingconnection.data_types['DateTimeField'].datetimein line-evaluation globals and verify preserved bounds.USE_TZ=True/USE_TZ=Falsetimezone handling.Changelog: entry added under
## [Unreleased]### FixedinCHANGELOG.md.