Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ objc2 = "=0.6.4"
objc2-app-kit = { version = "=0.3.2", default-features = false, features = ["std", "NSImage", "NSImageRep", "NSBitmapImageRep", "NSWindow", "NSWorkspace"] }
objc2-foundation = { version = "=0.3.2", default-features = false, features = ["std", "NSData", "NSDictionary", "NSString", "NSError", "NSException", "NSNotification", "NSOperation", "block2"] }
objc2-web-kit = { version = "=0.3.2", default-features = false, features = ["std", "WKWebView", "WKSnapshotConfiguration", "block2"] }

# Keep build-time macro metadata intact on macOS loaders affected by
# rust-lang/rust#157750. This profile override applies to host build dependencies.
[profile.release.build-override]
debug = true
39 changes: 37 additions & 2 deletions desktop/src/__tests__/hologram-label-placement.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { parseKnowledgeGraph } from '../knowledge/graph-model';
// pipeline without a WebGL context, real accounts, or a physical window.
type Box = { width: number; left: number; top: number; visible: boolean };
type Bounds = { left: number; top: number; right: number; bottom: number };
type NodeSpec = { id: string; x?: number; y?: number; z?: number };
type NodeSpec = { id: string; label?: string; x?: number; y?: number; z?: number };
type TestHologram = {
render(dt: number): void;
refreshOverviewLabels(): void;
Expand Down Expand Up @@ -97,7 +97,7 @@ function setup(
if (opts.zoom) {
camera.position.z = 5 / opts.zoom;
const zoomNodes = parseKnowledgeGraph({nodes:specs.map(node=>({id:node.id,
label:'실제 자료 ' + node.id, category:opts.globalIds?.includes(node.id)?'topic':'document'})),edges:[]}).nodes;
label:node.label ?? '실제 자료 ' + node.id, category:opts.globalIds?.includes(node.id)?'topic':'document'})),edges:[]}).nodes;
// The real view and zoom candidates reference the same typed source nodes.
Object.assign(fake, { view: { hops: 0, focusId: opts.focus ?? null, nodes: zoomNodes } });
Object.assign(fake, {desiredCamera:camera.position.clone(), labelFitDistance:5,
Expand All @@ -112,6 +112,41 @@ function setup(
}

describe("overview labels in the native hologram projection loop", () => {
it('hides passive career subjects throughout the fitted and far overview', () => {
const specs = [
{ id: 'resume', label: '자소서', x: -.6 },
{ id: 'salary', label: '연봉·복리후생', x: 0 },
{ id: 'recruiting', label: '채용공고·지원시기', x: .6 },
];
for (const zoom of [.3, .55, 1, 1.34, 1.47]) {
const r = setup(specs, { globalIds: specs.map(node => node.id), zoom, width: 1000, height: 600 });
try {
expect(r.fake.labels.size, `passive labels at ${zoom}x`).toBe(0);
expect(r.accessible.querySelectorAll('button')).toHaveLength(3);
} finally { r.shell.remove(); }
}
});

it('reveals career subjects on zoom-in and removes them again on zoom-out', () => {
const specs = [
{ id: 'resume', label: '자소서', x: -.6 },
{ id: 'salary', label: '연봉·복리후생', x: 0 },
{ id: 'recruiting', label: '채용공고·지원시기', x: .6 },
];
const r = setup(specs, { globalIds: specs.map(node => node.id), zoom: 1, width: 1000, height: 600 });
try {
for (const zoom of [1.85, 1, .55, 2, .3]) {
Object.assign(r.fake, { desiredCamera: new THREE.Vector3(0, 0, 5 / zoom) });
r.fake.render(1 / 60);
if (zoom > 1.5) {
expect([...r.fake.labels.values()].map(label => label.textContent).sort()).toEqual(specs.map(node => node.label).sort());
expect([...r.fake.labels.values()].every(label => !label.hidden && Number(label.style.opacity) > 0)).toBe(true);
} else expect(r.fake.labels.size, `passive labels after returning to ${zoom}x`).toBe(0);
expect(r.accessible.querySelectorAll('button')).toHaveLength(3);
}
} finally { r.shell.remove(); }
});

it('reveals saved titles only after zooming in, with readable topic hierarchy and bounded boxes', () => {
const specs=Array.from({length:20},(_,i)=>({id:'n'+i,x:(i%5-2)*.25,y:(Math.floor(i/5)-1.5)*.25}));
const topics=specs.slice(0,8).map(n=>n.id);
Expand Down
68 changes: 68 additions & 0 deletions desktop/src/__tests__/hologram-overlay-bounds.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// @vitest-environment happy-dom
import { afterEach, describe, expect, it, vi } from 'vitest';
import { KnowledgeHologram } from '../knowledge/hologram';
import { parseKnowledgeGraph } from '../knowledge/graph-model';

// Keep the real constructor/resize/overlay discovery path; no GPU claim.
vi.mock('three', async importOriginal => ({
...await importOriginal<typeof import('three')>(),
WebGLRenderer: class {
setPixelRatio() {} setClearColor() {} setSize() {} setViewport() {}
getPixelRatio() { return 1; } dispose() {} render() {}
},
}));

type Bounds = { left: number; top: number; right: number; bottom: number };
type OverlayGeometry = {
labelOverlays: HTMLElement[];
excludedLabelBounds: Bounds[];
resize(resetCamera?: boolean): void;
};
const observed = new Set<Element>();

afterEach(() => {
document.body.replaceChildren();
observed.clear();
vi.unstubAllGlobals();
vi.restoreAllMocks();
});

describe('knowledge-map status caption exclusion', () => {
it('reserves the actual status HUD and refreshes its measured bounds on layout changes', () => {
vi.stubGlobal('requestAnimationFrame', vi.fn(() => 1));
vi.stubGlobal('cancelAnimationFrame', vi.fn());
vi.stubGlobal('ResizeObserver', class {
observe(element: Element) { observed.add(element); }
disconnect() {} unobserve() {}
});
const workspace = document.createElement('section');
workspace.className = 'knowledge-section';
workspace.innerHTML = '<div class="knowledge-command-stage"><div class="knowledge-map-caption">ALDEN / KNOWLEDGE COMMAND <time>확인 19시 7분 51초</time></div><div class="knowledge-hologram-shell"><canvas></canvas><div class="knowledge-node-labels"></div><div id="knowledge-accessible-nodes"></div></div></div>';
document.body.append(workspace);
const canvas = workspace.querySelector('canvas')!;
const shell = workspace.querySelector<HTMLElement>('.knowledge-hologram-shell')!;
const caption = workspace.querySelector<HTMLElement>('.knowledge-map-caption')!;
const rect = (left: number, top: number, width: number, height: number) =>
({ left, top, width, height, right: left + width, bottom: top + height, x: left, y: top, toJSON() {} });
vi.spyOn(canvas, 'getBoundingClientRect').mockReturnValue(rect(144, 51, 495, 360));
vi.spyOn(shell, 'getBoundingClientRect').mockReturnValue(rect(144, 51, 495, 360));
const captionRect = vi.spyOn(caption, 'getBoundingClientRect').mockReturnValue(rect(154, 380, 304, 13));
const hologram = new KnowledgeHologram(canvas, parseKnowledgeGraph({ nodes: [], edges: [] }), () => {}, undefined, 'workspace', null);
const geometry = hologram as unknown as OverlayGeometry;
try {
expect(geometry.labelOverlays).toContain(caption);
expect(observed).toContain(caption);
const index = geometry.labelOverlays.indexOf(caption);
expect(geometry.excludedLabelBounds[index]).toEqual({ left: 4, top: 323, right: 320, bottom: 348 });
captionRect.mockReturnValue(rect(154, 360, 360, 26));
geometry.resize(false);
expect(geometry.excludedLabelBounds[index]).toEqual({ left: 4, top: 303, right: 376, bottom: 341 });
caption.hidden = true;
geometry.resize(false);
expect(geometry.excludedLabelBounds[index].right).toBe(geometry.excludedLabelBounds[index].left);
caption.hidden = false;
geometry.resize(false);
expect(geometry.excludedLabelBounds[index]).toEqual({ left: 4, top: 303, right: 376, bottom: 341 });
} finally { hologram.dispose(); }
});
});
2 changes: 1 addition & 1 deletion desktop/src/knowledge/hologram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export class KnowledgeHologram {
: new ResizeObserver(() => this.resize());
this.resizeObserver?.observe(canvas);
const workspace = canvas.closest('.knowledge-section, .alden-panel');
for (const selector of ['.knowledge-heading, .mini-graph-heading', '.knowledge-focus-card', '.knowledge-hologram-toolbar, .mini-graph-title', '.knowledge-depth-legend']) {
for (const selector of ['.knowledge-heading, .mini-graph-heading', '.knowledge-focus-card', '.knowledge-hologram-toolbar, .mini-graph-title', '.knowledge-depth-legend', '.knowledge-map-caption']) {
const overlay = workspace?.querySelector<HTMLElement>(selector);
if (overlay) { this.labelOverlays.push(overlay); this.excludedLabelBounds.push({left:0,top:0,right:0,bottom:0}); this.resizeObserver?.observe(overlay); }
}
Expand Down
88 changes: 88 additions & 0 deletions docs/evaluation/annotation-review-publication-20261024.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Annotation review publication ownership

Base source: `3407c08e8e3bdf14b378735bb7048e4398dbaede`.

Two candidate-review requests could both observe 15 fresh review JSON files,
pass the limit of 16, then publish distinct files. A regression through actual
`create_review` calls in two processes reproduced **17 files**. Atomic rename
published each file safely but did not serialize capacity admission.

The candidate holds one nonblocking advisory lock across the existing capacity
check, expired-metadata handling, staging and rename. A contender returns the
internal `annotation_review_cache_busy` error; the quality action retains its
existing `quality_annotation_review_unavailable` response. Source verification
and candidate calculation remain outside this short ownership region. The
change does not alter source records, annotations, identity or merge policy.

The private lock must be a regular, single-link, empty, owner-controlled 0600
file. Symlinks, hardlinks, directories, nonempty files and shared permissions
are rejected. Its inode remains in place: deleting a lock pathname on release
could let later callers lock another inode while the first is still owned.
Closing its descriptor releases ownership, including after process exit.

## State and property

```mermaid
stateDiagram-v2
[*] --> Prepared
Prepared --> Locked: acquire persistent inode
Prepared --> Busy: another owner
Locked --> Admitted: capacity available
Locked --> Rejected: fresh cache full
Admitted --> Staged: write and fsync metadata
Staged --> Published: atomic rename
Admitted --> Failed: write failure
Staged --> Failed: rename failure
Published --> Released: close descriptor
Rejected --> Released: close descriptor
Failed --> Released: clean staging and close
Locked --> Released: process exit
Busy --> [*]
Released --> [*]
```

Writing, fsync and rename are separate operations. The lock prevents another
cooperating publisher from interleaving admission and publication; it does not
turn the whole region into a filesystem transaction.

| Claim | Evidence and limit |
| --- | --- |
| Starting within capacity, these publishers cannot increase review JSON count beyond the limit. | Actual two-process, 15-existing/cap16 regression; baseline and an unlocked writer both produce 17, guarded source stays at 16. |
| Failure does not permanently retain ownership. | Real process exit while holding the lock, and an injected rename failure, followed by successful normal publication. |
| Contention does not expose source content or damage prior reviews. | Existing public failure contract, original source DB byte comparison, retained existing JSON files and private metadata contract tests. |
| The description is sensitive to the guarded defect. | Disabling the guard in one real writer makes the regression fail; restoring it passes without changing source bytes. |

A separate bounded interleaving check covered two actors, capacities 1–3 and
every initially valid count (nine cases), with publication, busy/full rejection,
write failure and owner exit. It found the unguarded counterexample and no
guarded capacity violation in those bounds. Both successful publications were
reachable when two slots were available. This is a model check plus real-code
regressions, not an all-input implementation proof. Liveness was not checked.

Assumptions: publishers share this implementation and the same persistent lock
inode on a supported local filesystem. External folder/lock replacement,
legacy writers, power-loss durability, staging leftovers after a hard crash,
and total folder byte budgets are outside this count-only claim. An already
overfull legacy cache is rejected, not silently repaired or purged. Existing
expired-review handling is unchanged.

## Verification and delivery boundary

Related local checks: **114 tests**, comprising 14 annotation-candidate tests,
44 quality-action tests and 56 graph-quality tests, all passed on the pinned
CPython 3.11 runtime. Re-run the producer regressions with the project runtime:

```sh
python3 -B -m unittest discover -s tests -p test_alden_annotation_candidates.py
```

Private baseline failures, mutation/restoration receipts, bounded-model output
and actual-store read-only audit evidence are retained under the task's
`outputs/quality-boundaries-20261024/`. Actual source content is not included in
this document or commit.

This remains an uninstalled candidate. The original approved review packet
retains its exact bytes; a subsequent applicable source-delta review and
integration gate are still required. Local tests do not attest installation,
native UI, broader graph semantics, deduplication truth or completed external
cross-audit.
33 changes: 33 additions & 0 deletions docs/evaluation/numeric-digit-recall-20261024.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Bare digit recall in collection search and graph pages

Base: `3407c08e8e3bdf14b378735bb7048e4398dbaede`. This source candidate fixes direct collection search and graph pages missing text such as `100개입니다` for the bare query `100`. Routed retrieval already had an additive digit-lexeme supplement; both paths now share that matcher. Original bodies, source records, IDs, memberships, versions, permissions, and FTS contents are preserved.

The policy accepts only a bare string of 2–64 ASCII digits. It adds complete matching digit runs after existing FTS results. It does not convert numbers, signs, units, grouped/decimal notation, Unicode digits, or identifiers into equivalent quantities or entities. Existing FTS punctuation matches remain compatible: a query can still return a token from `100,000` or `100.5`. Neither those existing hits nor new lexical candidates establish a numerical claim's truth. Quoted and advanced FTS queries keep their existing behavior. The existing `expand_korean=False` switch disables the direct-search supplement too.

## Selection and cost

For direct search, existing FTS results fill the requested limit first. If they already fill it, no body supplement executes. Otherwise, the supplement supplies additional eligible records after token hits. Both stages run in one source-guarded reader transaction.

For graph pages with offset O and limit L, the ordinary FTS page reads L+1 rows after O. If that page has a lookahead row, the supplement cannot affect its displayed rows or `next`: every FTS hit precedes every supplement hit. If no lookahead exists, a second selection includes the supplement. An exactly full displayed page without lookahead must still check the supplement; a regression covers that boundary. Each selection retains the same permitted/current membership, target/platform/type/relation/time filters and relationship integrity checks.

An initial candidate always scanned retained bodies. A subsequent SQL count gate still incurred unnecessary candidate materialization. The final candidate keeps the ordinary FTS graph SQL path when its lookahead suffices. The shared final SQL trace matched the baseline in the measured full-prefix graph case. Sparse searches can still require two graph-scope selections and a retained-text scan. This adds no numeric index or schema migration and is not an unbounded scaling claim. Display limits do not bound the amount of text a fallback might inspect.

## Verification

- Three new behavioral regressions failed on the base source before the fix.
- Four focused tests cover suffix/embedded digit recall, existing FTS ordering, quote/opt-out compatibility, pagination/lookahead, larger/grouped/decimal/Unicode runs, later occurrences, permitted current membership, time filters and byte/ID/version/FTS-count preservation. The previous Korean-only negative expectation was explicitly updated for the new integer supplement; one-character, Latin and oversized queries retain their negative checks.
- Final related Python checks: **313 tests in 10 fresh pinned-runtime processes**, all passed. This includes collection, retrieval, graph references, messenger access/context, quality, entity projection and content-evidence checks.
- Two actual retained-DB query cases used one normal read-only transaction per baseline/candidate pair. Source hashes were stable during each measurement. Existing selected IDs were retained, membership snapshot hashes matched, SQLite total_changes was 0, and no write was attempted. These cases exercised a full FTS prefix and a missing-number fallback; neither demonstrated additional matches in that live corpus. Positive recall improvement is demonstrated by the isolated regressions.
- These are source/SQLite observations. No new installed runtime, native search interaction, ingestion event, semantic gold, CPU/GPU/battery improvement distribution, or external model audit is attested.

Rerun the focused contract from the checkout with the pinned Python:

```sh
"/Users/twoimo/Library/Application Support/openkakao/runtimes/menubar/bin/python3.11" -B -m unittest discover -s tests -p test_alden_korean_search.py
```

Private detailed measurements and failure receipts remain under the task's `outputs/numeric-recall-20261024/`; they are not included in the product source commit.

## Integration boundary

This candidate is separate from the frozen installed-runtime-to-3407c08 review packet. That packet and its two already approved files retain their original bytes. Current-source external thesis/adversarial/reverse review and installation verification remain incomplete. This follow-up must be included in the applicable subsequent source review and integration checks; the original packet's review cannot certify it by implication. Full ST15 numeric value/unit semantics, independent gold, direct installed search and the remaining Alden requirements stay open.
Loading