repo stringlengths 5 53 | pr_number int32 1 321k | task_type stringclasses 2
values | issue_text stringlengths 0 81.2k | pr_title stringlengths 1 319 | pr_body stringlengths 0 105k | base_sha stringlengths 40 40 | head_sha stringlengths 40 40 | gold_diff stringlengths 0 202M | changed_files listlengths 0 100 | review_threads listlengths 0 100 | test_patch stringlengths 0 23.4M | merged bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
vadimdemedes/ink | 888 | comment_to_fix | Add interactive option for non-TTY and CI environments | This is not correct. It's already automatically disabled for these. | fbbeb23594f3a0b74f312afbc32823c79e01b9c6 | 763ac98ed7f6de2df8f84fe309b49eebc84573d7 | diff --git a/readme.md b/readme.md
index 78f521c35..8dedf6f8a 100644
--- a/readme.md
+++ b/readme.md
@@ -2480,6 +2480,23 @@ render(<MyApp />, {concurrent: true});
> [!NOTE]
> Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. The `concurrent` option only takes... | [
"readme.md"
] | [
{
"comment": "This is not correct. It's already automatically disabled for these.",
"path": "readme.md",
"hunk": "@@ -2427,6 +2427,25 @@ render(<MyApp />, {concurrent: true});\n > [!NOTE]\n > Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. The... | true | ||
vadimdemedes/ink | 888 | comment_to_fix | Add interactive option for non-TTY and CI environments | "Enable" sounds weird as description when it's on by default. | fbbeb23594f3a0b74f312afbc32823c79e01b9c6 | 763ac98ed7f6de2df8f84fe309b49eebc84573d7 | diff --git a/readme.md b/readme.md
index 78f521c35..8dedf6f8a 100644
--- a/readme.md
+++ b/readme.md
@@ -2480,6 +2480,23 @@ render(<MyApp />, {concurrent: true});
> [!NOTE]
> Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. The `concurrent` option only takes... | [
"readme.md"
] | [
{
"comment": "\"Enable\" sounds weird as description when it's on by default.",
"path": "readme.md",
"hunk": "@@ -2427,6 +2427,25 @@ render(<MyApp />, {concurrent: true});\n > [!NOTE]\n > Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. The `co... | true | ||
vadimdemedes/ink | 884 | issue_to_patch | Update tsconfig | Upgrade several dependencies to their latest versions and refactor the package loading logic for improved efficiency. | be1b1bb6ec65056e2ed60ef3c5ae642704b82d31 | 85889538b0fc4d382a8642027651c7272a0d063c | diff --git a/package.json b/package.json
index e5fff51fb..06ef5d3bc 100644
--- a/package.json
+++ b/package.json
@@ -72,7 +72,7 @@
},
"devDependencies": {
"@faker-js/faker": "^10.3.0",
- "@sindresorhus/tsconfig": "^7.0.0",
+ "@sindresorhus/tsconfig": "^8.1.0",
"@sinonjs/fake-timers": "^15.1.0",
"@types/m... | [
"package.json",
"tsconfig.json"
] | [
{
"comment": "Using `fs` was an intentional choice. `import` requires `with` attribute and it's not stable.",
"path": "src/reconciler.ts",
"hunk": "@@ -100,12 +100,8 @@ let currentUpdatePriority = NoEventPriority;\n let currentRootNode: DOMElement | undefined;\n \n async function loadPackageJson() {\n-\... | true | ||
vadimdemedes/ink | 890 | issue_to_patch | ci: test on Node.js 22 and 24 | ## Summary
- Add Node.js 22 (Maintenance LTS) and 24 (Active LTS) to the CI test matrix
- The package declares `engines: ">=20"` but only tested on Node.js 20
This ensures regressions on newer runtimes are caught before release.
## Current state
```yaml
node_version:
- 20
```
## After
```yaml
node_version:
- ... | 88731d1ebee11d235d7ee74c26ce91261618b9e0 | 435dc79bafa594f787ebc6a022dd31a5563c8898 | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 929df8519..523fb232c 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -7,9 +7,11 @@ jobs:
strategy:
matrix:
node_version:
+ - 24
+ - 22
- 20
steps:
- - uses: ... | [
".github/workflows/test.yml"
] | [] | true | ||
vadimdemedes/ink | 891 | issue_to_patch | test: expand coverage for measureText and text width | ## Summary
- Add 11 new tests for `measureText` (previously had 1 test)
- Add 4 new tests for text width rendering (previously had 1 test)
## Problem
`measureText` is load-bearing for all layout correctness — it tells Yoga how wide text is — but only had a single test for the word "constructor". Text width rendering... | 88731d1ebee11d235d7ee74c26ce91261618b9e0 | 2f768b4a80829b876910da37bee2d16f3d94bce0 | [
"test/measure-text.tsx",
"test/text-width.tsx"
] | [] | diff --git a/test/measure-text.tsx b/test/measure-text.tsx
index e5276b7a7..8e55e59e8 100644
--- a/test/measure-text.tsx
+++ b/test/measure-text.tsx
@@ -1,7 +1,72 @@
import test from 'ava';
import measureText from '../src/measure-text.js';
-test('measure "constructor"', t => {
- const {width} = measureText('constru... | true | ||
vadimdemedes/ink | 877 | issue_to_patch | react devtools v7 error
14805 | var validateAndParse = function validateAndParse2(version) {
14806 | if (typeof version !== "string") {
14807 | throw new TypeError("Invalid argument expected string");
14808 | }
14809 | var match = version.match(semver);
14810 | ... | Add support for react-devtools version 7 | Update the peer dependency for react-devtools-core to ensure compatibility with the latest version.
<img width="912" height="712" alt="image" src="https://github.com/user-attachments/assets/153dbb4f-617d-4dc2-8a0f-0b2b1b183e63" />
closes #878
| bd2f6a4f03da24a0f91c1cdbaca3caf176e3e05a | d25ece39aa2209bd30d97dcb9725f28973a9e612 | diff --git a/package.json b/package.json
index 618353274..4944b0518 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,8 @@
"prepare": "npm run build",
"test": "tsc --noEmit && xo && FORCE_COLOR=true ava",
"example": "NODE_NO_WARNINGS=1 node --import=tsx",
- "benchmark": "NODE_NO_WARNINGS=1 node --impo... | [
"package.json",
"src/ink.tsx",
"src/reconciler.ts",
"src/utils.ts"
] | [
{
"comment": "I don't see any reason to break older versions.\n```suggestion\n\t\t\"react-devtools-core\": \">=6.1.2\"\n```",
"path": "package.json",
"hunk": "@@ -104,7 +104,7 @@\n \t\"peerDependencies\": {\n \t\t\"@types/react\": \">=19.0.0\",\n \t\t\"react\": \">=19.0.0\",\n-\t\t\"react-devtools-core\... | true | |
vadimdemedes/ink | 877 | comment_to_fix | Add support for react-devtools version 7 | I don't see any reason to break older versions.
```suggestion
"react-devtools-core": ">=6.1.2"
``` | bd2f6a4f03da24a0f91c1cdbaca3caf176e3e05a | d25ece39aa2209bd30d97dcb9725f28973a9e612 | diff --git a/package.json b/package.json
index 618353274..4944b0518 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,8 @@
"prepare": "npm run build",
"test": "tsc --noEmit && xo && FORCE_COLOR=true ava",
"example": "NODE_NO_WARNINGS=1 node --import=tsx",
- "benchmark": "NODE_NO_WARNINGS=1 node --impo... | [
"package.json"
] | [
{
"comment": "I don't see any reason to break older versions.\n```suggestion\n\t\t\"react-devtools-core\": \">=6.1.2\"\n```",
"path": "package.json",
"hunk": "@@ -104,7 +104,7 @@\n \t\"peerDependencies\": {\n \t\t\"@types/react\": \">=19.0.0\",\n \t\t\"react\": \">=19.0.0\",\n-\t\t\"react-devtools-core\... | true | ||
vadimdemedes/ink | 877 | comment_to_fix | Add support for react-devtools version 7 | This should be the Ink version. | bd2f6a4f03da24a0f91c1cdbaca3caf176e3e05a | d25ece39aa2209bd30d97dcb9725f28973a9e612 | diff --git a/src/reconciler.ts b/src/reconciler.ts
index 12fad7c01..4817d094b 100644
--- a/src/reconciler.ts
+++ b/src/reconciler.ts
@@ -1,4 +1,3 @@
-import process from 'node:process';
import createReconciler, {type ReactContext} from 'react-reconciler';
import {
DefaultEventPriority,
@@ -23,11 +22,12 @@ import {
... | [
"src/reconciler.ts"
] | [
{
"comment": "This should be the Ink version.",
"path": "src/reconciler.ts",
"hunk": "@@ -346,4 +346,8 @@ export default createReconciler<\n \twaitForCommitToBeReady() {\n \t\treturn null;\n \t},\n+\t// TODO: get the name and version dynamically from package.json with \"resolveJsonModule\" but it's not ... | true | ||
vadimdemedes/ink | 877 | comment_to_fix | Add support for react-devtools version 7 | Just keep passing in this with a TODO comment to remove when we target v7. | bd2f6a4f03da24a0f91c1cdbaca3caf176e3e05a | d25ece39aa2209bd30d97dcb9725f28973a9e612 | diff --git a/src/ink.tsx b/src/ink.tsx
index 831386ab6..2e2e7b483 100644
--- a/src/ink.tsx
+++ b/src/ink.tsx
@@ -11,6 +11,7 @@ import {type FiberRoot} from 'react-reconciler';
import Yoga from 'yoga-layout';
import wrapAnsi from 'wrap-ansi';
import terminalSize from 'terminal-size';
+import {isDev} from './utils.js'... | [
"src/ink.tsx"
] | [
{
"comment": "Just keep passing in this with a TODO comment to remove when we target v7.",
"path": "src/ink.tsx",
"hunk": "@@ -280,13 +280,8 @@ export default class Ink {\n \t\tthis.unsubscribeExit = signalExit(this.unmount, {alwaysLast: false});\n \n \t\tif (process.env['DEV'] === 'true') {\n-\t\t\trec... | true | ||
vadimdemedes/ink | 877 | comment_to_fix | Add support for react-devtools version 7 | This should be a function. And use proper async/await, not `.then`. | bd2f6a4f03da24a0f91c1cdbaca3caf176e3e05a | d25ece39aa2209bd30d97dcb9725f28973a9e612 | diff --git a/src/reconciler.ts b/src/reconciler.ts
index 12fad7c01..4817d094b 100644
--- a/src/reconciler.ts
+++ b/src/reconciler.ts
@@ -1,4 +1,3 @@
-import process from 'node:process';
import createReconciler, {type ReactContext} from 'react-reconciler';
import {
DefaultEventPriority,
@@ -23,11 +22,12 @@ import {
... | [
"src/reconciler.ts"
] | [
{
"comment": "This should be a function. And use proper async/await, not `.then`.",
"path": "src/reconciler.ts",
"hunk": "@@ -99,6 +99,12 @@ let currentUpdatePriority = NoEventPriority;\n \n let currentRootNode: DOMElement | undefined;\n \n+export const packageJson = JSON.parse(",
"resolving_sha": "... | true | ||
vadimdemedes/ink | 877 | comment_to_fix | Add support for react-devtools version 7 | These should only be set in `DEV`. No point in doing it in production. | bd2f6a4f03da24a0f91c1cdbaca3caf176e3e05a | d25ece39aa2209bd30d97dcb9725f28973a9e612 | diff --git a/src/reconciler.ts b/src/reconciler.ts
index 12fad7c01..4817d094b 100644
--- a/src/reconciler.ts
+++ b/src/reconciler.ts
@@ -1,4 +1,3 @@
-import process from 'node:process';
import createReconciler, {type ReactContext} from 'react-reconciler';
import {
DefaultEventPriority,
@@ -23,11 +22,12 @@ import {
... | [
"src/reconciler.ts"
] | [
{
"comment": "These should only be set in `DEV`. No point in doing it in production.",
"path": "src/reconciler.ts",
"hunk": "@@ -346,4 +352,6 @@ export default createReconciler<\n \twaitForCommitToBeReady() {\n \t\treturn null;\n \t},\n+\trendererPackageName: packageJson.name,\n+\trendererVersion: packa... | true | ||
vadimdemedes/ink | 879 | issue_to_patch | Nested <Text> element displays on wrong line when previous string length goes from 0 to 1
While writing a component for multi-line text input, I ran into an issue where the `<Text>` element that I'm using to represent the cursor fails to show up in the correct spot in a specific situation. Specifically, whenever the s... | fix: mark text node dirty on insertBefore to fix stale layout | ## Summary
Fixes #867
When a string child of `<Text>` transitions from empty (`""`) to non-empty (e.g., `"x"`), the rendered output could be incorrectly truncated because Yoga used a stale cached width from the previous layout.
### Root cause
`insertBeforeNode` in `dom.ts` had an early `return` that skipped the `ma... | 54c4e6518c392ab2bf81f006492756fe3291e1de | f08d59d390fbd73835e6eee34fee3b01dbee7904 | diff --git a/src/dom.ts b/src/dom.ts
index 59da3cb3c..9cb6faaf2 100644
--- a/src/dom.ts
+++ b/src/dom.ts
@@ -145,17 +145,15 @@ export const insertBeforeNode = (
if (newChildNode.yogaNode) {
node.yogaNode?.insertChild(newChildNode.yogaNode, index);
}
+ } else {
+ node.childNodes.push(newChildNode);
- retur... | [
"src/dom.ts",
"test/text.tsx"
] | [] | diff --git a/test/text.tsx b/test/text.tsx
index 1bf03febe..a62582fb4 100644
--- a/test/text.tsx
+++ b/test/text.tsx
@@ -99,6 +99,27 @@ test('text with inversion', t => {
t.is(output, chalk.inverse('Test'));
});
+// See https://github.com/vadimdemedes/ink/issues/867
+test('text with empty-to-nonempty sibling does ... | true |
vadimdemedes/ink | 874 | issue_to_patch | Add react-router/MemoryRouter to list of useful components in the readme
I've been looking for a solution to implement routing in `ink`, in particular I saw this https://github.com/jimmed/ink-router which looks abandoned but let me understand I was not the first one to take a look at this need,
I ended up looking a... | Add routing recipe using React Router's MemoryRouter | ## Summary
- Adds a **Recipes** section to the README with a routing recipe showing how to use React Router's `MemoryRouter` in Ink apps
- Adds a working example in `examples/router/` demonstrating route navigation with `useNavigate` and `useInput`
- Adds `react-router` to devDependencies for the example (following `@... | 3ded4bef2d2e516bceb5110fbe9de969f0514ca3 | 32631755a49d03d8539deeaa4da04cfef898a9a6 | diff --git a/examples/router/index.ts b/examples/router/index.ts
new file mode 100644
index 000000000..7d892d433
--- /dev/null
+++ b/examples/router/index.ts
@@ -0,0 +1,1 @@
+import './router.js';
diff --git a/examples/router/router.tsx b/examples/router/router.tsx
new file mode 100644
index 000000000..8cae9e119
--- /d... | [
"examples/router/index.ts",
"examples/router/router.tsx",
"package.json",
"readme.md",
"recipes/routing.md"
] | [
{
"comment": "The readme is getting quite long. I think this should be in a separate markdown file in \"recipes\" folder.",
"path": "readme.md",
"hunk": "@@ -2569,6 +2570,61 @@ For a practical example of building an accessible component, see the [ARIA examp\n \n - [ink-use-stdout-dimensions](https://git... | true | |
vadimdemedes/ink | 835 | issue_to_patch | perf: use caches to speed up output generation | Really only noticeable for huge terminals so hard to use the current benchmarks, but anecdotally on my 150x200 terminal it's sped renders up from ~40ms to ~9ms, so almost 5x faster. Presumably it'd be more of a speedup the larger the terminal gets.
All tests (that were passing on current `master`) are passing. | 6c47b49f0fd4d1b9ac810859476bb6e706a71bf0 | ea64f62e3d72c842ce579f5ac37be691ac3109c2 | diff --git a/src/output.ts b/src/output.ts
index 1a0a86cc4..197000849 100644
--- a/src/output.ts
+++ b/src/output.ts
@@ -1,6 +1,5 @@
import sliceAnsi from 'slice-ansi';
import stringWidth from 'string-width';
-import widestLine from 'widest-line';
import {
type StyledChar,
styledCharsFromTokens,
@@ -48,11 +47,53... | [
"src/output.ts"
] | [] | true | ||
vadimdemedes/ink | 873 | issue_to_patch | Add Color Picker Component to Ink Documentation
### **Description**:
I have developed a color picker component for **Ink** and would like to contribute by adding it to the documentation under the **"Useful Components"** section.
#### Links:
- **NPM Package**: [ink-color-picker](https://www.npmjs.com/package... | docs: ink-color-picker added to useful components list | add `ink-color-picker` to the list of useful components inside readme.md.
follow up pull request on the linked issue - @sindresorhus
Closes #690 | 3ded4bef2d2e516bceb5110fbe9de969f0514ca3 | 37a21d08a8bc07ba9674884cf5823ee03cf7e565 | diff --git a/readme.md b/readme.md
index 0684151a2..2521ead0c 100644
--- a/readme.md
+++ b/readme.md
@@ -2564,6 +2564,7 @@ For a practical example of building an accessible component, see the [ARIA examp
- [ink-scroll-list](https://github.com/ByteLandTechnology/ink-scroll-list) - Scrollable list.
- [ink-stepper](http... | [
"readme.md"
] | [] | true | |
vadimdemedes/ink | 871 | issue_to_patch | Links don't render correctly when used with flexDirection='row'
I am seeing a strange issue when using `ink-link` (or `terminalLink` as well) along with the [Box](https://github.com/vadimdemedes/ink/blob/master/src/components/Box.js) provided by [ink](https://github.com/vadimdemedes/ink).
I am trying to make a two ... | Upgrade slice-ansi to v8 for hyperlink-aware slicing | ## Summary
- Upgrades `slice-ansi` from `^7.1.0` to `^8.0.0`
- v8.0.0 adds hyperlink-aware slicing, fixing links that render incorrectly when used with `flexDirection="row"`
The root cause was that `slice-ansi` didn't understand terminal hyperlink escape sequences (OSC 8), producing invalid output when Ink's layout e... | 4848547e92f012c5e65dc31566a0daaf6de4446f | cc1dca9344da4f158fcf4d5182e5bf73ec41d3f1 | diff --git a/package.json b/package.json
index fbc74d461..2e4d3eb3d 100644
--- a/package.json
+++ b/package.json
@@ -59,7 +59,7 @@
"react-reconciler": "^0.33.0",
"scheduler": "^0.27.0",
"signal-exit": "^3.0.7",
- "slice-ansi": "^7.1.0",
+ "slice-ansi": "^8.0.0",
"stack-utils": "^2.0.6",
"string-width":... | [
"package.json"
] | [] | true | |
vadimdemedes/ink | 868 | issue_to_patch | How to render to string
Is there a way to render to string? I am wanting to render to a file for documentation, etc. | Add renderToString() for synchronous string output | Closes #459.
## Summary
Add a `renderToString()` function that renders React elements to a string synchronously, without writing to stdout or setting up terminal event listeners.
```jsx
import {renderToString, Text, Box} from 'ink';
const output = renderToString(
<Box padding={1}>
<Text color="green">Hello Wo... | c183c53a8174fa1693e04685072973ba519d72d5 | 755f5ffb2b5f3112be2da674f553d6266ddf2049 | diff --git a/readme.md b/readme.md
index af6341fd1..4a92fafdd 100644
--- a/readme.md
+++ b/readme.md
@@ -2234,6 +2234,56 @@ When the kitty keyboard protocol is enabled, input handling changes in several w
- `Escape` key vs `Ctrl+[` - these are disambiguated.
- **Event types.** With the `reportEventTypes` flag, key ... | [
"readme.md",
"src/index.ts",
"src/render-to-string.ts",
"test/render-to-string.tsx"
] | [
{
"comment": "Don't hard-wrap.",
"path": "src/render-to-string.ts",
"hunk": "@@ -0,0 +1,154 @@\n+import type {ReactNode} from 'react';\n+import Yoga from 'yoga-layout';\n+import {LegacyRoot} from 'react-reconciler/constants.js';\n+import reconciler from './reconciler.js';\n+import renderer from './rende... | diff --git a/test/render-to-string.tsx b/test/render-to-string.tsx
new file mode 100644
index 000000000..bbcb2eda4
--- /dev/null
+++ b/test/render-to-string.tsx
@@ -0,0 +1,365 @@
+import test from 'ava';
+import chalk from 'chalk';
+import boxen from 'boxen';
+import React, {useEffect, useLayoutEffect, useState} from '... | true |
vadimdemedes/ink | 746 | issue_to_patch | Feat: Add Screen Reader and ARIA support | Introduces a suite of accessibility enhancements to Ink, centered around screen reader detection and support for ARIA attributes. These changes are just a starting point.
* screen reader-aware rendering: Ink can now be initialized in a "screen reader" mode via the isScreenReaderEnabled option in render() or by setti... | 56a5a7f5c2975e03c50b71ef5362f64532e278b6 | 5e8e5f813a07de0e2b37a69ddd9b4a48d4fb4d60 | diff --git a/examples/aria/aria.tsx b/examples/aria/aria.tsx
new file mode 100644
index 000000000..202c4ac70
--- /dev/null
+++ b/examples/aria/aria.tsx
@@ -0,0 +1,31 @@
+import React, {useState} from 'react';
+import {render, Text, Box, useInput} from 'ink';
+
+function AriaExample() {
+ const [checked, setChecked] = u... | [
"examples/aria/aria.tsx",
"examples/aria/index.ts",
"examples/select-input/index.ts",
"examples/select-input/select-input.tsx",
"readme.md",
"src/components/AccessibilityContext.ts",
"src/components/Box.tsx",
"src/components/ErrorOverview.tsx",
"src/components/Text.tsx",
"src/components/Transform.... | [
{
"comment": "nit: name internalAccessibility doesn't seem consistent with other names. Should either be internal_accessibility\nor consider switching to just surfacing \nariaHidden directly.",
"path": "src/components/Text.tsx",
"hunk": "@@ -119,8 +133,11 @@ export default function Text({\n \t\t<ink-tex... | diff --git a/test/helpers/render-to-string.ts b/test/helpers/render-to-string.ts
index 1e9e29e2a..0ffb6267f 100644
--- a/test/helpers/render-to-string.ts
+++ b/test/helpers/render-to-string.ts
@@ -3,13 +3,14 @@ import createStdout from './create-stdout.js';
export const renderToString: (
node: React.JSX.Element,
-... | true | |
vadimdemedes/ink | 746 | comment_to_fix | Feat: Add Screen Reader and ARIA support | nit: name internalAccessibility doesn't seem consistent with other names. Should either be internal_accessibility
or consider switching to just surfacing
ariaHidden directly. | 56a5a7f5c2975e03c50b71ef5362f64532e278b6 | 5e8e5f813a07de0e2b37a69ddd9b4a48d4fb4d60 | diff --git a/src/components/Text.tsx b/src/components/Text.tsx
index 93ef38840..9f81aaffc 100644
--- a/src/components/Text.tsx
+++ b/src/components/Text.tsx
@@ -3,9 +3,20 @@ import chalk, {type ForegroundColorName} from 'chalk';
import {type LiteralUnion} from 'type-fest';
import colorize from '../colorize.js';
impo... | [
"src/components/Text.tsx"
] | [
{
"comment": "nit: name internalAccessibility doesn't seem consistent with other names. Should either be internal_accessibility\nor consider switching to just surfacing \nariaHidden directly.",
"path": "src/components/Text.tsx",
"hunk": "@@ -119,8 +133,11 @@ export default function Text({\n \t\t<ink-tex... | true | ||
vadimdemedes/ink | 746 | comment_to_fix | Feat: Add Screen Reader and ARIA support | should we also omit children if ariaHidden is specified? | 56a5a7f5c2975e03c50b71ef5362f64532e278b6 | 5e8e5f813a07de0e2b37a69ddd9b4a48d4fb4d60 | diff --git a/src/components/Text.tsx b/src/components/Text.tsx
index 93ef38840..9f81aaffc 100644
--- a/src/components/Text.tsx
+++ b/src/components/Text.tsx
@@ -3,9 +3,20 @@ import chalk, {type ForegroundColorName} from 'chalk';
import {type LiteralUnion} from 'type-fest';
import colorize from '../colorize.js';
impo... | [
"src/components/Text.tsx"
] | [
{
"comment": "should we also omit children if ariaHidden is specified?",
"path": "src/components/Text.tsx",
"hunk": "@@ -119,8 +133,11 @@ export default function Text({\n \t\t<ink-text\n \t\t\tstyle={{flexGrow: 0, flexShrink: 1, flexDirection: 'row', textWrap: wrap}}\n \t\t\tinternal_transform={transfor... | true | ||
vadimdemedes/ink | 746 | comment_to_fix | Feat: Add Screen Reader and ARIA support | The previous could leave a trailing comma.
```suggestion
aria-label={
line === origin.line ? `Line ${line}, error` : `Line ${line}`
}
``` | 56a5a7f5c2975e03c50b71ef5362f64532e278b6 | 5e8e5f813a07de0e2b37a69ddd9b4a48d4fb4d60 | diff --git a/src/components/ErrorOverview.tsx b/src/components/ErrorOverview.tsx
index adfdf615d..d9509e78d 100644
--- a/src/components/ErrorOverview.tsx
+++ b/src/components/ErrorOverview.tsx
@@ -67,6 +67,11 @@ export default function ErrorOverview({error}: Props) {
dimColor={line !== origin.line}
... | [
"src/components/ErrorOverview.tsx"
] | [
{
"comment": "The previous could leave a trailing comma.\r\n\r\n```suggestion\r\n\t\t\t\t\t\t\t\t\taria-label={\r\n\t\t\t\t\t\t\t\t\t\tline === origin.line ? `Line ${line}, error` : `Line ${line}`\r\n\t\t\t\t\t\t\t\t\t}\r\n```",
"path": "src/components/ErrorOverview.tsx",
"hunk": "@@ -67,6 +67,9 @@ expo... | true | ||
vadimdemedes/ink | 746 | comment_to_fix | Feat: Add Screen Reader and ARIA support | Should it really be height 1 when empty?
```suggestion
const outputHeight = output === '' ? 0 : output.split('\n').length;
``` | 56a5a7f5c2975e03c50b71ef5362f64532e278b6 | 5e8e5f813a07de0e2b37a69ddd9b4a48d4fb4d60 | diff --git a/src/renderer.ts b/src/renderer.ts
index 4898a7b60..08e8bc81e 100644
--- a/src/renderer.ts
+++ b/src/renderer.ts
@@ -1,4 +1,6 @@
-import renderNodeToOutput from './render-node-to-output.js';
+import renderNodeToOutput, {
+ renderNodeToScreenReaderOutput,
+} from './render-node-to-output.js';
import Output ... | [
"src/renderer.ts"
] | [
{
"comment": "Should it really be height 1 when empty?\r\n\r\n```suggestion\r\n\t\t\tconst outputHeight = output === '' ? 0 : output.split('\\n').length;\r\n```",
"path": "src/renderer.ts",
"hunk": "@@ -8,14 +10,27 @@ type Result = {\n \tstaticOutput: string;\n };\n \n-const renderer = (node: DOMElement... | true | ||
vadimdemedes/ink | 746 | comment_to_fix | Feat: Add Screen Reader and ARIA support | Some more tests:
```js
test('render aria-label-only Text for screen readers', t => {
const output = renderToString(
<Text aria-label="Screen-reader only" />,
{
isScreenReaderEnabled: true,
},
);
t.is(output, 'Screen-reader only');
});
test('omit ANSI styl... | 56a5a7f5c2975e03c50b71ef5362f64532e278b6 | 5e8e5f813a07de0e2b37a69ddd9b4a48d4fb4d60 | diff --git a/test/screen-reader.tsx b/test/screen-reader.tsx
new file mode 100644
index 000000000..2dfd24fe1
--- /dev/null
+++ b/test/screen-reader.tsx
@@ -0,0 +1,348 @@
+import test from 'ava';
+import React from 'react';
+import {Box, Text} from '../src/index.js';
+import {renderToString} from './helpers/render-to-st... | [
"test/screen-reader.tsx"
] | [
{
"comment": "Some more tests:\r\n\r\n```js\r\ntest('render aria-label-only Text for screen readers', t => {\r\n const output = renderToString(\r\n <Text aria-label=\"Screen-reader only\" />,\r\n {\r\n isScreenReaderEnabled: true,\r\n },\r\n );\r\n\r\n t.is(output, 'Scre... | true | ||
vadimdemedes/ink | 746 | comment_to_fix | Feat: Add Screen Reader and ARIA support | I would like to see more tests. Maybe ask Gemini to generate more tests. | 56a5a7f5c2975e03c50b71ef5362f64532e278b6 | 5e8e5f813a07de0e2b37a69ddd9b4a48d4fb4d60 | diff --git a/test/screen-reader.tsx b/test/screen-reader.tsx
new file mode 100644
index 000000000..2dfd24fe1
--- /dev/null
+++ b/test/screen-reader.tsx
@@ -0,0 +1,348 @@
+import test from 'ava';
+import React from 'react';
+import {Box, Text} from '../src/index.js';
+import {renderToString} from './helpers/render-to-st... | [
"test/screen-reader.tsx"
] | [
{
"comment": "I would like to see more tests. Maybe ask Gemini to generate more tests.",
"path": "test/screen-reader.tsx",
"hunk": "@@ -0,0 +1,76 @@\n+import test from 'ava';",
"resolving_sha": "5e8e5f813a07de0e2b37a69ddd9b4a48d4fb4d60",
"resolving_diff": "diff --git a/test/screen-reader.tsx b/t... | true | ||
vadimdemedes/ink | 746 | comment_to_fix | Feat: Add Screen Reader and ARIA support | I would mention that Ink only supports a tiny subset of AIRA and link to https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA | 56a5a7f5c2975e03c50b71ef5362f64532e278b6 | 5e8e5f813a07de0e2b37a69ddd9b4a48d4fb4d60 | diff --git a/readme.md b/readme.md
index f847131ef..93fd73c9a 100644
--- a/readme.md
+++ b/readme.md
@@ -144,6 +144,7 @@ Feel free to play around with the code and fork this repl at [https://repl.it/@v
- [API](#api)
- [Testing](#testing)
- [Using React Devtools](#using-react-devtools)
+- [Screen Reader Support](#scr... | [
"readme.md"
] | [
{
"comment": "I would mention that Ink only supports a tiny subset of AIRA and link to https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA",
"path": "readme.md",
"hunk": "@@ -2153,6 +2174,92 @@ You can even inspect and change the props of components, and see the results imm\n \n **Note**: Yo... | true | ||
vadimdemedes/ink | 746 | comment_to_fix | Feat: Add Screen Reader and ARIA support | Add a section below this one called "Creating Components" which can be expanded upon later, but for now, it could encourage writing accessible components. | 56a5a7f5c2975e03c50b71ef5362f64532e278b6 | 5e8e5f813a07de0e2b37a69ddd9b4a48d4fb4d60 | diff --git a/readme.md b/readme.md
index f847131ef..93fd73c9a 100644
--- a/readme.md
+++ b/readme.md
@@ -144,6 +144,7 @@ Feel free to play around with the code and fork this repl at [https://repl.it/@v
- [API](#api)
- [Testing](#testing)
- [Using React Devtools](#using-react-devtools)
+- [Screen Reader Support](#scr... | [
"readme.md"
] | [
{
"comment": "Add a section below this one called \"Creating Components\" which can be expanded upon later, but for now, it could encourage writing accessible components.",
"path": "readme.md",
"hunk": "@@ -2153,6 +2174,92 @@ You can even inspect and change the props of components, and see the results i... | true | ||
vadimdemedes/ink | 855 | issue_to_patch | feat: Add kitty keyboard protocol support | ## Summary
- Add support for the kitty keyboard protocol for enhanced keyboard input
- Parse CSI u sequences for kitty protocol key events
- Add new Key modifiers: `super`, `hyper`, `capsLock`, `numLock`
- Add `eventType` field for press/repeat/release events
- Protocol auto-enables in TTY environments (configurable vi... | 390549d03940972555c8189906cec79ea64a7b1c | 0354eadd8b19c8150946d1610f803e074c784654 | diff --git a/readme.md b/readme.md
index e8c84c22d..af6341fd1 100644
--- a/readme.md
+++ b/readme.md
@@ -1592,6 +1592,41 @@ Default: `false`
[Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.
+###### key.super
+
+Type: `boolean`\
+Default: `false`
+
+Super key (Cmd on macOS, Win on Windows) was presse... | [
"readme.md",
"src/hooks/use-input.ts",
"src/index.ts",
"src/ink.tsx",
"src/kitty-keyboard.ts",
"src/parse-keypress.ts",
"src/render.ts",
"test/fixtures/use-input-kitty.tsx",
"test/hooks.tsx",
"test/kitty-keyboard.tsx"
] | [
{
"comment": "Make sure readme and index.d.ts docs are in sync. For example, this one is not.",
"path": "readme.md",
"hunk": "@@ -2088,6 +2123,46 @@ render(<MyApp />, {concurrent: true});\n \n **Note:** Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await u... | diff --git a/test/fixtures/use-input-kitty.tsx b/test/fixtures/use-input-kitty.tsx
new file mode 100644
index 000000000..2ee892b85
--- /dev/null
+++ b/test/fixtures/use-input-kitty.tsx
@@ -0,0 +1,98 @@
+import process from 'node:process';
+import React from 'react';
+import {render, useInput, useApp} from '../../src/in... | true | |
vadimdemedes/ink | 855 | comment_to_fix | feat: Add kitty keyboard protocol support | Make sure readme and index.d.ts docs are in sync. For example, this one is not. | 390549d03940972555c8189906cec79ea64a7b1c | 0354eadd8b19c8150946d1610f803e074c784654 | diff --git a/readme.md b/readme.md
index e8c84c22d..af6341fd1 100644
--- a/readme.md
+++ b/readme.md
@@ -1592,6 +1592,41 @@ Default: `false`
[Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.
+###### key.super
+
+Type: `boolean`\
+Default: `false`
+
+Super key (Cmd on macOS, Win on Windows) was presse... | [
"readme.md"
] | [
{
"comment": "Make sure readme and index.d.ts docs are in sync. For example, this one is not.",
"path": "readme.md",
"hunk": "@@ -2088,6 +2123,46 @@ render(<MyApp />, {concurrent: true});\n \n **Note:** Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await u... | true | ||
vadimdemedes/ink | 855 | comment_to_fix | feat: Add kitty keyboard protocol support | Should be separate code blocks. Each with their own `import`. I don't think `render(<MyApp />, {kittyKeyboard: {mode: 'enabled'}});` example is needed. | 390549d03940972555c8189906cec79ea64a7b1c | 0354eadd8b19c8150946d1610f803e074c784654 | diff --git a/readme.md b/readme.md
index e8c84c22d..af6341fd1 100644
--- a/readme.md
+++ b/readme.md
@@ -1592,6 +1592,41 @@ Default: `false`
[Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.
+###### key.super
+
+Type: `boolean`\
+Default: `false`
+
+Super key (Cmd on macOS, Win on Windows) was presse... | [
"readme.md"
] | [
{
"comment": "Should be separate code blocks. Each with their own `import`. I don't think `render(<MyApp />, {kittyKeyboard: {mode: 'enabled'}});` example is needed.",
"path": "readme.md",
"hunk": "@@ -2088,6 +2123,46 @@ render(<MyApp />, {concurrent: true});\n \n **Note:** Concurrent mode changes the t... | true | ||
vadimdemedes/ink | 866 | issue_to_patch | Add IME cursor positioning and Synchronized Update Mode | ## Summary
- Expose a `useCursor()` hook so apps can position the terminal cursor after each render — enabling CJK IME composition characters to appear at the correct location
- Wrap terminal output with **Synchronized Update Mode** (`CSI ? 2026 h/l`) to prevent terminal multiplexers (tmux, Zellij) from reading interm... | 9b21b24794230a574083c3f477c4518318805786 | aefd18ee5d02ff743e571518950d0b0462c54640 | diff --git a/examples/cursor-ime/cursor-ime.tsx b/examples/cursor-ime/cursor-ime.tsx
new file mode 100644
index 000000000..51a5faa83
--- /dev/null
+++ b/examples/cursor-ime/cursor-ime.tsx
@@ -0,0 +1,35 @@
+import React, {useState} from 'react';
+import stringWidth from 'string-width';
+import {render, Box, Text, useInp... | [
"examples/cursor-ime/cursor-ime.tsx",
"examples/cursor-ime/index.ts",
"readme.md",
"src/components/App.tsx",
"src/components/CursorContext.ts",
"src/cursor-helpers.ts",
"src/hooks/use-cursor.ts",
"src/index.ts",
"src/ink.tsx",
"src/log-update.ts",
"src/write-synchronized.ts",
"test/cursor-help... | [] | diff --git a/test/cursor-helpers.tsx b/test/cursor-helpers.tsx
new file mode 100644
index 000000000..6afbd554a
--- /dev/null
+++ b/test/cursor-helpers.tsx
@@ -0,0 +1,123 @@
+import test from 'ava';
+import ansiEscapes from 'ansi-escapes';
+import {
+ cursorPositionChanged,
+ buildCursorSuffix,
+ buildReturnToBottom,
+ ... | true | |
vadimdemedes/ink | 799 | issue_to_patch | Add dev3000 to the list of Ink users | 9b21b24794230a574083c3f477c4518318805786 | 2cc192f0109b951e9d4463c4293a37f8c8bd08f2 | diff --git a/readme.md b/readme.md
index ac0790d04..ccbcd9e92 100644
--- a/readme.md
+++ b/readme.md
@@ -123,6 +123,7 @@ Feel free to play around with the code and fork this Repl at [https://repl.it/@v
- [argonaut](https://github.com/darksworm/argonaut) - Manage Argo CD resources.
- [Qodo Command](https://github.com/... | [
"readme.md"
] | [] | true | |||
vadimdemedes/ink | 817 | issue_to_patch | I built an AI client using Ink and can access it via SSH | Experience it now using `ssh vadimdemedes@chat.agi.li` | 9b21b24794230a574083c3f477c4518318805786 | 9f03f26fa7816700cf1d65b6f7f9cc1bf77cd791 | diff --git a/readme.md b/readme.md
index ac0790d04..8437f5460 100644
--- a/readme.md
+++ b/readme.md
@@ -126,6 +126,7 @@ Feel free to play around with the code and fork this Repl at [https://repl.it/@v
- [Neovate Code](https://github.com/neovateai/neovate-code) - An agentic coding tool made by AntGroup.
- [instagram-... | [
"readme.md"
] | [] | true | ||
vadimdemedes/ink | 856 | issue_to_patch | Fullscreen: trailing newline on initial render <> lack of trailing newline on update
Kudos for an approved fix https://github.com/vadimdemedes/ink/pull/769. That issue bugged me for a while and required hacks for vim-style fullscreen application.
After testing I believe this fix is incomplete: I see that first render... | Fix fullscreen trailing newline on initial render | ## Summary
Add a `fullscreen` render option to fix the trailing newline issue in fullscreen terminal applications.
**The problem (issue #808):**
In fullscreen mode, the trailing newline added on initial render caused the first line of the UI to be cut off.
**Previous approach (broken):**
Simply removing the trailing... | c587da3e34a96aa7d740b6c1669b09ada0479c48 | 97b1e4659f527ec414e9d085cc923a9d108f1dad | diff --git a/src/ink.tsx b/src/ink.tsx
index d8070fbbe..6458b13b7 100644
--- a/src/ink.tsx
+++ b/src/ink.tsx
@@ -74,6 +74,7 @@ export default class Ink {
// Ignore last render after unmounting a tree to prevent empty output before exit
private isUnmounted: boolean;
private lastOutput: string;
+ private lastOutput... | [
"src/ink.tsx",
"src/log-update.ts",
"test/log-update.tsx"
] | [] | diff --git a/test/log-update.tsx b/test/log-update.tsx
index e1d70af36..b98dfc75b 100644
--- a/test/log-update.tsx
+++ b/test/log-update.tsx
@@ -7,11 +7,11 @@ test('standard rendering - renders and updates output', t => {
const stdout = createStdout();
const render = logUpdate.create(stdout);
- render('Hello');
+... | true |
vadimdemedes/ink | 863 | issue_to_patch | Wait for Ink to finish any pending renders before process exit
I have a custom logger class which uses Ink.
If I hit an exception anywhere in my application, the parent process immediately exits and stops Ink from going through any final render cycles that would result in logs being printed.
If I put a timeout for 1... | fix: make unmount flush pending renders and await stdout drain | ## Summary
- Makes `unmount()` flush pending throttled renders and log writes before the final render, so the last frame is always displayed
- Makes `waitUntilExit()` await the stdout drain callback, so the promise only resolves once buffered writes are actually flushed to the terminal
- Users can use `process.exitCode... | c587da3e34a96aa7d740b6c1669b09ada0479c48 | 6d537d213a91ad2e2a871e99ad585af198a36c36 | diff --git a/src/ink.tsx b/src/ink.tsx
index d8070fbbe..195f4f3ac 100644
--- a/src/ink.tsx
+++ b/src/ink.tsx
@@ -1,6 +1,6 @@
import process from 'node:process';
import React, {type ReactNode} from 'react';
-import {throttle} from 'es-toolkit/compat';
+import {throttle, type DebouncedFunc} from 'es-toolkit/compat';
i... | [
"src/ink.tsx",
"test/render.tsx"
] | [] | diff --git a/test/render.tsx b/test/render.tsx
index 87bb41b7d..01fa2b711 100644
--- a/test/render.tsx
+++ b/test/render.tsx
@@ -1,5 +1,6 @@
import EventEmitter from 'node:events';
import process from 'node:process';
+import {Writable} from 'node:stream';
import url from 'node:url';
import * as path from 'node:path... | true |
vadimdemedes/ink | 850 | issue_to_patch | Support React concurrent mode
- https://github.com/vadimdemedes/ink/pull/719
- https://github.com/vadimdemedes/ink/pull/656
It will require rewriting all the tests. | Concurrent rendering support | ## Summary
Fixes #720
Add optional React Concurrent Rendering mode to Ink, enabling React 19's concurrent features like Suspense with async data and useTransition.
- Add `concurrent?: boolean` option to render API
- Use `ConcurrentRoot` instead of `LegacyRoot` when enabled
- Integrate Scheduler ... | e8b08e75cf272761d63782179019d052e4410545 | 691104b15279ce217506679df7982f317d906d37 | diff --git a/examples/concurrent-suspense/concurrent-suspense.tsx b/examples/concurrent-suspense/concurrent-suspense.tsx
new file mode 100644
index 000000000..902faf13b
--- /dev/null
+++ b/examples/concurrent-suspense/concurrent-suspense.tsx
@@ -0,0 +1,120 @@
+import React, {Suspense, useState} from 'react';
+import {r... | [
"examples/concurrent-suspense/concurrent-suspense.tsx",
"examples/concurrent-suspense/index.ts",
"examples/use-transition/index.ts",
"examples/use-transition/use-transition.tsx",
"package.json",
"readme.md",
"src/ink.tsx",
"src/reconciler.ts",
"src/render.ts",
"test/background.tsx",
"test/border... | [
{
"comment": "Don't prefix lines withg `*`",
"path": "src/ink.tsx",
"hunk": "@@ -43,6 +43,19 @@ export type Options = {\n \twaitUntilExit?: () => Promise<void>;\n \tmaxFps?: number;\n \tincrementalRendering?: boolean;\n+\n+\t/**\n+\t * Enable React Concurrent Rendering mode.",
"resolving_sha": "6911... | diff --git a/test/background.tsx b/test/background.tsx
index 4c2115b9c..371be17de 100644
--- a/test/background.tsx
+++ b/test/background.tsx
@@ -2,8 +2,12 @@ import React from 'react';
import test from 'ava';
import chalk from 'chalk';
import {render, Box, Text} from '../src/index.js';
-import {renderToString} from ... | true |
vadimdemedes/ink | 850 | comment_to_fix | Concurrent rendering support | Don't prefix lines withg `*` | e8b08e75cf272761d63782179019d052e4410545 | 691104b15279ce217506679df7982f317d906d37 | diff --git a/src/ink.tsx b/src/ink.tsx
index 611a93efc..d8070fbbe 100644
--- a/src/ink.tsx
+++ b/src/ink.tsx
@@ -6,7 +6,7 @@ import isInCi from 'is-in-ci';
import autoBind from 'auto-bind';
import signalExit from 'signal-exit';
import patchConsole from 'patch-console';
-import {LegacyRoot} from 'react-reconciler/con... | [
"src/ink.tsx"
] | [
{
"comment": "Don't prefix lines withg `*`",
"path": "src/ink.tsx",
"hunk": "@@ -43,6 +43,19 @@ export type Options = {\n \twaitUntilExit?: () => Promise<void>;\n \tmaxFps?: number;\n \tincrementalRendering?: boolean;\n+\n+\t/**\n+\t * Enable React Concurrent Rendering mode.",
"resolving_sha": "6911... | true | ||
vadimdemedes/ink | 859 | issue_to_patch | `borderDimColor` dims all child `Text` components at the left edge of the `Box`
On a parent box component with a `borderStyle`, setting `borderDimColor` to true dims all `bold` child `Text` components (even ones nested in more boxes).
Interestingly it seems to only happen to `Text` components who are "touching" the l... | Fix borderDimColor dimming child Text components | ## Summary
- Updates `@alcalzone/ansi-tokenize` from `^0.2.1` to `^0.2.3`
- This fixes the issue where `borderDimColor` would incorrectly dim child `Text` components that are touching the left edge of the `Box`
## Details
Fixes #840
The bug was in the upstream `ansi-tokenize` library and has been fixed in v0.2.3:
- I... | 2e63a26231645011492925e42178698df9d4dae4 | b7fd2bfd526724f199b7e7b1a6938458d6c4548d | diff --git a/package.json b/package.json
index 0c0d03b92..c105884e9 100644
--- a/package.json
+++ b/package.json
@@ -43,7 +43,7 @@
"text"
],
"dependencies": {
- "@alcalzone/ansi-tokenize": "^0.2.1",
+ "@alcalzone/ansi-tokenize": "^0.2.3",
"ansi-escapes": "^7.2.0",
"ansi-styles": "^6.2.1",
"auto-bind":... | [
"package.json",
"test/borders.tsx"
] | [] | diff --git a/test/borders.tsx b/test/borders.tsx
index 3627f0ef2..e964d0ac3 100644
--- a/test/borders.tsx
+++ b/test/borders.tsx
@@ -65,6 +65,17 @@ test('single node - fit-content box with emojis', t => {
t.is(output, boxen('🌊🌊', {borderStyle: 'round'}));
});
+// Issue #733: Emojis with variation selectors (FE0F... | true |
vadimdemedes/ink | 862 | issue_to_patch | test: add regression test for variation selector emoji border alignment | ## Summary
Adds a regression test for emojis with variation selectors (U+FE0F) to prevent future issues with box border alignment.
This follows up on the maintainer's request in #861 to "reduce the PR to just the test" after the dependency update in commit 0a685a76 fixed the underlying issue by upgrading `widest-line... | 12fe119c0af3a8d28e6fbf9ad6bd506c385a0443 | 70c230477c8d3aa84d349079629d799c5cccd8ae | [
"test/borders.tsx"
] | [] | diff --git a/test/borders.tsx b/test/borders.tsx
index 3627f0ef2..dac4e8e90 100644
--- a/test/borders.tsx
+++ b/test/borders.tsx
@@ -65,6 +65,17 @@ test('single node - fit-content box with emojis', t => {
t.is(output, boxen('🌊🌊', {borderStyle: 'round'}));
});
+// Issue #733: Emojis with variation selectors (FE0F... | true | ||
vadimdemedes/ink | 860 | issue_to_patch | How to handle soft return in MacOS?
I am trying to use Ink in a CLI app on MacOS. Unfortunately, shift+return isn't a think in mac terminal, so we have to use option+return. This doesn't seem to be recognized in "key" returned to the callback in `useInput`.
I dug into the code in node_modules and I was able to se... | Handle Option+Return (soft return) on macOS | ## Summary
On macOS terminals, Option+Return (the common way to input a "soft return" or newline without submitting) sends the escape sequence `\x1b\r` (ESC + carriage return). This was not being recognized by the keypress parser, causing inconsistent behavior.
This fix:
- Recognizes `\x1b\r` as a return key with the... | 2e63a26231645011492925e42178698df9d4dae4 | 69db559ed085f2abfcd359fa4416c61a824fb761 | diff --git a/src/parse-keypress.ts b/src/parse-keypress.ts
index db51e4f85..93df53b42 100644
--- a/src/parse-keypress.ts
+++ b/src/parse-keypress.ts
@@ -165,10 +165,11 @@ const parseKeypress = (s: Buffer | string = ''): ParsedKey => {
key.sequence = key.sequence || s || key.name;
- if (s === '\r') {
- // carriag... | [
"src/parse-keypress.ts",
"test/fixtures/use-input.tsx",
"test/hooks.tsx"
] | [] | diff --git a/test/fixtures/use-input.tsx b/test/fixtures/use-input.tsx
index bc6fadc1f..f976c22cd 100644
--- a/test/fixtures/use-input.tsx
+++ b/test/fixtures/use-input.tsx
@@ -151,6 +151,11 @@ function UserInput({test}: {readonly test: string | undefined}) {
return;
}
+ if (test === 'returnMeta' && key.retur... | true |
valeriansaliou/sonic | 354 | issue_to_patch | No results when the keyword is part of the indexed term
Guessing I ingest the object key in this way (I am currently using the php-client [Psonic](https://github.com/ppshobi/psonic))
`$ingest->push($collection, $bucket, $object_key, "Search Index");`
I am getting results on the search when the keywords are _search... | Better search results | Basically most of what’s in https://github.com/valeriansaliou/sonic/milestone/20.
TL;DR:
- Fix typo correction in `QUERY`
- A bug used to limit the Levenshtein distance to 1, it is now word length-dependant as it was supposed to be.
- Add support for diacritic folding
- Disabled by default for backward com... | 3c42a69fe60e9535a822811b434e10d5b45a4fbd | 9c16f96f88f0a77fcad689b8a4f1f67f9f45be31 | diff --git a/Cargo.lock b/Cargo.lock
index 262cfc03..c26cb584 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -140,6 +140,15 @@ dependencies = [
"pkg-config",
]
+[[package]]
+name = "caseless"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b6fd507454086c8edfd769ca6ad... | [
"Cargo.lock",
"README.md",
"Taskfile.dist.yaml",
"config.cfg",
"core/Cargo.toml",
"core/src/config.rs",
"core/src/executor/pop.rs",
"core/src/executor/push.rs",
"core/src/executor/search.rs",
"core/src/executor/suggest.rs",
"core/src/lexer/mod.rs",
"core/src/lexer/stemming.rs",
"core/src/lex... | [] | diff --git a/server/tests/auto_completion.rs b/core/tests/auto_completion.rs
similarity index 100%
rename from server/tests/auto_completion.rs
rename to core/tests/auto_completion.rs
diff --git a/server/tests/back_compat.rs b/core/tests/back_compat.rs
similarity index 100%
rename from server/tests/back_compat.rs
rename... | true |
valeriansaliou/sonic | 348 | issue_to_patch | Speed up CI | 13316554bde58c6c71d2d767d7932a8f667e5d85 | 4b0dd66a141dd3bed4aa158bda0ea7bd8ff41cc7 | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index a7ea6e55..a37a0f34 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,17 +1,103 @@
on:
push:
branches: [master]
+ # Do not run the workflow if the project hasn't changed.
+ paths: &source_paths
+ -... | [
".github/workflows/test.yml",
"README.md"
] | [] | true | |||
valeriansaliou/sonic | 352 | issue_to_patch | Introduce Rust integration tests | This PR introduces native Rust tests. This will prevent most regressions, help us catch subtle issues (already has) and give us better insights on what code paths are executed.
Some tests are ignored because they are known to not work, either because a feature is unsupported or because of a bug. I’ll fix those bugs ... | ecc54a0cd5ff9c985ecbcf47330b2ba972cb4f8c | 88e629bba7906fa991deeb8cca062a9d59a78426 | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 7555bf31..ee8c0f11 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -120,13 +120,13 @@ jobs:
target
key: test-${{ runner.os }}-cargo-${{ matrix.rust-toolchain }}
- - name: Cache integrati... | [
".github/workflows/test.yml",
"CONTRIBUTING.md",
"Cargo.lock",
"Taskfile.dist.yaml",
"core/src/executor/mod.rs",
"core/src/store/fst.rs",
"core/src/store/kv.rs",
"core/src/util/fmt.rs",
"core/src/util/mod.rs",
"scripts/changelog_prepare.sh",
"server/Cargo.toml",
"server/src/server/config.rs",
... | [] | diff --git a/server/tests/auto_completion.rs b/server/tests/auto_completion.rs
new file mode 100644
index 00000000..409ac3f9
--- /dev/null
+++ b/server/tests/auto_completion.rs
@@ -0,0 +1,32 @@
+// Sonic
+//
+// Fast, lightweight and schema-less search backend
+// Copyright: 2026, Rémi Bardon <remi@remibardon.name>
+//... | true | |
valeriansaliou/sonic | 351 | issue_to_patch | Release for Red Hat Enterprise Linux (RHEL) | Supersedes #349 because I was working on improving the CI and it broke the PR (which was published less than a day ago).
I made changes to the CI to better support the addition of new platforms before adding support for RHEL in a simple commit. I tried running the CI, it should work next time we release.
---
C... | 5d34e21784e3fce7a50ff3a6cfd90767b6bc3332 | 0e983a33c17d8f37e4651c235cab50bd669ae13d | diff --git a/.github/workflows/release-core.yml b/.github/workflows/release-core.yml
index ec7d6827..da4197ee 100644
--- a/.github/workflows/release-core.yml
+++ b/.github/workflows/release-core.yml
@@ -7,7 +7,7 @@ name: Release library
jobs:
cargo-publish:
- runs-on: ubuntu-22.04
+ runs-on: ubuntu-24.04
... | [
".github/workflows/release-core.yml",
".github/workflows/release-server.yml",
".github/workflows/test.yml",
"scripts/build_release_archive.sh",
"scripts/release_binaries.sh"
] | [] | true | ||
valeriansaliou/sonic | 350 | issue_to_patch | Separate Sonic library code from binary | Following #347, here is a PR which splits Sonic into two crates; one for the library and one for the binary. This will allow for SemVer releases for the binary, without it being impacted by breaking changes in the library (which will happen quite often as we’re reworking a ton of things). Same with feature flags, defau... | 65e5a8099e6ade89d374c3ffea5b28a5355bf2b0 | bb8ab3032fe9ed986082ba95c24d56ef46aa7e37 | diff --git a/.github/workflows/release-core.yml b/.github/workflows/release-core.yml
new file mode 100644
index 00000000..ec7d6827
--- /dev/null
+++ b/.github/workflows/release-core.yml
@@ -0,0 +1,43 @@
+on:
+ push:
+ tags:
+ - "core-v*.*.*"
+
+name: Release library
+
+jobs:
+ cargo-publish:
+ runs-on: ubu... | [
".github/workflows/release-core.yml",
".github/workflows/release-server.yml",
".github/workflows/test.yml",
".gitignore",
"CHANGELOG.md",
"CHANGELOG.md",
"CONFIGURATION.md",
"Cargo.lock",
"Cargo.toml",
"PACKAGING.md",
"README.md",
"Taskfile.dist.yaml",
"config.cfg",
"core/CHANGELOG.md",
... | [] | true | ||
valeriansaliou/sonic | 347 | issue_to_patch | Possible to use as a library?
Hello,
Obviously, this crate was designed to operate as a server, but there are a lot of cases where embedding it into an application make sense:
* using it in your own servers
* using it for a desktop application
* perhaps even compiling to WASM and using it on the front-end (e... | Sonic as a library | In addition to addressing #150, this unlocks native Rust integration testing, and separation of concern between the Sonic Channel layer and Sonic’s internals.
This PR will have a lot of diff lines, I suggest you check each commit individually to understand the process. I’ll try to keep commits focused on individual ... | 13316554bde58c6c71d2d767d7932a8f667e5d85 | 1f72d07451f166b3990e0f91e1ca820d7e897531 | diff --git a/.gitignore b/.gitignore
index da65b3db..19c24867 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@ target/
*~
*#
.cargo
+.task
data/store/fst/*
data/store/kv/*
diff --git a/Cargo.lock b/Cargo.lock
index 04b68b97..39314a3e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1645,7 +1645,6 @@ dependen... | [
".gitignore",
"Cargo.lock",
"Cargo.toml",
"Taskfile.dist.yaml",
"src/channel/command.rs",
"src/channel/handle.rs",
"src/channel/listen.rs",
"src/channel/macros.rs",
"src/channel/message.rs",
"src/channel/statistics.rs",
"src/config.rs",
"src/config/defaults.rs",
"src/config/env_var.rs",
"s... | [] | true | |
valeriansaliou/sonic | 346 | issue_to_patch | config: Support environment-based configuration | Variables named `SONIC_FOO__BAR__BAZ` are now interpreted as `foo.bar.baz`, removing the need for a configuration file.
Thanks to parsing improvements, it is not necessary to define all keys (even empty) anymore.
It unlocks new possibilities and simplifies future test tooling, in addition to having been requested... | 466cf7d8e6702b2b2514034a5d9d80d1cc462cf0 | cc994613130fdf69b408841244e85883f41ca666 | diff --git a/CONFIGURATION.md b/CONFIGURATION.md
index 3db02a03..0a336926 100644
--- a/CONFIGURATION.md
+++ b/CONFIGURATION.md
@@ -1,20 +1,34 @@
# Sonic Configuration
-## File: config.cfg
+## Configuration sources
+
+Sonic looks for its configuration as [TOML] in `./config.cfg`, or whatever you
+passed via `--config... | [
"CONFIGURATION.md",
"Cargo.lock",
"Cargo.toml",
"Taskfile.dist.yaml",
"config.cfg",
"src/config/defaults.rs",
"src/config/env_var.rs",
"src/config/options.rs",
"src/config/reader.rs",
"src/main.rs",
"tests/integration/instance/config.cfg"
] | [] | diff --git a/tests/integration/instance/config.cfg b/tests/integration/instance/config.cfg
index a42bb596..6459748f 100644
--- a/tests/integration/instance/config.cfg
+++ b/tests/integration/instance/config.cfg
@@ -2,22 +2,8 @@
# Configuration file (integration tests)
[server]
-
log_level = "warn"
[channel]
-
... | true | |
valeriansaliou/sonic | 345 | issue_to_patch | Modernize tooling | Various improvements, see commit messages. | aa757f89174d75d7f498469a085b9ad7cc5a403c | c0d6c39f22a223cf02e95525acd20ce621bed2e5 | diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..720bffee
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,24 @@
+# https://editorconfig.org/
+
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_style = space
+indent_size = 2
+insert_final_newline = true
+trim_trailing_whitespace ... | [
".editorconfig",
".github/workflows/build.yml",
".github/workflows/test.yml",
".gitignore",
".markdownlint.yaml",
"CHANGELOG.md",
"CODE_OF_CONDUCT.md",
"CONFIGURATION.md",
"CONTRIBUTING.md",
"Cargo.toml",
"INNER_WORKINGS.md",
"PACKAGING.md",
"PROTOCOL.md",
"README.md",
"Taskfile.dist.yam... | [] | diff --git a/tests/integration/runner/package-lock.json b/tests/integration/runner/package-lock.json
index e87b563c..aba9bdf9 100644
--- a/tests/integration/runner/package-lock.json
+++ b/tests/integration/runner/package-lock.json
@@ -1,13 +1,28 @@
{
"name": "sonic-tests-integration",
"version": "1.0.0",
- "loc... | true | |
valeriansaliou/sonic | 344 | issue_to_patch | Configure Clippy and run `cargo clippy --fix` | I also removed useless `#[macro_export]`s first as they would trigger [`clippy::crate_in_macro_def`](https://rust-lang.github.io/rust-clippy/rust-1.95.0/index.html?search=macro#crate_in_macro_def). | 05b8ddbbf0986519a1d59ea21ccbeabe414d097f | 08c6c7be7fcdd1559df286ed6debb31190e5c85e | diff --git a/src/channel/macros.rs b/src/channel/macros.rs
index 720a4cc0..97040f77 100644
--- a/src/channel/macros.rs
+++ b/src/channel/macros.rs
@@ -4,7 +4,6 @@
// Copyright: 2019, Valerian Saliou <valerian@valeriansaliou.name>
// License: Mozilla Public License v2.0 (MPL v2.0)
-#[macro_export]
macro_rules! gen_... | [
"src/channel/macros.rs",
"src/channel/message.rs",
"src/executor/macros.rs",
"src/executor/pop.rs",
"src/executor/search.rs",
"src/main.rs",
"src/store/fst.rs",
"src/store/item.rs",
"src/store/kv.rs",
"src/store/macros.rs",
"src/store/operation.rs"
] | [] | true | ||
valeriansaliou/sonic | 343 | issue_to_patch | ci: Bump third-party actions | See each commit message for more explanations. | 05b8ddbbf0986519a1d59ea21ccbeabe414d097f | 8449b15be1ef6eb3cd9a04e84adbbe23a3c24d59 | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 86fe53b7..e30c2575 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -11,11 +11,11 @@ jobs:
steps:
- name: Checkout code
- uses: actions/checkout@v2
+ uses: actions/checkout@de0fac2e4500d... | [
".github/workflows/build.yml",
".github/workflows/test.yml"
] | [] | true | ||
valeriansaliou/sonic | 342 | issue_to_patch | Bump deps (fixes CVEs) | `cargo audit` used to say
```log
(truncated)
error: 6 vulnerabilities found!
warning: 8 allowed warnings found
```
now it says
```log
(truncated)
warning: 3 allowed warnings found
```
<details>
<summary>Details</summary>
```log
Crate: bincode
Version: 1.3.3
Warning: unmaintained
T... | 8e998d7d43feeda3ef2ecaf516538f851d5dbcbb | f0195b7da6ab4027bb1872fdb4fb213ba2d69e9d | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index e51b626c..6a1122b2 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -48,10 +48,10 @@ jobs:
run: rustc --version && rustup --version && cargo --version && node --version && npm --version
- name: Build ... | [
".github/workflows/test.yml",
"CONTRIBUTING.md",
"Cargo.lock",
"Cargo.toml",
"Dockerfile",
"README.md",
"scripts/release_binaries.sh",
"src/channel/command.rs",
"src/lexer/stopwords.rs",
"src/main.rs",
"src/stopwords/cym.rs",
"src/stopwords/mod.rs"
] | [] | true | ||
valeriansaliou/sonic | 324 | issue_to_patch | Windows: use windows-sys instead of winapi | use windows-sys as maintained bindings for windows | a2bf0c54eee7bb68f55df434b8ef3cc81df5400d | 26d45f6f90046a9d610edca711d2a1bd7f2fbd7c | diff --git a/Cargo.lock b/Cargo.lock
index f2e5e74e..512f291f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -407,7 +407,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
dependencies = [
"libc",
- "windows-sys",
+ "windo... | [
"Cargo.lock",
"Cargo.toml",
"src/tasker/shutdown.rs"
] | [] | true | ||
valeriansaliou/sonic | 337 | issue_to_patch | Bump rocksdb to 0.24 | Fixes build on NixOS after GCC 14 -> 15 and librocksdb upgrades.
* librocksdb 10.7.5 removed rocksdb_options_set_access_hint_on_compaction_start from the API
* rocksdb-rs 0.24 adds support for GCC 15 and updated API bindings
See failing build: https://hydra.nixos.org/build/317945528 | 444caca78bd4eb708ad1fb5fe6241d5e328b7cee | 266af2fd88309086c611390fdde6f008ebfcf502 | diff --git a/Cargo.lock b/Cargo.lock
index f2e5e74e..6583f616 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
-version = 3
+version = 4
[[package]]
name = "adler"
@@ -75,16 +75,14 @@ dependencies = [
[[package]]... | [
"Cargo.lock",
"Cargo.toml"
] | [] | true | ||
valeriansaliou/sonic | 338 | issue_to_patch | Fix mismatched_lifetime_syntaxes warnings | Fixes the mismatched lifetime syntaxes warnings.
Rust 1.89 includes a new [lint](https://blog.rust-lang.org/2025/08/07/Rust-1.89.0/#mismatched-lifetime-syntaxes-lint) for mismatched lifetime syntaxes:
```rust
warning: hiding a lifetime that's elided elsewhere is confusing
--> src/channel/message.rs:153:25
... | 444caca78bd4eb708ad1fb5fe6241d5e328b7cee | e1b7878116f7a63ee33d99c8178c1497a54e4d3b | diff --git a/src/channel/message.rs b/src/channel/message.rs
index 1122322c..f8f8c1ba 100644
--- a/src/channel/message.rs
+++ b/src/channel/message.rs
@@ -150,7 +150,7 @@ impl ChannelMessage {
result
}
- fn extract(message: &str) -> (String, SplitWhitespace) {
+ fn extract(message: &str) -> (Strin... | [
"src/channel/message.rs",
"src/lexer/token.rs",
"src/query/builder.rs",
"src/store/fst.rs",
"src/store/item.rs"
] | [] | true | ||
valeriansaliou/sonic | 339 | issue_to_patch | Fix CVEs | * Bump nix to 0.31.1 to fix CVE-2021-45707
* Update ring to fix https://github.com/advisories/GHSA-4p46-pwfr-66x6
* Update zerovec to fix https://github.com/advisories/GHSA-xrv3-jmcp-374j
* Update zerovec-derive to fix https://github.com/advisories/GHSA-74r5-g7vc-j2v2
Detected during a Trivy scan on Cargo.toml. | 444caca78bd4eb708ad1fb5fe6241d5e328b7cee | c50a16c86714eabde17bf1478f0ebc029c6144f8 | diff --git a/Cargo.lock b/Cargo.lock
index f2e5e74e..b441f79d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
-version = 3
+version = 4
[[package]]
name = "adler"
@@ -14,7 +14,7 @@ version = "0.8.11"
source = "reg... | [
"Cargo.lock",
"Cargo.toml"
] | [] | true | ||
valeriansaliou/sonic | 301 | issue_to_patch | Adds Malayalam language support. | f5302f5c424256648ba0be32b3c5909d846821fe | e3ec1909c7947b5ed3d971d90b8adf4ef72e5074 | diff --git a/src/stopwords/mal.rs b/src/stopwords/mal.rs
index 5eaf288a..124a12ae 100644
--- a/src/stopwords/mal.rs
+++ b/src/stopwords/mal.rs
@@ -5,4 +5,120 @@
// License: Mozilla Public License v2.0 (MPL v2.0)
// Notice: we do not have stopwords for this language yet.
-pub static STOPWORDS_MAL: &[&str] = &[];
+pu... | [
"src/stopwords/mal.rs"
] | [] | true | |||
valeriansaliou/sonic | 320 | issue_to_patch | Added Serbian latin stopwords | 2a5293c5416db80a68632d18c5416a50a0a8c70f | b0c1f66b32875536a0303186dc7ca1857c927bfa | diff --git a/README.md b/README.md
index 0eb29200..8ec06ae5 100644
--- a/README.md
+++ b/README.md
@@ -274,6 +274,7 @@ Sonic supports a wide range of languages in its lexing system. If a language is
* 🇵🇹 Portuguese
* 🇮🇳 Punjabi
* 🇷🇺 Russian
+* 🇷🇸 Serbian (latin)
* 🇸🇰 Slovak
* 🇸🇮 Slovene
* 🇪🇸 Spanish... | [
"README.md",
"src/stopwords/srp.rs"
] | [] | true | |||
valeriansaliou/sonic | 321 | issue_to_patch | Fix build warnings treated as errors | These warnings prevent builds on latest master with latest stable rustc 1.78.0 (9b00956e5 2024-04-29)
Full error:
```
Compiling sonic-server v1.4.8 (/Users/j/src/sonic)
error: unnecessary qualification
--> src/store/fst.rs:690:36
|
690 | ... if std::fs::rename(&bucket_tmp_path, &b... | 2a5293c5416db80a68632d18c5416a50a0a8c70f | 033c15b4d276bf20166649ebec1589a9e9ef4264 | diff --git a/src/store/fst.rs b/src/store/fst.rs
index 5b3d3786..fd7ea6ec 100644
--- a/src/store/fst.rs
+++ b/src/store/fst.rs
@@ -687,7 +687,7 @@ impl StoreFSTPool {
);
// Proceed temporary FST to final FST path rename
- ... | [
"src/store/fst.rs",
"src/store/generic.rs"
] | [] | true | ||
valeriansaliou/sonic | 310 | issue_to_patch | Adding docker image for ARM | Hey,
I would love to run this on ARM without having to build the container locally.
I added a tag that will build docker image for ARM based systems in parallel to x86. | 084827f0fef5a1ffc929849530576f58d361dc5d | c8c4bfbaa82a5feb54163a4a656b816d355642ac | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0db49e6c..37d4a3ab 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -33,10 +33,22 @@ jobs:
build-docker:
runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ platform:
+ - linux/arm64
+ ... | [
".github/workflows/build.yml"
] | [] | true | ||
valeriansaliou/sonic | 316 | issue_to_patch | upgrade rocksdb dependency to use newer bindgen
Right now the bindgen is with `0.59.2`, which has [some compilation issue against clang 16](https://github.com/rust-lang/rust-bindgen/issues/2312). (the issue is fixed with 0.62.0+) | Bump rocksdb to 0.21 | Fixes #315
Build of sonic-server is failing on NixOS for a few weeks now, see https://hydra.nixos.org/build/239524816
This failing build has been caused by a clang 16 upgrade, because rocksdb depends on a old [rust-bindgen](https://github.com/rust-lang/rust-bindgen) version which is not compatible with this version... | e2f5d2c71c6884cff51fe42bc136301eb341fa4f | 81d5f1efec21ef8b911ed3303fcbe9ca6335f562 | diff --git a/Cargo.lock b/Cargo.lock
index 0e00d739..819d3428 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -85,9 +85,9 @@ dependencies = [
[[package]]
name = "bindgen"
-version = "0.59.2"
+version = "0.65.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bd2a9a458e8f4304c52c43ebb0cfb... | [
"Cargo.lock",
"Cargo.toml",
"src/store/kv.rs"
] | [] | true | |
valeriansaliou/sonic | 311 | issue_to_patch | Add Lindera tokenizer support for Japanese | This PR adds support of Lindera tokenizer for better search results in Japanese. This uses unidic since it is newer than ipadic and could provide consistent search results [1].
[1] https://www.anlp.jp/proceedings/annual_meeting/2016/pdf_dir/D6-5.pdf | 084827f0fef5a1ffc929849530576f58d361dc5d | 50b59c71572cbfe5b107e24a649a87f9f39cabaa | diff --git a/Cargo.lock b/Cargo.lock
index 4fc7479a..8f60b695 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,6 +2,24 @@
# It is not intended for manual editing.
version = 3
+[[package]]
+name = "adler"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f26201604c87b1e0... | [
"Cargo.lock",
"Cargo.toml",
"src/lexer/token.rs"
] | [] | true | ||
valeriansaliou/sonic | 293 | issue_to_patch | List all terms/words indexed in a bucket
Note: I'm using the `node-sonic-channel` to integrate sonic in my node.js project.
### Context
I am building a "tagging" system wherein objects can be assigned certain tags. I have created a bucket called "tags" in which I index objects using tags as `terms`. I am able to g... | List all words from the bucket control operator | resolve https://github.com/valeriansaliou/sonic/issues/177 | 7d33d55d5ec1d40fac774eeb6efc5ad4bb7fd862 | 33ed1477108d1cd3b8f6a2c6b65000e49b9883e5 | diff --git a/src/channel/command.rs b/src/channel/command.rs
index 4b2bd6f0..9d30db44 100644
--- a/src/channel/command.rs
+++ b/src/channel/command.rs
@@ -15,7 +15,10 @@ use std::vec::Vec;
use super::format::unescape;
use super::statistics::ChannelStatistics;
use crate::query::builder::{QueryBuilder, QueryBuilderRes... | [
"src/channel/command.rs",
"src/channel/message.rs",
"src/config/defaults.rs",
"src/config/options.rs",
"src/executor/list.rs",
"src/executor/mod.rs",
"src/query/actions.rs",
"src/query/builder.rs",
"src/query/types.rs",
"src/store/fst.rs",
"src/store/operation.rs"
] | [] | true | |
valeriansaliou/sonic | 282 | issue_to_patch | Use distroless instead of debian slim | Use distroless to build docker image. It is more secure and reduces the image size from ~98MB to ~39MB. | e5ca11425f79277127332fe118493c963edece0b | 26ffa5c8aa2530ea894c192504aa56ba14d171ec | diff --git a/Dockerfile b/Dockerfile
index 58a8b6b6..ab4f14bd 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -15,7 +15,7 @@ COPY . /app
RUN cargo clean && cargo build --release --target x86_64-unknown-linux-gnu
RUN strip ./target/x86_64-unknown-linux-gnu/release/sonic
-FROM debian:bullseye-slim
+FROM gcr.io/distroless... | [
"Dockerfile"
] | [] | true | ||
valeriansaliou/sonic | 295 | issue_to_patch | Fix typo: Sonic not Vigil | Probably from copy/paste: 9922e5e8 | d5d16ea99b17763e63d838d0be206e5bca529e58 | 33872d082532fba171e95811fe76622fdb62c48e | diff --git a/README.md b/README.md
index d660271b..91d651f6 100644
--- a/README.md
+++ b/README.md
@@ -59,7 +59,7 @@ Sonic is integrated in all Crisp search products on the [Crisp](https://crisp.ch
### Installation
-Vigil is built in Rust. To install it, use `cargo install` or pull the source code from `master`.
+... | [
"README.md"
] | [] | true | ||
valeriansaliou/sonic | 294 | issue_to_patch | Fix typos | Found via `codespell -S ./src/stopwords,./src/lexer/stopwords.rs -L crate,statics,dake` | 7d33d55d5ec1d40fac774eeb6efc5ad4bb7fd862 | 368b44a86bd84221182b03da36dc6a6c5de41f3e | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 25189695..bf416fb6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -107,7 +107,7 @@ Sonic Changelog
### Bug Fixes
-* Fixed a rare deadlock occuring when 3 concurrent operations get executed on different threads for the same collection, in the following timely order: `... | [
"CHANGELOG.md",
"INNER_WORKINGS.md",
"src/executor/push.rs",
"src/lexer/token.rs",
"src/store/fst.rs"
] | [] | true | ||
valeriansaliou/sonic | 276 | issue_to_patch | Bump tikv-jemallocator version | This version fix some alloc issue in RISC-V architecture. Now sonic is available in RISC-V platform too! | e5943e650ca0e8c69cbc1fdfe377373115b056b9 | c1b3ca363b224ef9fe404969d808fc0ccefc5152 | diff --git a/Cargo.lock b/Cargo.lock
index 1f51be9c..25502bab 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -594,9 +594,9 @@ dependencies = [
[[package]]
name = "tikv-jemallocator"
-version = "0.4.1"
+version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c14a5a604eb8715bc57... | [
"Cargo.lock",
"Cargo.toml"
] | [] | true | ||
valeriansaliou/sonic | 275 | issue_to_patch | Use tikv-jemallocator instead of jemallocator | `jemallocator` has been abandoned for two years. And `rustc` itself moved to use `tikv-jemallocator` instead: https://github.com/rust-lang/rust/commit/3965773ae7743e051070b4eed3c6e02e9df3b25c
Let's switch to a better maintained version. | 3d49b095a9d9ec13c87cf147d059a609cc3d8995 | df96f94cc76911ff9dc6cf64460844747b3cc35a | diff --git a/Cargo.lock b/Cargo.lock
index c7f2b933..beca3ee6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -226,27 +226,6 @@ dependencies = [
"ahash 0.7.6",
]
-[[package]]
-name = "jemalloc-sys"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d3b9f3f5c9b31aa0f5ed32... | [
"Cargo.lock",
"Cargo.toml",
"src/main.rs"
] | [] | true | ||
valeriansaliou/sonic | 267 | issue_to_patch | Add a new python client #265 | ec3c660eadff232b864e8f57dfdfaf7912de9930 | d111c6bdc0825cab65c85b8385543686bd4d925c | diff --git a/README.md b/README.md
index cd71da7b..ed79ed60 100644
--- a/README.md
+++ b/README.md
@@ -159,6 +159,7 @@ You can find below a list of Sonic integrations provided by the community (many
* **Python**:
* **[asonic](https://github.com/moshe/asonic)** by [@moshe](https://github.com/moshe)
* **[python-so... | [
"README.md"
] | [] | true | |||
valeriansaliou/sonic | 233 | issue_to_patch | Fix clippy warnings | Added built-in attribute that deny some rust lints and all clippy rules (with some exceptions) and fixed all moments in the code.
These changes should reduce a bit memory allocation | f4aa5f5322db5e38883072e1d0e935bbbbd3e90e | 4ae1d6cee6ee9ebb7f73b1dc0e2833506caad8ff | diff --git a/src/channel/command.rs b/src/channel/command.rs
index 5d19cc5c..ed3147ad 100644
--- a/src/channel/command.rs
+++ b/src/channel/command.rs
@@ -7,6 +7,7 @@
use hashbrown::HashMap;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
+use std::fmt;
use std::path::Path;
use std::str::{self,... | [
"src/channel/command.rs",
"src/channel/handle.rs",
"src/channel/message.rs",
"src/config/config.rs",
"src/config/env_var.rs",
"src/config/logger.rs",
"src/config/mod.rs",
"src/config/reader.rs",
"src/executor/flusho.rs",
"src/executor/pop.rs",
"src/executor/push.rs",
"src/executor/search.rs",
... | [] | true | ||
valeriansaliou/sonic | 209 | issue_to_patch | add jieba tokenizer for Chinese | add jieba tokenizer for Chinese | ac7bcf118e9989f433b69a81cae8d815225139a0 | f2d21aab67c4fd5dde531552ab0f132aad318fa3 | diff --git a/Cargo.toml b/Cargo.toml
index 5ade465e..dfe503bc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,6 +29,7 @@ serde = "1.0"
serde_derive = "1.0"
rand = "0.7"
unicode-segmentation = "1.6"
+jieba-rs = "0.4"
radix = "0.6"
rocksdb = { version = "0.13", features = ["zstd"] }
fst = "0.3"
diff --git a/src/lex... | [
"Cargo.toml",
"src/lexer/token.rs"
] | [] | true | ||
valeriansaliou/sonic | 259 | issue_to_patch | docs: add `deno_sonic` | b8bf28b38d3fdd13b497fb0da2b5baccb4670b81 | 58a9dda1c67e8bbb844b9eda5d414e78901864b7 | diff --git a/README.md b/README.md
index c63ec938..d4dc322a 100644
--- a/README.md
+++ b/README.md
@@ -178,6 +178,8 @@ You can find below a list of Sonic integrations provided by the community (many
* **[nim-sonic-client](https://github.com/xmonader/nim-sonic-client)** by [@xmonader](https://github.com/xmonader)
* ... | [
"README.md"
] | [] | true | |||
valeriansaliou/sonic | 236 | issue_to_patch | Adding Norwegian stopwords | 2902bf5724a268b4bcd1e81979c595808b7a8fef | d5111682cced9e92e191f9dda6fd51f91eae4cc0 | diff --git a/src/stopwords/nob.rs b/src/stopwords/nob.rs
index b0c46830..48392cbf 100644
--- a/src/stopwords/nob.rs
+++ b/src/stopwords/nob.rs
@@ -5,4 +5,225 @@
// License: Mozilla Public License v2.0 (MPL v2.0)
// Notice: we do not have stopwords for this language yet.
-pub static STOPWORDS_NOB: &[&'static str] = ... | [
"src/stopwords/nob.rs"
] | [] | true | |||
valeriansaliou/sonic | 227 | issue_to_patch | Added Catalan | This PR adds support for the Catalan language. The stopwords list is from http://latel.upf.edu/morgana/altres/pub/ca_stop.htm. | c7b701307038ede8fbd7f044248837667d65dd4a | 12c45d9d262ef63bb48e10532d48576d3f84e27a | diff --git a/Cargo.lock b/Cargo.lock
index 00273011..a3321e7f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -479,7 +479,7 @@ dependencies = [
"toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"twox-hash 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-segmentation 1.6.0 (... | [
"Cargo.lock",
"Cargo.toml",
"README.md",
"src/lexer/stopwords.rs",
"src/stopwords/cat.rs",
"src/stopwords/mod.rs"
] | [] | true | ||
valeriansaliou/sonic | 223 | issue_to_patch | chore: add rust sonic-channel client library | Hello!
I started to make rust library for sonic client because rust version from frostmage seems deprecated or unsupported. | 7248ef67c5ed4bd48a56fd26a74268f7a9706b41 | 7b0414207605cae8b4d70880263de7a54cc53bf9 | diff --git a/README.md b/README.md
index 903384f6..f1b8ddd2 100644
--- a/README.md
+++ b/README.md
@@ -154,6 +154,7 @@ You can find below a list of Sonic integrations provided by the community (many
* **Rust**:
* **[sonic_client](https://github.com/FrontMage/sonic_client)** by [@FrontMage](https://github.com/Fron... | [
"README.md"
] | [] | true | ||
valeriansaliou/sonic | 213 | issue_to_patch | store: fix deadlock caused by conflicting lock order | `GRAPH_POOL` is locked before `GRAPH_CONSOLIDATE` at L102 and L103, L961 and L961
https://github.com/valeriansaliou/sonic/blob/fd7a21b9983228f76ad6f08560464d08a15c429e/src/store/fst.rs#L102-L103
https://github.com/valeriansaliou/sonic/blob/fd7a21b9983228f76ad6f08560464d08a15c429e/src/store/fst.rs#L960-L961
However, ... | fd7a21b9983228f76ad6f08560464d08a15c429e | 0236ccee9e6bc0932c08f4270c346ad21178f2d1 | diff --git a/src/store/fst.rs b/src/store/fst.rs
index b4493907..3556626b 100644
--- a/src/store/fst.rs
+++ b/src/store/fst.rs
@@ -197,10 +197,11 @@ impl StoreFSTPool {
// Notice: this prevents store to be acquired from any context
let _access = GRAPH_ACCESS_LOCK.write().unwrap();
+ ... | [
"src/store/fst.rs"
] | [] | true | ||
valeriansaliou/sonic | 210 | issue_to_patch | Update README.md | * Changed the flag for 'English' to one which more appropriate. English came from England, in Britain, hence the Union Flag. If this gets rejected, I will just open a PR changing 'French' to the Canadian flag. Same argument. | ac7bcf118e9989f433b69a81cae8d815225139a0 | fc99ad71f052d1d9651ce97a8fac3a6fc4719a95 | diff --git a/README.md b/README.md
index e1b23b61..cb66c92a 100644
--- a/README.md
+++ b/README.md
@@ -187,7 +187,7 @@ Sonic supports a wide range of languages in its lexing system. If a language is
* 🇨🇿 Czech
* 🇩🇰 Danish
* 🇳🇱 Dutch
-* 🇺🇸 English
+* 🇬🇧 English
* 🏳 Esperanto
* 🇪🇪 Estonian
* 🇫🇮 Finni... | [
"README.md"
] | [] | true | ||
valeriansaliou/sonic | 211 | issue_to_patch | channel: fix possible concurrency bugs in ChannelMessage::on | There are possibly two kinds of bugs in `ChannelMessage::on` if it is called by two threads simultaneously:
1. Deadlock:
https://github.com/valeriansaliou/sonic/blob/ac7bcf118e9989f433b69a81cae8d815225139a0/src/channel/message.rs#L131-L136
There are two RwLock::read() on L132 and L133. The first read lock is not r... | ac7bcf118e9989f433b69a81cae8d815225139a0 | 679edca2e67c08a2d294c3edb1553fcff4f24f88 | diff --git a/src/channel/message.rs b/src/channel/message.rs
index 6adffe61..5c7764d7 100644
--- a/src/channel/message.rs
+++ b/src/channel/message.rs
@@ -125,14 +125,17 @@ impl ChannelMessage {
// commands that do no work or I/O; they would make statistics less accurate)
let command_took_mi... | [
"src/channel/message.rs"
] | [] | true | ||
valeriansaliou/sonic | 201 | issue_to_patch | Upgrade Hashbrown to lasted version | ```
running 48 tests
test config::env_var::tests::it_gets_environment_variable ... ok
test channel::command::tests::it_matches_command_response_string ... ok
test channel::format::tests::it_unescapes_command_text ... ok
test lexer::ranges::tests::it_gives_ranges ... ok
test lexer::ranges::tests::it_gives_regex_ra... | 6ef80f46c893f8f0817b20d7c61843494331b93b | 7d3f1caf806885b398208b021bc340334a0fa1e4 | diff --git a/Cargo.lock b/Cargo.lock
index f4cd2f49..38d78a54 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,7 +2,7 @@
# It is not intended for manual editing.
[[package]]
name = "ahash"
-version = "0.2.18"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cons... | [
"Cargo.lock",
"Cargo.toml"
] | [] | true | ||
valeriansaliou/sonic | 191 | issue_to_patch | Added some documentation for contributors | We're doing a small hackaton at work and started working on #177. Hopefully a PR for that feature will come soon :)
Anyways, we spent like 15 mins on just getting up and running and thought we would make this easier for the next dev seeking to contribute. | 1f401c36fbd3fd57e12e3cddb1ce04978d9b5bfb | 8ba80b97640c1810f60cd124fd5c4dc0c848b32e | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..76255399
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,37 @@
+# How to get started with contributing
+
+- First of all, fork and clone this repo
+- Install Rust and Cargo
+- Install npm
+
+## Build
+
+From repo root run
+
+```sh
+cargo... | [
"CONTRIBUTING.md"
] | [] | true | ||
valeriansaliou/sonic | 163 | issue_to_patch | Use jemalloc as global allocator only on unix | #161
jemallocator has no supoort for window-msvc now [jemallocator #91](https://github.com/gnzlbg/jemallocator/issues/91), use it as global allocator only on unix | 8fd283aaf0cb1a8d8e045f02c88bdfc98a709bfd | ac5cec55dedddabf4e23d53f0dfbd649d8364e73 | diff --git a/Cargo.toml b/Cargo.toml
index f4fd4415..7a46272e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,6 @@ path = "src/main.rs"
doc = false
[dependencies]
-jemallocator = { version = "0.3", optional = true }
log = "0.4"
toml = "0.5"
clap = { version = "2.33", default-features = false }
@@ -45,6 +44... | [
"Cargo.toml",
"src/main.rs"
] | [] | true | ||
valeriansaliou/sonic | 154 | issue_to_patch | Integration Tests | This pull request proposes a framework for integration testing of Sonic. It uses Node.js as a runtime for tests. and the [Sonic Channel](https://www.npmjs.com/package/sonic-channel) client library.
The test suite is organized into scenarios, each running in an isolated Sonic state, i.e. the index is empty at the sta... | 587750f8238fb6413183cab62009a131e86d3e5a | ea23db176066a7f9b2fa144ffb78397c189476eb | diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..241e560d
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+*
+
diff --git a/.travis.yml b/.travis.yml
index e5e84651..c47ea6ea 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,19 @@
+dist: xenial
+
+addons:
+ apt:
+ packages: ["no... | [
".dockerignore",
".travis.yml",
"tests/.gitignore",
"tests/config.cfg",
"tests/package-lock.json",
"tests/package.json",
"tests/run-tests.sh",
"tests/runner.js",
"tests/scenarios/insert.js",
"tests/scenarios/ping.js"
] | [] | diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 00000000..dd950c97
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,2 @@
+data/
+node_modules/
diff --git a/tests/config.cfg b/tests/config.cfg
new file mode 100644
index 00000000..d8d33cdd
--- /dev/null
+++ b/tests/config.cfg
@@ -0,0 +1,63 @@
+... | true | |
valeriansaliou/sonic | 148 | issue_to_patch | Channel password from environment
It would be surely a nice feature to be able to populate a Sonic Channel password from the environmental variable rather from the config file. | Add environment variables in the configuration file | Changelog:
* implement custom `deserialize-with` methods for deserializing `config::config::Config`
* add a note to the CONFIGURATION.md file
It resolves https://github.com/valeriansaliou/sonic/issues/146
This solution works only for **string-like** values. It can be extended in the future if it's needed. | 83aae7c43353efc38d3c38cf799020b2eb116aa0 | fc74a510c00c905c08fe2dfaca66319716a1d776 | diff --git a/CONFIGURATION.md b/CONFIGURATION.md
index aca19df7..5349593d 100644
--- a/CONFIGURATION.md
+++ b/CONFIGURATION.md
@@ -56,3 +56,21 @@ Sonic Configuration
**[store.fst.graph]**
* `consolidate_after` (type: _integer_, allowed: seconds, default: `180`) — Time after which a graph that has pending updates sh... | [
"CONFIGURATION.md",
"Cargo.lock",
"Cargo.toml",
"src/config/config.rs",
"src/config/env_var.rs",
"src/config/mod.rs",
"src/main.rs"
] | [] | true | |
valeriansaliou/sonic | 126 | issue_to_patch | Add nim-sonic-client | 5bdf409600a823f1a9bf973ee6d74d4a7f84803b | bfe2650fbd320b5d1032e06be9aa585047e93942 | diff --git a/README.md b/README.md
index 1910d530..8af1d24e 100644
--- a/README.md
+++ b/README.md
@@ -158,6 +158,10 @@ You can find below a list of Sonic integrations provided by the community (many
* **[jsonic](https://github.com/alohaking/jsonic)** by [@alohaking](https://github.com/alohaking)
* **Elixir**:
*... | [
"README.md"
] | [] | true | |||
valeriansaliou/sonic | 125 | issue_to_patch | Add sonic-client to python clients list | Adds client implemented with sockets module to work with contexts other than asyncio | c98a487ff767c9357aa198950ceb1732c5b83651 | e2f6de81d78b86a80bf64932dc0139c5d3877c0e | diff --git a/README.md b/README.md
index b81ed2ef..83e8676f 100644
--- a/README.md
+++ b/README.md
@@ -142,6 +142,7 @@ You can find below a list of Sonic integrations provided by the community (many
* **[sonic_client](https://github.com/FrontMage/sonic_client)** by [@FrontMage](https://github.com/FrontMage)
* **Pyt... | [
"README.md"
] | [] | true | ||
valeriansaliou/sonic | 120 | issue_to_patch | Add link to laravel-scout-sonic in PHP list | [Laravel Scout](https://laravel.com/docs/5.8/scout) is a driver-based search system for the Laravel ORM. Although it uses [php-sonic](https://github.com/php-sonic/php-sonic) underneath, it is a specific Laravel package. | 3154adbe551578b233bb79914ed4749b1966c79f | 8ba97fe749da475c2ba7fdd9fdc5de6d54079959 | diff --git a/README.md b/README.md
index f82d765c..0217994d 100644
--- a/README.md
+++ b/README.md
@@ -148,6 +148,7 @@ You can find below a list of Sonic integrations provided by the community (many
* **PHP**:
* **[php-sonic](https://github.com/php-sonic/php-sonic)** by [@touhonoob](https://github.com/touhonoob)
... | [
"README.md"
] | [] | true | ||
valeriansaliou/sonic | 118 | issue_to_patch | Added one more php client - psonic by ppshobi | Hi, I have gone ahead and implemented a PHP client for sonic, including unit tests and a relatively complete [readme](https://github.com/ppshobi/psonic/blob/master/Readme.md) and an [api documentation](https://github.com/ppshobi/psonic/blob/master/api-docs.md) as well.
| 73ff40851f93ffa35058b4c16a67dd48a289d1cd | a43106b1e18518fab0e3e9ba55e7a1776431070d | diff --git a/README.md b/README.md
index af4f7d1d..86cd4f35 100644
--- a/README.md
+++ b/README.md
@@ -147,6 +147,7 @@ You can find below a list of Sonic integrations provided by the community (many
* **[go-sonic](https://github.com/OGKevin/go-sonic)** by [@OGKevin](https://github.com/OGKevin)
* **PHP**:
* **[ph... | [
"README.md"
] | [] | true | ||
valeriansaliou/sonic | 117 | issue_to_patch | Add go-sonic lib made by @OGKevin | This PR adds https://github.com/OGKevin/go-sonic to the README | 08683da2c32b1902c08e4a87d86a4d2ebcea3e09 | 40a4f56110aaf76a2db4dd80aff10ff97c4bd241 | diff --git a/README.md b/README.md
index b932294b..af4f7d1d 100644
--- a/README.md
+++ b/README.md
@@ -144,6 +144,7 @@ You can find below a list of Sonic integrations provided by the community (many
* **[sonic-ruby](https://github.com/atipugin/sonic-ruby)** by [@atipugin](https://github.com/atipugin)
* **Go**:
*... | [
"README.md"
] | [] | true | ||
valeriansaliou/sonic | 114 | issue_to_patch | Bump serde from 1.0.89 to 1.0.90 | Bumps [serde](https://github.com/serde-rs/serde) from 1.0.89 to 1.0.90.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.89...v1.0.90)
Signed-off-by: dependabot[bot] <support@dependabot.com> | 7550fb2fd85d5a66fef5afc27febe2ee18f2ba68 | 5f48748d8b6851420ae3fb873be26afbd8643849 | diff --git a/Cargo.lock b/Cargo.lock
index 62ffb907..8bb3db1b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -636,7 +636,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde"
-version = "1.0.89"
+version = "1.0.90"
source = "registry+https://github.com/rust-lang/crates.io-in... | [
"Cargo.lock"
] | [] | true | ||
valeriansaliou/sonic | 115 | issue_to_patch | Bump regex-syntax from 0.6.5 to 0.6.6 | Bumps [regex-syntax](https://github.com/rust-lang/regex) from 0.6.5 to 0.6.6.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/regex-syntax-0.6.5...regex-syntax-0.6.6)
Si... | 7550fb2fd85d5a66fef5afc27febe2ee18f2ba68 | 888c9b996ef6b9433dcdf4839d16ba9e07631ae8 | diff --git a/Cargo.lock b/Cargo.lock
index 62ffb907..66368da7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -584,7 +584,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.0 (registry+https:/... | [
"Cargo.lock"
] | [] | true | ||
valeriansaliou/sonic | 111 | issue_to_patch | Clippy fixes | Cleaned up code to remove clippy warnings. This does not yet fix all the clippy warnings but only those which were relatively straightforward style issues. | 5f1765110e8fc3179953bc7652d3ee4a8091e7c7 | bb6bdf57dcc180494759a0b888751dd439197323 | diff --git a/src/channel/command.rs b/src/channel/command.rs
index f3619d84..9169a041 100644
--- a/src/channel/command.rs
+++ b/src/channel/command.rs
@@ -149,7 +149,7 @@ impl ChannelCommandBase {
))])
}
(Some(manual_key), next_part) => {
- if next_part.is_none(... | [
"src/channel/command.rs",
"src/channel/handle.rs",
"src/channel/message.rs",
"src/executor/count.rs",
"src/executor/flushb.rs",
"src/executor/flushc.rs",
"src/executor/flusho.rs",
"src/executor/pop.rs",
"src/executor/push.rs",
"src/executor/search.rs",
"src/lexer/stopwords.rs",
"src/lexer/toke... | [] | true | ||
valyala/fasthttp | 2,287 | issue_to_patch | Found a bug in LBClient.get() that causes a permanent deadlock when cs becomes empty.
When using AddClient/RemoveClients for dynamic backend management, if all backends are removed, cc.cs becomes an empty slice. Any concurrent DoDeadline call at that point will call get(), which takes cc.mu.RLock() and then immediatel... | fix(lbclient): prevent deadlock when all clients are removed |
`LBClient.get()` takes an `RLock` and then immediately reads `cs[0]` without checking for an empty slice:
Once every client is removed via `RemoveClients`, `cc.cs` becomes empty. The next concurrent `DoDeadline`/`Do` calls `get()`, panics on `cs[0]`, and because `RUnlock` is not deferred it is never reached — the ... | 9df7942bcd0be0d734ac4fa31dc2730dcd827c84 | 7e3a370cda60a54346708c64621f90db4f9d64b3 | diff --git a/lbclient.go b/lbclient.go
index 690f4d0c0d..9a871c0545 100644
--- a/lbclient.go
+++ b/lbclient.go
@@ -1,11 +1,16 @@
package fasthttp
import (
+ "errors"
"sync"
"sync/atomic"
"time"
)
+// ErrNoAvailableClients is returned by LBClient methods when no clients are
+// available, for example after ... | [
"lbclient.go",
"lbclient_test.go"
] | [
{
"comment": "If `rc` panics it will still result in a broken state because it did `cc.cs[idx] = nil`.\n\nIt's probably better to only do `cc.cs[idx] = nil` after.",
"path": "lbclient.go",
"hunk": "",
"resolving_sha": "7e3a370cda60a54346708c64621f90db4f9d64b3",
"resolving_diff": "diff --git a/lb... | diff --git a/lbclient_test.go b/lbclient_test.go
new file mode 100644
index 0000000000..913ee8e699
--- /dev/null
+++ b/lbclient_test.go
@@ -0,0 +1,122 @@
+package fasthttp
+
+import (
+ "errors"
+ "testing"
+ "time"
+)
+
+type mockBalancingClient struct {
+ err error
+ pending int
+}
+
+func (m *mockBalancingClient... | true |
valyala/fasthttp | 2,287 | comment_to_fix | fix(lbclient): prevent deadlock when all clients are removed | If `rc` panics it will still result in a broken state because it did `cc.cs[idx] = nil`.
It's probably better to only do `cc.cs[idx] = nil` after. | 9df7942bcd0be0d734ac4fa31dc2730dcd827c84 | 7e3a370cda60a54346708c64621f90db4f9d64b3 | diff --git a/lbclient.go b/lbclient.go
index 690f4d0c0d..9a871c0545 100644
--- a/lbclient.go
+++ b/lbclient.go
@@ -1,11 +1,16 @@
package fasthttp
import (
+ "errors"
"sync"
"sync/atomic"
"time"
)
+// ErrNoAvailableClients is returned by LBClient methods when no clients are
+// available, for example after ... | [
"lbclient.go"
] | [
{
"comment": "If `rc` panics it will still result in a broken state because it did `cc.cs[idx] = nil`.\n\nIt's probably better to only do `cc.cs[idx] = nil` after.",
"path": "lbclient.go",
"hunk": "",
"resolving_sha": "7e3a370cda60a54346708c64621f90db4f9d64b3",
"resolving_diff": "diff --git a/lb... | true | ||
valyala/fasthttp | 2,292 | issue_to_patch | Fix flaky race tests | ca4600a0a3df1869939efadead108d0a51d9a6a5 | 97372e6a9a1e1085f6308de581af1d2ec011303a | diff --git a/client.go b/client.go
index c209794c65..3ade63aec5 100644
--- a/client.go
+++ b/client.go
@@ -3033,7 +3033,10 @@ func (c *pipelineConnClient) writer(conn net.Conn, stopCh <-chan struct{}, chs *
select {
case w = <-chW:
case <-stopTimer.C:
- return nil
+ if c.canStopPipelineConn(chs) {
+ ... | [
"client.go",
"compress_test.go",
"fs_fs_test.go",
"race_disabled_test.go",
"race_enabled_test.go",
"server_test.go",
"test_timeout_test.go"
] | [] | diff --git a/compress_test.go b/compress_test.go
index 53e8b11c73..2e778fc59d 100644
--- a/compress_test.go
+++ b/compress_test.go
@@ -216,6 +216,7 @@ func testConcurrent(concurrency int, f func() error) error {
err := f()
if err != nil {
ch <- fmt.Errorf("error in goroutine %d: %w", idx, err)
+ return
... | true | ||
valyala/fasthttp | 2,288 | issue_to_patch | safety: re-enable deferInLoop gocritic check to catch defer-in-loop resource leaks
## Description
The `deferInLoop` check from `gocritic` is explicitly disabled in `.golangci.yml` (line 50):
```yaml
gocritic:
disabled-checks:
- deferInLoop # <-- disabled
```
This check detects `defer` statements inside `for... | ci: re-enable gocritic deferInLoop check for non-test code | deferInLoop was disabled in .golangci.yml, so CI could not catch defer statements added inside for loops. Such defers run only at function exit, not per iteration, leaking file descriptors, connections, or locks under load.
Re-enable the check, but exclude _test.go files: deferring cleanup to the end of a short-live... | 9df7942bcd0be0d734ac4fa31dc2730dcd827c84 | e0ab48ac520378ee92c087547811d918784a6ff7 | diff --git a/.golangci.yml b/.golangci.yml
index fa5d0b580a..7eb9120ab6 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -47,7 +47,6 @@ linters:
settings:
gocritic:
disabled-checks:
- - deferInLoop
- importShadow
- sloppyReassign
- unnamedResult
| [
".golangci.yml",
"client_test.go",
"fasthttputil/inmemory_listener_test.go"
] | [
{
"comment": "There's only a single defer in a loop. If you create a closure there it should be fine and you don't need to exclude all test files.",
"path": ".golangci.yml",
"hunk": "@@ -83,6 +82,10 @@ linters:\n - linters:\n - lll\n path: _test\\.go\n+ - linters:\n+ ... | diff --git a/client_test.go b/client_test.go
index a359f79c66..476698eb16 100644
--- a/client_test.go
+++ b/client_test.go
@@ -2943,12 +2943,20 @@ func TestClientHTTPSConcurrent(t *testing.T) {
func TestClientManyServers(t *testing.T) {
t.Parallel()
+ servers := make([]*testEchoServer, 0, 10)
addrs := make([]str... | true |
valyala/fasthttp | 2,291 | issue_to_patch | chore(deps): bump golang.org/x/net from 0.55.0 to 0.56.0 | Bumps [golang.org/x/net](https://github.com/golang/net) from 0.55.0 to 0.56.0.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/golang/net/commit/9e7fdbfadb32b0cc7524100014c5cf9b6adc7729"><code>9e7fdbf</code></a> internal/http3: fix wrong argument being given when validating header value</li>
<... | 9df7942bcd0be0d734ac4fa31dc2730dcd827c84 | 585d4641c9ba2e08a8bc0e35d474d43756f7ecc3 | diff --git a/go.mod b/go.mod
index 00ce831a40..f5410daec5 100644
--- a/go.mod
+++ b/go.mod
@@ -7,7 +7,7 @@ require (
github.com/klauspost/compress v1.18.6
github.com/valyala/bytebufferpool v1.0.0
golang.org/x/crypto v0.53.0
- golang.org/x/net v0.55.0
+ golang.org/x/net v0.56.0
golang.org/x/sys v0.46.0
)
diff... | [
"go.mod",
"go.sum"
] | [] | true | ||
valyala/fasthttp | 2,290 | issue_to_patch | chore(deps): bump golang.org/x/crypto from 0.52.0 to 0.53.0 | Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.52.0 to 0.53.0.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/golang/crypto/commit/45460e079737ecb64f30d79d3d6fc2914494fa66"><code>45460e0</code></a> go.mod: update golang.org/x dependencies</li>
<li><a href="https://github... | 5be41c4aeefddd5740317fce4aedab1d7b8262dc | 4d1598e3fdc04c5e270b864f9db6b94fd0291b2b | diff --git a/go.mod b/go.mod
index dc0a2c165d..00ce831a40 100644
--- a/go.mod
+++ b/go.mod
@@ -6,9 +6,9 @@ require (
github.com/andybalholm/brotli v1.2.1
github.com/klauspost/compress v1.18.6
github.com/valyala/bytebufferpool v1.0.0
- golang.org/x/crypto v0.52.0
+ golang.org/x/crypto v0.53.0
golang.org/x/net v0... | [
"go.mod",
"go.sum"
] | [] | true | ||
valyala/fasthttp | 2,289 | issue_to_patch | chore(deps): bump golang.org/x/sys from 0.45.0 to 0.46.0 | Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.45.0 to 0.46.0.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/golang/sys/commit/d58dcfa8a74514c0ef0fc401259156c5e2fc9ff5"><code>d58dcfa</code></a> unix: add GPIO constants and structs</li>
<li>See full diff in <a href="https://gi... | cb4dc24ca0b500436280c8b82d1dde0df598f0c4 | 026064003dbf2289b2a4ea9492fe7b76608999f5 | diff --git a/go.mod b/go.mod
index 3a39bd0911..dc0a2c165d 100644
--- a/go.mod
+++ b/go.mod
@@ -8,7 +8,7 @@ require (
github.com/valyala/bytebufferpool v1.0.0
golang.org/x/crypto v0.52.0
golang.org/x/net v0.55.0
- golang.org/x/sys v0.45.0
+ golang.org/x/sys v0.46.0
)
require golang.org/x/text v0.37.0 // indire... | [
"go.mod",
"go.sum"
] | [] | true | ||
valyala/fasthttp | 2,265 | issue_to_patch | bug: HTTP 303 redirect does not switch POST to GET (RFC 7231 violation)
## Description
In `client.go:1224`, the redirect logic only converts POST→GET for 301 and 302 status codes:
```go
if string(req.Header.Method()) == string(MethodPost) && (statusCode == 301 || statusCode == 302) {
req.Header.SetMethod(MethodG... | fix(client): switch to GET on 303 redirect per RFC 9110 | RFC 9110 section 15.4.4, a 303 (See Other) response must be followed by a body-less GET regardless of the original method.
https://datatracker.ietf.org/doc/html/rfc9110#name-303-see-other
Handle 303 explicitly: change any non-GET/HEAD method to GET, drop the body, and clear Content-Length/Content-Type. 301/302 k... | fa2b76590bf5d47227a861e6ad65c62f512f662b | 1a0ea5f17bd64a92805d172c01d3ea38814be48d | diff --git a/client.go b/client.go
index ce6b5b12c6..72196a4c30 100644
--- a/client.go
+++ b/client.go
@@ -1221,7 +1221,29 @@ func doRequestFollowRedirects(
stripSensitiveHeadersOnRedirect(req, initialHost, redirectURI)
ReleaseURI(redirectURI)
- if string(req.Header.Method()) == "POST" && (statusCode == 301 ||... | [
"client.go",
"client_test.go"
] | [
{
"comment": "This fails if the original was already a `GET`:\n```go\nfunc TestClientRedirect303DropsGetRequestBody(t *testing.T) {\n\tt.Parallel()\n\n\ts := &Server{\n\t\tHandler: func(ctx *RequestCtx) {\n\t\t\tswitch string(ctx.Path()) {\n\t\t\tcase \"/redirect\":\n\t\t\t\tctx.Redirect(\"/landing\", StatusSee... | diff --git a/client_test.go b/client_test.go
index 803c8ffd36..a359f79c66 100644
--- a/client_test.go
+++ b/client_test.go
@@ -2024,6 +2024,139 @@ func TestClientFollowRedirects(t *testing.T) {
ReleaseResponse(resp)
}
+func TestClientRedirectMethodSwitch(t *testing.T) {
+ t.Parallel()
+
+ // /redirect-NNN replies ... | true |
valyala/fasthttp | 2,265 | comment_to_fix | fix(client): switch to GET on 303 redirect per RFC 9110 | This fails if the original was already a `GET`:
```go
func TestClientRedirect303DropsGetRequestBody(t *testing.T) {
t.Parallel()
s := &Server{
Handler: func(ctx *RequestCtx) {
switch string(ctx.Path()) {
case "/redirect":
ctx.Redirect("/landing", StatusSeeOther)
case "/landing":
ctx.SetBodyString(... | fa2b76590bf5d47227a861e6ad65c62f512f662b | 1a0ea5f17bd64a92805d172c01d3ea38814be48d | diff --git a/client.go b/client.go
index ce6b5b12c6..72196a4c30 100644
--- a/client.go
+++ b/client.go
@@ -1221,7 +1221,29 @@ func doRequestFollowRedirects(
stripSensitiveHeadersOnRedirect(req, initialHost, redirectURI)
ReleaseURI(redirectURI)
- if string(req.Header.Method()) == "POST" && (statusCode == 301 ||... | [
"client.go"
] | [
{
"comment": "This fails if the original was already a `GET`:\n```go\nfunc TestClientRedirect303DropsGetRequestBody(t *testing.T) {\n\tt.Parallel()\n\n\ts := &Server{\n\t\tHandler: func(ctx *RequestCtx) {\n\t\t\tswitch string(ctx.Path()) {\n\t\t\tcase \"/redirect\":\n\t\t\t\tctx.Redirect(\"/landing\", StatusSee... | true | ||
valyala/fasthttp | 2,265 | comment_to_fix | fix(client): switch to GET on 303 redirect per RFC 9110 | According to the spec you also need to remove `Transfer-Encoding` and Trailers. | fa2b76590bf5d47227a861e6ad65c62f512f662b | 1a0ea5f17bd64a92805d172c01d3ea38814be48d | diff --git a/client.go b/client.go
index ce6b5b12c6..72196a4c30 100644
--- a/client.go
+++ b/client.go
@@ -1221,7 +1221,29 @@ func doRequestFollowRedirects(
stripSensitiveHeadersOnRedirect(req, initialHost, redirectURI)
ReleaseURI(redirectURI)
- if string(req.Header.Method()) == "POST" && (statusCode == 301 ||... | [
"client.go"
] | [
{
"comment": "According to the spec you also need to remove `Transfer-Encoding` and Trailers.",
"path": "client.go",
"hunk": "@@ -1221,7 +1221,24 @@ func doRequestFollowRedirects(\n \t\tstripSensitiveHeadersOnRedirect(req, initialHost, redirectURI)\n \t\tReleaseURI(redirectURI)\n \n-\t\tif string(req.He... | true | ||
valyala/fasthttp | 2,211 | issue_to_patch | fix double release of streamed client response body | Fix double release of the underlying streamed response body when a client response `BodyStream()` is closed directly.
When `StreamResponseBody` is enabled, the transport wraps `resp.bodyStream` with a `ReadCloserWithError` that releases the reader, closes or releases the backend connection, and releases the underly... | bf00c3e2dfbe9b8e674968f54492a5ab996d35e3 | 77e381728c864f3f8a4294a70b940fcf50bd7918 | diff --git a/client.go b/client.go
index 9269f51fe6..f01b45647f 100644
--- a/client.go
+++ b/client.go
@@ -3205,7 +3205,11 @@ func (t *transport) RoundTrip(hc *HostClient, req *Request, resp *Response) (ret
closeConn := resetConnection || req.ConnectionClose() || resp.ConnectionClose()
if customStreamBody && resp.b... | [
"client.go",
"http_test.go"
] | [] | diff --git a/http_test.go b/http_test.go
index 17c4fc9eba..4f40832cf2 100644
--- a/http_test.go
+++ b/http_test.go
@@ -3349,6 +3349,73 @@ func TestResponseBodyStream(t *testing.T) {
}
})
+ t.Run("direct close with error releases client stream", func(t *testing.T) {
+ t.Parallel()
+
+ client := Client{Stre... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.