Skip to content

docs(tech-debt): split STDLIB-04 into 04a–04e per per-extern audit (Refs #175) - #333

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/stdlib-04-audit-split
May 24, 2026
Merged

docs(tech-debt): split STDLIB-04 into 04a–04e per per-extern audit (Refs #175)#333
hyperpolymath merged 1 commit into
mainfrom
claude/stdlib-04-audit-split

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Replaces the single-row STDLIB-04 umbrella in docs/TECH-DEBT.adoc:162 with five concrete rows (04a..04e), one per PR, each tracking its own sub-issue. The Status column carries the audit finding (stub / missing / wired-but-untested / done) so the ledger reflects reality without needing a sibling audit doc.

Row map

Row Scope Audit finding Issue
04a Mut: make_ref/get/set stub — syntax only, no real refcell #328
04b Throws: error<T> missing in all backends #329
04c string_concat no direct wiring; ++ is operator-only #330
04d IO: print/println/read_line/read_file/write_file wired but no dedicated tests #331
04e Pure: int_to_string/string_to_int/string_length real + tested; close-as-done #332

Test plan

  • AsciiDoc table compiles (preserves the cols="1,3,1,2" shape)
  • No code change — docs only, AOT gate unaffected
  • Hypatia DOC-FORMAT: no .md introduced

Refs #175.


Generated by Claude Code

…efs #175)

Replaces the single-row STDLIB-04 umbrella with 04a..04e — one row per
PR, each tracking its own issue (#328 Mut, #329 error, #330 string_concat,
#331 IO tests, #332 Pure close-as-done). Status column carries the audit
finding (stub / missing / wired-but-untested / done) so the ledger
reflects reality without a sibling audit doc.

Refs #175.
@hyperpolymath
hyperpolymath merged commit c7c67e6 into main May 24, 2026
12 of 15 checks passed
@hyperpolymath
hyperpolymath deleted the claude/stdlib-04-audit-split branch May 24, 2026 04:25
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 140 issues detected

Severity Count
🔴 Critical 13
🟠 High 69
🟡 Medium 58

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Stray AI.a2ml in root -- use 0-AI-MANIFEST.a2ml only",
    "type": "banned",
    "file": "AI.a2ml",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Superseded by 0-AI-MANIFEST.a2ml",
    "type": "banned",
    "file": "AI.djot",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Action actions/checkout@v6 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action denoland/setup-deno@v2 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/example/smoke_driver.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/cli.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

hyperpolymath added a commit that referenced this pull request May 24, 2026
…al impl (Closes #328) (#334)

## Summary

Lands real implementations of the three `Mut` effect externs declared in
`stdlib/effects.affine`:

```
extern fn make_ref<T>(x: T) -> Ref<T> / Mut;
extern fn get<T>(r: Ref<T>) -> T / Mut;
extern fn set<T>(r: Ref<T>, x: T) -> Unit / Mut;
```

Before this PR they were stubs — the surface parsed and typechecked, but
no backend wired the runtime semantics, so any caller would compile and
then fail at runtime with `make_ref is not defined`.

## Changes

- **`lib/interp.ml`** — three new `VBuiltin` entries: `make_ref`
allocates a `VMut` cell (the existing runtime mutable-cell variant in
`Value`); `get`/`set` route through the standard deref / assign
primitives. Reuses the same store the borrow-surface `&mut` already
uses.
- **`lib/codegen_deno.ml`** — three new entries in `deno_builtins`:
`make_ref` → `{__cell: x}`, `get` → `((r).__cell)`, `set` →
`(((r).__cell = x), null)`. Single-field object so `get`/`set` are O(1);
`set` returns `null` (Unit) via comma-expression to match the signature.
- **`test/test_e2e.ml`** — three hermetic tests under `E2E STDLIB-04a
Mut #328`:
  1. Int round-trip: `make_ref(7); set(r, 42); get(r) == 42`
2. String round-trip (value-polymorphic): `make_ref("alpha"); set(r,
"omega"); get(r) == "omega"`
3. Deno codegen emits `__cell` shape (proves the new table entries
actually fire).
- **`docs/TECH-DEBT.adoc`** — row 04a marked DONE per the audit-split
contract from #333.

## Conceptual note

These are **runtime mutable cells** (`Ref<T>` parameterised type),
distinct from the borrow-checker's `&`/`&mut` references — different
concept that happens to share the word "ref". The `Mut` effect on the
signatures is what marks the call sites as observably stateful.

## Test plan

- [x] Three new hermetic tests added to the gate (`E2E STDLIB-04a Mut
#328`)
- [x] No change to stdlib AOT gate count (no new stdlib file)
- [ ] CI: `dune runtest` green (gate moves from 281 → 284)
- [ ] Hypatia DOC-FORMAT: no `.md` introduced

Closes #328. Refs #175.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01NUHL3MH3yKKQAEhSZn4Thu)_

Co-authored-by: Claude <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request May 24, 2026
## Summary

- `migration-assistant` has been failing on `main` and every PR (incl.
docs-only #333, #336) at the "Smoke-parse a sample .res file" step with
`Failed to read paths file tools/vendor/tree-sitter-rescript / Caused
by: Is a directory (os error 21)`.
- Root cause: tree-sitter-cli >= 0.25 repurposed `--paths` to mean "a
file listing input source paths", not "a directory containing the
grammar". The `^0.25.0` range in
`editors/tree-sitter-rescript/package.json` resolves to 0.25.10, where
the flag's strict file requirement breaks the invocation introduced in
#321.
- Fix: cd into the vendored grammar tree (the documented 0.25.x
grammar-lookup mechanism) and pass an absolute path to the fixture.
Drops the misused `--paths` flag entirely.

The pinned grammar commit `990214a` is unchanged, the install script is
unchanged, and the failure is not diff-induced.

## Test plan

- [x] Reproduced the failure locally with tree-sitter-cli 0.25.10 + the
pinned grammar commit.
- [x] Verified the new invocation exits 0 on the existing
`tools/res-to-affine/test/fixtures/sample.res` fixture.
- [ ] CI run on this PR turns the `migration-assistant` job green.

Strict scope per request: only `.github/workflows/ci.yml`
migration-assistant block touched. No changes to
`editors/tree-sitter-rescript/` or `tools/res-to-affine/vendor/` were
required.

https://claude.ai/code/session_01HZ3i2wX5R5rbY8Ycmug4Ao

---
_Generated by [Claude
Code](https://claude.ai/code/session_01HZ3i2wX5R5rbY8Ycmug4Ao)_

Co-authored-by: Claude <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request May 24, 2026
…#330) (#337)

## Summary

The `extern fn string_concat(s1: String, s2: String) -> String;`
declared in `stdlib/effects.affine:35` was dead surface:

- Never wired in any backend (no entry in `lib/interp.ml` builtins or
`lib/codegen_deno.ml` `deno_builtins` table).
- Never called from any stdlib, test, or fixture file (verified by `grep
-rn string_concat`).

The canonical surface for string concatenation is the `++` operator,
lowered in `Value.binop_string` (interp) and `__as_concat` (Deno
codegen) — one source of truth.

Removing the dead extern eliminates the runtime trap where a caller
could `use effects::{string_concat}`, get a clean compile, and then fail
at run with `string_concat is not defined`.

## Test plan

- [x] `grep -rn string_concat stdlib/ lib/ test/` shows no callers
- [ ] CI: `dune runtest` — stdlib AOT gate must stay green (no fewer
tests; this is pure removal)
- [ ] Hypatia DOC-FORMAT: no `.md` introduced

Updates `docs/TECH-DEBT.adoc` row 04c → DONE per the audit-split
contract from #333.

Closes #330. Refs #175.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01NUHL3MH3yKKQAEhSZn4Thu)_

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

Labels

None yet

2 participants