Skip to content

Eliminate all src/*.ts (Closes #30; Refs affinescript#122)#31

Merged
hyperpolymath merged 1 commit into
mainfrom
feat/eliminate-src-typescript
May 16, 2026
Merged

Eliminate all src/*.ts (Closes #30; Refs affinescript#122)#31
hyperpolymath merged 1 commit into
mainfrom
feat/eliminate-src-typescript

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Eliminate all src/*.ts (ubicity#30; Refs hyperpolymath/affinescript#122)

rsr-antipattern forbids .ts in src/ (src/ is not allowlisted). All
four src/*.ts removed:

  • storage.ts → storage.affine → storage.js (the AffineScript
    showcase for affinescript#122's Deno-ESM backend). storage.affine is
    the source of truth; storage.js is generated, drop-in, dependency-free
    ESM — exact surface export class ExperienceStorage (constructor +
    9 async methods) consumed by index.js / mapper.js / privacy.js /
    visualize.js. Self-contained extern decls lowered by the backend
    (Deno.Sync / JSON. / object indexing); real AffineScript helpers
    (has_json_ext / drop_json_ext); try/catch; orDefault preserves the
    new ExperienceStorage() default; kbString for the KB display.
    Regenerate: affinescript compile src/storage.affine -o src/storage.js --deno-esm.
  • observability.ts / rescript-bridge.ts / wasm-bridge.ts → .js:
    faithful plain-ESM type-strips. These are pure JS-runtime /
    ReScript-interop / WebAssembly-runtime glue (no algorithm; wasm-bridge
    has no importers in src|tests). AffineScript is the wrong tool for
    them and porting rescript-bridge would re-implement a ReScript bridge
    against the estate ReScript-hands-off rule; type-stripping keeps
    behaviour byte-identical and the boundary intact.

Consumers already import ./storage.js etc. (no .ts specifiers) — no
call-site changes needed.

Verification: the AffineScript toolchain (affinescript#123 + the
follow-up polymorphic-len/show fix, affinescript#125) compiles
storage.affine cleanly to the exact expected class surface; affinescript
dune runtest + the Deno-ESM harness suite are green. deno task test
is left to ubicity CI (no usable local deno in the dev env).

Closes #30.
Refs hyperpolymath/affinescript#122, #123, #125.

🤖 Generated with Claude Code

rsr-antipattern forbids `.ts` in src/ (src/ is not allowlisted). All
four src/*.ts removed:

- **storage.ts → storage.affine → storage.js** (the AffineScript
  showcase for affinescript#122's Deno-ESM backend). storage.affine is
  the source of truth; storage.js is generated, drop-in, dependency-free
  ESM — exact surface `export class ExperienceStorage` (constructor +
  9 async methods) consumed by index.js / mapper.js / privacy.js /
  visualize.js. Self-contained extern decls lowered by the backend
  (Deno.*Sync / JSON.* / object indexing); real AffineScript helpers
  (has_json_ext / drop_json_ext); try/catch; orDefault preserves the
  `new ExperienceStorage()` default; kbString for the KB display.
  Regenerate: `affinescript compile src/storage.affine -o src/storage.js
  --deno-esm`.
- **observability.ts / rescript-bridge.ts / wasm-bridge.ts → .js**:
  faithful plain-ESM type-strips. These are pure JS-runtime /
  ReScript-interop / WebAssembly-runtime glue (no algorithm; wasm-bridge
  has no importers in src|tests). AffineScript is the wrong tool for
  them and porting rescript-bridge would re-implement a ReScript bridge
  against the estate ReScript-hands-off rule; type-stripping keeps
  behaviour byte-identical and the boundary intact.

Consumers already import `./storage.js` etc. (no `.ts` specifiers) — no
call-site changes needed.

Verification: the AffineScript toolchain (affinescript#123 + the
follow-up polymorphic-len/show fix, affinescript#125) compiles
storage.affine cleanly to the exact expected class surface; affinescript
`dune runtest` + the Deno-ESM harness suite are green. `deno task test`
is left to ubicity CI (no usable local deno in the dev env).

Closes #30.
Refs hyperpolymath/affinescript#122, #123, #125.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@hyperpolymath hyperpolymath merged commit f2cb58f into main May 16, 2026
16 of 28 checks passed
@hyperpolymath hyperpolymath deleted the feat/eliminate-src-typescript branch May 16, 2026 15:09
hyperpolymath added a commit that referenced this pull request May 16, 2026
## Make a plain clone work fully + Deno container (Refs
affinescript#122, #126; ubicity#30)

Follow-up to #31. After the `.ts` elimination the repo did not run from
a clean clone. This makes it work end-to-end, including containerised.

### Fixes

1. **`src/storage.js` regenerated** with the fixed async-IIFE backend
   (affinescript#126). The version merged in #31 was generated *before*
   that fix, so `loadAllExperiences` was a `SyntaxError`
   (`await` inside a non-async IIFE).
2. **`deno.json`**: `exports` → `./src/index.js`; added
   `"nodeModulesDir": "auto"` (npm:zod had no resolution); every task /
   glob `.ts` entrypoint (`cli`/`capture`/`visualize`/`index`) → `.js`
   (they were deleted in #31).
3. **`node:` prefix** on all bare node-builtin imports deno rejects:
   `export/import` (`fs`), `capture` (`process`, `readline/promises`),
   `mapper/privacy` (`crypto`), `performance` (`perf_hooks`).
4. **`.tool-versions`**: pin `deno 2.7.14` (matches CI `setup-deno`
   and `flake.nix`) so an `asdf`/`mise` clone provisions deno.
5. **Containerfile** rewritten on `denoland/deno:2.7.14` (was a stale
   Node image that cannot run this Deno project); `.dockerignore`
   keeps `tests/` so the image can run the suite; `docker-compose.yml`
   names `Containerfile` explicitly so `docker compose` (not just
   podman) finds it.

### Verification

- Local: `deno task test` → **44 passed / 0 failed**.
- Containerised: `docker build -f Containerfile -t ubicity .` → builds
  clean; `docker run --rm ubicity test --allow-read --allow-write
  tests/` → **44 passed / 0 failed**; default CMD (CLI help) works.
- A plain `git clone` now works fully via: host deno (`.tool-versions`
  / `flake.nix` both provide 2.7.14) **or** the container.

`flake.nix` already provided deno (unchanged). storage.affine remains
the source of truth for storage.js (affinescript#122 showcase).

Refs hyperpolymath/affinescript#122 #126, ubicity#30.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
hyperpolymath added a commit that referenced this pull request May 16, 2026
ci: repin denoland/setup-deno to a resolvable SHA (v2.0.4)

`ReScript/Deno CI` was failing at "Set up job", before any code ran:

    Unable to resolve action `denoland/setup-deno@5fae568d...`,
    unable to find version `5fae568d37bbd5d82f7bc6ead283828a72525312`

The pinned SHA (commented `# v2.0.0`) is no longer resolvable (yanked /
non-existent ref). Repin both occurrences to the current release:
`denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282`
(= tag v2.0.4), keeping the org's full-length-SHA pin policy.

Pre-existing infra rot, unrelated to the source migration (#31/#33);
this was just the only source-side-fixable red. Other red main checks
(GitHub Pages, Finishingbot, Seambot, Mirror, Rhodibot, CodeQL) are
org-level infra (missing bot/PAT/Radicle secrets; CodeQL `actions`
lane needs GHAS; an action in the Pages reusable chain not SHA-pinned)
— not fixable by a source PR here.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

src/storage.ts + src/wasm-bridge.ts: TS→AffineScript blocked on toolchain

1 participant