Skip to content

docs: palace_path must have even number of segments#5

Merged
arncore merged 1 commit intodevelopfrom
docs/palace-path-segment-rule
Apr 16, 2026
Merged

docs: palace_path must have even number of segments#5
arncore merged 1 commit intodevelopfrom
docs/palace-path-segment-rule

Conversation

@arncore
Copy link
Copy Markdown
Owner

@arncore arncore commented Apr 16, 2026

Summary

Adds a section to FIRESTORE_BACKEND.md explaining why palace_path must have an even number of segments.

Firestore paths alternate collection/document/collection/document…. Since the backend uses palace_path as a document-level prefix and appends a collection name to it ({palace_path}/mempalace_drawers), the prefix must be even-segmented — otherwise the resulting path is invalid and Firestore raises ValueError: A collection path must have an odd number of components.

This bites anyone nesting the palace under a user doc. A natural-feeling users/{id}/memory is 3 segments → invalid. The fix is to add an anchor doc level, e.g. users/{id}/memory/palace, which Firestore materializes implicitly.

Includes a clear ✅/❌ table of examples.

🤖 Generated with Claude Code

Firestore paths alternate collection/document, so any palace_path used
as a prefix for collection creation must have an even number of
segments — otherwise `db.collection(f"{palace_path}/{name}")` fails
with ValueError.

This bites anyone nesting the palace under a user doc (e.g.
"users/{id}/memory" feels natural but is 3 segments and produces an
invalid collection path). The fix is to add an anchor doc level
("users/{id}/memory/palace"), which Firestore materializes implicitly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@arncore arncore merged commit 13e2a3f into develop Apr 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant