GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(setup,scan): fail closed on corrupt manifests, JSON envelopes on every hosted failure; fetch_stage unit tests by mikolalysenko · Pull Request #152 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Aug 10, 2026 •
edited by cursor Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #150 (retarget to main once it lands). Three coverage gaps from the 2026-08-10 structure review, each fixed with the RED-first test that pins it:

  1. setup --exclude clobbered a corrupt manifest — persist_setup_excludes flattened a read/parse error to "no manifest yet" and rewrote the file as a bare setup block, destroying every patch record a merely-corrupt (possibly hand-recoverable) manifest still held. Now fails closed: persistence is skipped with a loud stderr warning and the manifest bytes are untouched. Exit semantics deliberately unchanged (the broader setup exit-code question stays a separate product decision). RED-verified: exclude_persistence_fails_closed_on_corrupt_manifest.

  2. scan --redirect --json emitted empty stdout on every failure exit — discovery-detail failure, reference-resolve failure, and both write failures returned exit 1 with nothing to parse. All four bail-outs now emit the machine-readable error envelope (status/error/redirect.mode, mirroring the success envelope's error fold). RED-verified: redirect_json_mode_failures_emit_error_envelope (both legs).

  3. fetch_stage.rs had zero direct tests (443-LOC offline-guard-critical download planner). New in-src unit tests pin: the read-only-.socket/ contract on the Unavailable path, in-place staging when fully cached, the documented disk-vs-vendor staging asymmetry (diff archive sufficient for apply, insufficient for vendor), writable_blobs overlay promotion (late downloads can't pollute the cache), overlay_dir semantics, and the bad --download-mode hard failure.

Verification

  • Both regression tests RED-verified against the unfixed code, then green with the fixes.
  • All 7 fetch_stage unit tests green; neighboring vendor/scan/redirect suites green.
  • cargo clippy --workspace --all-targets -- -D warnings and cargo fmt --check clean.

🤖 Generated with Claude Code


Note

Medium Risk
Touches manifest persistence and hosted redirect CLI output on failure paths; changes are fail-closed and test-backed but affect data-loss and automation parsing behavior.

Overview
Closes three contract gaps with regression tests and targeted behavior fixes.

setup --exclude no longer treats a unreadable or corrupt .socket/manifest.json as “no manifest”: it skips persisting excludes, warns on stderr, and leaves the file byte-identical so patch records are not wiped for an exclude list.

scan --redirect --json (hosted) early failures (discovery, reference resolve, lockfile write, redirect ledger write) now print a parseable JSON envelope on stdout (status: error, error, redirect.mode: hosted) instead of exit 1 with empty stdout; stderr behavior is unchanged.

fetch_stage gains in-module unit tests for offline staging, read-only .socket/, disk vs vendor diff-archive policy, writable_blobs overlay promotion, overlay_dir, and invalid --download-mode.

Reviewed by Cursor Bugbot for commit 078fa1f. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mikolalysenko @claude
fix(setup,scan): fail closed on corrupt manifests, JSON envelopes on …
078fa1f
…every hosted failure; fetch_stage unit tests

Three coverage gaps from the 2026-08-10 structure review, each with the
test that pins it:

* setup --exclude persistence clobbered a corrupt manifest:
  persist_setup_excludes flattened a read/parse error to "no manifest
  yet" and rewrote the file as a bare setup block, destroying every
  patch record a merely-corrupt manifest still held. Now fails closed
  (skip persistence, warn on stderr, manifest bytes untouched). RED
  test: exclude_persistence_fails_closed_on_corrupt_manifest.

* scan --redirect --json emitted empty stdout on every failure exit
  (discovery-detail failure, reference-resolve failure, file/ledger
  write failure) — exit 1 with nothing to parse. All four bail-outs now
  emit the machine-readable error envelope (status/error mirror the
  success envelope's error fold). RED test:
  redirect_json_mode_failures_emit_error_envelope.

* fetch_stage.rs (the offline-guard-critical download planner) had zero
  direct tests. In-src unit tests now pin: the read-only-.socket
  contract, in-place staging when fully cached, the diff-archive
  disk-vs-vendor staging asymmetry both module docs describe, overlay
  promotion for late downloads, overlay_dir semantics, and the
  bad --download-mode hard failure.

Co-Authored-By: Claude Fable 5 <[email protected]>
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

Folded into #150 — the stack was consolidated into a single PR at the author's request; this PR's commit is included there verbatim (cherry-picked, all tests green on the consolidated head).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko Mikola Lysenko (mikolalysenko) closed this Aug 10, 2026
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the fix/coverage-gaps branch August 10, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@mikolalysenko
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.