Repository navigation
feat(server): suggest near slugs when a direct read finds no entity - #211
Conversation
Signed-off-by: Erik Nilsen <enilsen16@live.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
PR SummaryMedium Risk Overview The server adds Reviewed by Cursor Bugbot for commit 8a91321. Bugbot is set up for automated code reviews on this repo. Configure here. |
Signed-off-by: Erik Nilsen <enilsen16@live.com>
Problem
When a direct read does not find an entity, the error says only
entity not found. The caller must list or search to find the correct slug. For example,get_slice_projectionforcommand_sliceacme-storefront/place-orderfails, but the slug isplace-order-slice.Change
did_you_meanto theNOT_FOUNDErrorInfometadata. The value is up to 3 comma-separated slugs, closest first. The slugs have the same kind and the same namespace as the request. A prefix or substring match ranks above an edit-distance match.get_entity,get_slice_projection,get_storyboard_projectionandget_event_model_projection(live read only, notas_of_changeset).require_visiblepasses. A namespace that the caller cannot see still gets the bareNOT_FOUND, so a lookup cannot show what the namespace contains.Failure::from_reasonin the client copiesdid_you_meaninto the failure details as a list. MCP shows it asnext_action_detail.did_you_meanwith no MCP change.trogon-atlas-server/src/suggest.rs). The workspace has no string-distance crate, so this change adds none.docs/reference/failure-reasons.mddocuments the new metadata.Test
suggest.rsunit tests: a missing suffix ranks above a closer typo; only the same kind and namespace are suggested; at most 3 distinct slugs; an unrelated slug is not suggested.failure.rsunit test:did_you_meanmetadata becomes a list in the details.tests/cross_tenant_reads.rs: the owner getsdid_you_meanfor a near slug, and a caller who cannot see the namespace getsNOT_FOUNDwith nodid_you_mean.cargo test -p trogon-atlas-server -p trogon-atlas-client -p trogon-atlas-mcp -p trogon-atlas-cliandcargo clippy -p trogon-atlas-server -p trogon-atlas-client --all-targets -- -D warningspass.Follow-up for the maintainer
Other not-found paths still return the bare error. They can use the same
read_errhelper if you want them:get_outgoing_references,export_event_model_manifests,validate_event_model,diff_entities(both sides)retarget_references(thetotarget) and theput_entityreadas_of_changesetpath ofget_event_model_projectionget_changeset,revert_changesetand the changeset lookups insnapshot_as_of/baseline_changesets_after(these are ids, not slugs, so a slug ranking may not fit)Closes #77
Need help on this PR? Tag
@codesmith-botwith what you need.