Dashboard › opencode › Distillation
9311999a-33d9-4b1e-b21e-3ad7cd78139e["lore_tm_v1_dOuDFJljij-SmCXqHIFs8nBLoYtTq8TqlMPIsi5UItY","lore_tm_v1_gGoRG0hpqSoOoz6hFia8mVRMoLeiXXxMx0UNVMoI2QY","lore_tm_v1__eT_pPGHfG8krlXCb1Os8CtpoB1Yw7FCLS7B_FM_n30","lore_tm_v1_4vDpT0V9W-xWlsV8vL4dOWnba_abxyBCZ-nU2q2myzU","lore_tm_v1_PZ71igbyA32d9EXPSigjmKX1R3PvfcoIVJYPa3HDsok"]
/home/byk/Code/opencode-lore-v2/quality/REVIEW.md codifies a mandatory regression-test discipline: every adversarial-review defect must receive a deterministic regression test in the same PR that fails on the base branch, passes on the fix, and drives the real precondition; guard tests must fail if the guard is deleted.SYNCED_TABLES → sync-registry-contract.test.ts, covering every table’s shape, pull-only/no-capture invariant, composite-pk correctness, sync/id columns, and versioned flag; MIGRATIONS → db.test.ts with one toBe(MIGRATIONS.length) schema-version assertion plus migration-specific tests; AGENTS → agents.test.ts, requiring every agent to have name, displayName, binary, and detect(), with binary a constant placeholder string.packages/core/test/sync-registry-contract.test.ts; per-operation sync invariants via assertSyncInvariants in packages/core/src/sync-data.ts, enforcing no pull-only outbox, profiles ≤ 1, and every state row referencing a registered table; sequence properties in packages/gateway/test/sync.property.test.ts, covering invariants after every operation, prune-floor non-wedging, eventual convergence, no ping-pong, and currentTier correctness.NOT EXISTS, latest <> 'upsert', and content-match guards previously masked data-loss bugs; each skip branch needs a test that makes it skip something it should not.#833 property-test battery found 4 real sync-engine bugs missed by example tests; all were sequence-dependent across enable/disable/push/pull boundaries.syncedColumns PRAGMA cache, so mutation throws TypeError in strict mode rather than silently corrupting the cache.db().query monkeypatches are shadowed by the tracing Proxy; SQL-counting tests must use the log.registerSink({ withDbSpan }) seam because direct db().query = ... patches are silently ignored, as empirically verified in #874.pnpm test, pnpm run typecheck, pnpm run lint, and pnpm run format:check; verify exit codes because a blank tail may conceal lint/format failure; run property tests ×10; confirm the final working tree is unmodified using hashes; and report per-point PASS / FAIL / CONCERN / MUST-FIX verdicts with file:line evidence plus an overall MERGE / DO-NOT-MERGE verdict rather than unstructured “LGTM”.#856, #861, #866, #868 and PRAGMA N+1 fixes #874, #878. (meaning June 2026)/home/byk/Code/opencode-lore-v2/packages/opencode/src/server-runtime.ts defines LoreServerRuntime with gatewayBase, projectPath, gitRemote, gatewayHeaders, and async release; ServerRuntimeDependencies allows optional resolveGateway() and gitRemote(path).server-runtime.ts uses a shared gatewayLeasePromise and reference-counted GatewayLease (refs, gatewayBase, gatewayHeaders, optional shutdown, optional closing). acquireGatewayLease() reuses the lease, waits and retries if it is closing, increments refs, and clears the shared promise if acquisition rejects; releaseGatewayLease() decrements refs, shuts down only at zero, and clears the active shared promise in finally.resetServerRuntimeForTest() in server-runtime.ts throws "Server runtime reset is test-only" unless NODE_ENV === "test", clears gatewayLeasePromise, awaits any existing lease, and invokes its optional shutdown().acquireServerRuntime() returns undefined during tests—when NODE_ENV === "test" or any argv contains .test.—unless LORE_OPENCODE_FORCE_ACTIVE === "1"; it also returns undefined when LORE_DISABLED is "1" or "true".acquireServerRuntime() acquires a gateway lease before resolving the git remote with dependencies.gitRemote ?? getGitRemote; a null remote becomes "". If git-remote resolution throws, it releases the lease before rethrowing. Its returned release() is idempotent through a released boolean.server-runtime.ts checks LORE_REMOTE_URL first and, if probing fails, logs that it is falling through to local discovery; it then checks LORE_GATEWAY_URL, a port returned by dynamically imported @loreai/gateway’s readPortFile(), and known ports [3207, 5673]. URLs have one trailing slash removed and local candidates use http://127.0.0.1:${port}.createGatewayLease() dynamically imports @loreai/gateway, calls startGateway({ quiet: true, local: true }), uses http://127.0.0.1:${handle.port}, derives headers with gatewayAccessHeadersForRemote(), and only retains handle.shutdown when handle.owned is true.buildServerHeaders() creates headers x-lore-session-id, x-lore-agent, x-lore-project, x-lore-git-remote, and x-lore-provider alongside runtime gateway headers; conditionally adds x-parent-session-id; reads provider-specific upstream URL from LORE_UPSTREAM_${providerID.toUpperCase().replace(/-/g, "_")} into x-lore-upstream-url; and forwards entries parsed from LORE_UPSTREAM_EXTRA_HEADERS only when shouldForwardUpstreamExtraHeader(name) permits them./home/byk/Code/opencode-lore-v2/packages/opencode/test/package.test.ts builds the package with pnpm run build, packs it using pnpm pack --out <temporary>/loreai-opencode.tgz, extracts it with tar -xzf, and recursively removes the temporary directory after all tests.V2 package export test suite verifies packed package.json export ./server exactly equals { types: "./src/server.ts", bun: "./dist/server.js", default: "./dist/server.js" }; verifies package/dist/server.js contains neither interface LoreServerRuntime, import type , nor @opencode/plugin; and imports the packed entrypoint with Node --input-type=module --eval, expecting { id: "lore", setup: "function" } without a host SDK./home/byk/Code/opencode-lore-v2/packages/opencode/package.json defines @loreai/opencode version 0.40.0, ESM ("type": "module"), license FSL-1.1-Apache-2.0, description "Three-tier memory architecture for OpenCode — distillation, not summarization", and author BYK.@loreai/opencode exports "." from ./src/index.ts for types, bun, and default; exports "./server" with types: "./src/server.ts" and both bun and default set to ./dist/server.js; uses scripts "typecheck": "tsc --noEmit" and "build": "tsx script/build.ts".@loreai/opencode declares peer dependencies @opencode-ai/plugin >=1.1.0 and optional @opencode/plugin >=0.0.0; workspace dependencies @loreai/core and @loreai/gateway; dev dependencies @opencode-ai/plugin ^1.1.39, @opencode-ai/sdk ^1.1.39, @opencode/plugin 0.0.0-beta-19378, and @types/bun ^1.2.0; and publishes src/, dist/, README.md, and LICENSE..jj/ exists, mutations must use Jujutsu (jj) rather than Git; interactive flags such as -i/--interactive must never be used; commit/description operations must use -m "msg"; and mutations must be verified with jj st and jj log.jj undo, jj op log, or jj op restore <op-id> for recovery.rebase, new, and squash; agents must run jj st, edit conflicted files manually, and must not use interactive jj resolve.@, edits auto-amend it without staging, bookmarks do not auto-advance, jj commit -m "..." leaves content in @- and creates an empty @, and jj new creates a new empty change rather than committing current work.