WIP: investigating frontend/Dolt data mismatch
- Added memory-anchor filter to left-panel.tsx - Removed issues.jsonl fallback in read-issues.ts (Dolt-only) - Frontend still shows stale data despite these changes - Root cause NOT identified - see NEXT_SESSION_PROMPT.md for details
This commit is contained in:
parent
d68f776cfc
commit
64a5129412
3 changed files with 138 additions and 206 deletions
|
|
@ -70,7 +70,7 @@ function formatRelative(timestamp: string): string {
|
|||
}
|
||||
|
||||
function buildEntries(issues: BeadIssue[]): EpicEntry[] {
|
||||
const epics = issues.filter((issue) => issue.issue_type === 'epic');
|
||||
const epics = issues.filter((issue) => issue.issue_type === 'epic' && !issue.labels?.includes('memory-anchor'));
|
||||
const tasks = issues.filter((issue) => issue.issue_type !== 'epic');
|
||||
const taskById = new Map(tasks.map((task) => [task.id, task] as const));
|
||||
const incomingBlockers = new Map<string, string[]>();
|
||||
|
|
|
|||
|
|
@ -1,69 +1,43 @@
|
|||
import path from 'node:path';
|
||||
|
||||
import { parseIssuesJsonl } from './parser';
|
||||
import { canonicalizeWindowsPath } from './pathing';
|
||||
import { readTextFileWithRetry } from './read-text-retry';
|
||||
import { buildProjectContext } from './project-context';
|
||||
import { readIssuesViaDolt } from './read-issues-dolt';
|
||||
import type { BeadIssueWithProject, ProjectSource } from './types';
|
||||
|
||||
export interface ReadIssuesOptions {
|
||||
projectRoot?: string;
|
||||
includeTombstones?: boolean;
|
||||
projectSource?: ProjectSource;
|
||||
projectAddedAt?: string | null;
|
||||
preferBd?: boolean;
|
||||
skipAgentFilter?: boolean;
|
||||
}
|
||||
|
||||
export function resolveIssuesJsonlPathCandidates(projectRoot: string = process.cwd()): string[] {
|
||||
const baseDir = path.resolve(projectRoot, '.beads');
|
||||
const primary = canonicalizeWindowsPath(path.join(baseDir, 'issues.jsonl'));
|
||||
const fallback = canonicalizeWindowsPath(path.join(baseDir, 'issues.jsonl.new'));
|
||||
return [primary, fallback];
|
||||
}
|
||||
|
||||
export function resolveIssuesJsonlPath(projectRoot: string = process.cwd()): string {
|
||||
return resolveIssuesJsonlPathCandidates(projectRoot)[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
export async function readIssuesFromDisk(options: ReadIssuesOptions = {}): Promise<BeadIssueWithProject[]> {
|
||||
const projectRoot = options.projectRoot ?? process.cwd();
|
||||
const candidates = resolveIssuesJsonlPathCandidates(projectRoot);
|
||||
const project = buildProjectContext(projectRoot, {
|
||||
source: options.projectSource ?? 'local',
|
||||
addedAt: options.projectAddedAt ?? null,
|
||||
});
|
||||
|
||||
// Try Dolt SQL first (always preferred when server is available)
|
||||
const viaDolt = await readIssuesViaDolt(projectRoot, options);
|
||||
if (viaDolt !== null) {
|
||||
return viaDolt.map((issue) => ({ ...issue, project }));
|
||||
}
|
||||
|
||||
// Dolt unreachable — fall back to issues.jsonl
|
||||
console.warn('[beadboard] Dolt unreachable, falling back to issues.jsonl (data may be stale)');
|
||||
|
||||
for (const issuesPath of candidates) {
|
||||
try {
|
||||
const jsonl = await readTextFileWithRetry(issuesPath);
|
||||
return parseIssuesJsonl(jsonl, {
|
||||
includeTombstones: options.includeTombstones ?? false,
|
||||
skipAgentFilter: options.skipAgentFilter ?? false,
|
||||
}).map((issue) => ({
|
||||
...issue,
|
||||
project,
|
||||
}));
|
||||
} catch (error) {
|
||||
if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
|
||||
continue;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
import path from 'node:path';
|
||||
|
||||
import { buildProjectContext } from './project-context';
|
||||
import { readIssuesViaDolt } from './read-issues-dolt';
|
||||
import type { BeadIssueWithProject, ProjectSource } from './types';
|
||||
|
||||
export interface ReadIssuesOptions {
|
||||
projectRoot?: string;
|
||||
includeTombstones?: boolean;
|
||||
projectSource?: ProjectSource;
|
||||
projectAddedAt?: string | null;
|
||||
preferBd?: boolean;
|
||||
skipAgentFilter?: boolean;
|
||||
}
|
||||
|
||||
export function resolveIssuesJsonlPathCandidates(projectRoot: string = process.cwd()): string[] {
|
||||
const baseDir = path.resolve(projectRoot, '.beads');
|
||||
return [
|
||||
path.join(baseDir, 'issues.jsonl'),
|
||||
path.join(baseDir, 'issues.jsonl.new'),
|
||||
];
|
||||
}
|
||||
|
||||
export function resolveIssuesJsonlPath(projectRoot: string = process.cwd()): string {
|
||||
return resolveIssuesJsonlPathCandidates(projectRoot)[0];
|
||||
}
|
||||
|
||||
export async function readIssuesFromDisk(options: ReadIssuesOptions = {}): Promise<BeadIssueWithProject[]> {
|
||||
const projectRoot = options.projectRoot ?? process.cwd();
|
||||
const project = buildProjectContext(projectRoot, {
|
||||
source: options.projectSource ?? 'local',
|
||||
addedAt: options.projectAddedAt ?? null,
|
||||
});
|
||||
|
||||
// Dolt-only: throw if unreachable
|
||||
const viaDolt = await readIssuesViaDolt(projectRoot, options);
|
||||
if (viaDolt !== null) {
|
||||
return viaDolt.map((issue) => ({ ...issue, project }));
|
||||
}
|
||||
|
||||
// No fallback - fail fast to indicate Dolt is not running
|
||||
throw new Error('Dolt unreachable - ensure Dolt is running: bd dolt start');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue