Skip to content

Make contrib-screen fail gracefully, report partial index results - #23

Open
nishantkluhera wants to merge 2 commits into
mainfrom
issue-2-contrib-screen-graceful-failure
Open

Make contrib-screen fail gracefully, report partial index results#23
nishantkluhera wants to merge 2 commits into
mainfrom
issue-2-contrib-screen-graceful-failure

Conversation

@nishantkluhera

Copy link
Copy Markdown

Audit of all 5 tools' failure modes, fixes included, rebuilt on top of the post-#11 plugin (record_outcome, org-graph MCP server, dashboard, build_env).

  • github.py: read-timeouts, dropped connections, and mid-body truncations (IncompleteRead) all normalize to retryable GitHubError
  • sync_org: per-repo isolation for API AND local-DB failures, with rollback so a failed repo's partial writes never leak into the next repo's commit
  • index handler: repos_indexed/failed_repos partial contract preserving upstream mcp_server keys; empty-org is its own error; MCP registration only fires when something indexed
  • screen: API failure = distinct retryable tool_error, never a verdict
  • search/_voice: falsy-zero-safe limit coercion; corrupt-DB recovery errors
  • claim: unwritable dir/file refuses to fake exclusivity

README gains a Failure behavior section. ~20 failure-path tests ported onto the merged suite's conventions. Two pre-existing test_find_dockerfiles_* failures are unrelated (Windows path handling in upstream build_env, verified on clean main).

Closes #2

Merge order: this PR first; #3->#10 in the chain retarget after each merge.

Rebuild of the issue-2 work on top of origin/main's expanded plugin
(record_outcome, org-graph MCP server, dashboard, build_env):

- github.py: read-timeouts (bare TimeoutError), dropped connections
  (OSError), and mid-body truncations (http.client.IncompleteRead,
  an HTTPException not an OSError) all normalize to retryable
  GitHubError - handlers catch one transport type
- org_index.sync_org: per-repo isolation for GitHubError AND local
  sqlite3.Error; partial sweeps keep prior successes searchable and
  report failed_repos
- index handler: repos_indexed/failed_repos/note partial contract,
  preserving upstream's mcp_server keys; empty-org is its own error;
  all-failed carries per-repo detail; MCP registration only fires
  when something actually indexed
- screen: API failure = distinct retryable tool_error, never a
  verdict; signed_orgs validated
- search/_voice: limit parsed without the falsy-zero trap (0 must
  reach validation, same bug class as claim's old ttl_hours or 2);
  corrupt DB = recovery-step error
- claim: unwritable dir/file/replace refuse to fake exclusivity

Tests ported onto the merged 132-test suite's conventions (~20 new).
Two upstream test adaptations documented inline: mcp-registration test
now indexes one real repo (zero-repo indexing is now an error) and
exposes its fake's latent repo-shape mismatch. The two
test_find_dockerfiles_* failures are pre-existing on clean main
(Windows path handling in build_env) - verified by stashing.

Closes #2
…cion

- sync_org: store.db.rollback() in both failure branches. Without it,
  a repo failing mid-sync_repo (rate limit landing after
  list_repo_issues already wrote rows) left its pending writes on the
  shared transaction, and the NEXT successful repo's commit() published
  them - a 'failed' repo partially indexed and searchable, directly
  contradicting the failed_repos note. Prior successes are durable
  (each committed by its own sync_repo), so rollback discards exactly
  the failing repo's partials. Regression test asserts bad's issue is
  absent from the db while ok/fine persist.
- _coerce_positive_int: reject bools (int(True)==1 slipped through as
  a valid limit) and catch OverflowError (int(float('inf')) escaped
  the TypeError/ValueError net into the registry catch-all)
- comment corrections: empty repos:[] never reaches the no-results
  branch (upstream coerces it to whole-org); test comment no longer
  overstates the fake's prior exercise

Found by second-pass code review with a live reproduction.
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.

Audit plugins/contrib-screen/'s tools for graceful failure, not just the happy path

1 participant