-
Notifications
You must be signed in to change notification settings - Fork 0
feat: idb infrastructure. #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ on: | |
| pull_request: | ||
| branches: | ||
| - main | ||
| - next | ||
|
|
||
| jobs: | ||
| ci: | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ on: | |
| pull_request: | ||
| branches: | ||
| - main | ||
| - next | ||
| types: | ||
| - opened | ||
| - synchronize | ||
|
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| # Dual Build GitHub Pages Strategy | ||
|
|
||
| ## Purpose | ||
|
|
||
| Document a clean migration strategy for delivering both stable and overhaul UI versions from one repository without adding runtime feature flags to application code. | ||
|
|
||
| ## Core Idea | ||
|
|
||
| Build two versions of the site during deployment and publish both under one GitHub Pages branch. | ||
|
|
||
| - Stable site at root path: /index.html | ||
| - Overhaul site at next path: /next/index.html | ||
|
|
||
| The URL path acts as the switch. | ||
|
|
||
| - Stable: /develop/ | ||
| - Overhaul: /develop/next/ | ||
|
|
||
| ## Why This Approach | ||
|
|
||
| 1. Keeps runtime code clean. | ||
| 2. Avoids pervasive if version checks in app modules. | ||
| 3. Allows side-by-side validation of stable and next UX. | ||
| 4. Reduces long-term cleanup work versus in-app toggles. | ||
|
|
||
| ## Deployment Layout | ||
|
|
||
| Publish a combined artifact to the GitHub Pages branch with this shape: | ||
|
|
||
| - /index.html and root assets from stable branch build | ||
| - /next/index.html and next assets from overhaul branch build | ||
|
|
||
| ## CI Workflow Design | ||
|
|
||
| A deployment workflow builds both branches in one run and publishes one artifact. | ||
|
|
||
| 1. Checkout stable branch into an isolated worktree directory. | ||
| 2. Install dependencies and build stable output. | ||
| 3. Copy stable output into publish root. | ||
| 4. Checkout overhaul branch into a second isolated worktree directory. | ||
| 5. Install dependencies and build overhaul output. | ||
| 6. Copy overhaul output into publish root under /next. | ||
| 7. Deploy combined publish folder to GitHub Pages. | ||
|
|
||
| ## Operational Guidance | ||
|
|
||
| 1. Run both builds in isolated directories to prevent cross-branch contamination. | ||
| 2. Keep Node and npm versions pinned consistently in CI. | ||
| 3. Use workflow concurrency to cancel outdated deploy jobs. | ||
| 4. Use relative asset URLs so content works under both root and /next paths. | ||
| 5. Fail the deploy if either build fails. | ||
|
|
||
| ## Source Control Model | ||
|
|
||
| - main branch represents stable production UX. | ||
| - overhaul branch represents next-generation UX. | ||
| - Deploy workflow may trigger on pushes to either branch, but each run should still build both branches for a consistent dual-output artifact. | ||
|
|
||
| ## Relationship To App Architecture Work | ||
|
|
||
| This strategy complements the multi-tab and local workspace migration by separating rollout concerns from runtime logic. | ||
|
|
||
| - Runtime implementation remains modular and focused on architecture. | ||
| - Deployment controls the exposure of stable versus next. | ||
|
|
||
| ## Tradeoffs | ||
|
|
||
| Pros: | ||
|
|
||
| 1. Cleaner codebase during migration. | ||
| 2. Lower risk of runtime toggle regressions. | ||
| 3. Clear QA and stakeholder review URLs. | ||
|
|
||
| Cons: | ||
|
|
||
| 1. Longer deploy times due to dual builds. | ||
| 2. More CI configuration complexity. | ||
| 3. Temporary branch coordination requirements. | ||
|
|
||
| ## Exit Plan | ||
|
|
||
| After next UI is production-ready: | ||
|
|
||
| 1. Promote next code into main. | ||
| 2. Remove dual-build deployment logic. | ||
| 3. Publish only root output again. | ||
| 4. Remove migration-only docs and branch conventions. | ||
|
|
||
| ## Suggested Follow-up | ||
|
|
||
| 1. Add a deploy workflow implementation doc with exact GitHub Actions YAML and permissions. | ||
| 2. Add a release checklist for validating both URLs before each deploy. | ||
| 3. Add ownership notes for stable and next branch review responsibilities. |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| const previewEntryNamePattern = /(?:^|\/)(?:app|main)\.[jt]sx?$/i | ||
|
|
||
| const normalizeTabIdentity = tab => { | ||
| if (!tab || typeof tab !== 'object') { | ||
| return '' | ||
| } | ||
|
|
||
| if (typeof tab.path === 'string' && tab.path.trim().length > 0) { | ||
| return tab.path.trim() | ||
| } | ||
|
|
||
| if (typeof tab.name === 'string' && tab.name.trim().length > 0) { | ||
| return tab.name.trim() | ||
| } | ||
|
|
||
| return '' | ||
| } | ||
|
|
||
| export const isPreviewEntryTab = tab => | ||
| previewEntryNamePattern.test(normalizeTabIdentity(tab)) | ||
|
|
||
| export const resolvePreviewEntryTab = tabs => { | ||
| if (!Array.isArray(tabs) || tabs.length === 0) { | ||
| return null | ||
| } | ||
|
|
||
| return tabs.find(isPreviewEntryTab) ?? null | ||
| } | ||
|
|
||
| export const canRenderPreview = ({ tabs, fallbackSource = '' } = {}) => { | ||
| if (Array.isArray(tabs) && tabs.length > 0) { | ||
| return Boolean(resolvePreviewEntryTab(tabs)) | ||
| } | ||
|
|
||
| return typeof fallbackSource === 'string' && fallbackSource.trim().length > 0 | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| const normalizeImportSpecifier = value => | ||
| typeof value === 'string' && value.trim().length > 0 ? value.trim() : null | ||
|
|
||
| const normalizeGraphEntry = entry => { | ||
| if (!entry || typeof entry !== 'object') { | ||
| return null | ||
| } | ||
|
|
||
| if (typeof entry.tabId !== 'string' || entry.tabId.length === 0) { | ||
| return null | ||
| } | ||
|
|
||
| const imports = Array.isArray(entry.imports) | ||
| ? entry.imports.map(normalizeImportSpecifier).filter(Boolean) | ||
| : [] | ||
|
|
||
| return { | ||
| tabId: entry.tabId, | ||
| contentHash: typeof entry.contentHash === 'string' ? entry.contentHash : '', | ||
| imports, | ||
| lastUpdated: | ||
| typeof entry.lastUpdated === 'number' && Number.isFinite(entry.lastUpdated) | ||
| ? entry.lastUpdated | ||
| : Date.now(), | ||
| } | ||
| } | ||
|
|
||
| export const createPreviewWorkspaceGraphCache = () => { | ||
| const byTabId = new Map() | ||
|
|
||
| const upsert = entry => { | ||
| const normalized = normalizeGraphEntry(entry) | ||
|
|
||
| if (!normalized) { | ||
| throw new TypeError('Graph entry is invalid.') | ||
| } | ||
|
|
||
| byTabId.set(normalized.tabId, normalized) | ||
| return normalized | ||
| } | ||
|
|
||
| const get = tabId => { | ||
| if (typeof tabId !== 'string' || tabId.length === 0) { | ||
| return null | ||
| } | ||
|
|
||
| return byTabId.get(tabId) ?? null | ||
| } | ||
|
|
||
| const getDependents = targetImportSpecifier => { | ||
| const normalizedSpecifier = normalizeImportSpecifier(targetImportSpecifier) | ||
|
|
||
| if (!normalizedSpecifier) { | ||
| return [] | ||
| } | ||
|
|
||
| const dependents = [] | ||
|
|
||
| for (const entry of byTabId.values()) { | ||
| if (entry.imports.includes(normalizedSpecifier)) { | ||
| dependents.push(entry) | ||
| } | ||
| } | ||
|
|
||
| return dependents | ||
| } | ||
|
|
||
| const remove = tabId => { | ||
| if (typeof tabId !== 'string' || tabId.length === 0) { | ||
| return false | ||
| } | ||
|
|
||
| return byTabId.delete(tabId) | ||
| } | ||
|
|
||
| const clear = () => { | ||
| byTabId.clear() | ||
| } | ||
|
|
||
| const list = () => [...byTabId.values()] | ||
|
|
||
| return { | ||
| upsert, | ||
| get, | ||
| getDependents, | ||
| remove, | ||
| clear, | ||
| list, | ||
| } | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.