fix(search): key ext facet filters on the NIP-AMB <ns>:<facet> grammar (#54) #58
No reviewers
Labels
No labels
bug
discussion
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
edufeed/edufeed-app!58
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/issue-54-ext-filter-shape"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #54.
The issue understated this — it is not latent
The issue's severity section says
filters.extFieldsis "never populated outside tests". That was true when it was filed and is not true ondev@09842a48:LearningContentFilters.svelteholds anextFieldsmap and emits it,ExtFacetField.svelterenders the chips, andLearningView.svelte:250passes it to the loader. The ext facet filters in the learning view are live and match nothing. Toggling a chip narrows the result set to zero rather than filtering it.The correct key, derived rather than guessed
formValuesToAmbJson.js:63-66stores a form-driven ext value atamb.ext[form.dTag][field.id], which serializes to the tag keyext:<dTag>:<fieldId>;ambJsonToFormValues.js:100inverts exactly that. So the filter key is<dTag>:<fieldId>— the kind and the author pubkey are not part of the grammar.Three places, not two
The issue named the two helpers in
searchQueryBuilder.js. It missed the one that matters most:LearningContentFilters.svelte:extKeyFor()builds the stale key and feeds it to those helpers, so fixing only the helpers would have changed nothing observable. Both test files also asserted the stale shape as correct.Decisions worth reviewing
Malformed keys now emit no filter.
extPathToTagKey()returns null unless it gets exactly two non-empty colon-free segments. A malformed key producing nothing is much better than one producing a filter that cannot match — the second reads to a user as "no results" rather than "this is broken".Ext facets are gone from the NIP-50
searchstring. The dot path was removed rather than repaired, per the issue's own recommendation: with reverse-DNS namespaces,ext.org.edufeed.ekw.konfi.themen.idgives no way to tell where the namespace ends and the facet begins. It is unfixable, not just wrong. The exact-match#ext:tag filter is what the relay indexes (nostrlibedufeed@99dfee4).Verification
At
e99dfecb: full suite 5153 passed / 5153, 468 files, lint clean,pnpm check0 errors.Negative control: restoring the old
extKeyFor()fails both component tests, including the new end-to-end one that runs the UI's emitted key throughbuildSearchFilterObject. Asserting the two halves separately is exactly what let them drift apart in the first place.The one
Errors: 1line in the suite output is the pre-existingGlobalFAB.test.jsteardown race — #55, unrelated, every test passes.Not browser-verified yet — a unit test cannot show that a chip now actually filters instead of zeroing the list. Handed to TestOER.