[codex] Add source-aware Builder database foundation#1173
Draft
3mdistal wants to merge 16 commits into
Draft
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
18ba3cd to
5f219de
Compare
Contributor
Visual recap — skippedThe visual recap job did not run for this pull request. This is informational only and does not block the PR. Recap skipped for |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…tch, delete-property cleanup Found while dogfooding the content-template Builder source flow in the browser: - Render Builder reference fields as readable labels instead of raw JSON in the source adapter (+ test) - Remove the duplicate "Local files" sidebar nav button - Add AGENT_NATIVE_LOCAL_BUILDER_ENV local-dev escape hatch so env Builder keys can back a signed-in user under the workspace runtime (non-prod, opt-in; default off keeps the tenant-safety gate and its test intact) + tests + DEVELOPING docs - Clear the mapped source field when its property is deleted so it returns to the picker without a refresh - postinstall now rebuilds better-sqlite3 to match the pinned Node ABI Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Request reference enrichment on the Builder read (content API enrich=true + MCP enrich:true) so referenced entries (e.g. blog-article -> blog-author) come back inline, and harden builderReferenceLabel to pull the referenced entry's name from value.data or the entry top level. Mapped reference columns (author, authors) now render names instead of `model:id` tokens. Verified live: Author column shows real author names. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Builder CMS date fields come back as milliseconds-since-epoch numbers, which normalizeDatePropertyValue dropped (string/object only) — so mapped Date columns rendered empty. Coerce numeric epoch values to a date before normalizing. Tests: the date normalizer and the source-field value mapper both now accept epoch numbers. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
This draft PR adds the first source-aware database foundation to the Content template, with Builder CMS as the first real integration target.
It gives databases an explicit source layer: source metadata, field mappings, row identity/provenance, change sets, review records, and execution records. Builder CMS is wired as a read/diff/review target, with live writes disabled by default. The only live-write-eligible Builder target in this PR is the
agent-native-blog-article-testmodel;blog-articleand every other Builder model remain read-only.What is completed
b4908454:ready,blocked, andwrite_disabledexecute-builder-source-executionwith approval, push-mode, capability, safe-model, dry-run, and idempotency gatesagent-native-blog-article-testc8db4ef:liveWritesEnabledremains false by defaultagent-native-blog-article-testReview Builder updatelives in Database settings -> Source, with badges, modalPush, validate-only disabled state, and guarded live execution when enabled3d1de9b, with execution-path regression coverage added in7ae60bd:builder-${documentId}are detected but are not treated as proven Builder entry IDsThis row is not matched to a Builder entry yet. Refresh or match a Builder row before pushing.execute-builder-source-executionnow has a regression test proving synthetic fixture rows block beforeexecuteWriteis invokedagent-native-blog-article-testBuilder entry:readBuilderCmsContentEntries({ model: "agent-native-blog-article-test", limit: 3 })returnedstate: livewith three real entry IDsexecuteBuilderCmsWritePATCHed/api/v1/write/agent-native-blog-article-test/0bdeaf87310f4d7f9a677c6fa862764e?autoSaveOnly=true&triggerWebhooks=falsedata.title, then immediately reverteddata.titleto the original{ ok: true, status: 200, entryId: "0bdeaf87310f4d7f9a677c6fa862764e" }agent-native-blog-article-test6a231de4a:http://127.0.0.1:8081with the ignored root.envloadedhttp://localhost:8081/page/oJ5v9MB3EiDZin the in-app browserDatabase settingsBuilder update badge appearedDatabase settings -> Source -> Review Builder updateagent-native-blog-article-testand entry0bdeaf87310f4d7f9a677c6fa862764ePushand sawPushed to Builder and reconciled locallyapplied, execution issucceeded, target model isagent-native-blog-article-test, response status is200, and the toolbar pending badge clearsfetch failedwhile direct Node fetch workedMaximum update depth exceeded; the in-app browser itself was unauthenticated, so it could not prove the authenticated database rowsagent-native-blog-article-testand showed20 of 20 entries matched.What is not completed yet
autoSaveOnly=truevisibility still needs a follow-up decision:200write response/reconciled local successoJ5v9MB3EiDZ; it is an unmatched fixture row and should now be ignored by live-source diff synthesis or blocked before execution.Validation
Passed:
pnpm --filter content exec vitest --run actions/execute-builder-source-execution.test.ts actions/_builder-cms-write-adapter.test.ts actions/_builder-cms-write-client.test.ts actions/_database-source-utils.test.ts app/components/editor/DocumentDatabase.test.tsResult: 5 files passed, 126 tests passed.
Passed:
pnpm --filter content exec vitest --run actions/_database-source-utils.test.ts actions/content-database-source-actions.test.ts actions/_builder-cms-read-client.test.ts actions/_builder-cms-source-adapter.test.ts actions/_builder-cms-write-adapter.test.ts actions/_builder-cms-write-client.test.ts actions/_builder-cms-write-settings.test.ts actions/execute-builder-source-execution.test.ts app/components/editor/DocumentDatabase.test.tsResult: 9 files passed, 161 tests passed.
Passed:
Passed:
Direct live-write proof:
.envand the content dev server started with that env loaded, the orchestrator ran a direct app-client probe fromtemplates/contentagainst onlyagent-native-blog-article-test.readBuilderCmsContentEntries({ model: "agent-native-blog-article-test", limit: 3 })returnedstate: live, count 3, with real entry IDs.executeBuilderCmsWritePATCHed real test entry0bdeaf87310f4d7f9a677c6fa862764eat/api/v1/write/agent-native-blog-article-test/0bdeaf87310f4d7f9a677c6fa862764e?autoSaveOnly=true&triggerWebhooks=false, changeddata.title, then immediately reverteddata.titleto the original.{ ok: true, status: 200, entryId: "0bdeaf87310f4d7f9a677c6fa862764e" }.agent-native-blog-article-test.Browser/runtime notes:
cb68555still 404ed when attempting to PATCH the legacy first row;3d1de9bchanges that case to a blocked local execution instead of a live PATCH attempt.6a231de4a:agent-native-blog-article-testPushcompleted withPushed to Builder and reconciled locally77b018a3-3e55-4d06-8cfa-c8018ef38b44asapplied, execution assucceeded, target modelagent-native-blog-article-test, entry0bdeaf87310f4d7f9a677c6fa862764e, response status200autoSaveOnly=true, so draft/autosave visibility remains a follow-up verification question.Maximum update depth exceededconsole errors.Latest focused validation:
pnpm --filter content exec vitest run actions/_builder-cms-write-client.test.ts actions/_database-source-utils.test.ts actions/content-database-source-actions.test.ts app/components/editor/DocumentDatabase.test.tsResult: 4 files passed, 119 tests passed.