Repository navigation
Conversation
packages/db/src/data/index.ts listed 512 names by hand and conflicted whenever two PRs added a data function. It is now one export * line per public module. Environment lifecycle writers move to a private data/environment-lifecycle.ts so @bb/db still does not expose them; the @bb/db/internal-environment-lifecycle subpath is unchanged. No export is removed; 230 types and 20 helpers their modules already exported are now also reachable from @bb/db. Co-Authored-By: Claude Opus 5.5 <[email protected]>
data/environment-lifecycle.ts imported getEnvironment from data/environments.ts while environments.ts re-exported from it. Move getEnvironment into the private module so the dependency runs one way; environments.ts still re-exports it, so @bb/db is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
deleted the
bb/stop-hand-editing-the-bb-db-data-export-list-thr_yf5f8s7zrb
branch
November 16, 2026 18:50
This was referenced Nov 17, 2026
mistakeknot
added a commit
to mistakeknot/aleph
that referenced
this pull request
Nov 17, 2026
Sync upstream DB data exports (get-bb#7554)
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.
Human comments
What was wrong
packages/db/src/data/index.tsre-exported every public data function, type, and constant by name: 582 lines, 512 names across 38 modules. Adding or renaming any data function meant editing that list, and 82 commits touched it in the last 60 days, so two open PRs that each add a data function usually conflicted there. The list also served as the public/private filter for@bb/db. It hid 11 helper modules entirely and, inconsistently, about 20 helpers in otherwise-public modules. Only one of those hidden groups was deliberate: the environment-lifecycle writers, whichapps/serverreaches through@bb/db/internal-environment-lifecycle.What changed
packages/db/src/data/index.tsis now oneexport * from "./<module>.js"line per public module (38 lines). A module is public if and only if it is listed there; unlisted modules stay package-private. Adding, renaming, or deleting a function in a public module no longer touches a shared file. Only a new public module adds one line. That happened in 9 of the 82 commits, and a sorted one-line-per-module list conflicts only on adjacent insertions.environments.tsinto a new private module,packages/db/src/data/environment-lifecycle.ts:applyEnvironmentLifecycleEvent,applyEnvironmentLifecycleEventInTransaction,recordProvisionedEnvironmentWorkspace, and the sharedupdateEnvironmentMetadataRecord. So the root@bb/dbstill does not expose them.updateEnvironmentMetadataandrecordEnvironmentCurrentBranchshare the private record writer, and every writer reads throughgetEnvironment, so those three live in that module too.environments.tsimports and re-exports them, so they stay public. The private module imports nothing fromenvironments.ts, so the dependency runs one way and the data modules still have no value-import cycles, as on main.@bb/db/internal-environment-lifecyclenow re-exports from the new module and exports the same 4 values and 2 types as before.CreateProjectSourceInputwas declared, with different shapes, in bothprojects.tsandproject-sources.ts. Star exports reject that (TS2308), and no code outside the two files used either alias, so both aliases are deleted and their one use each now names the underlying type.COMPLETED_EVENT_OUTPUT_RETENTION_MSandRETAINED_EVENT_OUTPUT_TARGETSfromsrc/retained-event-output.ts(not a data module). That re-export moved tosrc/index.ts.packages/db/src/data/environment-lifecycle.ts#…, becauselistQueryFunctionskeys functions by their declaring file. Relative imports inenvironments.test.ts,environment-lifecycle.test.ts, andhosts-environments-cases.tspoint at the new file.Export surface change (computed with the TypeScript checker over
src/index.tsandsrc/internal-environment-lifecycle.ts, before vs after):@bb/dband@bb/db/internal-environment-lifecycleimport keeps working, so no caller changed.@bb/db: 230 types and 20 values that their modules already exported but the list left out. Most of the types already appear in public signatures, for exampleCreateThreadInputandListThreadsOptions. The values:ACTIVE_PENDING_INTERACTION_STATUSES,ACTIVE_THREAD_STATUSES,appendStoredThreadEventInTransaction,bumpThreadEventRewriteGeneration,copyRetainedEventOutputs,getContextWindowUsagePruningBoundarySequence,listActiveVisiblePinnedThreadRoots,markHostSeen,MAX_COMPLETED_EVENT_OUTPUT_MIGRATION_EVENT_DATA_BYTES,NON_TERMINAL_SESSION_STATUSES,prepareLegacyImageGenerationOutputData,PRUNABLE_THREAD_EVENT_TYPES,pruneContextWindowUsageEventsInTransaction,pruneTokenUsageEventsInTransaction,resolveStoredProviderSessions,THREAD_PRUNING_ADVANCE_WORK_BUDGET_MS,ThreadLifecycleEventNotAppliedError,toProjectSource,upsertThreadSearchSegmentBatch,upsertThreadSearchSegments. Each is a sibling of names that were already public (for example, the pluralappendStoredThreadEventsInTransactionandgetStoredProviderSessionwere public), so hiding them was incidental, not a boundary.Alternatives rejected:
@bb/db/data/*subpath: this would rewrite imports in 451 files, conflict with every open PR, and expose the private helper modules.export *already gives.No wire, CLI, or plugin-API change.
How you verified
src/index.tsandsrc/internal-environment-lifecycle.ts: 0 names removed; the additions are listed above.packages/db/src/data/*.tsfinds none on main and none on this branch.tsrs --noEmitfail withTS2308: Module "./project-sources.js" has already exported a member named ..., so a future clash fails typecheck instead of silently dropping a name.pnpm exec turbo run typecheck --filter='...@bb/db'passed (@bb/db,@bb/server,@bb/host-daemon,@bb/scripts,@bb/integration-tests).vitest runontest/data/environments,environment-lifecycle,projects,project-sources, andprompt-history: 50/50 passed.listQueryFunctionsvsQUERY_COST_CASES): no missing cases, no stale cases.oxlinton the changed files: clean.lint:type-aware --filter=@bb/db: passed.🤖 Generated with Claude Code