Skip to content

fix(snapshot): retain schema diagnostics in file failures - #7875

Closed
wunianze666-netizen wants to merge 2 commits into
morluto:mainfrom
wunianze666-netizen:codex/snapshot-validation-diagnostics
Closed

wunianze666-netizen wants to merge 2 commits into
morluto:mainfrom
wunianze666-netizen:codex/snapshot-validation-diagnostics

Conversation

@wunianze666-netizen

@wunianze666-netizen wunianze666-netizen commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #7442. Keep the first snapshot schema failure location/message and the count of additional issues through read/write file wrappers and public CLI/MCP diagnostics, while continuing to refuse invalid snapshots.

Problem and expected behavior

A snapshot containing only empty entries/workflow_entries arrays raises a specific ZodError for missing header fields, but the file wrapper replaced it with a constant reason. Invalid entries and serialization had the same loss. Expected schema errors now use the existing bounded first-issue formatter; original TypeError reasons and unknown-cause fallback remain unchanged.

Change and scope

Reuse domain describeValidationFailure in the existing shared snapshotValidationMessage helper. No duplicate formatter, parser, issue-list representation or new error category. Read and write keep the internal cause while the public error includes a concise reason, not a serialized exception.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: AnalysisSnapshotFiles recognizes the expected schema failure and consumes the existing domain validationFailure description; both file wrappers already share this helper.
  • Contribution scope fit and linked maintainer decision: ordinary correction inside existing snapshot persistence/admission; separate scope decision not applicable.
  • CLI and MCP/tool-catalog contract: existing analyze --snapshot/open_binary snapshot_path keep requests, code/category/retryable and schema unchanged; only the diagnostic reason becomes useful.
  • Provider, bridge, target-format, or platform compatibility: provider-independent local snapshot reading/serialization; no new engine, target execution or format admission.
  • Evidence, artifact, provenance, or reconstruction contract: invalid data remains refused; valid snapshot and input identity are unchanged. No raw cause/stack or new public issue-list representation.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): caller-selected local JSON and inert ZIP fixtures only; no change to cancellation, file selection, permissions, cleanup or fresh-cache CLI behavior.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none; no package/lock changes or generated output committed.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: header/provider/workflow errors through native and streamed readers, serialization refusal before file creation, and compiled CLI/stdio MCP parity with no raw exception. Existing syntax/file-selection/valid-object controls retained.
  • Base reproduction or other evidence: independently observed production source reader's internal ZodError and public constant, plus source CLI on frozen570abe95. After correcting a CLI legacy-envelope test adapter, unchanged production code gives13pass/8fail; all8new controls pass with the correction.
  • User-visible CLI/MCP output (if applicable): details.reason now locates target or query_id and the first message with further-issue count. The same integrity refusal stays nonretryable. Five compiled CLI calls and10full/compact stdio calls passed; two subsequent discovery calls remained usable; generated inputs kept exact hashes.
  • Remaining proof gaps: the older exact2e3/base570 local51-control group had50pass/1existing Windows POSIX-mode assertion failure, and full check had4knip findings reproduced on that unchanged base. These historical results remain below. Current-head Linux CI is now successful as detailed below; skipped deep/provider/Windows-capability lanes and a new full local suite remain unverified.

For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

  • Publication-time source-only recheck on frozen main a6295e4: the file wrapper, shared diagnostic formatter and public error schema are unchanged; the domain snapshot schema only adds supported format enum values. Independent merge-tree exits0, tree fa5ba39f5763ddb779b8435a4e216f445510995e. No checkout/build/tests of that new merge tree are claimed; the local results below belong to exact candidate2e3fc980/base570abe95. New PR CI will qualify its actual merge.

Validation performed

