Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3547c94
refactor(core-types): extract kTypeOps frozen dispatch table replacin…
ofriw Oct 15, 2026
b3e1eed
refactor(types): consolidate CFD type operations into frozen kTypeOpe…
ofriw Oct 15, 2026
5dfd3eb
refactor(richtext): delete dead isRef/richtext legacy code, reject le…
ofriw Oct 15, 2026
3938956
refactor(date): unify Date wire format with redefined checksum, add s…
ofriw Oct 15, 2026
ed57355
refactor(encoding): make JSON decoder pool leak-safe with Disposable …
ofriw Oct 15, 2026
9808cd9
chore(gates): pin Deno v2.3.3 runtime floor, ES2024 lib, type-check p…
ofriw Oct 15, 2026
07b4eca
feat(json-log): route file I/O through the worker-owned boundary
ofriw Oct 16, 2026
8a350d0
fix(server): narrow Node server type and make stop idempotent
ofriw Oct 16, 2026
46dec8c
ci: split type check and runtime floor probes into separate steps
ofriw Oct 16, 2026
726b11c
ci: install Playwright browsers on Node and pin its version
ofriw Oct 16, 2026
6b62c37
ci: verify committed system assets stay fresh with pinned esbuild
ofriw Oct 16, 2026
6a3e62f
chore: ignore local agent harness state
ofriw Oct 16, 2026
54862a4
fix(json-log): reject directory reads with EISDIR on Deno, Node, and …
ofriw Oct 16, 2026
020983d
fix(cli): append .exe for Windows targets and return compiled path fr…
ofriw Oct 16, 2026
77a6fdd
fix(test): make stopped-server probe retry until ECONNREFUSED is obse…
ofriw Oct 16, 2026
94b75ee
fix(ci): fail the run when Deno tests fail
ofriw Oct 16, 2026
fab1c7c
fix(server): await HTTP listener close in stop()
ofriw Oct 16, 2026
1d52423
test(server): await stop() and assert port release
ofriw Oct 16, 2026
557b898
test(server): send connection close to avoid pooled socket reuse
ofriw Oct 17, 2026
731c7bf
feat(server): add graceful HTTP stop with drain, timeout and force
ofriw Oct 18, 2026
d907d64
fix(cli): align template force-exit with the drain budget
ofriw Oct 18, 2026
a6be659
chore(npm): add a type-check surface for public entrypoints
ofriw Oct 18, 2026
893da13
refactor(base): use runtime id and typed config in getEnvVar
ofriw Oct 18, 2026
6f2e52f
fix(server): serialize start/stop and match ALB health checks by pars…
ofriw Oct 23, 2026
dccccc6
fix(test-runner): validate worker timeout, report heartbeats and coll…
ofriw Oct 23, 2026
a0ab11a
build(npm): share the production manifest and gate package archives
ofriw Oct 23, 2026
e405bf2
fix(cli): ship dotfile templates and fail init on install errors
ofriw Oct 23, 2026
d610ba8
build(deps): declare fast-check, react-dom, and chokidar
ofriw Oct 26, 2026
fdb1b95
refactor(path): brand POSIX paths and replace string containment
ofriw Oct 26, 2026
009c48d
fix(db): reject relative and root store paths
ofriw Oct 26, 2026
9d47382
ci: verify npm archive contents and path contract
ofriw Oct 26, 2026
56379e2
test: replace registry flows with checkout and path guard contracts
ofriw Oct 26, 2026
e19c5e0
fix(system-info): report invalid hardware config as a validation error
ofriw Oct 26, 2026
685852c
chore(logging): use type-only imports in log entries
ofriw Oct 26, 2026
e393394
test(cli): derive project root from deno info graph roots
ofriw Oct 27, 2026
171dd00
fix(test): resolve compile vendor root without Deno.realPath
ofriw Oct 27, 2026
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
35 changes: 19 additions & 16 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
deno-version: v2.3.3 # floor: native explicit resource management (V8); see denoland/deno#29282

- uses: actions/setup-node@v4
with:
Expand All @@ -30,9 +30,22 @@ jobs:
- name: Install npm dependencies
run: rm -rf node_modules && npm install

