-
Notifications
You must be signed in to change notification settings - Fork 2
notion-md: $EDITOR-based editing — VRS + implementation epic #786
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 28 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
44e864a
docs(notion-md): VRS for $EDITOR-based editing — refuse-lossy, one en…
schickling-assistant ffb6d15
fix(notion-md): refuse pages with not-round-trip-safe body blocks (R3…
schickling-assistant 49c0d2d
fix(notion-md): canonicalize hosted-media URLs everywhere bodies are …
schickling-assistant e0f8e70
feat(notion-md): editor surfaces cat/put/edit (VRS Group A, R30-R39)
schickling-assistant 23dc68a
feat(notion-md): schema-drift refusal via engine schema_snapshot (Gro…
schickling-assistant b38e6ff
feat(notion-md,notion-cli): Group G observability tests + notion edit…
schickling-assistant 6ae9123
docs(notion-md): reconcile OTEL span table with implemented notion_md…
schickling-assistant 26e6442
fix(notion-cli): build renderer TUI apps lazily to fix umbrella TDZ c…
schickling-assistant 7b3fc37
feat(notion-md): surface integration token fingerprint on gateway errors
schickling-assistant 39fba1a
docs(notion-cli): link upstream bun#30634 for the #787 lazy-init work…
schickling-assistant 563772d
docs(notion-md): restructure VRS into layered subsystems + sync-progr…
schickling-assistant d1e03eb
docs(notion-md): add edit --read-only requirement (R46) to 01-editor VRS
schickling-assistant c267b69
feat(notion-md): add `edit --read-only` inspection-only editor session
schickling-assistant 3fe487e
docs(notion-md): rebalance 03-sync-engine to own leaked push-engine m…
schickling-assistant 3bea5ec
docs(notion-md): fix stale cross-cutting anchor links in 01-editor
schickling-assistant f0c12df
docs(notion-md): lift leaked impl detail out of VRS requirements into…
schickling-assistant 5abce09
feat(notion-md): force list tightness in canonical body (spread:false)
schickling-assistant d8e7d7c
feat(notion-md): route pull receive through the canonical body form
schickling-assistant f2a1ace
refactor(notion-md): make pull body total, drop dead endpoint fallback
schickling-assistant 6c5d635
refactor(notion-effect-client): delete vestigial markdownToBlocks con…
schickling-assistant 6f5cdbe
refactor(notion-md): dedupe stripChildAnchors onto one definition
schickling-assistant e936846
test(notion-md): lock planMarkdownUpdate over a canonical base/remote
schickling-assistant 2ddc7c0
docs(notion-md): clarify editor-surface frames the canonical body ver…
schickling-assistant bbd358b
refactor(notion): move canonical body fn into notion-effect-client (O…
schickling-assistant bc90f7f
docs(notion-md): record canonical-body decision 0019, re-baseline demo
schickling-assistant 8f2327d
fix(nix): refresh pnpm-deps FOD hashes after the canonical-body dep move
schickling-assistant 8c6259a
docs(notion-md): compact VRS decision log — delete 6 superseded recor…
schickling-assistant 425a36c
test(notion-md): pin the canonical-body two-oracle invariant + demo f…
schickling-assistant 48382ac
fix(nix): reconcile notion-md pnpm-deps FOD hash after canonical-body…
schickling-assistant 228cc0d
fix(notion): address PR #786 codex review (media-url host gate, utils…
schickling-assistant 8f4f19a
fix(nix): reconcile pnpm-deps FOD hashes after lockfile change
schickling-assistant 5b064dd
fix(nix): reconcile oxc-config pnpm-deps FOD hash after lockfile change
schickling-assistant 13430b1
fix(notion-effect-client): declare inherited utils peer deps via geni…
schickling-assistant fd86d27
feat(notion-md): staged sync progress + drift notes for `edit` (R43–R…
schickling-assistant 17e719b
docs(notion-md): add R47 (visible remote drift on the write path)
schickling-assistant 26d6b97
fix(notion-cli): avoid concurrent import TDZ
schickling-assistant b9b23a5
test(notion-cli): allow cold concurrent import
schickling-assistant 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
25 changes: 25 additions & 0 deletions
25
packages/@overeng/notion-cli/src/concurrent-import.fixture.ts
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,25 @@ | ||
| /** | ||
| * Reproduction fixture for #787: the umbrella `notion` binary loads its three | ||
| * command trees concurrently via `Promise.all` (see `cli.ts`'s `runRootCli`). | ||
| * | ||
| * Under Bun's concurrent async module evaluation this used to reach a renderer | ||
| * `app.ts`'s top-level `createTuiApp(...)` side-effect while the shared | ||
| * `@overeng/tui-react` module graph was still mid-initialization, producing a | ||
| * TDZ `ReferenceError: Cannot access '…' before initialization`. | ||
| * | ||
| * Run with Bun (the umbrella binary's runtime). Exits non-zero on the crash. | ||
| */ | ||
| const main = async () => { | ||
| await Promise.all([ | ||
| import('@overeng/notion-md/cli-program'), | ||
| import('./commands/db/mod.ts'), | ||
| import('./commands/schema/mod.ts'), | ||
| ]) | ||
| process.stdout.write('CONCURRENT_IMPORT_OK\n') | ||
| } | ||
|
|
||
| main().catch((error: unknown) => { | ||
| const message = error instanceof Error ? error.message : String(error) | ||
| process.stderr.write(`CONCURRENT_IMPORT_CRASH: ${message}\n`) | ||
| process.exit(1) | ||
| }) |
30 changes: 30 additions & 0 deletions
30
packages/@overeng/notion-cli/src/concurrent-import.unit.test.ts
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,30 @@ | ||
| import { spawnSync } from 'node:child_process' | ||
| import { fileURLToPath } from 'node:url' | ||
|
|
||
| import { describe, expect, it } from 'vitest' | ||
|
|
||
| /** | ||
| * Regression test for #787. | ||
| * | ||
| * The umbrella `notion` binary runs on Bun and imports its three command trees | ||
| * concurrently. A renderer `app.ts` calling `createTuiApp(...)` as a module-load | ||
| * side-effect crashed with a TDZ error under Bun's concurrent module evaluation. | ||
| * | ||
| * This test spawns the fixture with Bun — the binary's real runtime — because the | ||
| * crash is specific to Bun's async-evaluation interleaving and does not reproduce | ||
| * under vitest's Node runner. | ||
| */ | ||
| describe('concurrent command-tree import (#787)', () => { | ||
| it('loads all three trees concurrently under Bun without a TDZ crash', () => { | ||
| const fixture = fileURLToPath(new URL('./concurrent-import.fixture.ts', import.meta.url)) | ||
|
|
||
| const proc = spawnSync('bun', ['run', fixture], { encoding: 'utf8' }) | ||
|
|
||
| const stdout = proc.stdout ?? '' | ||
| const stderr = proc.stderr ?? '' | ||
|
|
||
| expect(stderr, stderr).not.toContain('before initialization') | ||
| expect(stdout).toContain('CONCURRENT_IMPORT_OK') | ||
| expect(proc.status).toBe(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
29 changes: 20 additions & 9 deletions
29
packages/@overeng/notion-cli/src/renderers/DiffOutput/app.ts
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 |
|---|---|---|
| @@ -1,12 +1,23 @@ | ||
| import { createTuiApp } from '@overeng/tui-react' | ||
| import { type TuiApp, createTuiApp } from '@overeng/tui-react' | ||
|
|
||
| import { DiffState, DiffAction, diffReducer } from './schema.ts' | ||
|
|
||
| /** TUI app definition for the schema diff command. */ | ||
| export const DiffApp = createTuiApp({ | ||
| stateSchema: DiffState, | ||
| actionSchema: DiffAction, | ||
| initial: { _tag: 'Loading' } as DiffState, | ||
| reducer: diffReducer, | ||
| exitCode: (state) => (state._tag === 'Error' ? 1 : 0), | ||
| }) | ||
| let cached: TuiApp<DiffState, DiffAction> | undefined | ||
|
|
||
| /** | ||
| * TUI app definition for the schema diff command. | ||
| * | ||
| * Constructed lazily (and memoized) rather than at module top level: building it | ||
| * eagerly is a module-load side-effect that crashes the umbrella `notion` binary | ||
| * under Bun's concurrent command-tree import (#787, upstream oven-sh/bun#30634). | ||
| * The five renderer `get*App()` accessors share this workaround; see `cli.ts` for | ||
| * the trigger + the TODO to drop it once the Bun fix lands. | ||
| */ | ||
| export const getDiffApp = (): TuiApp<DiffState, DiffAction> => | ||
| (cached ??= createTuiApp({ | ||
| stateSchema: DiffState, | ||
| actionSchema: DiffAction, | ||
| initial: { _tag: 'Loading' } as DiffState, | ||
| reducer: diffReducer, | ||
| exitCode: (state) => (state._tag === 'Error' ? 1 : 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
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.