fix(entities): prefix-expansion resolve for bare first names + stub guard#1009
Closed
garrytan-agents wants to merge 1 commit into
Closed
Conversation
…uard
Root cause: resolveEntitySlug fell through to slugify('Jared') → 'jared'
because pg_trgm scores too low on short strings (similarity < 0.4).
writeFactsToFence then stub-created people/jared.md instead of routing
to the existing people/jared-friedman page.
Three-layer fix:
1. resolve.ts: new isBareName() + tryPrefixExpansion() step queries
people/<token>-% then companies/<token>-%, picks highest-connection
match as tiebreaker
2. fence-write.ts: stub-creation guard refuses to create pages with
no directory prefix (bare 'jared' instead of 'people/jared-*')
3. backstop.ts: stubGuardBlocked result routes facts to legacy DB-only
path so they aren't silently dropped
13 new tests (entity-resolve.test.ts), all passing.
Owner
|
Moving to base-repo branch so CI secrets are available (garrytan-agents is a fork; pull_request workflows from forks don't get base-repo secrets). Replacement PR coming next from the same branch pushed to garrytan/gbrain. |
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.
Problem
resolveEntitySlug(Jared) fell through to slugify → bare jared because pg_trgm scores too low on short strings. writeFactsToFence then stub-created a phantom people/jared.md instead of routing to people/jared-friedman.
Three-layer fix
Tests
13 new tests, all passing. Jared→jared-friedman, Diana→diana-hu, Sam→sam-altman, etc.