Windows10/x64, pinned Node24.22.1/npm11.16.0, existing locked dependencies and genuine matching native6.8 artifact; no new installation.

  • node scripts/run-development-tests.mjs focused tests/boundary/filesystem/analysisSnapshotInput.test.ts tests/acceptance/analysisSnapshotDiagnostics.test.ts on unchanged570 production — build3 passed,13pass/8diagnostic failures. Initial adapter failed on analyze's extra error decoration; its original log is retained and is not a product failure.
  • node scripts/run-development-tests.mjs focused tests/boundary/filesystem/analysisSnapshotInput.test.ts tests/boundary/filesystem/analysisSnapshot.test.ts tests/boundary/filesystem/analysisSnapshotProvenance.test.ts tests/boundary/mcp/analysisSnapshotProvenanceMcp.test.ts tests/acceptance/analysisSnapshotDiagnostics.test.ts tests/conformance/readmeConsistency.test.ts — build3 passed,50pass/1fail/0skip across51; the single POSIX-mode failure was reproduced on unmodified570 (1selected failure,16filtered controls not executed). No permission assertion was skipped or changed.
  • npm run check — failed at4unused exports/types: staticFileUrlPath, AndroidManifestComponentInventory, ObjcClassImportBindingCoverage, AndroidJniRelocationSource. Unmodified570 knip gives the same4.
  • Separate check:fast, verify:architecture-guards, knip:production, lint:typed and docs:check — passed; formatting/metadata passed. Repeated docs9 are not extra unique tests.
  • npm run verify:test-discovery —2677files exactly once, discovery rather than execution.
  • External production protocol verifier —5CLI/10MCP errors and2successful discovery calls across full/compact, real SDK-converted schemas/canonical errors and input SHA preservation passed. A first verifier mistakenly treated an absent analyze snapshot as a read failure; source confirms it means a fresh cache, so file-selection controls remain at the reader API and public probes use existing invalid files.

Current head a4dc5f4a27ed636dd364a86bbbe3833551214a84 includes maintainer morluto's follow-up commit strengthening the multi-issue fixture: native/streamed readers and CLI/MCP now assert the complete first message and exact additional-issue count. Review thread PRRT_kwDOSB6hVc6xPhmP is resolved. The maintainer reports21 focused tests on macOS plus targeted lint/diff checks; these are their results, not a new local run by the author.

Code CI40737617989 completed success, attempt1:37jobs comprise17success/20optional skips. Source tests passed21,313 with15skips. Static/docs/build, all eight built shards, native build, selected Linux package and final gates passed.

Raw primary, all eight shard, native-build and Linux-package checkouts are 5220d2be32f86375f25f48ee02dcbaaee128f588, parents e79ad6ca8ebbf2e96b5095e7c2b8bfaf27ca7559 + a4dc5f4a27ed636dd364a86bbbe3833551214a84, tree c6239e4365277d6223b5788df3e7b2bb2ccb0667. This is separate from the older locally validated2e3/base570 tree. Input-reader20, persistence17, provenance2, MCP provenance2 and compiled CLI/MCP diagnostics1 passed individually in the raw shard logs; docs9 were observed separately and are not added again. Optional skips do not establish their platform/provider qualifications. Initial run40735888647 was cancelled after the maintainer's newer push, not a code-regression result.

Follow-up validation: the multi-issue missing-header fixture now asserts the first message and exact additional-issue count through native and streamed file readers and public CLI/MCP. The focused two-file run passed 21 tests on macOS; targeted lint and git diff --check passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; no format/identity/admission change, only a specific diagnostic retained.
  • Real Hopper/Ghidra, browser, or OS coverage: generated local snapshots/ZIP and public adapters on Windows; no external provider or target execution. Linux permission control and whole-platform coverage not run.
  • Package or release metadata impact: none; no dependency/install/budget changes.
  • Security, privacy, process, or containment review: known ZodError uses the established first-issue summary; raw cause/stack stays internal and unknown causes remain generic. No capture/replay/model call/release/deployment or performance claim.

Author readiness

Human owner: @wunianze666-netizen

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge, with the previous test-coverage finding addressed.

Summary

The PR keeps snapshot schema diagnostics through the shared file-error helper. Invalid snapshots remain refused.

  • Invalid snapshots now show which schema field failed.

Reviews (2) · Last reviewed commit: "test(snapshot): assert full validation d..." · Reviewed by Greptile

gensokyo-dev added a commit that referenced this pull request Nov 14, 2026
gensokyo-dev added a commit that referenced this pull request Nov 14, 2026
N0zoM1z0 pushed a commit that referenced this pull request Nov 14, 2026
@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Thank you for this fix. It landed in #10499 with your authorship kept on the commit (adapted where noted in the PR), so I'm closing this PR as superseded.

@N0zoM1z0 N0zoM1z0 closed this Nov 14, 2026
@morluto morluto added area: domain Domain logic, errors, and pure functions bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] analyze --snapshot replaces specific schema diagnostics with a constant failure reason

3 participants