Skip to content

Improve diagnostics for invalid local definition references - #175

Draft
pchiusano with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-error-handling-issue
Draft

pchiusano with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-error-handling-issue

Conversation

Copilot AI commented Oct 27, 2026

Copy link
Copy Markdown

@pchiusano @ChrisPenner

Overview

Replace opaque empty Fold crashes from invalid local definition references with diagnostics that identify the reference kind, index, lookup size, and term/type/component context. Validate persisted mapping indices and imported term references so inconsistent data is caught closer to its source.

Implementation notes

  • Add checked local-reference lookup and mapping-contiguity validation.
  • Preserve mapping indices while loading term, type, and cached-result references.
  • Validate decoded term bytes against the supplied local lookup tables before saving.
  • Report partial existing term/type components instead of treating them as complete.
  • Add focused tests for an out-of-range lookup, a mapping gap, and valid mappings.

Interesting/controversial decisions

Validation failures include IDs and hash/component context, but do not include term contents.

Test coverage

Added focused local-reference unit tests. stack test share-api:local-reference-tests could not run because Stack could not find the Unison submodule package at unison/codebase2/codebase/ in this environment.

Loose ends

Initialize the Unison submodule and rerun the test target.

Copilot AI and others added 4 commits October 22, 2026 19:31
Co-authored-by: pchiusano <11074+pchiusano@users.noreply.github.com>
Co-authored-by: pchiusano <11074+pchiusano@users.noreply.github.com>
Co-authored-by: pchiusano <11074+pchiusano@users.noreply.github.com>
Co-authored-by: pchiusano <11074+pchiusano@users.noreply.github.com>
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.

2 participants