docs: add engine-native record selection plan#792
Conversation
Document the V1 API, engine architecture, resume model, implementation phases, and validation strategy for exact accepted-row targets. Refs #790 Signed-off-by: Nabin Mulepati <nmulepati@nvidia.com>
Code Review: PR #792 —
|
andreatnvidia
left a comment
There was a problem hiding this comment.
The engine-native direction makes sense to me: exact accepted-row selection is a stage-local data-plane operation, while workflow chaining remains responsible for separate generate, judge, enrich, and transform stages.
The main design points I think need resolving before implementation are:
- preserving explicit candidate offsets through the current row-group-plan normalization;
- keeping selection checkpoint artifacts valid after after-generation processing; and
- defining a successful zero-row
return_partialpath through the interface and profiler.
The remaining comments are API and lifecycle clarifications rather than objections to the overall direction.
Resolve review gaps around scheduler offset reuse, checkpoint accounting, publication and media lifecycles, resume compatibility, empty partial output, and interface semantics. Refs #790 Signed-off-by: Nabin Mulepati <nmulepati@nvidia.com>
|
Addressed the review feedback in Key design revisions:
Validation: pre-commit hooks passed, |
Clarify that parquet-files contains only terminal accepted rows and specify Hugging Face validation, metadata, media, and testing requirements. Refs #790 Signed-off-by: Nabin Mulepati <nmulepati@nvidia.com>
|
@andreatgretel Thanks for the review. I addressed the three main lifecycle concerns and all of the inline clarifications:
The latest follow-up ( All pre-commit checks and Markdown fence validation pass. Re-requesting your review. |
Signed-off-by: Nabin Mulepati <nmulepati@nvidia.com>
Document strict candidate budgets, durable empty schemas, batch-addressed processor artifacts, and scoped publication recovery to match the completed implementation. Signed-off-by: Nabin Mulepati <nmulepati@nvidia.com>
| stateDiagram-v2 | ||
| [*] --> LoadConfig | ||
| LoadConfig --> Fresh: no checkpoints or resume=NEVER | ||
| LoadConfig --> Reconstruct: checkpoints exist and config, buffer, target match | ||
| LoadConfig --> Incompatible: config, buffer, or target mismatch with resume=ALWAYS | ||
| LoadConfig --> ResetForFresh: config, buffer, or target mismatch with resume=IF_POSSIBLE | ||
| ResetForFresh --> Fresh: warn and clear selection-owned artifacts |
There was a problem hiding this comment.
resume=NEVER leaves stale batch markers that corrupt subsequent resumes
The state machine routes resume=NEVER directly to Fresh without cleaning up existing selection artifacts. If a prior run wrote markers 0–4 and a resume=NEVER run overwrites markers 0–2 but completes in only three batches, the old selection-checkpoints/batch_00003.json and batch_00004.json survive. A subsequent resume=ALWAYS or resume=IF_POSSIBLE that passes all fingerprint/buffer/target checks would enter Reconstruct, read all markers in selection-checkpoints/, and silently sum accepted counts from both runs—breaking the accepted-count invariant and potentially short-circuiting to Satisfied before the new run has actually reached its target.
The ResetForFresh state exists precisely to clear selection-owned artifacts before starting fresh (used by the IF_POSSIBLE mismatch path). The resume=NEVER transition should go through the same cleanup, or the plan should explicitly state that reconstruction is bounded by next_candidate_batch_id from global metadata rather than by the full contents of the selection-checkpoints/ directory.
Prompt To Fix With AI
This is a comment left during a code review.
Path: plans/790/engine-native-record-selection.md
Line: 780-786
Comment:
**`resume=NEVER` leaves stale batch markers that corrupt subsequent resumes**
The state machine routes `resume=NEVER` directly to `Fresh` without cleaning up existing selection artifacts. If a prior run wrote markers 0–4 and a `resume=NEVER` run overwrites markers 0–2 but completes in only three batches, the old `selection-checkpoints/batch_00003.json` and `batch_00004.json` survive. A subsequent `resume=ALWAYS` or `resume=IF_POSSIBLE` that passes all fingerprint/buffer/target checks would enter `Reconstruct`, read **all** markers in `selection-checkpoints/`, and silently sum accepted counts from both runs—breaking the accepted-count invariant and potentially short-circuiting to `Satisfied` before the new run has actually reached its target.
The `ResetForFresh` state exists precisely to clear selection-owned artifacts before starting fresh (used by the `IF_POSSIBLE` mismatch path). The `resume=NEVER` transition should go through the same cleanup, or the plan should explicitly state that reconstruction is bounded by `next_candidate_batch_id` from global metadata rather than by the full contents of the `selection-checkpoints/` directory.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Good catch—the state diagram was ambiguous. ResumeMode.NEVER already follows ArtifactStorage fresh-run semantics: a non-empty requested dataset directory causes allocation of a new timestamped sibling, while an empty requested directory has no prior markers. Checkpoint discovery is scoped to that resolved artifact directory, so markers from separate runs cannot be combined. I updated the state machine and documented this invariant in 1e992a5. I also audited the implementation and reran the artifact-storage suite (69 tests passed), so no code change was required.
Document that resume=NEVER allocates an empty requested path or a new timestamped sibling, keeping checkpoint discovery isolated from earlier runs. Signed-off-by: Nabin Mulepati <nmulepati@nvidia.com>
📋 Summary
Adds the source-of-truth design plan for engine-native record selection, allowing users to request an exact number of rows that satisfy a declared boolean criterion in one bounded, resumable DataDesigner run. The plan defines V1 as the complete user-facing feature and leaves concurrent batches and early cancellation as benchmark-driven optimizations.
🔗 Related Issue
Related to #790. The issue remains open to track implementation of the approved design.
🔄 Changes
RecordSelectionConfigAPI and exact accepted-row semantics.🧪 Testing
git diff --check origin/main..HEAD✅ Checklist