-
Notifications
You must be signed in to change notification settings - Fork 6
feat: add pluggable friction stores #75
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 9 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
6cabac8
Add pluggable friction stores
Slokh 333d5cd
Expose stored occurrence counts
Slokh 553a3a8
Respect PostgreSQL search paths
Slokh ed18ff8
Configure CLI friction stores
Slokh c0ddea2
Simplify Postgres store setup
Slokh ce222cc
Format CLI store configuration
Slokh bf300bd
Resolve pnpm toolchain friction
Slokh 566a4b7
Harden pluggable store boundaries
Slokh 7fbbda0
merge main
jxom 2a6581d
refactor: align pluggable stores
jxom 3051a84
test: use postgres testcontainers
jxom 1c18c67
refactor: group postgres options
jxom 69ce3b2
test: namespace postgres fixture
jxom 29c402a
fix: resolve store review feedback
jxom 8fca846
feat: accept postgres connection strings
jxom f906b82
feat: use postgres.js for stores
jxom 0c570d2
fix: preserve store edge cases
jxom 2b1a59f
feat: migrate stores through frog
jxom 71283ea
docs: describe database store roadmap
jxom 74b1d55
docs: add d1 store roadmap
jxom 6b5f93c
docs: reorder database store guide
jxom 3aa2ac9
fix: guard store parsing boundaries
jxom 3a097a6
docs: simplify database setup
jxom 0239ceb
docs: trim database usage
jxom b70df92
docs: reorder database storage
jxom 20ecbf0
docs: expand database overview
jxom ec4ce5a
docs: reuse database URL
jxom 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
Some comments aren't visible on the classic Files Changed page.
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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| 'frog': minor | ||
| --- | ||
|
|
||
| Add a public friction-store contract, a storage-independent `FrictionLog` API, and an optional | ||
| Postgres adapter while preserving the repository file store as the default. `FROG_DATABASE_URL` | ||
| automatically selects Postgres for CLI commands, and `frog migrate` prepares the selected store. |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { tmpdir } from '../test/helpers.js' | ||
| import { FrictionLog } from './FrictionLog.js' | ||
|
|
||
| const entry = { | ||
| body: 'It took an unnecessary workaround.', | ||
| severity: 'minor', | ||
| title: 'Filters ignored', | ||
| } as const | ||
|
|
||
| describe('FrictionLog', () => { | ||
| test('behavior: defaults to the existing repository-file store', async () => { | ||
| const log = new FrictionLog({ root: await tmpdir() }) | ||
| const result = await log.record(entry) | ||
|
|
||
| expect(result).toMatchObject({ created: true, occurrences: 1 }) | ||
| expect(log.store.name).toBe('file') | ||
| expect(await log.list()).toEqual([result.entry]) | ||
| expect(await log.records()).toEqual([{ entry: result.entry, occurrences: 1 }]) | ||
| }) | ||
|
|
||
| test('behavior: deduplicates normalized titles without changing the file-store default', async () => { | ||
| const log = new FrictionLog({ root: await tmpdir() }) | ||
| const first = await log.record(entry) | ||
| const repeated = await log.record({ ...entry, title: 'filters: ignored!' }) | ||
|
|
||
| expect(repeated).toEqual({ created: false, entry: first.entry, occurrences: 1 }) | ||
| expect(await log.list()).toHaveLength(1) | ||
| }) | ||
|
|
||
| test('behavior: delegates atomic recording to an adapter that provides it', async () => { | ||
| const record = vi.fn(async () => ({ | ||
| created: false, | ||
| entry: { ...entry, id: 'existing' }, | ||
| occurrences: 4, | ||
| })) | ||
| const log = new FrictionLog({ | ||
| store: { | ||
| name: 'custom', | ||
| record, | ||
| read: vi.fn(), | ||
| list: vi.fn(), | ||
| get: vi.fn(), | ||
| write: vi.fn(), | ||
| remove: vi.fn(), | ||
| files: vi.fn(), | ||
| }, | ||
| }) | ||
|
|
||
| await expect(log.record(entry)).resolves.toMatchObject({ created: false, occurrences: 4 }) | ||
| expect(record).toHaveBeenCalledWith(entry, {}) | ||
| }) | ||
| }) |
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.