PR opensearch-project#981 unified the two ScheduledJob.parse overloads behind a single
top-level walk, but the two overloads are called with the parser at
different positions:
- parse(xcp, id, version): parser is before the outer START_OBJECT.
- parse(xcp, type, id, version): the sweeper's isSweepableJobType() has
already consumed START_OBJECT and advanced to the wrapper FIELD_NAME.
The unified walk assumed the first position for both, so on the sweeper
path it descended into the monitor object, found no wrapper key, and
threw ("Unable to parse ScheduledJob source"). The job was then never
scheduled and postIndex/postDelete callbacks (which drive AlertMover)
never fired.
Restore the type overload to parse the already-located wrapper directly,
while keeping the no-type overload order-independent so security-injected
top-level fields (e.g. all_shared_principals) are still tolerated.
Add XContentTests covering both parser positions and leading/trailing
ancillary fields; ScheduledJob.parse previously had no direct coverage.
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Description
PR #981 unified the two
ScheduledJob.parseoverloads behind a single top-level field walk. However, the two overloads are invoked with the parser at different positions:parse(xcp, id, version)— parser is positioned before the outerSTART_OBJECT.parse(xcp, type, id, version)— the sweeper'sJobSweeper.isSweepableJobType()has already consumed the outerSTART_OBJECTand advanced the parser to the wrapper'sFIELD_NAME(e.g."monitor").The unified walk assumed the first position for both. On the sweeper path it therefore descended into the monitor object, found no wrapper key, and threw — surfacing as
Unable to parse ScheduledJob sourcein alerting logs. Because the job failed to parse, it was never scheduled, and thepostIndex/postDeleteshard-listener callbacks that driveAlertMover.moveAlertsnever fired. This broke a range of alerting integration tests (delete-trigger alert movement, workflow scheduling, doc-level monitor execution, monitor stats scheduling).Fix
typeoverload to parse the already-located wrapper directly (matching its original, pre-Override DocRequest.type() on alerting request classes; tolerate ancillary top-level fields in ScheduledJob.parse #981 contract).all_shared_principalsfrom the resource-sharing framework's DLS) are still tolerated before or after the wrapper.XContentTestscovering both parser positions and leading/trailing ancillary fields.ScheduledJob.parsepreviously had no direct test coverage, which is how the regression slipped through.Related
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.