@gnolith/taproot 0.1.0-rc.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,10 @@ inspects the packed artifact, publishes to npm through OIDC trusted publishing,
11
11
  and attaches the tarball, SBOM, checksums, and build attestation to a GitHub
12
12
  Release.
13
13
 
14
+ A Taproot release qualifies the published package and its supported local
15
+ runtime contracts. It does not assemble, provision, deploy, or accept a complete
16
+ Gnolith Site; the Codex agent creating a Site owns those responsibilities.
17
+
14
18
  The current minor line receives fixes. Security support follows `SECURITY.md`.
15
19
  Deprecations are announced in the changelog before removal whenever a safe
16
20
  migration path exists.
package/docs/testing.md CHANGED
@@ -11,11 +11,20 @@ projection repair, shared RDF values, and injected RDF failures. The injected
11
11
  failure proves that canonical JSON, revisions, audit events, search terms,
12
12
  ownership, and Diamond quads roll back as one D1 batch.
13
13
 
14
- `test/example.test.ts` runs the documented Codex Site example and queries its
15
- Taproot-generated graph through Diamond SPARQL. `consumer:check` packs the
14
+ `test/interop.test.ts` runs the documented local D1 and Diamond interoperability
15
+ example and queries its Taproot-generated graph through Diamond SPARQL.
16
+
17
+ `test/persistence.test.ts` exercises Diamond's Node SQLite adapter in memory
18
+ and on disk, including read-only planning, immutable identity, close/reopen,
19
+ same-adapter enforcement, late-batch rollback, and concurrent writers.
20
+ `consumer:check` packs the
16
21
  package, installs the tarball into a fresh temporary project with registry
17
22
  Diamond and Miniflare dependencies, initializes a new D1 database, writes an
18
23
  entity, and verifies the RDF through SPARQL using only public package exports.
19
24
 
20
- `npm run check` is the complete local release-quality gate. Coverage thresholds
21
- are enforced in `vitest.config.ts`; lowering them requires an explained review.
25
+ `npm run check` is the complete local package release-quality gate. Coverage
26
+ thresholds are enforced in `vitest.config.ts`; lowering them requires an
27
+ explained review. Miniflare/Workerd and packed-consumer success verifies the
28
+ package's supported D1 runtime contract, not assembly, provisioning, deployment,
29
+ or acceptance of a complete Gnolith Site. The Codex agent creating a Site owns
30
+ those checks.
@@ -8,9 +8,9 @@ association between an edit and its claimed attribution metadata.
8
8
 
9
9
  ## Trust boundaries
10
10
 
11
- The host application is trusted to authenticate and authorize callers, select
12
- the D1 binding, supply an absolute site-owned base IRI, and protect mutation
13
- routes. Attribution is a stored claim, not proof of identity. Diamond executes
11
+ Taproot assumes its consumer supplies a D1 binding and absolute base IRI, and
12
+ that callers reaching mutations have already been authenticated and authorized.
13
+ Attribution is a stored claim, not proof of identity. Diamond executes
14
14
  the RDF patch prepared by Taproot and exposes read-only SPARQL querying; hosts
15
15
  must not give untrusted callers an independent write path to Taproot or Diamond
16
16
  tables.
@@ -24,8 +24,8 @@ tables.
24
24
  - History tampering is deterred and detected by immutable-table triggers,
25
25
  SHA-256 content/parent chains, schema inspection, and integrity APIs.
26
26
  - Resource exhaustion is bounded by entity, command, page, bulk, redirect, and
27
- RDF patch limits. Hosts still need request-size, authentication, and rate
28
- limits at the network boundary.
27
+ RDF patch limits. Request-size, authentication, and network rate limits are
28
+ outside the package boundary.
29
29
  - RDF projection confusion is constrained by strict entity validation,
30
30
  deterministic mapping, site-owned namespaces, and per-entity quad ownership.
31
31
  - Dependency and release compromise is reduced through locked installs, pinned
@@ -38,3 +38,8 @@ Taproot does not provide authentication, authorization, agent/MCP isolation,
38
38
  network rate limiting, D1 backup custody, UI sanitization, or arbitrary SPARQL
39
39
  Update. A compromised host with direct D1 access can bypass library controls;
40
40
  restore from a trusted backup and verify audit chains after such an incident.
41
+
42
+ Taproot's local Workerd tests validate its package controls under the supported
43
+ D1 contract. They do not qualify a deployed host. The Codex agent creating a
44
+ Site owns assembly, provisioning, route and security wiring, deployment, backup
45
+ policy, and production acceptance.
@@ -0,0 +1,11 @@
1
+ # Local D1 and Diamond interoperability example
2
+
3
+ Pass a D1-compatible database to `runTaprootInteropDemo(db)`. The demo
4
+ initializes Taproot and Diamond in the same database, creates Properties and an
5
+ Item, applies revision-guarded edits, and queries Taproot's RDF projection
6
+ through Diamond SPARQL.
7
+
8
+ The automated test runs this example locally with Miniflare's Workerd D1
9
+ implementation. It verifies the published package's D1 and Diamond contracts;
10
+ it does not assemble, provision, deploy, or accept a complete Gnolith Site.
11
+ Those responsibilities belong to the Codex agent creating that Site.
@@ -8,8 +8,8 @@ import {
8
8
  } from '@gnolith/taproot';
9
9
  import { createSparqlHandler } from '@gnolith/diamond';
10
10
 