- name: Type check and runtime floor probe
run: |
deno task check
deno eval 'using x = { [Symbol.dispose]() {} };'
# deno eval defaults to TypeScript; --ext=js guards the native JS path.
deno eval --ext=js 'using x = { [Symbol.dispose]() {} };'

- name: Build npm artifact
run: npm run build:npm

# Publication check: the archive must contain every export, bin, and
# template. Source tests validate the checkout; this validates the
# release artifact.
- name: Verify npm archive contents
run: deno task verify:npm-archive

# Extract version once from deno.json; reused across all publish steps (DRY).
- name: Extract version from deno.json
id: extract_version
Expand All @@ -41,23 +54,13 @@ jobs:
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT

# Rewrite package.json version + exports for npm publish.
# In the repo, exports point to .ts source (for local dev/tests). Here we switch to dist/.
# In the repo, exports point to .ts source (for local dev/tests). The shared
# transform in scripts/npm-manifest.ts switches them to dist/. The package
# contract test applies the same transform, so a shipped-manifest
# regression fails the gate rather than the release.
# This runs AFTER npm install + build so the lockfile matches during install.
- name: Sync version and exports from deno.json → package.json
run: |
deno eval --node-modules-dir=none "
import pkg from './package.json' with {type:'json'};
import cfg from './deno.json' with {type:'json'};
pkg.version = cfg.version;
pkg.exports = {
'.': { import: './dist/mod.js', types: './dist/mod.d.ts' },
'./react': { import: './dist/react/hooks.js', types: './dist/react/hooks.d.ts' },
'./server': { import: './dist/server.js', types: './dist/server.d.ts' },
'./server/build': { import: './dist/server-build.js', types: './dist/server-build.d.ts' },
'./link': { import: './dist/cli/link.js', types: './dist/cli/link.d.ts' },
};
await Deno.writeTextFile('./package.json', JSON.stringify(pkg, null, 2) + '\n');
"
run: deno run -A scripts/npm-manifest.ts

- name: Publish to JSR
run: |
Expand Down
109 changes: 105 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,73 @@ jobs:
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
deno-version: v2.3.3 # floor: native explicit resource management (V8); see denoland/deno#29282

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24.x'

- name: Type check
run: deno task check

- name: Path contract pre-check
run: deno task test:paths
env:
FC_SEED: 42

- name: Runtime floor probe (TypeScript)
run: deno eval 'using x = { [Symbol.dispose]() {} };'

- name: Runtime floor probe (native JavaScript)
# deno eval defaults to TypeScript; --ext=js guards the native JS path.
run: deno eval --ext=js 'using x = { [Symbol.dispose]() {} };'

- name: Run Deno tests
run: deno task test --runtime=deno
env:
CI: true
FC_SEED: 42

- name: Run Node.js tests
run: deno task test --runtime=node
env:
CI: true
FC_SEED: 42

package-validation:
name: Package Archive
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.3.3 # floor: native explicit resource management (V8); see denoland/deno#29282

# Validates the JSR upload set and publish-time specifier rewriting
# without publishing. The compile E2E links local source, so it cannot
# cover this package-boundary contract.
- name: Validate JSR package
run: deno publish --dry-run

system-assets-check:
name: System Assets Freshness
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.3.3 # floor: native explicit resource management (V8); see denoland/deno#29282

- name: Rebuild system assets
run: deno task build

- name: Verify system assets are fresh
run: git diff --exit-code -- system-assets/assets.json

docs-build:
name: Docs Build
Expand All @@ -45,7 +96,7 @@ jobs:
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
deno-version: v2.3.3 # floor: native explicit resource management (V8); see denoland/deno#29282

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -69,6 +120,11 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.3.3 # floor: native explicit resource management (V8); see denoland/deno#29282

- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand All @@ -77,9 +133,44 @@ jobs:
- name: Install npm dependencies
run: npm install

- name: Type check npm surface
run: npm run check:npm-types

- name: Build npm package
run: npm run build:npm

# Archive membership is checked on every push, not only at tag time.
# Same verifier as publish, so a staging regression fails the PR.
- name: Verify npm archive contents
run: deno task verify:npm-archive

build-contract:
name: Build Contract
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.3.3 # floor: native explicit resource management (V8); see denoland/deno#29282

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24.x'

- name: Install npm dependencies
run: npm install

