Skip to content

Fail closed on unreadable scala-cli Bloop evidence, as sbt does (#1270) - #1358

Merged
Mikola Lysenko (mikolalysenko) merged 3 commits into
mainfrom
arch-refactor/1270-scala-evidence-fail-closed
Oct 9, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 3 commits into
mainfrom
arch-refactor/1270-scala-evidence-fail-closed

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-opus-5-5

Fixes #1270

Summary

crawlers::scala_evidence::discover now fails closed when a Bloop project file can't be read whole. That covers a file over MAX_FILE_BYTES, a read error, and a truncated or non-Bloop record. It now uses the policy that formats::sbt::evidence::resolution and crawlers::sbt_evidence already use. The skip-and-continue branches are deleted.

Why

What changed

  • discover: an oversized, unreadable or non-Bloop .json returns None. Non-regular entries (symlinks, FIFOs), non-.json names and other workspaces' projects are still ignored.
  • Module and MAX_FILE_BYTES docs now state the fail-closed rule.

Lines

Production +23/−6 (one file, about half of it doc comments). Tests +87/−1.

Behavior

  • An unreadable project file anywhere in .scala-build/.bloop now makes the scala-cli gate skip with vendor_scala_cli_resolution_missing, where it used to pass or judge partial evidence. Already-vendored GAVs still re-plan, because the gate's vendored path doesn't need evidence.
  • No change to codes, the contract, JSON shape or lockfile bytes.

Test evidence

  • Red → green: crawlers::scala_evidence::tests::an_unreadable_project_file_hides_no_conflict covers the issue's table. With both files intact the gate reports vendor_scala_cli_version_conflict. A truncated, foreign or oversized -test twin, or a truncated newest main project, makes discover return None and the gate report vendor_scala_cli_resolution_missing.
    • It fails on main's discover: Some(ScalaEvidence { files: ["…/sc_p.json"] … }) instead of None.
    • It passes on this branch.
  • caps_and_special_files now also asserts that an oversized file next to a readable project gives None, and that removing it brings the evidence back.
  • cargo clippy --workspace --all-features -- -D warnings: clean.
  • cargo test -p socket-patch-core --lib: 6092 passed. The 4 failures are the known root-sandbox ones that also fail on main (relax_loop_must_not_traverse_symlinked_root, an_unremovable_hidden_lock_keeps_every_store_entry, wire_write_failure_maps_error_and_leaves_lock_untouched, wire_failure_rolls_back_already_written_files).
  • cargo test -p socket-patch-cli --all-features --test e2e_scala_cli_vendor: 31 passed, 1 ignored. --test spawn_env_hygiene: 12 passed.

Risk

Low. The change is one function, and it only adds refusals in a case where the result used to be partial evidence.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YTFbfEEtE5pUm5pdEaFyMz


Note

Low Risk
Single-function policy tightening in evidence discovery only increases refusals when Bloop metadata is incomplete; no auth, wire format, or gate code contract changes.

Overview
Fixes #1270 by changing scala-cli Bloop evidence discovery to fail closed when any .scala-build/.bloop project JSON cannot be read whole—over MAX_FILE_BYTES, I/O failure, truncated content, or non-Bloop JSON—instead of skipping that file and returning partial resolution evidence.

That matches the sbt evidence reader: an unreadable record might be the one that names a conflicting GAV (e.g. a -test twin with test.dep at another version), so the vendor gate must not judge main-only evidence. Unreadable cases now yield no evidence (discover → None, gate → vendor_scala_cli_resolution_missing) rather than incorrectly passing when the bad file hid a version conflict.

Docs for the cap behavior are updated; tests cover oversized files beside valid projects and gate behavior for truncated/foreign/oversized -test twins and corrupt newest main projects.

Reviewed by Cursor Bugbot for commit d762714. Configure here.


Generated by Claude Code

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) added arch-refactor PR opened by the scheduled architecture refactor routine refactor Structural change: duplicated code or logic, missing abstraction, layering, dead code labels Oct 9, 2026
A truncated, oversized or non-Bloop project file under
.scala-build/.bloop was skipped, so the vendored scala-cli gate judged
the remaining projects alone. When the skipped file was the newest
project's -test twin, a test.dep at another version went unseen and
vendoring went ahead while the test classpath kept the old version.

Such a file now means no evidence at all, the policy the sbt evidence
reader already follows, so the gate skips with
vendor_scala_cli_resolution_missing and asks for a fresh compile.
Symlinks, FIFOs and other workspaces' projects are still ignored.

Fixes #1270

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 9, 2026 18:17
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

Mikola Lysenko (mikolalysenko) pushed a commit that referenced this pull request Oct 9, 2026
Assisted-by: Claude Code:claude-opus-5-5

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d762714. Configure here.

@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 9, 2026
@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 9, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

Ready for review at d76271406fc5.

  • CI: required checks ci-ok and clippy green; 7 check suites succeeded, 2 skipped. 2 superseded workflow run(s) show as cancelled; the required gates passed on this head.
  • Mergeable against main, no CHANGELOG.md change.
  • Bugbot reviewed this head; no unresolved review threads.

Labeled Ready for review by the burn-down agent. Slack announcement pending (connector unavailable this run).


Generated by Claude Code

@mikolalysenko
Mikola Lysenko (mikolalysenko) removed this pull request from the merge queue due to a manual request Oct 9, 2026
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 9, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[agent] ci-ok failed on a5fbe0c (the main merge) only because its upstream jobs were cancelled: 12 jobs, including e2e, cargo, coverage, hosted-e2e and node-addon, were cancelled within about 3 minutes of the run starting, and none of them failed a test. The previous head d762714 was green on all 100 checks. I re-ran the failed jobs of run 37994113413 once. If they fail again, that failure is real and I'll take it up here.


Generated by Claude Code

Merged via the queue into main with commit 56ccbfc Oct 9, 2026
71 of 84 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the arch-refactor/1270-scala-evidence-fail-closed branch October 9, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-refactor PR opened by the scheduled architecture refactor routine Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review refactor Structural change: duplicated code or logic, missing abstraction, layering, dead code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vendored scala-cli gate passes a version conflict when a Bloop project file is truncated or oversized

3 participants