11
- export async function runTaprootDemo(db: D1DatabaseLike) {
12
- await initializeTaproot(db);
11
+ export async function runTaprootInteropDemo(db: D1DatabaseLike) {
12
+ await initializeTaproot(db, { baseIri: 'https://knowledge.example' });
13
13
  const taproot = new TaprootRepository(db, {
14
14
  baseIri: 'https://knowledge.example',
15
15
  });
@@ -125,7 +125,7 @@ export async function runTaprootDemo(db: D1DatabaseLike) {
125
125
  }`;
126
126
  const response = await sparql(
127
127
  new Request(
128
- `https://site.example/api/sparql?query=${encodeURIComponent(query)}`,
128
+ `https://interop.example/sparql?query=${encodeURIComponent(query)}`,
129
129
  { headers: { accept: 'application/sparql-results+json' } },
130
130
  ),
131
131
  );
@@ -1,6 +1,7 @@
1
- -- Structural half of the v1 -> v2 migration. initializeTaproot() must run
2
- -- immediately afterward to SHA-256 backfill legacy revisions, create their
3
- -- audit events, install immutability triggers, and verify version metadata.
1
+ -- Historical 0.1 structural migration retained as package documentation.
2
+ -- Taproot 0.2 hosts must use the exported migration/initializer APIs rather
3
+ -- than applying this file directly; checksummed adoption and JavaScript
4
+ -- backfills cannot be represented by this SQL file alone.
4
5
  ALTER TABLE taproot_entity_revisions ADD COLUMN attribution_json TEXT CHECK (attribution_json IS NULL OR json_valid(attribution_json));
5
6
  ALTER TABLE taproot_entity_revisions ADD COLUMN tags_json TEXT NOT NULL DEFAULT '[]' CHECK (json_valid(tags_json));
6
7
  ALTER TABLE taproot_entity_revisions ADD COLUMN event_id TEXT;
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@gnolith/taproot",
3
- "version": "0.1.0-rc.0",
4
- "description": "D1-native Wikibase-compatible knowledge graph and revision layer for Gnolith.",
3
+ "version": "0.2.0",
4
+ "description": "Portable SQLite and D1 Wikibase-compatible knowledge graph and revision layer for Gnolith.",
5
5
  "author": "Gnolith contributors",
6
6
  "keywords": [
7
7
  "cloudflare-d1",
8
+ "sqlite",
8
9
  "knowledge-graph",
9
10
  "rdf",
10
11
  "sparql",
@@ -47,20 +48,21 @@
47
48
  ],
48
49
  "scripts": {
49
50
  "build": "tsc -p tsconfig.build.json",
50
- "check": "npm run format:check && npm run lint && npm run typecheck && npm run test:coverage && npm run build && npm run example:check && npm run pack:check && npm run consumer:check && npm run licenses:check && npm run readiness:check",
51
+ "check": "npm run format:check && npm run lint && npm run typecheck && npm run test:coverage && npm run build && npm run interop:check && npm run pack:check && npm run consumer:check && npm run licenses:check && npm run repository:check",
51
52
  "consumer:check": "node scripts/consumer-smoke.mjs",
52
- "example:check": "vitest run test/example.test.ts",
53
+ "interop:check": "vitest run test/interop.test.ts",
53
54
  "format": "prettier --write .",
54
55
  "format:check": "prettier --check .",
55
56
  "licenses:check": "license-checker-rseidelsohn --production --summary --onlyAllow \"MIT;ISC;BSD-2-Clause;Apache-2.0;BSD-3-Clause;BlueOak-1.0.0;FreeBSD;(WTFPL OR MIT);UNLICENSED\"",
56
57
  "lint": "eslint .",
57
58
  "pack:check": "npm pack --dry-run",
58
59
  "prepack": "npm run build",
59
- "readiness:check": "node scripts/readiness-check.mjs",
60
+ "repository:check": "node scripts/repository-check.mjs",
60
61
  "release:check": "node scripts/release-check.mjs",
61
62
  "test": "vitest run",
62
63
  "test:coverage": "vitest run --coverage",
63
- "test:integration": "vitest run test/repository.test.ts test/example.test.ts",
64
+ "test:integration": "vitest run test/repository.test.ts test/interop.test.ts",
65
+ "test:persistence": "vitest run test/persistence.test.ts test/migration-recovery.test.ts",
64
66
  "test:unit": "vitest run test/rdf.test.ts test/scaffold.test.ts",
65
67
  "typecheck": "tsc --noEmit"
66
68
  },
@@ -68,7 +70,7 @@
68
70
  "node": ">=22"
69
71
  },
70
72
  "dependencies": {
71
- "@gnolith/diamond": "^0.3.2",
73
+ "@gnolith/diamond": "0.4.0",
72
74
  "@rdfjs/types": "^2.0.1",
73
75
  "rdf-data-factory": "^2.0.2"
74
76
  },
@@ -1,3 +0,0 @@
1
- {
2
- "framework": "nextjs"
3
- }
@@ -1,13 +0,0 @@
1
- # Codex Site example
2
-
3
- Bind a Cloudflare D1 database as `DB`, apply Diamond's and Taproot's numbered
4
- migrations, call `initializeTaproot`, and run `runTaprootDemo(env.DB)` from a
5
- trusted setup route or test fixture.
6
-
7
- `demo.ts` creates Properties and an Item, adds a qualified and referenced
8
- statement, changes its rank, adds a `somevalue`, queries the truthy projection
9
- through Diamond SPARQL, exports canonical JSON, proves that a stale edit is
10
- rejected, and returns the attribution/audit and integrity records. A production
11
- site should authenticate every mutation route and can enable
12
- `requireAttribution`; Taproot deliberately does not own authentication or agent
13
- transport.