# Builds the current checkout. The suite loads dist in place and must not
# install the package or resolve it from a registry.
- name: Package contract
run: deno task test:package
env:
GOATDB_TEST_PACKAGE: '1'
npm_config_offline: 'true'

test-browser:
name: Browser Tests
runs-on: ubuntu-latest
Expand All @@ -89,7 +180,7 @@ jobs:
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
deno-version: v2.3.3 # floor: native explicit resource management (V8); see denoland/deno#29282

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -105,7 +196,17 @@ jobs:
playwright-

- name: Install Playwright browsers and system dependencies
run: deno run -A npm:playwright@^1.48.0 install --with-deps chromium
# Runs under Node, not Deno: Playwright's downloader passes a `lookup`
# option that Deno's node:http does not implement. Tests still run on Deno.
# Version comes from deno.json so the install and the test runner cannot drift.
# deno.json must stay strict JSON (no comments): the probe reads it with require().
run: |
PLAYWRIGHT_VERSION=$(node -e "console.log(require('./deno.json').imports.playwright.split('@').pop().replace(/^[\^~]/, ''))")
if [ -z "$PLAYWRIGHT_VERSION" ]; then
echo '::error::Could not parse the playwright version from deno.json imports.playwright (expected e.g. npm:playwright@1.64.1)'
exit 1
fi
npx --yes "playwright@${PLAYWRIGHT_VERSION}" install --with-deps chromium

- name: Run browser tests
run: deno task test --runtime=browser
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ temp_bench_*
.chunkhound.json
.mcp.json

# Agent harness state (local only)
.pi/

# API docs build artifacts
docs/api.json

Expand All @@ -26,5 +29,8 @@ docs/api.json
# npm build artifacts
dist/

# npm entrypoint guard test temp dirs
.npm-entrypoints-*

# Benchmark JSON output (generated by deno task bench:json)
benchmarks/results/
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ db.item('data/todos/task-123'); // FAILS - not absolute
Database operations MUST await readiness:

