Skip to content

Store stack config as a _config@1 record#41

Merged
cuibonobo merged 3 commits into
mainfrom
claude/elegant-maxwell-e3nh3v
Jun 23, 2026
Merged

Store stack config as a _config@1 record#41
cuibonobo merged 3 commits into
mainfrom
claude/elegant-maxwell-e3nh3v

Conversation

@cuibonobo

Copy link
Copy Markdown
Member

Summary

  • Removes getConfig/setConfig from StackAdapter — config is no longer a stringly-typed key/value bag on the adapter interface
  • Stack-level configuration (ownerEntityId, timezone) is now stored as a singleton _config@1 record in the records table and exposed as typed readonly properties directly on the adapter
  • Adapters that previously stored config in a separate mechanism (SQLite's stack_config table, API adapter's internal Map) now populate the properties from their natural source (record query / discovery endpoint)

What changed

@haverstack/core

  • StackAdapter gains readonly ownerEntityId: string and readonly timezone: string; getConfig/setConfig removed
  • New ConfigContent type and SYSTEM_TYPES.CONFIG ('_config') exported
  • Stack.create() reads directly from adapter.ownerEntityId / adapter.timezone
  • seedSystemTypes() now seeds the _config@1 type definition
  • MemoryAdapter constructor changes from Record<string, string> to { ownerEntityId?, timezone? }

@haverstack/adapter-sqlite

  • Config stored as a _config@1 record with id='_config' in the records table; stack_config table removed from schema
  • runMigrations() handles existing databases by reading stack_config, writing the record, and dropping the table
  • buildWhereClause always excludes the '_config' singleton from app-visible queries

@haverstack/adapter-api

  • ownerEntityId and timezone populated from the discovery response and exposed as public properties; getConfig/setConfig removed

Test plan

  • pnpm -r test passes (182 core + 75 SQLite + 48 API = 305 tests)
  • Existing SQLite databases with stack_config tables are migrated cleanly on next open()
  • _config record does not appear in queryRecords results

Generated by Claude Code

claude added 3 commits June 23, 2026 12:35
Removes getConfig/setConfig from StackAdapter. Stack-level configuration
(ownerEntityId, timezone) is now stored as a singleton _config@1 record
in the records table and exposed as typed readonly properties on the adapter.

- StackAdapter gains ownerEntityId and timezone as required properties
- ConfigContent type and SYSTEM_TYPES.CONFIG added to core
- Stack.create() reads directly from adapter properties
- seedSystemTypes() seeds the _config@1 type definition
- SQLiteAdapter stores config as a _config@1 record; runMigrations()
  handles existing databases with a stack_config table
- buildWhereClause excludes the singleton _config record from all queries
- APIAdapter reads ownerEntityId/timezone from the discovery response
- MemoryAdapter constructor takes { ownerEntityId?, timezone? } options
- All tests updated accordingly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FiDqP6DsUEgtxTaAUj62iE
No reason to store them twice — the adapter is the source of truth.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FiDqP6DsUEgtxTaAUj62iE
@cuibonobo cuibonobo merged commit 19b2931 into main Jun 23, 2026
4 of 5 checks passed
@cuibonobo cuibonobo deleted the claude/elegant-maxwell-e3nh3v branch June 23, 2026 13:38
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.

2 participants