Skip to content

Fix the Linguist sync's enry baseline for large samples - #7

Open
andrew wants to merge 2 commits into
mainfrom
enry-decode-large-requests
Open

andrew wants to merge 2 commits into
mainfrom
enry-decode-large-requests

Conversation

@andrew

@andrew andrew commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

The weekly Linguist sync has failed every run since 2026-10-19 (https://github.com/git-pkgs/languages/actions/runs/46495120930). The most recent failure was a casing mismatch for "Vim9 Script" in Linguist's heuristics; github-linguist/linguist#8391 fixed it upstream. The runs from 2026-11-02 to 2026-11-23 failed in "Evaluate upstream samples" with bufio.Scanner: token too long: cmd/evaluate sends whole files to the enry baseline for the full-size row, and several Linguist samples are larger than the 256 KiB line buffer in tools/enry once encoded. (The two October runs failed on govulncheck findings in Go 1.26.8; the toolchain has since moved to 1.26.10.) The helper now reads requests with a json.Decoder, which reads each value whole whatever its length, and a new test sends a request over 256 KiB. Against Linguist main, generate, modelgen and evaluate complete with this change; evaluate fails on the same corpus with the old helper.

A new report job in the sync workflow opens or comments on an issue titled "Sync Linguist workflow is failing" when the sync fails, with a link to the run, and the next successful run closes it.

Summary by CodeRabbit

  • New Features
    • Workflow failures are now reported through a matching issue, with updates added to an existing issue or a new one created when needed. When the workflow succeeds, the matching issue is closed.
  • Bug Fixes
    • Large requests exceeding 256 KiB can now be processed, and input decoding errors are reported instead of being silently missed.

Whole-file requests for large Linguist samples overflowed the 256 KiB scanner buffer.
@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The workflow adds issue reporting for failed runs and closes matching issues after successful runs. The Enry tool replaces line scanning with sequential JSON decoding and adds a test for requests larger than 256 KiB.

Changes: Workflow failure reporting

Layer / File(s) Summary
Report workflow status
.github/workflows/linguist-sync.yml
A reporting job searches open issues for an exact failure-title match. It closes a matching issue when no job failed, or comments on the issue or creates one when a job failed.

Enry JSON request decoding

Layer / File(s) Summary
Decode requests and verify large input
tools/enry/main.go, tools/enry/main_test.go
The request loop uses a JSON decoder instead of a line scanner. EOF returns nil, other decoding errors are returned, and a test verifies a request larger than 256 KiB returns Go.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: Minimal · up to f2af6

The change lets the Enry helper handle very large sample requests and adds failure reporting for the Linguist sync workflow. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the Linguist sync's enry baseline now handles large samples. The changeset replaces the line-based scanner in tools/enry/main.go with a json.Decoder, removing the 256 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the Linguist sync's enry baseline now handles large samples. The changeset replaces the line-based scanner in tools/enry/main.go with a json.Decoder, removing the 256 KiB limit, and adds TestLargeRequest to cover it. The title does not mention the new failure-reporting job in the sync workflow, but that is a secondary change, so the title is related to the main change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c8be4b79-d860-47ca-a6d1-2a50e27df4b1
Commits

Reviewing files that changed from the base of the PR and between 9fa3278 and f2af6d0.

Files selected for processing: 3

  • .github/workflows/linguist-sync.yml
  • tools/enry/main.go
  • tools/enry/main_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

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.

1 participant