Skip to content

Commit 1d946ce

Browse files
committed
feat(nav): rich title-first directory index
1 parent 2546d6f commit 1d946ce

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

internal/core/service/palette.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ func (s *ReadingService) NameIndex(ctx context.Context, scope, world string) ([]
3333
topo := s.readHub(ctx, s.hub)
3434
var host2name map[string]string
3535
if len(topo.nodes) > 0 {
36-
host2name = s.host2name(ctx)
36+
var err error
37+
if host2name, err = s.host2name(ctx); err != nil {
38+
return nil, err // outbound failure propagates; the web layer decides
39+
}
3740
}
3841

3942
if scope != "universe" {

internal/core/service/worldmap.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,15 @@ func intraWorldEdges(world string, host2name map[string]string, all []domain.Edg
258258
}
259259

260260
// host2name maps each authorized world's dial host to its world name — the join
261-
// key for hub-graph refs (keyed by host) against world names. Best-effort: an
262-
// unreadable world list yields an empty map (orphan-ness then unknown).
263-
func (s *ReadingService) host2name(ctx context.Context) map[string]string {
264-
m := map[string]string{}
261+
// key for hub-graph refs (keyed by host) against world names. A world-list read
262+
// failure propagates (outbound-port errors are never swallowed in the core); the
263+
// caller decides whether to degrade or surface it.
264+
func (s *ReadingService) host2name(ctx context.Context) (map[string]string, error) {
265265
worlds, err := s.world.Worlds(ctx)
266266
if err != nil {
267-
return m
267+
return nil, err
268268
}
269+
m := make(map[string]string, len(worlds))
269270
for _, w := range worlds {
270271
addr := w.Address
271272
if addr == "" {
@@ -275,7 +276,7 @@ func (s *ReadingService) host2name(ctx context.Context) map[string]string {
275276
m[h] = w.Name
276277
}
277278
}
278-
return m
279+
return m, nil
279280
}
280281

281282
// worldMember reports whether a topology ref's world resolves to world — either

0 commit comments

Comments
 (0)