fix(semantic): resolve Option.insights against findings as well as prior_insights (closes #70)#89
Open
ksd3 wants to merge 1 commit into
Open
Conversation
…ightconeResearch#70) Option.insights previously only resolved against a node's prior_insights map (at bare-id scope, or via ../-form refs at an ancestor's scope). Findings are also Insight entries — claims produced by an analysis are valid evidence for a downstream option, alongside literature-backed prior_insights — so the validator now resolves Option.insights against the union of prior_insights and findings at each scope. The constraint is semantic, not syntactic: LinkML cannot express "this id must resolve in either of two keyed maps." The schema in astra-spec carries a documentation update describing the broader intent. - Thread findings through _validate_decisions and _validate_option_insight_ref - Union prior_insights ∪ findings at both bare-id and ancestor lookups - Update scope-description strings in error messages - Add valid fixture + test covering bare-id and ../-form refs into findings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Closes #70.
Option.insightsnow resolves against the union ofprior_insightsandfindingsat each scope, instead of onlyprior_insights. An option may cite either kind ofInsight— external evidence motivating the choice (prior_insights) or a claim produced by this analysis that in turn justifies a downstream choice (findings).This matches the semantics laid out by the
@claudeanalysis on the issue thread: the constraint is inherently cross-collection, LinkML cannot express it, and the enforcement therefore lives in the semantic validator.Change shape
_validate_option_insight_refpreviously resolved bare ids againstprior_insightsonly (and../id-form refs against an ancestor'sprior_insightsonly). Both lookups now union with the correspondingfindingsmap:{**prior_insights, **findings}at the node-local scope../id,../../id, ... → union ofprior_insights ∪ findingsat the resolved ancestor scope (via the existing_resolve_ancestor_scopewalk)findingsis threaded through_validate_decisionsfrom both call sites — root (validate_analysis) and sub-node (_validate_analysis_node). Scope-description strings inINVALID_INSIGHT_REFmessages updated to say "prior_insights or findings" so author-facing errors stay accurate.Companion PR
A small documentation / schema-description change lives in LightconeResearch/astra-spec#39 — clarifies
Option.insights's expanded resolution inanalysis.yamlanddocs/specification.md. The two are independent (each merges cleanly on its own) but read better together.Test plan
pytest tests/test_validation.py— 83 passed (82 existing + 1 new)test_init_generated_files_are_validfailure unrelated to this change, tracked separately): 213 passed, 21 skippedruff check/ruff format --check/mypyclean on changed filestests/fixtures/valid/option_insights_reference_finding.yamlcovers four cases: bare id → prior_insight, bare id → finding,../id→ ancestor prior_insight,../id→ ancestor findingtest_insight_ref_bare_id_does_not_walk_ancestorsandtest_insight_ref_escapes_too_farstill pass — the union widens which map within a scope but does not widen which scope, so the cross-scope-isolation behavior is preserved