Skip to content

fix: validate fork boundary indices before output creation - #306

Merged
ryoari merged 2 commits into
AOSSIE-Org:mainfrom
panshularora:fix/fork-boundary-validation
Nov 14, 2026
Merged

ryoari merged 2 commits into
AOSSIE-Org:mainfrom
panshularora:fix/fork-boundary-validation

Conversation

@panshularora

Copy link
Copy Markdown
Contributor

Summary

Closes #304.

Reject fork --at values outside 0 <= K < len(chain) immediately after reading the source chain, before indexing, reading prepared documents, or creating output. The error includes the valid range.

Valid boundary handling, checkpoints, source chain prefixes and exclusion rules are unchanged. Document the argument contract in simple/README.md.

Verification

  • Test-first: negative, chain-length and oversized inputs failed on unchanged upstream with raw IndexError/FileNotFoundError; after the guard they reject cleanly and leave no output.
  • Full Python 3.12 CPU suite: 73 passed, 9 subtests passed.
  • ruff check simple tests and git diff --check: passed.
  • Existing CLI reproduction rerun: valid index succeeds; negative/chain-length inputs reject without partial output.
  • Tests cover both first/last eligible boundaries, exact prefix/checkpoint preservation, and existing non-Wikipedia/already-forked rejection.

Limits / review focus

Synthetic CPU chain/checkpoint fixtures, not published trained weights or RTX 5090 replay. This fixes invalid argument handling, not atomic cleanup for other failures (e.g. a missing checkpoint at a valid index). No digest, RNG, optimizer, recipe or training arithmetic changes.

@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 081072f and 99f3138.

Files selected for processing: 3

  • simple/README.md
  • simple/ovl.py
  • tests/simple/test_ovl.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@panshularora
panshularora marked this pull request as ready for review November 11, 2026 15:19

@ryoari ryoari left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Checking the range right after reading the chain, before anything is created, is the right place, and the tests cover both ends and the negative indices. Marking it ready and merging.

@ryoari
ryoari merged commit a7a60e8 into AOSSIE-Org:main Nov 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] fork --at accepts negative indices and leaves a partial output directory

2 participants