Skip to content

Make effective discovery the default for type/member -D; drop empty sections#325

Merged
richlander merged 4 commits into
mainfrom
effective-discovery-default
May 30, 2026
Merged

Make effective discovery the default for type/member -D; drop empty sections#325
richlander merged 4 commits into
mainfrom
effective-discovery-default

Conversation

@richlander
Copy link
Copy Markdown
Owner

Summary

Improves the discovery (-D/--discover) UX for the type and member commands so that discovery advertises what you can actually query, not a static superset.

Two related changes:

  1. Drop empty sections from effective discovery + clearer messaging (88b4f22)

    • Effective discovery now reports only sections/columns that actually render for the given type (e.g. drops member-detail code sections and a Custom Attributes section that a type cannot populate).
    • A valid-but-empty section reports note: section '<X>' has no data for this type (exit 0) instead of the misleading Error: Section '<X>' not found.
  2. Make effective discovery the default; add --schema opt-out (cbab5c0)

    • Plain -D/-D <Section> for type/member now defaults to effective discovery (resolve source, list only sections with data), fixing the footgun where the static schema advertised sections a type can never have (e.g. Custom Attributes).
    • New --schema flag opts back out to the cheap, offline static schema listing.
    • --effective is still accepted (now redundant for type/member); --effective --schema resolves to --schema with a warning (only during discovery).

Scope

  • Limited to type/member (ApiOptions). package/assembly keep their existing static-by-default + --effective opt-in behavior, because their effective path runs a full-package inspection (cost/offline regression risk).
  • The "no source" case for type/member cannot regress into an error: the parser early-returns a static listing before any source is required, so effective is only reached when a source actually exists.
  • Cache-first: effective only triggers a NuGet download on a cache miss (the same cost the real query would pay), then caches it.

Behavior

Command Before After
type <T> -D static schema (all sections) effective (sections with data)
type <T> -D --schema n/a static schema (offline)
type <T> -D --effective effective effective (unchanged)
bare type -D (no source) static static (unchanged)
package <P> -D static static (unchanged)

Tests

  • Added coverage: effective-by-default drops empty sections; --schema restores the full static list; --schema parses to opt out of effective discovery; bare/no-source stays static.
  • Updated the static-path counterpart tests to pass Schema = true explicitly.
  • Full suite green except 9 pre-existing environmental ILDisassemblerComparisonTests failures (missing ilspycmd).

Docs

  • docs/design/schema-query.md updated for the new default + --schema.

richlander and others added 4 commits May 29, 2026 16:55
…aging

Effective discovery (-D --effective) over-reported sections whose CanRender
is a coarse proxy (e.g. Custom Attributes, gated on a type having methods)
but which render no table at the type level. Add a section render-probe
(RestrictToRenderedSections) that drops tabular schema sections producing no
rendered table, reusing the output already used for column narrowing.

Querying a valid-but-empty section now reports a clear note
("section '<X>' has no data for this type", exit 0) instead of a misleading
"not found". Unknown sections still report not-found with suggestions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… opt-out

Plain -D/--discover for the type and member commands now defaults to
effective discovery (resolve source, list only sections/columns with
data), fixing the footgun where the static schema advertised sections a
type can never populate (e.g. Custom Attributes). The new --schema flag
opts back out to the cheap, offline static schema listing.

- ApiOptions: add Schema + computed EffectiveDiscovery (Discover != null
  && !Schema). Gates in ApiCommand/TypeCommand/MemberCommand use it.
- SharedOptions: register --schema; ParseSchema warns only when --schema
  and an explicit --effective conflict during discovery.
- Scope limited to type/member; package/assembly keep static-by-default
  with --effective opt-in (their effective path is a full inspection).
- --effective still accepted (now redundant for type/member).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Convert mid-line asterisk emphasis to underscore to match the file's
enforced emphasis style.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@richlander richlander merged commit 8f645ff into main May 30, 2026
10 checks passed
@richlander richlander deleted the effective-discovery-default branch May 30, 2026 01:00
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