schema ls: list only the metas schema show can produce - #266
Open
thedavidmeister wants to merge 1 commit into
Open
schema ls: list only the metas schema show can produce#266thedavidmeister wants to merge 1 commit into
thedavidmeister wants to merge 1 commit into
Conversation
ls iterated all 13 KnownMeta variants while show matched 4, so 9 of the advertised names answered with "Unsupported for <name> meta". Both now go through one exhaustive KnownMeta -> Option<RootSchema> map, so a new variant is a compile error rather than a listing that show rejects. Closes #181 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 34 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Closes #181
The defect
schema lsiterated all 13KnownMetavariants;schema showmatched 4 ofthem and answered the other 9 with
Error: Unsupported for <name> meta. Thelisting under a command group documented "command related to meta json schema"
was a list of known metas, not of the schemas
showcan produce.The fix
The two surfaces now share one exhaustive
KnownMeta -> Option<RootSchema>mapin
cli::schema::json_schema.lsprints the variants it answersSomefor;showerrors, with its existing message unchanged, onNone. The match has nowildcard arm, so a
KnownMetavariant added later is a compile error in oneplace rather than a name
lsadvertises andshowrejects.schema lsnow printsop-v1,solidity-abi-v2,authoring-meta-v1,interpreter-caller-meta-v1. The full meta enumeration is unchanged and stillavailable from
magic ls.QA
schema_ls_lists_exactly_what_schema_show_accepts(new,crates/cli/tests/cli.rs) — walks everyKnownMeta, assertsschema show <name>succeeds with parseable JSON for each namelsprinted and exits non-zero for each name it did not; fails on base, verified by restoring the pre-fix unfilteredlsand running it:panicked at crates/cli/tests/cli.rs:79:13: listed but unsupported: dotrain-v1.schema_ls_prints_metas_that_have_a_schemaandtest_dispatch_schema_lsare the two pre-existing pinned listings, updated to the 4-name output; both fail on base by construction (base prints 13 lines).ls.rs:5drop.filter(|meta| super::json_schema(*meta).is_some())(= restore the pre-fix body) -> killed byschema_ls_lists_exactly_what_schema_show_accepts("listed but unsupported: dotrain-v1").ls.rs:5.is_some()->.is_none()-> killed byschema_ls_lists_exactly_what_schema_show_accepts("unlisted but supported: op-v1") andschema_ls_prints_metas_that_have_a_schema.schema.rs:31KnownMeta::OpV1 => Some(schema_for!(...))->KnownMeta::OpV1 => None-> killed bycli::schema::show::tests::test_show_op_v1_schema_compact,test_show_pretty_printandtest_show_supported_schemas_are_distinct. No surviving mutant; tree restored and re-verified green after each.schema lsis documented "Print all known schemas." under a command group documented "command related to meta json schema", so the set it prints must be the setshowproduces a schema for. The new test derives its expectation fromKnownMeta::iter()and fromls's own stdout at runtime, not from thejson_schemamatch it is testing, so rewiring that match cannot make the test agree with itself. The four-name pinned lists come from the fourschema_for!arms that existed before this change; no schema was added or removed.lswithshow, or reword the help to "known metas". Covered by the first:lsis filtered, so the existing help text "Print all known schemas." is now true and needs no reword. The user-facing enumeration of all 13 metas is not lost;magic lsstill prints every one.Verification
Green locally:
cargo test -p rain-metadata --test cli --test cli_dispatch -- schema(7 passed),cargo test -p rain-metadata --lib cli::schema(38 passed),cargo clippy -p rain-metadata --all-targetsclean,cargo fmt --check --allclean. The full suite was not run locally.🤖 Generated with Claude Code