Skip to content

Commit 300d089

Browse files
authored
fix: resolve remaining Dependabot security alerts (#833)
* fix: resolve remaining Dependabot security alerts - Regenerate package-lock.json so npm overrides take effect (serialize-javascript, handlebars, path-to-regexp, brace-expansion) - Upgrade Pygments 2.19.2 -> 2.20.0 in crewai and integration-tests lockfiles (fixes ReDoS via GUID matching) * fix: resolve duplicate alembic revision ID d6e7f8a9b0c1 Two migrations shared the same revision ID: the merge migration (drop_documents_metadata_column) and the trigram index migration (case_insensitive_entities_trgm_index). Assign a new unique ID to the trigram migration and update the downstream dependency. * chore: fix lint formatting for generated and existing files
1 parent 1a1fb35 commit 300d089

8 files changed

Lines changed: 67 additions & 76 deletions

File tree

hindsight-api-slim/hindsight_api/alembic/versions/d6e7f8a9b0c1_case_insensitive_entities_trgm_index.py renamed to hindsight-api-slim/hindsight_api/alembic/versions/2eee35aa3cfc_case_insensitive_entities_trgm_index.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
"Alice" and "alice" to have different trigram sets. This recreates it on
55
LOWER(canonical_name) so the % operator matches case-insensitively.
66
7-
Revision ID: d6e7f8a9b0c1
8-
Revises: c5d6e7f8a9b0
7+
Revision ID: 2eee35aa3cfc
8+
Revises: d6e7f8a9b0c1
99
Create Date: 2026-03-31
1010
"""
1111

1212
from collections.abc import Sequence
1313

1414
from alembic import context, op
1515

16-
revision: str = "d6e7f8a9b0c1"
17-
down_revision: str | Sequence[str] | None = "c5d6e7f8a9b0"
16+
revision: str = "2eee35aa3cfc"
17+
down_revision: str | Sequence[str] | None = "d6e7f8a9b0c1"
1818
branch_labels: str | Sequence[str] | None = None
1919
depends_on: str | Sequence[str] | None = None
2020

@@ -27,7 +27,7 @@ def _get_schema_prefix() -> str:
2727
def upgrade() -> None:
2828
schema = _get_schema_prefix()
2929
# Drop the old case-sensitive trigram index
30-
op.execute(f"DROP INDEX IF EXISTS entities_canonical_name_trgm_idx")
30+
op.execute("DROP INDEX IF EXISTS entities_canonical_name_trgm_idx")
3131
# Create case-insensitive trigram index on LOWER(canonical_name)
3232
op.execute(
3333
f"CREATE INDEX IF NOT EXISTS entities_canonical_name_lower_trgm_idx "
@@ -36,7 +36,7 @@ def upgrade() -> None:
3636

3737

3838
def downgrade() -> None:
39-
op.execute(f"DROP INDEX IF EXISTS entities_canonical_name_lower_trgm_idx")
39+
op.execute("DROP INDEX IF EXISTS entities_canonical_name_lower_trgm_idx")
4040
schema = _get_schema_prefix()
4141
# Restore original case-sensitive index
4242
op.execute(

hindsight-api-slim/hindsight_api/alembic/versions/a4b5c6d7e8f9_fix_per_bank_vector_index_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from sqlalchemy import text
2222

2323
revision: str = "a4b5c6d7e8f9"
24-
down_revision: str | Sequence[str] | None = "d6e7f8a9b0c1"
24+
down_revision: str | Sequence[str] | None = "2eee35aa3cfc"
2525
branch_labels: str | Sequence[str] | None = None
2626
depends_on: str | Sequence[str] | None = None
2727

hindsight-api-slim/hindsight_api/engine/memory_engine.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4340,13 +4340,16 @@ async def get_graph_data(
43404340

43414341
# Get entity information — only for visible units
43424342
if unit_ids:
4343-
unit_entities = await conn.fetch(f"""
4343+
unit_entities = await conn.fetch(
4344+
f"""
43444345
SELECT ue.unit_id, e.canonical_name
43454346
FROM {fq_table("unit_entities")} ue
43464347
JOIN {fq_table("entities")} e ON ue.entity_id = e.id
43474348
WHERE ue.unit_id = ANY($1::uuid[])
43484349
ORDER BY ue.unit_id
4349-
""", unit_ids)
4350+
""",
4351+
unit_ids,
4352+
)
43504353
else:
43514354
unit_entities = []
43524355

hindsight-control-plane/src/components/constellation.tsx

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ function heatColor(t: number): string {
7171
// Brighter, more luminous stops — like stars in a night sky
7272
// teal glow → bright cyan → white-blue
7373
const stops = [
74-
[80, 200, 205], // bright teal
75-
[100, 210, 255], // bright cyan
76-
[140, 180, 255], // light blue-white
74+
[80, 200, 205], // bright teal
75+
[100, 210, 255], // bright cyan
76+
[140, 180, 255], // light blue-white
7777
];
7878
const seg = v * (stops.length - 1);
7979
const i = Math.min(Math.floor(seg), stops.length - 2);
@@ -678,7 +678,10 @@ export function Constellation({
678678
const meta = node.metadata as Record<string, any> | undefined;
679679
const fullText = meta?.text || node.label || node.id;
680680
const entities: string[] = meta?.entities
681-
? String(meta.entities).split(",").map((e: string) => e.trim()).filter(Boolean)
681+
? String(meta.entities)
682+
.split(",")
683+
.map((e: string) => e.trim())
684+
.filter(Boolean)
682685
: [];
683686
const nodeColor = preparedNodes[idx].heatColor;
684687
const linkCount = preparedNodes[idx].linkCount;
@@ -717,9 +720,10 @@ export function Constellation({
717720
if (date) {
718721
html += `<div style="${rowStyle}"><span style="${labelStyle}">Date</span><span style="${valStyle}">${date}</span></div>`;
719722
} else if (occurredStart) {
720-
const timeRange = occurredEnd && occurredEnd !== occurredStart
721-
? `${occurredStart.slice(0, 10)}${occurredEnd.slice(0, 10)}`
722-
: occurredStart.slice(0, 10);
723+
const timeRange =
724+
occurredEnd && occurredEnd !== occurredStart
725+
? `${occurredStart.slice(0, 10)}${occurredEnd.slice(0, 10)}`
726+
: occurredStart.slice(0, 10);
723727
html += `<div style="${rowStyle}"><span style="${labelStyle}">Occurred</span><span style="${valStyle}">${timeRange}</span></div>`;
724728
}
725729

@@ -882,10 +886,7 @@ export function Constellation({
882886
: { position: "relative", width: "100%", height: `${height}px` }
883887
}
884888
>
885-
<canvas
886-
ref={canvasRef}
887-
style={{ width: "100%", height: "100%", display: "block" }}
888-
/>
889+
<canvas ref={canvasRef} style={{ width: "100%", height: "100%", display: "block" }} />
889890

890891
{/* Fullscreen toggle */}
891892
<button
@@ -917,14 +918,32 @@ export function Constellation({
917918
title={isFullscreen ? "Exit fullscreen (Esc)" : "Enter fullscreen"}
918919
>
919920
{isFullscreen ? (
920-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
921+
<svg
922+
width="14"
923+
height="14"
924+
viewBox="0 0 24 24"
925+
fill="none"
926+
stroke="currentColor"
927+
strokeWidth="2"
928+
strokeLinecap="round"
929+
strokeLinejoin="round"
930+
>
921931
<polyline points="4 14 10 14 10 20" />
922932
<polyline points="20 10 14 10 14 4" />
923933
<line x1="14" y1="10" x2="21" y2="3" />
924934
<line x1="3" y1="21" x2="10" y2="14" />
925935
</svg>
926936
) : (
927-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
937+
<svg
938+
width="14"
939+
height="14"
940+
viewBox="0 0 24 24"
941+
fill="none"
942+
stroke="currentColor"
943+
strokeWidth="2"
944+
strokeLinecap="round"
945+
strokeLinejoin="round"
946+
>
928947
<polyline points="15 3 21 3 21 9" />
929948
<polyline points="9 21 3 21 3 15" />
930949
<line x1="21" y1="3" x2="14" y2="10" />

hindsight-integration-tests/uv.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hindsight-integrations/crewai/uv.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 16 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

skills/hindsight-docs/references/developer/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ Controls the retain (memory ingestion) pipeline.
612612
| `HINDSIGHT_API_RETAIN_CUSTOM_INSTRUCTIONS` | Full prompt override for fact extraction (only used when mode is `custom`). Replaces built-in extraction rules entirely. | - |
613613
| `HINDSIGHT_API_RETAIN_EXTRACT_CAUSAL_LINKS` | Extract causal relationships between facts | `true` |
614614
| `HINDSIGHT_API_RETAIN_BATCH_ENABLED` | Use LLM Batch API for fact extraction (50% cost savings, only with async operations) | `false` |
615+
| `HINDSIGHT_API_RETAIN_MAX_CONCURRENT` | Max concurrent retain DB phases (HNSW reads + writes). Limits I/O contention during high-concurrency ingestion. | `4` |
615616
| `HINDSIGHT_API_RETAIN_BATCH_TOKENS` | Max characters per sub-batch for async retain auto-splitting | `10000` |
616617
| `HINDSIGHT_API_RETAIN_ENTITY_LOOKUP` | Entity lookup method during retain: `full` (exact match) or `trigram` (fuzzy trigram matching) | `trigram` |
617618
| `HINDSIGHT_API_RETAIN_DEFAULT_STRATEGY` | Default retain strategy name. When set, all retain calls without an explicit `strategy` parameter use this strategy. | - |

0 commit comments

Comments
 (0)