Skip to content

Add connection-aware impact analysis to Query subsystem - #54

Merged
Malcolmnixon merged 4 commits into
mainfrom
feature/connection-aware-impact
Jul 29, 2026
Merged

Add connection-aware impact analysis to Query subsystem#54
Malcolmnixon merged 4 commits into
mainfrom
feature/connection-aware-impact

Conversation

@Malcolmnixon

Copy link
Copy Markdown
Member

This pull request introduces and documents the new --include-connections option for the impact query verb, clarifies and corrects the traversal semantics for connector edges, and adds new traversal-metadata fields to query results. It also updates documentation to reflect these changes, corrects previous inaccuracies about connector edge handling, and ensures help text and CLI behavior are consistent across subsystems.

Key changes include:

Impact Query Semantics and Traversal

  • Added the --include-connections option to the impact query, allowing opt-in, undirected traversal of connect/bind edges, bounded by --walk-depth (default 1 hop), and clarified that default impact traversal is reference-only. [1] [2] [3] [4]
  • Corrected previous documentation: connector edges are present in SemanticIndex.AllEdges, but are now only traversed for impact when explicitly requested, preventing unbounded and misattributed connector traversal. [1] [2]

Query Result Structure

  • Added new optional fields to QueryResultEntry: Depth (traversal depth), Relation (relationship kind, string-serialized), and ViaQualifiedName (actual endpoint for rolled-up connections), all omitted from JSON when null to preserve payload shape for non-traversing verbs. [1] [2] [3]

CLI and Tooling Integration

  • Exposed --include-connections as a pass-through option in the Tool CLI, with help text sourced from resources and tested for parity with Core, ensuring discoverability and consistent documentation. [1] [2]

Documentation and Traceability

  • Updated requirements traceability and internal documentation to reference new helpers, traversal logic, and metadata fields, and to clarify the distinction between impact and used-by semantics post-correction.

These changes make connector traversal in impact explicit, bounded, and correctly attributed, improving both the accuracy of results and the clarity of the API and CLI.

Malcolm Nixon and others added 4 commits July 29, 2026 14:24
Add an opt-in `--include-connections` flag to `query impact`, backed by
`QueryOptions.IncludeConnections`. Default impact semantics are unchanged.

When enabled, `Connect` and `Binding` edges are traversed undirected, since
`SysmlEdge` documents their source/target ordering as carrying no causal
direction. All other edge kinds keep the existing reverse-only directed
traversal. Connection endpoints are rolled up through containment in both
directions, reusing the `Connections` verb's prefix logic (extracted as
`IsSelfOrNestedUnder`), so a subject part matches endpoints nested inside it
and each far endpoint is attributed to its nearest owning declaration.

Connector hops are bounded by `WalkDepth ?? 1` via a per-frontier-item hop
counter, guarding against the transitive degeneracy of shared buses. Reference
edge depth semantics are unchanged.

Add structured, machine-readable members to `QueryResultEntry` for
programmatic clients: `int? Depth`, `SysmlEdgeKind? Relation`, and
`string? ViaQualifiedName`, all omitted from JSON when null and registered in
the source-generated serializer context to stay AOT-safe. `Detail` remains
populated for human-readable Markdown, but the structured fields are
authoritative so clients need not parse "depth N" from English text.

All changes are additive and source-compatible. Requirements, design,
verification docs, README, and the user guide are updated so the feature is
fully traced.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Connect/Binding edges are published into the semantic index alongside
ordinary reference edges, so the impact verb's reference pass followed
every connector a second time: directed instead of undirected, attributed
to the raw nested-port endpoint instead of its owning declaration, and
outside the connector hop bound. Exclude connector edge kinds from
CollectImpactReferences so CollectImpactConnections is their single
attribution path. This bounds connector chains to the hop limit the
summary already claims, and stops one connector producing two entries when
the port sits on the connector's source side.

Replace the impact cycle guard's membership set with a minimum-hop
dictionary and a shared TryReach helper. Connector-hop cost is not
monotonic in breadth-first depth, so an element first reached over a
connector may later be reached over a pure reference path with its hop
budget restored. Re-expand on a strictly cheaper arrival without emitting
a second entry, so nothing within the bound is dropped while each element
keeps its first-arrival depth and relation attribution.

The flag-absent default now reports fewer rows than released versions on
models with declared-endpoint connectors. This is a defect correction, not
a feature removal: the previous behavior contradicted the documented
default and emitted qualified names that cannot be used as query subjects.
It also makes --include-connections a strict superset of the default. The
change is called out in the user guide, README, and design constraints.

Rewrite two mis-named tests onto fixtures that can actually fail, since
every existing connector fixture puts both endpoints on nested ports and
therefore never reaches the defective path. Add fixtures and tests for
both user-reported models and for the hop-minimality case.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restate SysML2Tools-Core-Query-ImpactHopMinimality as observable behavior
rather than cycle-guard mechanism, and move the guard, minimum-hop record,
and re-expansion detail out of its justification while keeping the
connector-hop non-monotonicity rationale.

Scope the "not resolvable as query subjects" claim to nested-port
endpoints, since declared endpoint names such as Model::System::b do
resolve, and replace the appeal to a "documented default contract" with an
intrinsic characterization of the defect, because that contract text never
shipped in a released user guide.

Reframe the user guide upgrade note, which anachronistically described
prior releases as following connectors "even without --include-connections"
when that flag did not exist, while retaining the warning strength.

Restate the verification acceptance criterion to match the requirement and
lead the hop-minimality traceability row with its public entry point.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the compound Core -ImpactConnections requirement with five atomic
requirements (-ImpactConnections, -ImpactConnectionEndpoints,
-ImpactConnectionRollUp, -ImpactConnectionHopBound, -ImpactConnectionCycles)
and the compound -EntryTraversalMetadata requirement with three
(-EntryTraversalMetadata, -EntryMetadataJsonOmission,
-EntryRelationSerialization), redistributing every test registration. The
"never additionally as a reference edge" and "exactly once" clauses are
dropped rather than re-homed because -Impact and -ImpactHopMinimality
already own them; the exactly-once test moves to -ImpactHopMinimality.

Split the Tool -IncludeConnections requirement into -IncludeConnections and
-IncludeConnectionsHelp, expressed purely as observable CLI behavior with
Core-internal detail removed from both title and justification.

Close the general-help traceability gap with a new Tool test asserting that
'query --help' documents --include-connections.

Correct the Tool design's help-block description, which named a resx key
that does not exist, and correct the user guide's claim that the flag can
never alter an existing row: a connector can re-attribute a row to a lower
depth and a Connect relation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Malcolmnixon
Malcolmnixon merged commit f589be0 into main Jul 29, 2026
9 checks passed
@Malcolmnixon
Malcolmnixon deleted the feature/connection-aware-impact branch July 29, 2026 23:53
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.

1 participant