```typescript
const db = new GoatDB({ path: './data' });
// path MUST be absolute and non-root; relative paths throw at construction.
const db = new GoatDB({ path: `${Deno.cwd()}/data` });
await db.readyPromise(); // MANDATORY - always
// ... operations ...
await db.flushAll();
Expand Down
82 changes: 82 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,42 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

## [Unreleased]

### Known Quirks

The following behaviors are intentional artifacts of the current implementation and are pinned by characterization tests:

- **iterableFilter is not applied during ref collection.** The Object branch drops options when recursing, so the filter never runs during ref collection. The filter is re-applied during final JSON encode, which can produce counterintuitive `__r`/`__d` wrappers. Pinned intentionally; see TODO(#58-followup) in `base/core-types/type-ops.ts`. Tests: `refs matrix: array iterableFilter is not applied during ref collection`, `refs matrix: set iterableFilter is not applied during ref collection`.

### Breaking Changes

- **Store path must be absolute and non-root.** `DBInstanceConfig.path` now
throws `DBInstanceConfig.path must be an absolute, non-root path` for
relative paths, the empty string, and filesystem roots such as `/`. Resolve
the path at the call site: `new GoatDB({ path: `${Deno.cwd()}/data` })`
instead of `{ path: './data' }`. Paths are normalized on ingress, and the
check keeps `logout()` from recursively removing the process working
directory.
- **Unified `Date` wire format and redefined commit checksum.** Dates in typed
fields now encode as `{ "__t": "D", "__v": <epoch-seconds> }` instead of a
bare number, and a `Date` is tagged uniformly in every checksum position
(a typed date-field checksum changes from `416277608` to `1391363808`). A
store written by an earlier version is rejected on open with a clear
"older GoatDB - delete and re-sync" error, rather than silently mis-decoding
or marking every commit as corrupted. Mixed-version fleets are unsupported.
- `coreValueHash` alias removed. Use `encodableValueHash`.
- Mixed-version sync unsupported. Bare-number dates from old peers throw
on typed-field deserialize and the commit is skipped. Epoch guards protect
local store only.
- Checksum limit: a non-`typeSafe` string can collide with a tagged `Date`
(e.g. `"41700000000"`). Use `typeSafe` checksums where untrusted input
matters.
- Stray ref marker: a sole-key `{ "__rId": <number> }` object outside a
`__r`/`__d` wrapper now throws at decode instead of passing through as user
data. Wider objects containing `__rId` among other keys are unaffected.
- Clone aliasing: `coreValueClone`/`coreObjectClone` now preserve shared-ref
aliasing across array/set siblings (they previously produced distinct
copies). Alias identity within an object's fields was already preserved.

### Added

- `DBInstanceConfig.repoInactivityTimeoutMs` and
Expand All @@ -21,6 +57,52 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and do not start loading. A fresh unobserved query reports `loading === false`
and, when `queryInactivityTimeoutMs` is set, is eligible for auto-close. A
closed query is replaced by calling `db.query()` again.
- `compile()` now resolves to the path of the compiled executable
(`Promise<string>`). Callers that ignore the value need no change.

### Changed

- `goatdb init` on Deno now requests `react`, `react-dom`, `yargs` and
`@types/react` as `^` ranges and installs all dependencies in one
`deno add` call, bounded by a 180s timeout. Exact pins let a transitive
peer resolve a newer `react` than `react-dom`, which crashes at runtime
with "Incompatible React versions".
- HTTP health checks from the `awsalb` host now accept `http` and `https`
URLs on any port and ignore the query string; the path must be exactly
`/healthy`. The comparison is now case-sensitive, so a mixed-case probe such
as `/HEALTHY` returns 404; the `/healthy` endpoint itself still matches
case-insensitively. Keep ALB health-check paths lowercase.
- `GOATDB_TEST_TIMEOUT_MS` now sets the whole-worker timeout and is validated
strictly: non-integer values and values outside `1` to `2147483647` abort the
run with an explicit error instead of silently using the 5-minute default.
Workers send a heartbeat every 10 seconds, and a timeout reports the active
suite and test, the test's elapsed time and the last heartbeat age.

### Fixed

- `deno compile` output names now include `.exe` for Windows targets, so
`compile()` returns and logs the path that the compiler actually writes.
- Reading a directory now fails with `EISDIR` on Deno, Node.js, and the
browser instead of returning empty bytes on Windows.
- `coreValueEquals` is now symmetric for objects when `objectFilterFields`
inspects the object; previously the second comparison loop passed the wrong
object to the filter.
- `goatdb init` now scaffolds `.gitignore` and `.npmrc` again when run from
the published npm package. `npm pack` drops dotfile sources, so the
templates use plain names (`gitignore`, `npmrc`) that `init` maps back to
their dotted targets.
- `goatdb init` now exits non-zero when dependency installation fails,
reporting the command, its exit code and its output. Previously a failed
`npm install` only warned, so a broken scaffold looked successful.
- A server `stop()` that races an in-flight `start()` now waits for that start
to settle before closing the listener, instead of returning early and
leaving a bound server behind. A `start()` after a failed teardown retries
cleanly, and a later `force` stop interrupts an in-progress drain even when
the stop is queued behind a restart. Drain-then-close ordering is unchanged,
and force or timeout still never cancel application handlers.
- The test runner no longer stops at the first failing runtime. Deno, Node and
browser results are all collected, and the process exits non-zero with the
combined failures.

## [0.6.1] - 2026-09-01

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const kSchemaTask = {
} as const;
DataRegistry.default.registerSchema(kSchemaTask);

const db = new GoatDB({ path: './data' });
const db = new GoatDB({ path: `${import.meta.dirname}/data` });
await db.readyPromise();

const item = db.create('/data/todos', kSchemaTask, {
Expand Down
3 changes: 2 additions & 1 deletion base/build-info.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { isDeno, isNode } from './common.ts';
import { cli } from './development.ts';
import { readTextFile } from './json-log/file-impl.ts';
import { parsePath } from './path.ts';
import { isWindows, normalizeNodePlatform } from './os.ts';
import type { JSONObject } from './interfaces.ts';

Expand Down Expand Up @@ -132,7 +133,7 @@ export async function generateBuildInfo(
// App version
let config: Record<string, unknown> = {};
try {
config = JSON.parse((await readTextFile(configPath)) || '{}');
config = JSON.parse((await readTextFile(parsePath(configPath))) || '{}');
} catch {
// Malformed config file — proceed without version/name
}
Expand Down
Loading
Loading