Repository navigation
refactor: decouple command discovery and reject pagination cycles #48
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 2 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
fb3bddd
refactor: inject command metadata and reject pagination cycles
thedogwiththedataonit 60a3845
docs: place pagination and development notes beside their context
thedogwiththedataonit 4d4cd72
fix: fence resumed lists and nested comment pagination
thedogwiththedataonit e5b6069
fix: confirm automation lifecycle changes and harden CLI output
thedogwiththedataonit bf96b13
fix: avoid confirmation prompts after stdin is consumed
thedogwiththedataonit 7959972
Merge main for final pre-merge validation
thedogwiththedataonit 29eaf27
fix(cli): preserve automation test payloads and confirm real delivery
thedogwiththedataonit 2181f49
fix(cli): preserve stdin requests in confirmation reruns
thedogwiththedataonit 02364a7
fix: complete and cancel type contract pagination safely
thedogwiththedataonit 69598b0
fix(cli): classify stdin sends and enforce command deadlines
thedogwiththedataonit 808dda1
fix(cli): preserve deadline budget across human confirmation
thedogwiththedataonit f2e5f9f
chore(api): sync integration consent provenance
thedogwiththedataonit ef725d6
fix: synchronize integration contact provenance contracts
thedogwiththedataonit ae0600d
fix(pagination): fail incomplete drains and explain sparse audience p…
thedogwiththedataonit ea20089
chore(api): document fail-closed inbox test creation
thedogwiththedataonit aa32c8c
Merge remote-tracking branch 'origin/main' into audit/cli-50
thedogwiththedataonit 6a070d2
Merge remote-tracking branch 'origin/main' into audit/cli-47
thedogwiththedataonit 206e46d
Merge remote-tracking branch 'origin/main' into audit/cli-48
thedogwiththedataonit e948a3b
fix: avoid confirmation prompts on consumed stdin
thedogwiththedataonit b8bd1ed
Merge branch 'audit/cli-47' into audit/cli-48
thedogwiththedataonit c400f2e
Merge branch 'audit/cli-47' into audit/cli-50
thedogwiththedataonit 9526e0b
Merge remote-tracking branch 'origin/main' into audit/cli-50
thedogwiththedataonit 2c2dd47
test: prove contract generation respects final-read interruption
thedogwiththedataonit 3a3e337
Merge branch 'audit/cli-50' into audit/cli-48
thedogwiththedataonit 2cc2cd2
docs: describe the prepared-input command deadline
thedogwiththedataonit e91eed5
Merge branch 'audit/cli-50' into audit/cli-48
thedogwiththedataonit 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
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 |
|---|---|---|
|
|
@@ -65,5 +65,6 @@ | |
| "typescript": "~6.0.2", | ||
| "vitest": "^4.1.2", | ||
| "yaml": "^2.8.0" | ||
| } | ||
| }, | ||
| "packageManager": "bun@1.3.10" | ||
| } | ||
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
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,78 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { defineCommand } from '../../src/lib/define-command' | ||
| import { collectAll } from '../../src/lib/paginate' | ||
| import { runCli } from '../helpers/run-cli' | ||
|
|
||
| describe('pagination protocol', () => { | ||
| it.each([ | ||
| ['a', 'a'], | ||
| ['a', 'b', 'a'], | ||
| ])( | ||
| 'fails a cyclic drain without printing partial data', | ||
| async (...cursors) => { | ||
| const requested: Array<string | undefined> = [] | ||
| const command = defineCommand({ | ||
| path: ['pagination-fixture'], | ||
| summary: 'Fixture', | ||
| sdkMethod: null, | ||
| commandClass: 'read', | ||
| examples: ['brew-cli pagination-fixture'], | ||
| run: async ({ ctx }) => ({ | ||
| data: await collectAll(ctx, async (cursor) => { | ||
| requested.push(cursor) | ||
| if (requested.length > cursors.length) { | ||
| throw new Error('refetched a known page') | ||
| } | ||
| return { | ||
| data: [requested.length], | ||
| pagination: { cursor: cursors[requested.length - 1] ?? null }, | ||
| } | ||
| }), | ||
| }), | ||
| }) | ||
| const result = await runCli(['pagination-fixture', '--quiet'], { | ||
| extraCommands: [command], | ||
| }) | ||
| expect(result.code).toBe(1) | ||
| expect(result.stdout).toBe('') | ||
| expect(JSON.parse(result.stderr)).toMatchObject({ | ||
| error: { | ||
| code: 'CLI_PAGINATION', | ||
| progress: { | ||
| rowsFetched: cursors.length, | ||
| pagesFetched: cursors.length, | ||
| }, | ||
| }, | ||
| }) | ||
| expect(requested).toEqual([undefined, ...cursors.slice(0, -1)]) | ||
| expect( | ||
| JSON.parse(result.stderr).error.progress.resumeCursor | ||
| ).toBeUndefined() | ||
| } | ||
| ) | ||
|
|
||
| it('follows empty advancing pages and stops on a terminal or absent envelope', async () => { | ||
| const requested: Array<string | undefined> = [] | ||
| const command = defineCommand({ | ||
| path: ['pagination-fixture'], | ||
| summary: 'Fixture', | ||
| sdkMethod: null, | ||
| commandClass: 'read', | ||
| examples: ['brew-cli pagination-fixture'], | ||
| run: async ({ ctx }) => ({ | ||
| data: await collectAll(ctx, async (cursor) => { | ||
| requested.push(cursor) | ||
| return cursor === undefined | ||
| ? { data: [], pagination: { cursor: 'a' } } | ||
| : { data: [7] } | ||
| }), | ||
| }), | ||
| }) | ||
| const result = await runCli(['pagination-fixture', '--quiet'], { | ||
| extraCommands: [command], | ||
| }) | ||
| expect(result.code).toBe(0) | ||
| expect(result.json).toEqual([7]) | ||
| expect(requested).toEqual([undefined, 'a']) | ||
| }) | ||
| }) |
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.