Repository navigation
fix(tier2): retain trailing shell comments in deduplication - #357
Conversation
Signed-off-by: YMuskrat <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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_linestay correct at EOF (end line is the last comment line), and#!still resets a block. tests/deduplicationpasses (316 passed, 1 skipped);ruff checkandruff format --checkare clean on the changed files.
No further concerns from me.
Signed-off-by: Narendran Raghavan <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
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.
Signed-off-by: Narendran Raghavan <[email protected]>
* 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]>
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
make lint, changed-file formatting and whitespace checks passed.make buildproduced the wheel and source distribution.make testwith two workers, isolated temporary files and a first-failure limit: 834 passed, 2 skipped, 2 failed before stopping. Both failures also occur on unchanged upstream55d8b8d: the GitLab template test cannot create its hard-coded/tmpdirectory, and the standalone provenance test returns norun_dir(cause not diagnosed). Full-suite success is not claimed. An earlier attempt hit a concurrent temporary-directory cleanup race before tests ran.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
CHANGELOG.md.