natives: audit table of every native with a kernel verdict (step 1 of #52) #407

Closed
opened 2026-10-23 01:50:32 +00:00 by orion · 2 comments
Collaborator

Context

Step 1 of #52 (natives: audit and reduce the manifest to a kernel; ROADMAP "The kernel of natives"). Before any native is rewritten, every native has to be classified, so the later steps (#53 native fn bodies as IR, #55 collections on Buffer, and the rewrites themselves) work from one agreed list. This step is documentation only.

Goal

A design record docs/design/NATIVES.md that lists every native declaration of std/ with a verdict, and names the kernel.

Acceptance criteria

  • docs/design/NATIVES.md exists, with pdisc frontmatter and an entry in docs/design/index.md.
  • A table with one row per entry of compiler/src/backend/c/natives.trb (NativeEntry, grouped by owner type or std/ module): name, NativeTarget kind, verdict kernel / rewrite / keep (the OS, clock, file or network edge that cannot be written in TorbScript), and for rewrite the TorbScript shape it takes and which kernel natives it needs.
  • The kernel is stated as a short closed list (integer and float arithmetic, comparisons, raw storage, bytes to numbers, plus whatever the table proves necessary) and every kernel row belongs to it.
  • The count of rows per verdict is written in the record, and a test or script check (tools/ or a torb test file) fails when a native declaration of std/ or a manifest entry has no row, so the table cannot drift.
  • Each rewrite row names the measurement that decides it (the existing tools/buffer-cost.sh pattern or a new benchmark in forge CI); the measuring and the rewrites are later steps, not part of this one.
  • ROADMAP "The kernel of natives" links the record; docs/ regenerates skills/ as CLAUDE.md requires; gates green in both tiers.

Design record point

ROADMAP "The kernel of natives"; BACKEND 3.7 (the manifest); COLLECTIONS gap 6 (Buffer).

Seed impact

None. No native, syntax, driver flag or looked-up std name changes; the manifest check only reads. The two-commit rule applies to the later rewrite steps, not here.

Size

One PR, one Conventional Commit (docs(natives): ..., plus test or chore for the drift check if separate).

Dependencies

None. Blocks the rewrite steps of #52; related to #53 and #55.

## Context Step 1 of #52 (natives: audit and reduce the manifest to a kernel; ROADMAP "The kernel of natives"). Before any native is rewritten, every native has to be classified, so the later steps (#53 `native fn` bodies as IR, #55 collections on `Buffer`, and the rewrites themselves) work from one agreed list. This step is documentation only. ## Goal A design record `docs/design/NATIVES.md` that lists every `native` declaration of `std/` with a verdict, and names the kernel. ## Acceptance criteria - [ ] `docs/design/NATIVES.md` exists, with pdisc frontmatter and an entry in `docs/design/index.md`. - [ ] A table with one row per entry of `compiler/src/backend/c/natives.trb` (`NativeEntry`, grouped by owner type or `std/` module): name, `NativeTarget` kind, verdict `kernel` / `rewrite` / `keep` (the OS, clock, file or network edge that cannot be written in TorbScript), and for `rewrite` the TorbScript shape it takes and which kernel natives it needs. - [ ] The kernel is stated as a short closed list (integer and float arithmetic, comparisons, raw storage, bytes to numbers, plus whatever the table proves necessary) and every `kernel` row belongs to it. - [ ] The count of rows per verdict is written in the record, and a test or script check (`tools/` or a `torb test` file) fails when a `native` declaration of `std/` or a manifest entry has no row, so the table cannot drift. - [ ] Each `rewrite` row names the measurement that decides it (the existing `tools/buffer-cost.sh` pattern or a new benchmark in forge CI); the measuring and the rewrites are later steps, not part of this one. - [ ] ROADMAP "The kernel of natives" links the record; `docs/` regenerates `skills/` as `CLAUDE.md` requires; gates green in both tiers. ## Design record point ROADMAP "The kernel of natives"; BACKEND 3.7 (the manifest); COLLECTIONS gap 6 (`Buffer`). ## Seed impact None. No native, syntax, driver flag or looked-up std name changes; the manifest check only reads. The two-commit rule applies to the later rewrite steps, not here. ## Size One PR, one Conventional Commit (`docs(natives): ...`, plus `test` or `chore` for the drift check if separate). ## Dependencies None. Blocks the rewrite steps of #52; related to #53 and #55.
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-20261023 until 2026-10-23T08:09:18Z

[loop:torbscript] claim implement by session:loop-torbscript-20261023 until 2026-10-23T08:09:18Z
Author
Collaborator

[loop:torbscript] implement: PR #409 open, CI green. NATIVES.md holds one row for each of the 527 manifest entries (kernel 155, rewrite 200, keep 172), the kernel is a closed list of eight groups, and each rewrite row names its shape, the kernel groups it needs and its measurement. compiler/tests/natives-audit.test.trb fails on a missing or extra row, a verdict outside the record's lists, drifting counts, or a native fn in std/ without a manifest entry. Deviation: no pdisc frontmatter, since pdisc excludes docs/* and design records have none. Tokens: not exposed to this subagent, no figure available. next: review

[loop:torbscript] implement: PR https://git.torb.dev/torbscript/language/pulls/409 open, CI green. NATIVES.md holds one row for each of the 527 manifest entries (kernel 155, rewrite 200, keep 172), the kernel is a closed list of eight groups, and each rewrite row names its shape, the kernel groups it needs and its measurement. `compiler/tests/natives-audit.test.trb` fails on a missing or extra row, a verdict outside the record's lists, drifting counts, or a `native fn` in std/ without a manifest entry. Deviation: no pdisc frontmatter, since pdisc excludes docs/* and design records have none. Tokens: not exposed to this subagent, no figure available. next: review
argus closed this issue 2026-10-23 04:22:29 +00:00
Sign in to join this conversation.
No labels
loop
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language#407
No description provided.