Skip to content

fix(tier2): retain trailing shell comments in deduplication - #357

Merged
rng1995 merged 3 commits into
NVIDIA:mainfrom
YMuskrat:codex/fix-tier2-trailing-shell-comments
Nov 9, 2026
Merged

rng1995 merged 3 commits into
NVIDIA:mainfrom
YMuskrat:codex/fix-tier2-trailing-shell-comments

Conversation

@YMuskrat

@YMuskrat YMuskrat commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Tier 2 omits a shell script's final comment block unless another non-comment line follows it. A normal terminal newline is insufficient. This can silently remove all qualifying content from comment-only scripts and miss repeated guidance across scripts.

Flush pending comments at end of file through the existing block-emission path. Keep the three-line/minimum-character filters, shebang handling and source line numbers. Function parsing still uses the original source.

Four EOF unit cases and the production-validator regression failed before the fix. The latter previously returned success without requesting any embeddings. It now reaches comparison and reports the repeated guidance when deterministic provider responses identify a duplicate.

Verification

  • Familiar with the contributing guidelines; commit includes DCO sign-off.
  • 122 focused chunker/validator tests passed, including EOF/newline boundaries, unchanged filters and the collection-to-finding path. Independent review reran these successfully.
  • Broader deduplication/embedding suite: 589 passed, 3 skipped, 1 deselected. The deselected test requires an AF_UNIX socket prohibited by this sandbox; the same failure was reproduced on unchanged main.
  • Updated the user-visible changelog.
  • make lint, changed-file formatting and whitespace checks passed.
  • make build produced the wheel and source distribution.
  • Ran make test with two workers, isolated temporary files and a first-failure limit: 834 passed, 2 skipped, 2 failed before stopping. Both failures also occur on unchanged upstream 55d8b8d: the GitLab template test cannot create its hard-coded /tmp directory, and the standalone provenance test returns no run_dir (cause not diagnosed). Full-suite success is not claimed. An earlier attempt hit a concurrent temporary-directory cleanup race before tests ran.
  • No credentials, private datasets or proprietary benchmark content added.

Validated on Python 3.12 with the repository's locked all/dev dependencies. Provider responses are test doubles; no live model calls were made.

Release Impact

  • Updated CHANGELOG.md.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed head 54b74938 against main 55d8b8d4.

The sentinel fixes the end-of-file case for every ending I tried: none, \n, \r\n, a trailing whitespace line, a bare final #, and a block after a shebang or a closed function. start_line/end_line match a mid-file block. The other chunkers already flush their last block, and the dedup chunks have no cache or version key that the new chunks would invalidate. 5 of the 11 new tests fail on main. tests/deduplication + tests/embedding pass with -n auto (591 passed, 2 skipped), and the existing tests are unaffected. The validator test also gives the same result when the files are written with CRLF, as the Windows Tier 2 job would write them.

I've left one P3 inline on the filter test.

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed. Flushing through the existing emission path with a single empty sentinel is a clean fix: line numbers, the shebang skip and the length/line-count filters all stay on one code path, and the validator-level test proves the EOF block now reaches the embedding call.

+1 to the open P3 thread on test_chunker.py: both "short" cases are rejected by min_chars=80 before the 3-line rule is consulted, so an EOF flush that only checked length would still pass. A two-line case that clears the length filter (or the existing case with min_chars=10) would pin the line-count rule for the EOF path.

CI has not run on this fork PR yet, so it needs a maintainer to approve the workflow run.

Add a two-line EOF comment block that passes the character threshold so the test independently enforces the three-line minimum.

Merge upstream main d136a59 and preserve its changelog while placing this fix under Unreleased.

Signed-off-by: Codex <[email protected]>

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM at 8121e2a. My earlier point is addressed: the new two-line EOF block joins to well over min_chars=80, so only the three-line minimum rejects it, which pins that rule on the end-of-file flush.

Checked locally:

  • The sentinel flush reuses the existing emission path, so start_line/end_line stay correct at EOF (end line is the last comment line), and #! still resets a block.
  • tests/deduplication passes (316 passed, 1 skipped); ruff check and ruff format --check are clean on the changed files.

No further concerns from me.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All review comments are addressed, including the two-line EOF regression that isolates the three-line minimum. Resolved the CHANGELOG-only conflict with current main while preserving both sets of entries. Fresh verification on the merged tree: 123 focused chunker/intra-skill validator tests passed; src/tests lint, changed-file formatting and PR whitespace checks passed.

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM.

rng1995 added a commit to YMuskrat/SkillEvaluator that referenced this pull request Nov 9, 2026
@rng1995
rng1995 merged commit e76fcc9 into NVIDIA:main Nov 9, 2026
22 checks passed
rng1995 added a commit that referenced this pull request Nov 9, 2026
* fix(quality): derive instruction tokens from parsed frontmatter

Signed-off-by: YMuskrat <[email protected]>

* Keep changelog additions mergeable with PR #357

Signed-off-by: Narendran Raghavan <[email protected]>

---------

Signed-off-by: YMuskrat <[email protected]>
Signed-off-by: Codex <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Co-authored-by: Narendran Raghavan <[email protected]>
Co-authored-by: Narendran Raghavan <[email protected]>
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.

3 participants