docs: assess language review and propose diagnostic extensions
This commit is contained in:
1 parent
a9a0d63f27
commit
d901d5227b
7 files changed
+829
-3
No files matched your search
@@ -58,6 +58,8 @@ RFC 0011 crossed the 10 % warning line (its own estimate said "below 10 %"): fou
|
||||
|
||||
The `.aji` condition does not get the AIR bundle as its documentation. It gets a directory mounted at `/docs` with a small front door, and the agent reads the rest only when it needs it. That tests a second hypothesis: a model can work from a small reference and selective reading.
|
||||
|
||||
**Historical layout and approximate counts (Phase 4, before std).** The following table is not the current bundle inventory or size. Later per-RFC measurements below record subsequent growth; use `tools/agent_bundle_tokens.py --source` on the generated bundle for current per-file and group counts.
|
||||
|
||||
| Path | Contents | cl100k tokens |
|
||||
|---|---|---:|
|
||||
| `QUICK.md` | the Quick Reference, then a table of which file to open for what | ~5.0k (Phase 4: +0.6k for §7 graphs) |
|
||||
@@ -72,7 +74,7 @@ The `.aji` condition does not get the AIR bundle as its documentation. It gets a
|
||||
| `diagnostics/errors.md` | spec 15 §10, stable codes, repair loop, error-code registry | ~1.9k |
|
||||
| `air/reference.md` | the whole AIR bundle, for reading `aji lower` output only | ~35.7k |
|
||||
|
||||
Without `air/` it comes to about 26.8k tokens. The manifest is [`source-bundle.txt`](source-bundle.txt): the `bundle.txt` syntax, plus `> path` to start an output file and `@manifest` to include another bundle. Text that exists only for this bundle (navigation, implementation status) is in [`source-notes.md`](source-notes.md).
|
||||
At that historical point, without `air/` it came to about 26.8k tokens. The current manifest is [`source-bundle.txt`](source-bundle.txt): the `bundle.txt` syntax, plus `> path` to start an output file and `@manifest` to include another bundle. Text that exists only for this bundle (navigation, implementation status) is in [`source-notes.md`](source-notes.md).
|
||||
|
||||
```sh
|
||||
zig build agent-reference # also writes zig-out/agent/source/ and source-report.json
|
||||
@@ -83,7 +85,7 @@ The groups `quick_reference`, `source_docs` and `air_docs` come from the `doc_gr
|
||||
|
||||
## Quick Reference (`.aji`)
|
||||
|
||||
[`quick-reference.md`](quick-reference.md) is the front door of the Source Reference Bundle (`QUICK.md`). It targets 4–6k tokens (about 4.4k with the navigation table, cl100k), covers most programs, and is kept consistent with spec 15.
|
||||
[`quick-reference.md`](quick-reference.md) is the front door of the Source Reference Bundle (`QUICK.md`). The [plan](../plan/README.md) targets 5–8k tokens; the earlier 4–6k target and approximately 4.4k measurement are historical. It covers most programs and is kept consistent with spec 15. Current measurements are recorded below; the target is not a hard CI cap.
|
||||
|
||||
**Its examples are checked.** Every ```aji block must be an excerpt of a program in `tests/conformance/source/quickref/`. Comments and whitespace are ignored, and `…` matches any text. Those programs are conformance tests, so each example is part of a program that verifies and runs. `zig build test` and `zig build agent-reference` fail on an example that is not. The concurrency programs (§7) are PENDING until layers 7–8 exist.
|
||||
|
||||
@@ -135,4 +137,6 @@ RFC 0035 caller-buffer paths (cl100k, relative to buffered files): Quick Referen
|
||||
|
||||
RFC 0036 (Proposed), explicit source borrow returns (cl100k, relative to paths): Quick Reference 8,518 → 8,642 (+1.46%), other source docs 63,296 → 64,160 (+1.37%), full source excluding AIR 71,814 → 72,802 (+1.38%). language/ownership.md is 1,834 tokens; AIR remains 179,282 bytes / 51 sections. Existing `from`, ref/mut bindings and named returns reuse verifier/runtime primitives; frontend ancestry selects transferred lexical ends. No new keyword, AIR feature, verifier state or diagnostic. Cumulative full-source growth is +114.24%, justified in the proposed RFC without an empirical MCC claim. This measurement records the implementation for review, not owner adoption.
|
||||
|
||||
2026-10-07 review documentation follow-up: the historical layout is now labeled, Q-016 states the implemented reserved status, and Quick Reference explicitly excludes floating point. The last sentence adds 46 cl100k tokens: Quick Reference 8,642 → 8,688 (+0.53%), other source docs stay 64,160, full source 72,802 → 72,848 (+0.06%). o200k groups are 8,723 / 64,359 / 73,082; Qwen2.5 8,954 / 65,733 / 74,687. AIR stays 46,300 cl100k tokens / 179,282 bytes; library/std.md stays 26,454 cl100k tokens. The clarification reduces status ambiguity without adding language semantics. RFCs 0037/0038 are Proposed and outside the bundles; their normative integration growth is not measured yet.
|
||||
|
||||
RFC 0036 review fixes clarify reserved task borrow returns and known array bounds in unused generic signatures. These rules add 54 cl100k tokens: other source docs 64,160 → 64,214, full source 72,848 → 72,902 (+0.07%); Quick Reference stays 8,688. o200k groups are 8,723 / 64,413 / 73,136; Qwen2.5 8,954 / 65,794 / 74,748. language/ownership.md is 1,873 cl100k tokens; AIR and library/std.md stay unchanged. The additions make source rejection predictable without adding a semantic feature.
|
||||
@@ -41,6 +41,8 @@ effects [io.read, io.write]
|
||||
| `task<T>`, `sender<T>`, `receiver<T>`, `mutex<T>` | concurrency (§8) |
|
||||
| `io_error`, `alloc_error`, `cap_error` | built-in error enums |
|
||||
|
||||
`f32`/`f64` are reserved in AIR (`E0006`, `reserved_type`) and unavailable in `.aji` 0.1 (`E7002`); floating-point semantics remain Q-016.
|
||||
|
||||
**Linear** values (resources, `own`, `region`, `task`, endpoints, `mutex`) are consumed exactly once. Everything else that is a plain value is copyable.
|
||||
|
||||
## 3. Statements and expressions
|
||||
|
||||
@@ -136,7 +136,7 @@ The SB litmus test requires the interpreter not to forbid `r1=0, r2=0` under rel
|
||||
|
||||
## Q-016 — Floating-point determinism
|
||||
|
||||
`f32`/`f64` exist (spec 02 §1) with no rules on NaN payloads, fused operations, rounding mode or denormals. Deterministic replay requires these to be fixed.
|
||||
`f32`/`f64` are listed in spec 02 §1 but reserved by spec 07 §8.4: AIR rejects their use with `E0006`, reason `reserved_type`, and `.aji` 0.1 exposes no floating-point types. They do not create a determinism gap in currently accepted programs. This question remains open for future activation: NaN payloads, fused operations, rounding mode and denormals need explicit rules before floating point can participate in deterministic replay.
|
||||
|
||||
## Q-017 — Replay file format
|
||||
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
# Assessment of the 2026-10-07 design review
|
||||
|
||||
Non-normative. Verification of [the original review](review-2026-10-07.md), which is left unchanged. This assessment neither accepts an RFC nor changes priorities, language rules or the benchmark. Routes below are recommendations for a subsequent proposal or owner decision, not newly scheduled implementation work.
|
||||
|
||||
## Scope and method
|
||||
|
||||
Checked against the current working tree on 2026-10-07: HEAD `715a8be` plus the uncommitted Q-034/P6-11 implementation (RFC 0036, **Proposed**). This matters for C9: borrow returns are now implemented for review; their RFC is not accepted. Earlier measurements refer to their recorded toolchain, not this working tree.
|
||||
|
||||
Read the relevant normative sections, diagnostic implementation, frontend mapping, std module registry and implementations, evaluation reporting code, public evaluation reports and B1 pre-registration. Ran existing negative fixtures for E2101, E2104 and reserved floating-point types. Measured bundles using the repository tooling during P6-11 validation. No private task statements, solutions, transcripts or held-out corpus were inspected. Private execution progress cannot be established from the public plan.
|
||||
|
||||
The five review questions are abbreviated below as **truth**, **existing coverage**, **consistency**, **mission**, and **payoff**. `confirmed`, `partly` and `wrong` describe observations, not approval of a proposal. Proposed benefits remain hypotheses unless a cited experiment measures them.
|
||||
|
||||
## Measurements and reading cost
|
||||
|
||||
Reproduction:
|
||||
|
||||
```sh
|
||||
zig build agent-reference
|
||||
uv run --with tiktoken --with tokenizers tools/agent_bundle_tokens.py --source
|
||||
```
|
||||
|
||||
| Current generated material | cl100k_base | o200k_base | Qwen2.5 |
|
||||
|---|---:|---:|---:|
|
||||
| Quick Reference including navigation (`QUICK.md`) | 8,642 | 8,677 | 8,900 |
|
||||
| Other source documentation | 64,160 | 64,359 | 65,733 |
|
||||
| Full source documentation, excluding AIR | 72,802 | 73,036 | 74,633 |
|
||||
| `library/std.md` (included above) | 26,454 | 26,556 | 26,950 |
|
||||
| AIR reference (excluded from full source above) | 46,300 | 46,451 | 47,800 |
|
||||
|
||||
These are **available documentation**, not tokens every run consumes. P6-11 changed cl100k Quick Reference 8,518 → 8,642 (+1.46%) and full source 71,814 → 72,802 (+1.38%). The pre-stdlib full-source baseline recorded in the RFC sequence was 33,981; current cumulative growth is +114.24%. AIR did not grow in P6-11.
|
||||
|
||||
[P6A-9](../evaluation/results/2026-10-05-p6a-9.md) provides evidence for selective reading on its older bundle: source cells read the Quick Reference plus roughly 0.4–8.6k other tokens, with one partially measured Quick Reference read. It also reports IR-form diagnostics 9 → 0, accepted cells 4/6 → 5/6, and mixed cost results. It does **not** measure today's 72.8k bundle or std. Its frozen commit `591f0ae` contains neither the current `std/` source modules nor `src/frontend/stdlib.zig` (checked with `git ls-tree`). No private M/C programs need to be opened to establish that these modules were unavailable in those official runs. Subsequent uses, if any, are not established here.
|
||||
|
||||
Documentation follow-up: the opening Source Reference Bundle table in [agent/README.md](../agent/README.md) described approximately 26.8k total and omitted later files. Following owner discussion it is now explicitly labeled historical. Q-016 and Quick Reference also clarify the already implemented floating-point reservation. The measurement table above remains the assessment-time snapshot before that Quick Reference sentence was added.
|
||||
|
||||
### Follow-up: B1 excludes the current std
|
||||
|
||||
The public tag `b1-frozen` resolves to commit `268926ca0f46eb180de1b506be2c28e815bd60ae` (2026-10-06). Checked its tree, `docs/agent/source-bundle.txt` and `tools/eval/languages/aji_source.json`:
|
||||
|
||||
- No current `std/` modules or `src/frontend/stdlib.zig` exist in that tree.
|
||||
- The source bundle manifest contains no `library/std.md`; the source-doc group contains only `language/` and `diagnostics/`.
|
||||
- The declared compiler therefore cannot execute programs using the current bundled std APIs. B1 as publicly specified cannot measure their use or benefit, and its default documentation input cannot measure reading their reference.
|
||||
|
||||
The actual private freeze record and mounted artifacts were not inspected; the freeze mechanism records their hashes and supports documentation overrides, so the public tag alone cannot certify their exact bytes. This limitation does not make current std available in the declared frozen compiler. A later experiment must explicitly freeze a compiler containing std and its documentation, account for `library/` reads, and distinguish imported modules from called APIs and executed calls. Existing audit call data may supply some static usage facts; the required usage metric should be specified before that experiment's freeze, not retrofitted during B1.
|
||||
|
||||
This strengthens B1/B2: source documentation more than doubled, the front door exceeded its target, and neither P6A-9 nor the declared B1 treatment evaluates current std. It justifies measuring current std in a subsequent experiment; it does not establish a freeze policy or a benefit. The std reference's 26,454 tokens are smaller than the pre-stdlib full-source baseline of 33,981, despite accounting for a substantial part of the current total.
|
||||
|
||||
## Part A — Properties to retain
|
||||
|
||||
| ID | Truth and existing coverage | Consistency and mission | Payoff / limits |
|
||||
|---|---|---|---|
|
||||
| A1 | **confirmed**: spec 14 §4/§12, the evaluation protocol and public negative reports require falsifiability and held-out evidence. | Retain; supports auditability and guards against benchmark-specific features. | Essential discipline; public negative findings do not establish that MCC is impossible. |
|
||||
| A2 | **confirmed**: JSON Lines, stable registry, effect suggestions and fuel are implemented. | Retain; explicitness, determinism and repairability. | Existing mechanism; its comparative economic benefit still needs measurement. |
|
||||
| A3 | **confirmed**: spec 15 §1 retains semantic actions at the source boundary. P6-11 makes borrow origin explicit with `from`. | Retain; explicitness and a small trusted computing base. | Source removes observed IR costs without replacing verifier checks. |
|
||||
| A4 | **confirmed** for enum matches: spec 15 §6 rejects missing variants and `_`; missing alternatives emit E7004. Integer matches have different rules. | Retain; verifier strength and local repairability. | An enum addition exposes incomplete consumers; no inference or extra feature is needed. |
|
||||
| A5 | **partly**: the native smoke documents IR overhead and zero strong-agent ownership/borrow/resource/concurrency diagnostics; P6A-9 validates the frontend response. | Retain the evidence-driven decision, not the inference that safety semantics have no cost. | Strong-agent success was at a ceiling. Zero diagnostics does not measure prevented defects or prove remaining failures are all logical. |
|
||||
| A6 | **confirmed**: spec 15 §1/§10, frontend/check pipeline and E7900 distinguish malformed lowering. | Retain; implementation simplicity, auditability and safety. | The verifier remains the acceptance boundary. Being outside the TCB does not make frontend bugs harmless to availability or diagnostic quality. |
|
||||
|
||||
## Part B — Verified concerns
|
||||
|
||||
### B1 — Growth versus evidence: partly
|
||||
|
||||
**Truth.** AIR 27,347 → 42,275 is +54.6%, as claimed. “Every phase adds about 10%” is too uniform: recorded increments range from 0.6% to 15.8%. The current cl100k AIR count is 46,300, about +9.5% since Phase 5; bytes grew 160,428 → 179,282 (+11.8%). The cited +11.8% must be distinguished from token growth. Native smoke's fixed documentation tax is confirmed. General MCC and comparative economic benefit remain unproved, but “no result shows a compression signal” omits the explicitly preliminary, repeated AIR/source signal on M in P6A-9.
|
||||
|
||||
**Existing coverage.** Spec 14 §3.7, bundle tooling, per-RFC complexity accounting, source selective reading and the accepted [B1 plan](../evaluation/b1-heldout-plan.md) already address this risk. B1 measures stack-level capability compression; D1 explicitly excludes a claim about H4. A public pre-registration is not evidence that its private runs have finished.
|
||||
|
||||
**Consistency.** Measuring total and actually read documentation is aligned with AGENTS.md. Spec 14 §3.2 concerns adding semantic features when existing primitives suffice; it does not prohibit reusable libraries composed from those primitives. Section 8's restriction on near-duplicate APIs is relevant but requires establishing the duplication.
|
||||
|
||||
**Mission.** Controlling growth can improve implementation simplicity and machine repairability; removing useful contracts merely to reduce tokens can hurt both.
|
||||
|
||||
**Payoff.** The concern survives. Measurement and accurate bundle navigation are inexpensive. Neither the success nor failure of the current selective-reading strategy follows from the available size alone; future analysis needs actual reads, retries and cost per accepted solution, failures included.
|
||||
|
||||
### B2 — Std scope before measurement: partly
|
||||
|
||||
**Truth.** The size comparison is correct: current spec 16 has 9,184 words against spec 15's 9,553. The compiler registry has **19 source modules**. Quick Reference §§10–14 mention **18**: bytes, math, utf8, encoding.hex, encoding.base64, fmt, hash, hashmap, hashset, heap, io, io.reader, io.writer, path, option, result, vec and deque. The numeric `std.map` module is available in the full std reference but is not named in Quick Reference. These modules were unavailable at the official P6A-9 freeze; present-day M/C uses are not verified.
|
||||
|
||||
**Existing coverage.** The separate std plan, owner-requested foundation merge, complexity sections and on-demand `library/std.md` make the expansion visible. Most APIs are safe `.aji` composition; prerequisite features such as linear aggregates, buffers and static function parameters are separate semantic changes.
|
||||
|
||||
**Consistency.** Std is not automatically contrary to the mission. Its opportunity cost and near-duplicate operations merit review under spec 14 §8. The already recorded owner request is not superseded by this review.
|
||||
|
||||
**Mission.** Reuse may reduce generated code and improve safety and repairability; more contracts increase reading and choice costs.
|
||||
|
||||
**Payoff.** Unknown for the present API set. Audit overlapping contracts and aggregate public usage/reading data before consolidation; do not infer useful scope from word counts or inspect private tasks to choose APIs.
|
||||
|
||||
### B3 — Mechanical repairs: partly
|
||||
|
||||
**Truth.** Text edits are absent from [Diagnostic](../../src/diag.zig); current repair candidates serialize kind names. [Effect suggestions](../../src/verifier/effects.zig) produce the sorted union of declared effects and missing effects found for that function, based on current callee declarations. Repairing a callee can expose a new missing effect in its caller on the next check. These are not a global one-pass effect repair.
|
||||
|
||||
**Existing coverage.** Spec 10 §3 describes non-binding structured suggestions and prohibits automatic semantic modification. It does not forbid richer optional edit data. E7004 already names missing alternatives, but does not select their bodies.
|
||||
|
||||
**Consistency.** Explicit agent-applied edits are compatible. A diagnostic code does not establish a unique intended repair: an owner may need to remain usable later; effects can be avoided by changing an operation; missing arms may need error handling rather than trapping. Code-specific eligibility needs precise conditions.
|
||||
|
||||
**Mission.** Accurate edit candidates can improve machine repairability and deterministic feedback.
|
||||
|
||||
**Payoff.** Plausible for a restricted subset, not established as cheap for every listed code. Source ranges, module files, generic specializations, repeated diagnostics and conflicting edits are real implementation work. C1 needs a narrower proposal.
|
||||
|
||||
### B4 — Lexical borrow scopes and conflict locations: partly
|
||||
|
||||
**Truth.** Lexical scopes and the structural repair cost are confirmed. E2101/E2104 expose `borrow` and `conflicts_with` SSA identities, a primary source position and `air_line`/`air_col`; they do **not** expose the earlier conflicting source span. E4302 reports the outstanding task identity. See [borrow verification](../../src/verifier/borrow.zig), [source mapping](../../src/frontend.zig) and the reproduction below.
|
||||
|
||||
**Existing coverage.** Borrow lifetime is already specified in spec 03/08/15 and illustrated in the Quick Reference. Rich conflict locations remain an implementation/API gap. Spec 14 §3.5 already recommends relevant previous state.
|
||||
|
||||
**Consistency.** Better facts fit AGENTS.md. Spec 14 §3.4 favors bounded local reasoning and requires justification for large inference; it does not categorically ban all non-lexical lifetime analysis. Keeping lexical scopes is a defensible design choice without that stronger claim.
|
||||
|
||||
**Mission.** Related locations improve repairability and auditability.
|
||||
|
||||
**Payoff.** Earlier definition and task-spawn locations are a bounded, promising first step. Computing a block that can safely enclose a borrow is a separate analysis, particularly across calls, reborrows and task loans; it is not just source-position reporting.
|
||||
|
||||
### B5 — Determinism gaps: partly
|
||||
|
||||
**Truth.** Q-016 and Q-017 are open future work. Usable floating-point operations creating a current determinism gap are **wrong**: spec 07 §8.4 reserves f32/f64; the AIR parser rejects them with E0006/`reserved_type`. The source frontend exposes no floating-point type (unknown source types reject with E7002).
|
||||
|
||||
**Existing coverage.** Spec 11 §4 explicitly says deterministic replay already works from the run record, seeds and quantum, including weak-memory choices. Q-017 is the deferred hosted/native replay file format. Q-016's review-time wording “exist” was misleading without the reserved-status qualification; the documentation follow-up above corrects it.
|
||||
|
||||
**Consistency.** Retaining reserved types and clarifying docs is consistent; no new semantics are needed. Keeping Q-016 open records the rules required before future activation.
|
||||
|
||||
**Mission.** Documentation clarity improves explicitness; current deterministic execution is not waiting for these decisions.
|
||||
|
||||
**Payoff.** A brief source reference/status clarification is cheap. Closing Q-016 solely because types remain reserved would erase the unresolved future specification work.
|
||||
|
||||
### B6 — Source contracts and logic: partly
|
||||
|
||||
**Truth.** P6-6 is pending. Spec 13 §1 sketches requires/ensures/invariants and four statuses, but **neither source nor AIR currently implements function pre/postcondition declarations and their status reports**. Existing assert, guard, unsafe assume and bounds facts already cover limited logic; the verifier also checks effects, capability use and structural obligations. “Memory, not logic” is too absolute.
|
||||
|
||||
**Existing coverage.** Spec 13 records the direction, and spec 10 §6.1 reports implemented runtime/proven checks while reserving contract statuses for a later extension. That report is not an implemented general contract engine.
|
||||
|
||||
**Consistency.** A contract feature needs a vertical RFC, explicit effects/failure, AIR feature/version review and the memory/concurrency checklist wherever applicable. Its selection cannot be justified by assuming unobserved smoke failures were logical.
|
||||
|
||||
**Mission.** Potentially improves verifier strength and explicitness, while adding verifier state, syntax and trusted logic.
|
||||
|
||||
**Payoff.** Unproved and expensive. A small independently motivated fragment is worth investigating; there is no evidence here that it should be the next major feature.
|
||||
|
||||
### B7 — Behavioral abstraction and std variants: partly
|
||||
|
||||
**Truth.** No runtime function values, closures or traits are exposed. Static function parameters are already enough for the cited hash/equality/comparator cases: [HashMap](../../std/hashmap.aji) takes pure ref-key hash/equal functions; [BinaryHeap](../../std/heap.aji) takes a pure comparator. [HashSet](../../std/hashset.aji) already composes HashMap. These are source generics, not separate built-in collection operations.
|
||||
|
||||
**Existing coverage.** Spec 15 §18 and RFC 0029 define exact signatures, declared effects and specialization. Runtime-selected or captured behavior is outside that mechanism.
|
||||
|
||||
**Consistency.** Check existing generic composition first, as AGENTS.md requires. No new trait or closure feature follows from these examples.
|
||||
|
||||
**Mission.** Existing static policies preserve explicitness and implementation simplicity. Consolidation could reduce learning cost if observable contracts really coincide.
|
||||
|
||||
**Payoff.** The hypothesis that absent behavioral abstraction explains std growth is not established. Numeric maps and general owning-key maps have different representations and policy/ownership costs; measure concrete duplication before proposing removal or merger.
|
||||
|
||||
### B8 — Dense normative prose: confirmed
|
||||
|
||||
**Truth / existing coverage.** Spec 15 §13/§17 contains dense paragraphs; the Quick Reference and selective bundle compensate but still direct uncertain readers to normative rules.
|
||||
|
||||
**Consistency / mission.** Splitting rules into short subsections or tables without changing their meaning is compatible and improves explicitness, auditability and repairability.
|
||||
|
||||
**Payoff.** A focused editorial task is inexpensive. Preserve normative terms and tested examples; remeasure bundles. A semantic RFC is unnecessary for presentation alone.
|
||||
|
||||
### B9 — Application test support: partly
|
||||
|
||||
**Truth.** There is no implemented `test fn` or `aji test`, and spec 12 defines no package test entry. Planned tooling mentions tests but does not implement application discovery.
|
||||
|
||||
**Existing coverage.** Applications can already put assertions in ordinary entry programs and run them with fuel, grants and schedule seeds; `aji explore` can enumerate scheduler/weak-memory outcomes. Conformance infrastructure supplies repeated seeded schedules. Thus deterministic application testing is possible, but has no dedicated discovery/reporting interface.
|
||||
|
||||
**Consistency / mission.** A test runner can improve determinism and repairability. Start by assessing CLI/manifest discovery using ordinary functions or entries before introducing a source keyword.
|
||||
|
||||
**Payoff.** Plausible tooling value; evidence does not show that language syntax is necessary. Grant binding, entry instantiation, fuel exhaustion and test isolation/order still need contracts.
|
||||
|
||||
## Part C — Proposal dispositions and routes
|
||||
|
||||
| ID | Disposition | Suggested destination; no adoption here |
|
||||
|---|---|---|
|
||||
| C1 | Defer pending incidence, repair-cost and workflow evidence | RFC 0038 retained as Proposed; no implementation recommendation |
|
||||
| C2 | Existing functionality; optional reporting refinement | Evaluation task only if a concrete missing metric is identified |
|
||||
| C3 | Owner policy option; payoff unknown | Owner decision/DD after considering existing std direction |
|
||||
| C4 | Owner policy option; numeric threshold unjustified | Owner decision/DD plus tooling task if adopted |
|
||||
| C5 | Retain, split factual locations from repair analysis | RFC for related locations first |
|
||||
| C6 | Research candidate; sequencing/payoff unproved | P6-6 RFC exploration, not immediate implementation |
|
||||
| C7 | Research candidate; compare tooling-only alternative | CLI/manifest design first; RFC if source syntax is needed |
|
||||
| C8 | Reserved-type policy already implemented | Documentation clarification completed; Q-016 stays open for future activation |
|
||||
| C9 | Evaluation emphasis valid; priority change is owner policy | Existing B1 track and possible owner/DD decision |
|
||||
|
||||
Updated count after RFC review: **1 concrete RFC candidate** (C5), **1 deferred candidate** (C1), **2 exploratory candidates** (C6/C7), **3 owner policy options** (C3/C4/C9), and **2 proposals substantially covered already** (C2/C8). Seven ideas remain recorded with qualifications; they are not seven approved or economically validated changes. The original benefit-per-cost ordering is not supported by the available evidence.
|
||||
|
||||
### C1 — Optional exact edits
|
||||
|
||||
**Truth / existing coverage:** absent edit API; existing suggestions provide some ingredients. **Consistency:** explicit application and public effects can be preserved. Missing-arm `trap` insertion chooses failure behavior; move insertion may invalidate later uses. **Mission:** potentially repairability. **Payoff:** insufficiently supported to recommend implementation. Published native smoke, P6A-9 and P5-0 reports do not report E3101; P6A-9's E7006 reasons are unspecified. This establishes no measured incidence of the eligible Copy-move subset. Unreported errors are not verified zeros.
|
||||
|
||||
RFC 0038 is therefore retained with a recommendation to defer work, preserving formal Proposed status. Its byte offsets and file hash identify an exact edit for a programmatic applicator, but `expected: "[]"` does not identify a unique string replacement. Context plus edit line/column, or an explicitly invoked application command, remain design alternatives rather than adopted fixes. Resume review only after aggregate eligible per-run incidence with a defined denominator, evidence of material repair cost, and validation of the actual application workflow. No arbitrary N% is set from these reports; any owner-selected threshold and minimum sample size must precede a new cohort's evaluation. M/C may only check regression and cannot select or tune the feature. Frozen evaluation inputs remain untouched.
|
||||
|
||||
**Independent measurement prerequisite: stable E7006 reasons.** Current frontend E7006 diagnostics do not provide a stable `reason` discriminator. The move rejection in [lower.zig](../../src/frontend/lower.zig) exposes `name`/`type`, but the same rejection site can cover Copy values and other non-linear forms, and E7006 also covers unrelated constructs across frontend stages. Parsing `message` would violate the machine-readable intent of spec 14 §3.5 and cannot supply a reliable Copy-move incidence metric.
|
||||
|
||||
Record a separate diagnostic-schema task, independent of RFC 0038's edits or application workflow, for owner routing to a plan task or RFC. Its proposed completion conditions are:
|
||||
|
||||
- Specify stable `reason` values and coverage in spec/reference, distinguishing Copy-move rejection from borrowed/non-Copy moves and other covered invalid constructs. Keep E7006's code/kind and the language's accepted/rejected sets unchanged.
|
||||
- Emit reasons from explicit frontend error classification, not message parsing or simply assigning one reason to every use of the shared code. Check JSON serialization, original source provenance and positive/negative examples for each specified reason; valid generic Copy transfer remains accepted.
|
||||
- Keep missing/unclassified reasons explicitly unknown in measurements. Do not relabel historical records or infer their reasons from prose; adding fields to future runs does not recover old data.
|
||||
- Separately extend evaluation reporting to aggregate affected source runs by `(code, reason)`, alongside existing code counts, with the agreed denominator/cutoff. Merely adding `reason` does not change `_diagnostic_codes`, which currently counts codes only. Both changes must precede the relevant future experiment's freeze.
|
||||
|
||||
The reason field improves machine repairability on its own; the reporting follow-up enables the Copy-move branch of 0038's evidence condition. E3101's code-level incidence can already be counted without this prerequisite. No task ID, implementation, new reason name or diagnostic-schema adoption is assigned by this assessment; the owner decides routing and scope.
|
||||
|
||||
### C2 — Diagnostic statistics
|
||||
|
||||
**Truth:** “one smoke run only” is **wrong**. [report.py](../../tools/eval/ajieval/report.py) implements `_diagnostic_codes` for both controlled events and native transcripts, and `profile` exposes counts per run; checkpoint reports categorized counts. [Harness documentation](../evaluation/harness.md) describes both. **Existing coverage:** substantial. **Consistency / mission:** aggregate measurement supports auditability without changing semantics. **Payoff:** identify whether the missing requirement is cohort aggregation, persistent raw counts, or counting only before first acceptance. Current counts scan recorded outputs; they do not promise the proposed pre-acceptance cutoff. Count occurrences separately from distinct failures and repair cycles. Do not rank the roadmap by raw code frequency alone: task exposure, repeated identical checks, truncation and early failure bias the counts, while successfully prevented errors can be invisible.
|
||||
|
||||
### C3 — Std freeze
|
||||
|
||||
**Truth:** growing std has a real documentation cost; benefit is not established. **Existing coverage:** remaining std work is already backlog and the foundation was explicitly requested by the owner. **Consistency:** a future scope gate is compatible, but this assessment cannot revoke that direction. **Mission:** potentially simplicity/auditability; reduced reuse may increase generated code and repairs. **Payoff:** not “free”: delayed reusable APIs and independent development are opportunity costs. An owner decision could define a gate and exceptions after weighing both, without accessing private tasks or altering frozen inputs.
|
||||
|
||||
### C4 — Quick Reference cap
|
||||
|
||||
**Truth:** the review-time front door exceeds the example 8k threshold by 642 cl100k tokens (688 after the floating-point clarification). **Existing coverage:** the plan targets 5–8k and tooling measures size, without a hard source cap. **Consistency:** a documentation CI policy is compatible and changes no language semantics. **Mission:** bounded context and repairability, provided essential rules remain discoverable. **Payoff:** an exact threshold is not empirically justified; trimming can transfer cost to more reads. Any adopted cap needs a pinned measurement convention, baseline transition, exceptions and clarity/example-coverage checks. Track full bundle and actual reads alongside it.
|
||||
|
||||
### C5 — Related locations
|
||||
|
||||
**Truth / existing coverage:** the second source location is missing despite SSA conflict identities. **Consistency:** factual locations are compatible; a suggested enclosing block is not automatically a proven fact about a valid repair. **Mission:** explicitness and repairability. **Payoff:** scope the first RFC to previous borrow origin and outstanding task/spawn locations, preserving primary location, stable codes and deterministic ordering through source/AIR mapping and modules. Test reborrows, call-returned borrows, regions, task loans and merged provenance. Defer block-enclosure analysis until its meaning, feasibility and soundness are specified. A diagnostic extension alone need not change ownership semantics.
|
||||
|
||||
The public native smoke reports six E2101 occurrences in AIR command output; P5-0 reports two in a strong agent's source run, repaired in one cycle. These support the relevance of borrow feedback, not a measured economic benefit of related positions. Review supports RFC 0037's bounded scope and the need to carry the original spawn through cancelled-handle transitions. Source variable names may help later; they remain outside scope rather than being inferred from SSA names.
|
||||
|
||||
### C6 — Integer contracts
|
||||
|
||||
**Truth / existing coverage:** declaration support remains pending; guard/assert are existing alternatives for local checks. **Consistency:** no unproved predicate may silently gain an unspecified runtime meaning. Define mathematical versus fixed-width arithmetic/overflow, evaluation timing, old-state capture, supported expressions, traps, effect requirements, interprocedural checking and behavior under concurrency/resource obligations. Distinguish decidable proof from executable runtime checking; not every possible contract is executable. Review AIR format-0 extension rules and register any new feature. **Mission:** verifier strength. **Payoff:** high and unknown, including solver/TCB and source/AIR bundle growth. A focused P6-6 RFC should compare existing primitives before recommending a language extension or priority.
|
||||
|
||||
### C7 — Application tests
|
||||
|
||||
**Truth / existing coverage:** dedicated discovery is absent; deterministic execution machinery exists. **Consistency:** reusing execution does not eliminate new entry, grants, isolation, ordering, aggregation and CLI contracts. Compare a manifest/runner over ordinary entries with `test fn`; the latter is a source feature and must land vertically. **Mission:** determinism and repairability. **Payoff:** evaluate authoring and repair cost before choosing syntax. Specify fuel and schedule behavior using existing deterministic limits, not wall-clock termination.
|
||||
|
||||
### C8 — Floating point
|
||||
|
||||
**Truth / existing coverage:** reservation is already normative and implemented. **Consistency:** add a short status clarification to Quick Reference/Q-016 rather than pretending floating-point semantics were decided. **Mission:** explicitness. **Payoff:** cheap documentation work; no float implementation or new reservation RFC is required. Keep the question open until NaNs, rounding, fused operations and related future behavior are specified or the owner permanently drops the types.
|
||||
|
||||
### C9 — Evaluation priority
|
||||
|
||||
**Truth:** evaluation remains essential; C9's ordering predates the current completed P6-11 implementation. **Existing coverage:** B1 is accepted and P7/P8 are already held; the owner separately requested the std merge and source resumption. B1 D1 measures a stack signal rather than H4. **Consistency:** future priority changes require an owner decision and must respect independent held-out authoring and frozen inputs. **Mission:** auditability and empirical control of complexity. **Payoff:** completing public aggregate analysis is valuable, but stopping every independent source improvement is not shown to be cost-free or beneficial. Preserve the distinction between an unvalidated benefit hypothesis and a requirement that no development occur before evidence.
|
||||
|
||||
## Reproductions and next review steps
|
||||
|
||||
```sh
|
||||
zig-out/bin/aji check tests/conformance/phase0/reject/float_reserved.air
|
||||
zig-out/bin/aji check tests/conformance/source/borrow_returns/parent_access.aji
|
||||
zig-out/bin/aji check tests/conformance/source/borrow_returns/region_live_reset.aji
|
||||
git ls-tree -r --name-only 591f0ae -- std src/frontend/stdlib.zig
|
||||
```
|
||||
|
||||
The three checks reject with E0006/`reserved_type`, E2101 and E2104 respectively. Borrow diagnostics contain SSA conflict identities and only one source position, confirming the location gap. The historical tree query returns no current std modules.
|
||||
|
||||
Existing evaluation harness self-tests also passed: `python3 -m unittest discover -s tests` in `tools/eval/`, 22 tests, one skipped (the freeze test requires a clean repository). They use public `dev-echo` fixtures and mock providers, not held-out runs. The suite emits ResourceWarnings about unclosed files/sockets; no harness changes were made for this review.
|
||||
|
||||
Recommended sequence, subject to the existing owner plan:
|
||||
|
||||
1. Correct the factual basis in future discussions: reserved floats, existing diagnostic counts, generic policies, old versus current bundle, and B1 versus H4.
|
||||
2. Continue owner review of the bounded C5 proposal in RFC 0037. Retain RFC 0038 without implementation pending its incidence, repair-cost and application-workflow conditions. Do not implement either RFC from this assessment.
|
||||
3. Route B8, the historical bundle table and C8's status wording to documentation maintenance. Route any precisely identified C2 remainder to evaluation tooling after respecting freeze rules.
|
||||
4. Keep C6/C7 as researched alternatives and C3/C4/C9 as explicit owner policy choices; neither approve semantics nor change the roadmap here.
|
||||
|
||||
The original review identifies a real growth/measurement risk and a concrete diagnostic repair gap. Its strongest immediate contributions are better evidence accounting and related source locations; it does not establish a current floating-point determinism bug, missing diagnostic statistics, or a need for new behavioral abstractions.
|
||||
|
||||
Following owner discussion, the bounded C5 and C1 proposals are written as [RFC 0037](../rfcs/0037-borrow-diagnostic-related-locations.md) and [RFC 0038](../rfcs/0038-bounded-diagnostic-edits.md), both **Proposed**, with no implementation or acceptance implied. The three requested documentation clarifications are complete. Generated bundle measurements after the Quick Reference sentence: cl100k Quick 8,688, other source 64,160, full source 72,848; o200k 8,723 / 64,359 / 73,082; Qwen2.5 8,954 / 65,733 / 74,687. AIR and std reference sizes are unchanged. C3/C4/C9 remain owner policy options.
|
||||
|
||||
The subsequent RFC review supports 0037 and recommends deferring 0038 as described above; formal adoption remains the owner's decision. The reviewed drafts had 2,010 and 2,381 words respectively (`wc -w`), disproportionate to the small diagnostic extension. At spec integration, express the schema and code-to-role/eligibility mapping as a few table rows plus indispensable invariants; keep rationale, alternatives and test matrices in RFCs/tests and remeasure bundle growth. Compactness must still preserve source-map fallback, deterministic ordering and task-spawn provenance. The evidence/workflow qualification added to 0038 is outside the bundles and is not itself language growth.
|
||||
@@ -0,0 +1,202 @@
|
||||
# Design review — 2026-10-07
|
||||
|
||||
Non-normative. An external review of the spec, the plan and the evaluation results, written for another agent to check and evaluate. It changes nothing; every proposal still needs an RFC, a `DD-NNN` entry or a plan task before it has any effect.
|
||||
|
||||
## Scope and limits
|
||||
|
||||
Read in full: spec 01, spec 14, spec 15 §1, §6, §9–§11, §13–§15 (parts), spec 10 §1–§6, `docs/agent/quick-reference.md`, `docs/agent/README.md`, `docs/plan/README.md`, `docs/design/decisions.md`, `docs/design/open-questions.md` (index), `docs/evaluation/results/2026-10-05-native-smoke.md`.
|
||||
|
||||
Skimmed by headings only: spec 03, 04, 05, 07, 07a, 08, 13, 16. Claims that touch these are marked **unverified**.
|
||||
|
||||
Not read: the RFCs (except their titles), `src/`, the conformance corpus, `docs/evaluation/protocol.md`, the P6A-9 and P5-0 results.
|
||||
|
||||
Every claim below has an **evidence** line. The reviewing agent should check it and mark the claim `confirmed`, `wrong` or `partly`.
|
||||
|
||||
## How to evaluate this document
|
||||
|
||||
For each item, answer:
|
||||
|
||||
1. Is the observation true? Check the evidence.
|
||||
2. Does the repository already address it somewhere this review did not read?
|
||||
3. If true, is the proposal consistent with `AGENTS.md`? In particular: no inferred effects in public contracts, no compiler flags that change semantics, no features tuned to benchmark tasks (spec 14 §12).
|
||||
4. Does it improve at least one of the mission properties in `AGENTS.md` (explicitness, verifier strength, determinism, repairability, safety, simplicity, auditability)?
|
||||
5. Is it cheaper than its expected gain? Use the same cost categories as spec 14 §5.
|
||||
|
||||
## Part A — What is right (keep)
|
||||
|
||||
| ID | Observation | Evidence |
|
||||
|---|---|---|
|
||||
| A1 | The central hypothesis is stated as falsifiable and is tested with a held-out benchmark, an anti-overfitting rule and published negative results. | spec 14 §4, §12; native-smoke results "No compression signal at this difficulty" |
|
||||
| A2 | "Agent proposes, verifier decides" is carried through: stable codes, JSON Lines diagnostics, `suggested_effects`, deterministic runs bounded by fuel. | spec 10 §2; DD-009, DD-013; quick reference §1 |
|
||||
| A3 | The source/AIR boundary rule is sharp and checkable: source may hide mechanics (SSA, CFG, `borrow.end`, frame storage, feature header) and must not hide semantics (authority, allocation, move, consumption, sync, effects, tasks, cancellation, failure). | spec 15 §1 |
|
||||
| A4 | Exhaustive enum `match` without `_` makes adding a variant a compile error everywhere it matters. | spec 15 §6 "Enums" |
|
||||
| A5 | Bringing Phase 6A forward was decided from data: the measured cost of Aji/AIR was hand-written IR, not the safety semantics. Strong agents hit no ownership, borrow, resource or concurrency diagnostics. | native-smoke "Diagnostics" and "Reading" §2 |
|
||||
| A6 | The frontend is outside the TCB, and malformed lowered AIR is reported as a compiler bug (`E7900`), not as a program error. | spec 15 §1, §10 |
|
||||
|
||||
## Part B — Concerns
|
||||
|
||||
Severity: **high** means a risk to the project hypothesis; **medium** means measurable agent cost; **low** means quality or clarity.
|
||||
|
||||
### B1 — Language and std grow faster than the evidence that growth pays (high)
|
||||
|
||||
- Bundle growth: 27.3k tokens (Phase 2 baseline) → 42.3k tokens (Phase 5), about +55 %. Every phase adds about 10 %, and growth only produces a CI warning.
|
||||
- The native smoke measured a fixed documentation read of about 33k tokens per Aji run. Rust runs read none.
|
||||
- No result shows a compression signal yet. E-A, E-1 and B1 are not done.
|
||||
- Spec 14 §3.2 says a feature should not be added when existing primitives suffice. Spec 14 §8 says nearly identical APIs should be avoided unless benchmarks show a benefit.
|
||||
|
||||
Evidence: `docs/agent/README.md` milestone table; `tools/agent_bundle_tokens.py` output ("+11.8 % since Phase 5"); native-smoke "Cost" table; `docs/plan/README.md` evaluation table.
|
||||
|
||||
**Question for the reviewer:** does the Source Reference Bundle (`/docs` front door plus selective reading) actually stay small? This review did not get token counts for it: the tokenizers were not installed.
|
||||
|
||||
### B2 — Standard library scope before measurement (high)
|
||||
|
||||
- RFC 0016–0035 add a large std: deque, numeric map, general key map, set, binary heap, buffered files, lexical paths, hashing, text encodings, integer formatting. Spec 16 is about 9.2k words, almost as large as spec 15 (9.6k).
|
||||
- Each collection is a set of operations and outcomes an agent must learn, and is part of what an agent may read.
|
||||
- The plan already moved std into a separate track and recorded the merge as an owner request (2026-10-06/07).
|
||||
|
||||
Evidence: `docs/rfcs/` listing; `wc -w docs/spec/*.md`; `docs/plan/README.md` "Standard library track".
|
||||
|
||||
**Question for the reviewer:** which std modules does the Quick Reference expose, and were any of them used in P6A-9 or the M/C regression runs?
|
||||
|
||||
### B3 — Deterministic repairs still cost a round-trip (medium)
|
||||
|
||||
- `E3101` already computes the full effect list (`suggested_effects`). The agent copies it back by hand.
|
||||
- Spec 10 §3 defines `repair_candidates` as kind names only (`{"kind": "move_reset_after_use"}`), with the rule "Suggestions never modify semantics automatically".
|
||||
- Several source diagnostics have exactly one mechanical fix:
|
||||
- `E3101`: replace the `effects [...]` list;
|
||||
- `E7003`: insert `move`;
|
||||
- `E7006` for `move` on a copyable value: delete `move`;
|
||||
- `E7004`: add the missing arms.
|
||||
|
||||
Evidence: spec 10 §3; spec 15 §9 "Effects", §10 code table; quick reference §1, §4.
|
||||
|
||||
### B4 — Lexical borrow scopes push structural edits onto the agent (medium)
|
||||
|
||||
- A named borrow lives until the end of its block. To end it earlier, the agent adds an inner `{ … }` block.
|
||||
- This is simple to state and simple to verify. The cost is that `E2101`/`E2104` repairs are structural edits whose correct location the agent must find itself.
|
||||
- **Not a proposal to adopt non-lexical lifetimes.** Those would add inference, which conflicts with spec 14 §3.4.
|
||||
|
||||
Evidence: spec 15 §9 "Borrow scopes"; quick reference §4, §6 (region example).
|
||||
|
||||
**Question for the reviewer:** do `E2101`/`E2104` diagnostics already carry the span of the conflicting earlier borrow? (spec 08 not read in full.)
|
||||
|
||||
### B5 — Open determinism gaps (medium)
|
||||
|
||||
- Q-016 (floating-point determinism) and Q-017 (replay file format) are open.
|
||||
- `f32`/`f64` appear in spec 02. **Unverified:** whether they are reserved or usable.
|
||||
- Spec 14 §3.6 promises "same program, same input, same grants, same seed … same observable result".
|
||||
|
||||
Evidence: `docs/design/open-questions.md` index; `grep f32 docs/spec/02-types-and-values.md` (line 20).
|
||||
|
||||
### B6 — No source contracts; the verifier covers memory, not logic (medium)
|
||||
|
||||
- Spec 13 defines `requires`/`ensures`. P6-6 (contracts in source) is `todo`.
|
||||
- The smoke showed that strong agents make almost no memory or resource errors. If the remaining errors are logical, the verifier currently cannot help with them.
|
||||
|
||||
Evidence: spec 13 lines 9–21; `docs/plan/phase-6-source-language.md` line 14; native-smoke "Diagnostics".
|
||||
|
||||
**Unverified:** the current status of spec 13 contracts in AIR.
|
||||
|
||||
### B7 — No behavioral abstraction pushes variants into std (medium)
|
||||
|
||||
- There are no user traits, closures or function values (spec 15 §15: "No user traits, overloads, type inference …"). Only qualified named functions may be passed to `task.spawn`, and static function parameters exist (RFC 0029).
|
||||
- Anything parameterized by behavior (comparator, hash, visitor) needs either a static function parameter or a separate built-in. That may partly explain the size of B2.
|
||||
|
||||
Evidence: spec 15 §14 (line 511), §15 (line 523), §18; RFC 0029 title.
|
||||
|
||||
**Question for the reviewer:** are static function parameters (spec 15 §18) enough for comparator/hash use? If so, can some std variants be expressed as one generic module?
|
||||
|
||||
### B8 — The normative source-language text is hard for an agent to read (low)
|
||||
|
||||
- Several spec 15 sections are dense single paragraphs with many rules, e.g. §13 (name mangling) and §17 (dynamic buffers).
|
||||
- The Quick Reference compensates, but when an agent is unsure it is directed to the normative text.
|
||||
|
||||
Evidence: spec 15 lines 481, 558.
|
||||
|
||||
### B9 — Tests are not a language-level construct (low)
|
||||
|
||||
- Tests live in the conformance infrastructure (`expect`/`phase`/`spec` headers, DD-010). An agent writing an application has no in-language way to state and run its own deterministic tests, including under N schedules.
|
||||
|
||||
Evidence: DD-010; quick reference sections 1–8 (no test construct).
|
||||
|
||||
**Unverified:** whether spec 12 (packages and build) defines a test entry point.
|
||||
|
||||
## Part C — Proposals
|
||||
|
||||
Ordered by estimated benefit per cost. Each states the concern it answers and how to measure it.
|
||||
|
||||
### C1 — Exact text edits in diagnostics (answers B3; cheap)
|
||||
|
||||
Add an optional field to diagnostics whose fix is unique and mechanical:
|
||||
|
||||
```json
|
||||
{"code": "E3101", "edits": [{"file": "main.aji", "range": [12, 1, 12, 14], "replacement": "effects [io.read, io.write]"}]}
|
||||
```
|
||||
|
||||
- The compiler never applies the edits. The agent applies them explicitly, so spec 10 §3 ("never modify semantics automatically") holds.
|
||||
- Initial set: `E3101`, `E7003`, `E7006` (`move` on a copyable value), `E7004` (missing arms, each `=> { trap; }`).
|
||||
- Not for borrow conflicts. There, more than one fix is correct.
|
||||
- Effects stay declared in the public signature. This is not effect inference (`AGENTS.md`).
|
||||
|
||||
Measure: repair iterations per accepted solution on the M/C regression corpus, before and after. Per `AGENTS.md`, M/C may show that nothing broke, but they never decide the question.
|
||||
|
||||
### C2 — Per-code diagnostic statistics across all runs (answers B1; cheap, evaluation tooling only)
|
||||
|
||||
- Record in the harness, for every run, the count of each diagnostic code before acceptance.
|
||||
- Use it as the input that ranks language work. If most iterations are `E3101` and `E2101`, those are the roadmap.
|
||||
- Today this breakdown exists for one smoke run only.
|
||||
|
||||
Measure: none needed; this is the measurement.
|
||||
|
||||
### C3 — Freeze std growth until B1 is analyzed (answers B1, B2; free)
|
||||
|
||||
- No new std modules until the B1 held-out analysis.
|
||||
- Fixes and spec integration of already accepted RFCs continue.
|
||||
|
||||
### C4 — Hard budget for the Quick Reference (answers B1; cheap)
|
||||
|
||||
- Cap, for example, the Quick Reference at 8k tokens as a CI failure, not a warning.
|
||||
- A feature that needs room must shrink or move something else to the selective-reading layer.
|
||||
|
||||
Risk: pressure to make the reference terse to the point of ambiguity. Mitigation: the budget covers the front door only; the full spec is unchanged.
|
||||
|
||||
### C5 — Both spans in borrow-conflict diagnostics (answers B4; medium cost)
|
||||
|
||||
- `E2101`, `E2104`, `E4302`: report the span of the earlier borrow, the span of the conflicting use, and the innermost block in which the earlier borrow could be enclosed.
|
||||
- Facts only, not edits: there is more than one valid fix.
|
||||
|
||||
First check B4's question: this may already exist.
|
||||
|
||||
### C6 — Decidable source contracts as the next major semantic feature (answers B6; high cost)
|
||||
|
||||
- A small decidable fragment: linear integer arithmetic over indices, lengths and counts in `requires`/`ensures`.
|
||||
- Anything not proved becomes an explicit runtime check, listed in `aji report` (spec 10 §6.1 already reports runtime vs proven checks).
|
||||
- Prioritize this over new std modules.
|
||||
|
||||
Needs a full RFC with the `Agent complexity impact` section and the memory/concurrency checklist where it applies.
|
||||
|
||||
### C7 — `test fn` in source (answers B9; medium cost)
|
||||
|
||||
- Deterministic in-language tests with fuel and `--schedules N`, run by `aji test`.
|
||||
- Grants are declared per test, with the same `main`-parameter rule.
|
||||
- Reuses the existing run record. No new runtime semantics.
|
||||
|
||||
### C8 — Close Q-016 before any task needs floating point (answers B5)
|
||||
|
||||
The simplest deterministic option is to keep `f32`/`f64` reserved in `.aji` 0.1 and say so in the Quick Reference.
|
||||
|
||||
### C9 — Prioritize B1 over P6-11 and further std work (answers B1; free)
|
||||
|
||||
- H4 is expected only on medium tasks, where a weaker model understands the task but fails on resources, cancellation or concurrency (`docs/plan/README.md` roadmap item 5).
|
||||
- Until such tasks are measured, language changes are optimized without signal.
|
||||
|
||||
## Part D — Suggested next steps for the reviewing agent
|
||||
|
||||
1. Verify every **unverified** item and every reviewer question above. List the outcome per ID.
|
||||
2. Count how many C proposals survive the evaluation questions at the top.
|
||||
3. For surviving proposals, pick the destination:
|
||||
- C1, C5, C6, C7: RFC;
|
||||
- C3, C4, C9: owner decision or `DD-NNN`;
|
||||
- C2: plan task in the evaluation track;
|
||||
- C8: resolution of Q-016.
|
||||
4. Do not start implementation from this document alone.
|
||||
@@ -0,0 +1,162 @@
|
||||
# RFC 0037: Related locations for borrow diagnostics
|
||||
|
||||
Status: Proposed\
|
||||
Scope: Diagnostic metadata for E2101, E2104 and E4302; AIR format 0 and `.aji` 0.1\
|
||||
Language version: 0.1\
|
||||
Supersedes: —
|
||||
|
||||
This proposal is ready for owner review. It is not implemented or accepted; the following rule changes enter the specification only on acceptance.
|
||||
|
||||
## Motivation
|
||||
|
||||
E2101/E2104 identify a conflicting live borrow with `conflicts_with`, but expose only the current operation's source position. E4302 identifies the outstanding task without showing its spawn. An agent must search lowered AIR or reconstruct provenance to find the earlier construct.
|
||||
|
||||
The existing verifier already selects the conflicting borrow or loan. Reporting its location improves machine repairability and auditability without introducing a lifetime inference or choosing a repair. This is the bounded part of C5 in [the design review](../design/review-2026-10-07.md) and [assessment](../design/review-2026-10-07-assessment.md).
|
||||
|
||||
Scope is deliberately limited to related **positions** using existing file/line/column conventions. Computing a safe enclosing block, exact edit ranges, ancestry trees, or every possible conflict is separate work.
|
||||
|
||||
## Precise invariant
|
||||
|
||||
For a fixed input, the verifier MUST make the same acceptance/rejection decision and select the same primary diagnostic as before this extension. Related metadata MUST refer to the already selected conflicting value or outstanding task and to a real definition/spawn location. Metadata MUST NOT add a borrow, end a borrow, change a loan, broaden effects or authority, or alter runtime behavior.
|
||||
|
||||
An earlier position denotes a syntactic origin, not a claim that it ran before the primary operation in every schedule or that enclosing/deleting it would repair the program.
|
||||
|
||||
## Normative rule changes
|
||||
|
||||
Proposed addition to spec 10 §2, “Related locations”:
|
||||
|
||||
> A diagnostic MAY include `related_locations`, an ordered array of non-binding factual context records. Each record MUST contain `role` and `value`. The identity in `value` uses the existing diagnostic value naming convention. A located record MUST contain `file`, `line` and `col`, using the primary location's conventions. Additional fields MUST NOT change an existing field's meaning.
|
||||
>
|
||||
> E2101 and E2104 diagnostics that identify `conflicts_with` MUST include one related record with role `conflicting_borrow` and that value's definition position. E4302 diagnostics that identify `task` MUST include one related record with role `task_spawn` and the spawn origin of that outstanding task. The record's `value` MUST equal the corresponding `conflicts_with` or `task` field, respectively. Other forms of these codes MUST NOT invent a conflicting value or task.
|
||||
>
|
||||
> The related record MUST describe the same conflict selected for the primary diagnostic. Implementations MUST NOT enumerate other conflicts as part of this extension. The primary position, existing structured fields, error code, diagnostic ordering and duplicate suppression MUST retain their existing meaning and selection behavior.
|
||||
|
||||
Proposed addition to spec 15 §10, “Related source positions”:
|
||||
|
||||
> For a diagnostic from lowered AIR, each related AIR position MUST be mapped independently through the lowering source map, including the source file recorded for imported or specialized code. If mapped, `file`, `line` and `col` MUST denote that source construct, and `air_line`/`air_col` MUST retain its AIR position, as for the primary diagnostic.
|
||||
>
|
||||
> If no related source mapping exists, the related record MUST omit `file`, `line` and `col` as a group, retain its factual `role`, `value` and `air_line`/`air_col`, and MUST NOT substitute a guessed source position. This rule does not change the existing primary-position fallback.
|
||||
|
||||
For direct AIR input, related records use the input AIR file and definition/spawn position, without source-mapping metadata. The new array is omitted when there is no identified related context. An unmapped source record still identifies a known AIR origin; it is not a located source record.
|
||||
|
||||
The first release adds exactly one related record for each covered diagnostic form. Stable role names are `conflicting_borrow` and `task_spawn`; future roles require a specified extension. Object key order is `role`, `value`, then `file`, `line`, `col` when available, then `air_line`, `air_col` for lowered AIR. Existing envelope fields keep their serialization order; `related_locations` is appended at the end. Values are source/SSA identities, not user-facing name inference.
|
||||
|
||||
## Verifier implications
|
||||
|
||||
No new abstract borrow state, acceptance rule or transfer function is introduced. For E2101/E2104, use the `ValueInfo.span` for the selected `conflicts_with` definition, never its root merely because the root is easier to find. For a caller receiving a borrow-returning call, this is the caller's view definition; the callee's `from` declaration is not substituted.
|
||||
|
||||
For E4302, record the creating `task.spawn` position as diagnostic provenance on a loan. Carry it through the existing task-handle transitions, including the returned handle on the cancelled edge of `task.join_cancel`. Looking up that returned handle's definition would report the cancellation arm instead of the spawn and is insufficient. The loan's current task identity remains the existing `task` field; the related position identifies its creation, even if the SSA handle name changed.
|
||||
|
||||
Metadata is available only after the same SSA/type prerequisites as today. It does not participate in liveness, overlap, join-state equality or rejection. Source-map failure affects only availability of a related source position.
|
||||
|
||||
Implementation uses constant-sized provenance per existing loan and constant-time definition lookup per diagnostic; asymptotic borrow-verification complexity is unchanged. Serialization adds at most one record per covered diagnostic. No recursive ancestry walk, additional whole-program pass or filesystem read is required.
|
||||
|
||||
## Interpreter / runtime implications
|
||||
|
||||
None. Accepted programs have identical run records, memory behavior, task scheduling, weak-memory choices, traps and fuel accounting. Rejected programs are never executed. Diagnostic output is deterministic for the same input and source maps; related metadata consumes no Aji runtime fuel.
|
||||
|
||||
## AIR changes
|
||||
|
||||
No syntax, instruction, operand/result type, ownership/memory/concurrency effect, capability requirement, trap or verifier transfer changes. AIR format 0 retains its frozen meaning. Diagnostic envelope metadata is not an AIR semantic feature and needs no module feature declaration.
|
||||
|
||||
## Valid example
|
||||
|
||||
```aji
|
||||
module related.valid
|
||||
fn main() -> u64 effects [] {
|
||||
var data: [u64; 1] = [1u64];
|
||||
{ ref view = data; assert(view[0] == 1u64); }
|
||||
data[0] = 2u64;
|
||||
return data[0];
|
||||
}
|
||||
```
|
||||
|
||||
The borrow ends before the write. The program remains accepted and returns 2; no diagnostic or related record is emitted. The verifier is not instructed to construct this block as a repair.
|
||||
|
||||
## Rejected example
|
||||
|
||||
```aji
|
||||
module related.rejected
|
||||
fn main() -> u64 effects [] {
|
||||
var data: [u64; 1] = [1u64];
|
||||
ref view = data;
|
||||
data[0] = 2u64;
|
||||
return view[0];
|
||||
}
|
||||
```
|
||||
|
||||
This remains E2101: the write conflicts with the live shared view. The primary diagnostic retains the write position, while the related position maps the selected view definition to the borrow construct. Illustrative additional field (the value name and exact column come from actual lowering):
|
||||
|
||||
```json
|
||||
{"related_locations":[{"role":"conflicting_borrow","value":"%data_4","file":"rejected.aji","line":4,"col":5,"air_line":13,"air_col":5}]}
|
||||
```
|
||||
|
||||
For E2104, the rejected [region-reset fixture](../../tests/conformance/source/borrow_returns/region_live_reset.aji) must report the existing selected borrow's definition. For E4302, [ending a lent borrow](../../tests/conformance/phase3/reject/tasks_end_lent_borrow.air) must retain the borrow-end primary position and add the outstanding task's spawn; [cancelled join](../../tests/conformance/phase3/reject/cancel_join_keeps_loans.air) must retain that spawn through handle replacement. These examples add facts, not new rejection rules.
|
||||
|
||||
## Diagnostics impact
|
||||
|
||||
No new codes or kinds. E2101, E2104 and E4302 receive the additive array in the identified forms. Existing `borrow`, `conflicts_with`, `task`, primary location and AIR position fields remain intact. Related objects must be typed structured data in `src/diag.zig`, not JSON embedded in a string field or text parsed from `message`.
|
||||
|
||||
Consumers must tolerate optional metadata and an unmapped related source record. The CLI's JSON Lines, exit codes and stdout/stderr contract remain unchanged. No edits or `repair_candidates` are generated by this RFC.
|
||||
|
||||
## Spec integration
|
||||
|
||||
On acceptance, integrate the rules into:
|
||||
|
||||
- spec 10 §2: envelope, roles, conditions, identity and serialization contract;
|
||||
- spec 15 §10: independent related-position source mapping and fallback;
|
||||
- spec 08 §11 and spec 03 §20: reference the E2101/E2104 diagnostic metadata without changing borrow rules;
|
||||
- spec 04 §34: reference E4302 spawn metadata and cancelled-handle provenance;
|
||||
- `reference/error-codes.md`: annotate existing codes with a reference to the metadata contract;
|
||||
- Quick Reference: one short note on using `related_locations` for the relevant errors.
|
||||
|
||||
Spec 10 §2 and spec 15 §10 already enter the AIR and source bundles respectively. Keep the necessary schema text there rather than adding the RFC rationale or repeated examples to every bundle page.
|
||||
|
||||
At integration, condense the schema and code-to-role mapping into a few table rows plus the required source-map/determinism invariants. Retain rationale, implementation discussion and test matrices here or in tests rather than expanding normative prose with them.
|
||||
|
||||
## Compatibility and migration
|
||||
|
||||
Accepted/rejected sets, rejection codes, runtime outcomes and source/AIR ratio stay unchanged. No AIR format or language-version increment is required because no construct's meaning changes. Diagnostics gain optional fields; consumers comparing exact JSON bytes or maintaining diagnostic goldens need updates. Existing clients ignoring unknown fields continue to operate.
|
||||
|
||||
Preserve current first-conflict selection and source diagnostic deduplication. Do not merge related records from discarded duplicate diagnostics: that would silently introduce conflict enumeration and change the proposed bounded scope.
|
||||
|
||||
## Agent complexity impact
|
||||
|
||||
- New concepts: one optional factual related-location record with two stable roles; no new programming-language concept.
|
||||
- New verifier state: diagnostic provenance on existing loans; no new abstract semantic state.
|
||||
- Syntax/instructions: none; `.aji` syntax and lowering semantics are unchanged.
|
||||
- Interactions: reborrows, borrow returns, region result parameters, cancelled task handles, imported source, generic specializations and existing diagnostic deduplication.
|
||||
- Repairability: avoids searching for the selected earlier construct; does not promise a unique repair or lower total cost without measurement.
|
||||
- Existing primitives: sufficient for the programs and verifier; the current JSON envelope lacks structured related positions.
|
||||
- New diagnostics: no codes; an additive metadata field on three existing codes.
|
||||
- Bundle budget: proposed normative integration is not included in this draft. Baseline before this RFC, after the floating-point documentation clarification, is AIR 46,300 cl100k tokens; Quick 8,688, other source 64,160, full source 72,848. Implementation MUST measure AIR, Quick and source groups before/after integration. No projected token delta is presented as a measurement.
|
||||
|
||||
This is a diagnostic extension, not a semantic feature with a new source syntax. It still lands through spec, diagnostic API, verifier provenance, source mapping, Quick Reference and AIR/source CLI tests together; interpreter behavior must remain unchanged.
|
||||
|
||||
## Validation plan
|
||||
|
||||
Before calling this RFC implemented:
|
||||
|
||||
1. Verify positive and negative examples in AIR and through the source pipeline: ending a borrow before access/reset remains accepted; keeping it live retains E2101/E2104; joining before ending remains accepted; ending before join retains E4302. Source lowering normally prevents explicit early `borrow.end`; where no ordinary source spelling exposes E4302, a mapped lowered-AIR pipeline fixture must cover its source metadata without adding source syntax or relaxing lifetime rules.
|
||||
2. Assert related role, identity and exact file/line/column for all three codes, including shared/exclusive reborrows, split views, region allocations, call-returned views and parameter definitions.
|
||||
3. Test E4302 on ordinary and cancelled join paths so the spawn position survives task-handle replacement. Retain existing deterministic/randomized scheduler coverage for accepted task counterparts; extra metadata must not influence scheduling or loans.
|
||||
4. Test imports, generic specialization and cases where the earlier and primary positions map to different source files. Preserve current code/location deduplication and deterministic record ordering.
|
||||
5. Test an intentionally absent related source mapping: no fabricated file/line/column, AIR coordinates retained. Cover direct AIR input and exact JSON serialization separately.
|
||||
6. Compare accepted run records before/after, conformance rejection codes and diagnostic counts. Run unit tests, conformance, targeted CLI checks and bundle measurements; do not use M/C to choose the schema or scope.
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
- **SSA names only:** current behavior; reliable identities but costly source reconstruction.
|
||||
- **Human notes only:** loses the machine-readable contract.
|
||||
- **Every ancestor/conflict:** adds output and provenance complexity; not needed to locate today's selected conflict.
|
||||
- **Suggested enclosing block or exact repair:** requires additional correctness analysis or a semantic choice; deferred.
|
||||
- **Task handle definition for E4302:** fails to identify spawn after a cancelled join returns another handle; use carried spawn provenance.
|
||||
- **A new error code:** the violated rule is unchanged; unnecessary compatibility cost.
|
||||
|
||||
## Unresolved questions
|
||||
|
||||
No semantic decision is delegated to implementation. The owner must decide adoption. End ranges, original user-facing names, multiple conflicts and block-enclosure suggestions are explicitly outside scope and need a separate proposal if desired.
|
||||
|
||||
## Draft validation
|
||||
|
||||
Both `.aji` code blocks were extracted and checked against the current compiler: the valid example returns 2 with fuel 1,000; the negative example rejects with E2101. Its selected `%data_4` definition is AIR line 13, mapping to source line 4, column 5. The JSON addition above is proposed output, not current compiler output. New metadata tests and implementation remain pending.
|
||||
@@ -0,0 +1,202 @@
|
||||
# RFC 0038: Bounded source edits in diagnostic repair candidates
|
||||
|
||||
Status: Proposed\
|
||||
Scope: Optional source edit candidates for E3101 and selected E7006 diagnostics\
|
||||
Language version: 0.1\
|
||||
Supersedes: —
|
||||
|
||||
**Work recommendation: defer pending evidence and application-workflow validation.** This is not a new RFC lifecycle status: formal status remains Proposed, and only the owner decides adoption. The design below is retained for discussion, not recommended for implementation as it stands. It narrows C1 in [the design review](../design/review-2026-10-07.md) following [its assessment](../design/review-2026-10-07-assessment.md).
|
||||
|
||||
## Evidence and conditions for resumption
|
||||
|
||||
The published [native smoke](../evaluation/results/2026-10-05-native-smoke.md), [P6A-9](../evaluation/results/2026-10-05-p6a-9.md) and [P5-0](../evaluation/results/2026-10-06-p5-0.md) reports do not report E3101. P6A-9 reports E7006 but not its reason; that does not establish a Copy-move error eligible for this RFC. An unreported code is not a verified zero in a complete per-run dataset. Synthetic examples establish feasibility, not observed repair cost or expected payoff.
|
||||
|
||||
Reconsider the proposal only after the following evidence is available:
|
||||
|
||||
1. **Incidence with an explicit denominator.** Publish aggregate counts for an independently chosen `Aji/source` cohort: runs with at least one eligible E3101 or classified Copy-move E7006, divided by all source runs, failures included, with sample size and agent/toolchain strata. Count affected runs separately from repeated diagnostic occurrences. Report unknown E7006 reasons as unknown, not eligible or zero. Current `ajieval profile` counts codes per run but does not classify Copy-move reasons or guarantee a pre-acceptance cutoff; specify that cutoff and missing-data treatment before collecting a new cohort.
|
||||
2. **Material repair cost.** Show that the eligible cases cause location/transcription work, failed patches, retries or meaningful tool cost, and compare the proposed workflow against today's `suggested_effects` plus ordinary editing on independent public fixtures/tasks. Frequency alone is insufficient; a syntactically exact edit may cost more to apply than the existing repair.
|
||||
3. **A usable application path.** Resolve the byte-offset workflow objection below and validate the chosen path with the actual editor/tool interface. Application must remain explicit, stale-input checks must hold, and edited source must be rechecked.
|
||||
|
||||
The Copy-move incidence branch has an independent instrumentation prerequisite: E7006 currently has no stable `reason` field, and the harness counts codes only. A separate diagnostic-schema task must specify and emit structured reasons distinguishing Copy moves from other E7006 forms; a reporting follow-up must count affected runs by code/reason without parsing `message`. These tasks are independently useful and do not require implementing this RFC. Their owner routing and completion conditions are recorded in the [assessment](../design/review-2026-10-07-assessment.md). Missing reasons in old records remain unknown. E3101 incidence remains measurable by code without this prerequisite; neither future instrumentation nor existing counts justify relaxing the repair-cost/workflow conditions above.
|
||||
|
||||
No numeric N% or minimum sample size is justified by the current reports. If the owner chooses an incidence threshold and sample-size gate, record them before evaluating a new cohort rather than selecting them to match observed results. These conditions reopen design review; they do not automatically accept the RFC. Do not change frozen B1 instrumentation or inputs, inspect private held-out material, or use M/C to select or tune the eligible transformations. An authorized independent operator may publish aggregate metadata under the evaluation protocol.
|
||||
|
||||
## Application workflow gap
|
||||
|
||||
The retained schema is exact for a programmatic byte-range applicator. It is not yet demonstrated to help an agent using contextual or string replacement: `expected: "[]"` is not unique in a file, and the primary E3101 position points to the operation, not necessarily the declaration. A file hash protects the input version but supplies no surrounding edit context. Requiring an agent to write an offset-application script may erase the intended saving.
|
||||
|
||||
Two alternatives remain open for a revised RFC:
|
||||
|
||||
- Add the edit's line/column plus enough original context to identify a unique replacement in that file, including a rule for multiline/ambiguous cases and stale input. Keep byte offsets as optional precise metadata if useful. One line alone is not guaranteed unique.
|
||||
- Specify a separately invoked `aji apply-candidate <id>` workflow, including candidate identity/lifetime, exact source snapshot, file scope, stale-input handling and explicit application. An agent-invoked command would not be automatic application during checking or a compiler flag changing language semantics; it would add a tool protocol and implementation cost that need evaluation.
|
||||
|
||||
Neither alternative is adopted or implemented here. If a future revision adds an explicit application command, it must revise the invariant and scope below, which currently prohibit compiler application and exclude such a command. Until the workflow and payoff are supported, the byte-offset design is a retained candidate rather than a resolved interface.
|
||||
|
||||
## Motivation
|
||||
|
||||
E3101 already supplies `suggested_effects`, but an agent still locates the declaration and copies the list. E7006 rejects some unnecessary `move` expressions on Copy bindings, but also covers many unrelated source restrictions. A small eligible subset can expose exact edits without inferring effects into the public contract or making an automatic repair.
|
||||
|
||||
The objective is machine repairability: reduce source-location and transcription work. An exact candidate is **not** a unique correct response to an error. The agent may instead change the operation, alter the API or reject the candidate. Candidates also do not promise that the whole program will verify after application.
|
||||
|
||||
## Precise invariant
|
||||
|
||||
The compiler MUST check the submitted source unchanged and MUST NOT apply a candidate to that source, emitted AIR or the program being executed. Acceptance, rejection, existing diagnostic codes and runtime behavior MUST remain unchanged until an external agent explicitly edits and rechecks the source.
|
||||
|
||||
Each emitted candidate MUST describe a single specified local transformation against the exact parsed file bytes. It MUST NOT insert `move`, choose a missing match arm's behavior, add a capability/grant, discharge unsafe obligations, or alter ownership/lifetime rules.
|
||||
|
||||
## Normative rule changes
|
||||
|
||||
Proposed addition to spec 10 §3, “Bounded source edit candidates”:
|
||||
|
||||
> A `repair_candidates` object MAY contain `edits`, a nonempty ordered array describing one candidate applied as a unit. A candidate is non-binding and MUST NOT be applied by the compiler. Consumers MUST NOT interpret a candidate as proof of programmer intent or whole-program acceptance.
|
||||
>
|
||||
> Each edit MUST contain `file`, `source_hash`, `range`, `expected` and `replacement`. `file` MUST identify the original source input as reported by source diagnostics. `source_hash` MUST be `sha256:` followed by 64 lowercase hexadecimal digits of the complete original file bytes, without newline or Unicode normalization. `range` MUST be `[start,end]`, zero-based UTF-8 byte offsets with an exclusive end, within that file and on UTF-8 boundaries. `expected` MUST equal those original bytes as UTF-8 text. `replacement` MUST be UTF-8 text.
|
||||
>
|
||||
> A consumer applying a candidate MUST check the complete file hash and every expected range before writing, and MUST NOT apply a stale or partial candidate. The language toolchain MUST continue to require an ordinary check of the edited program. Edit arrays MUST be ordered by file identity and increasing original start offset, with no overlapping edits. Multiple diagnostic candidates remain independent alternatives; the compiler MUST NOT implicitly compose them.
|
||||
|
||||
In this RFC each candidate has exactly **one edit**. The array shape supports the existing repair-candidate grouping, not additional multi-edit transformations in this release. New candidate kinds or eligibility rules require a specified extension.
|
||||
|
||||
Object serialization order: candidate `kind`, then `edits`; edit `file`, `source_hash`, `range`, `expected`, `replacement`. The existing diagnostic envelope order is retained. Existing kind-only candidates remain valid. The edited file is never read again merely to create a candidate: the hash and text come from the bytes that were parsed.
|
||||
|
||||
Proposed addition to spec 15 §10: source edit candidates are optional, source-only metadata governed by spec 10 §3. The following two kinds and eligibility conditions are exhaustive for this RFC.
|
||||
|
||||
### `replace_effects` — E3101
|
||||
|
||||
An implementation MAY emit this candidate only when all conditions hold:
|
||||
|
||||
1. The diagnostic is E3101 and has the verifier's complete `suggested_effects` for that function under the **current** submitted callee contracts.
|
||||
2. The checked AIR function maps unambiguously to exactly one original, non-generic `.aji` function declaration and one explicit `effects [...]` clause. The source file and exact token range are retained from parsing/lowering; they are not reconstructed by parsing messages or demangling a name.
|
||||
3. The function is not a generic specialization, template, compiler-generated wrapper, compiler-pinned std function or trusted boundary. The suggested list does not add/discharge `unsafe`. Static function-parameter/template contracts are outside this initial subset.
|
||||
4. The edit replaces only the bracketed effect list, preserving `effects`, the signature, body, capability parameters, annotations and surrounding tokens. Effects are distinct and canonically sorted, exactly matching `suggested_effects`. Comments inside that replaced range are omitted from the replacement; `expected` exposes their removal explicitly.
|
||||
|
||||
Repeated E3101 diagnostics for the same function MAY repeat the identical candidate. They MUST NOT describe inconsistent effect lists or ranges. An agent must deduplicate identical candidates or choose one; applying the first makes duplicates stale.
|
||||
|
||||
Changing a callee may expose a new missing caller effect on the next check. This is not a fixed-point inference or a promise of a one-pass global repair. Alternative reductions of effects and authority remain the agent's decision.
|
||||
|
||||
### `remove_copy_move` — E7006
|
||||
|
||||
An implementation MAY emit this candidate only when all conditions hold:
|
||||
|
||||
1. The compiler has identified the specific source error **move of a complete runtime Copy binding**, not merely the code E7006 or a matching human message. Name resolution and the binding's concrete type are available and valid.
|
||||
2. The type is Copy under the normative type properties, excluding borrows, linear values and internal storage/scope/guard/shield handles. A Copy binding represented in frame storage remains eligible only when ordinary name use is a complete Copy read; an internal storage handle is not eligible.
|
||||
3. The expression is exactly the parsed `move name` form in an ordinary monomorphic body, mapped to the original user-provided program source. It is not inside a generic template/specialized body where `move name` can intentionally transfer a Copy specialization (spec 15 §17), or compiler-pinned library/generated source. File permissions do not authorize the compiler to write; application remains an external agent's explicit action.
|
||||
4. The edit deletes exactly the four bytes of the `move` keyword, leaving the identifier, comments and whitespace unchanged. Removing those bytes must leave the parsed expression as an ordinary use of that same resolved binding, with no token concatenation or changed name resolution.
|
||||
|
||||
No candidate is emitted for a borrowed value, an owner, an unknown name, an unsupported move shape or any other E7006 reason. No new diagnostic code is needed; the compiler's explicit internal error classification determines eligibility. The candidate kind makes the proposed transformation machine-readable without relying on prose.
|
||||
|
||||
## Verifier implications
|
||||
|
||||
No new abstract state, rejection rule or transfer function. Existing effect verification and Copy properties supply facts. Edit provenance is frontend/diagnostic metadata, never evidence used to accept a program.
|
||||
|
||||
Effects candidates are attached only after the verifier has finished collecting `suggested_effects` for the original function. Eligibility does not broaden its contract. Copy candidates use the already resolved source binding and type; they do not substitute `not linear` for the stronger Copy condition.
|
||||
|
||||
Hash each relevant parsed file at most once; retain token offsets and declaration identity through lowering. Extra work is linear in input bytes plus emitted edit text. Do not run a speculative solver, infer new effects or recursively recheck candidate combinations to generate this initial subset. Failed or ambiguous provenance simply suppresses the optional candidate.
|
||||
|
||||
## Interpreter / runtime implications
|
||||
|
||||
No runtime changes, implicit moves, cleanup or authority. Deterministic checking emits deterministic candidates for the same input. Hashing and candidate serialization occur outside Aji execution and consume no program fuel. An unchanged rejected program remains rejected; an unchanged accepted program has the same run record.
|
||||
|
||||
## AIR changes
|
||||
|
||||
No new or changed instruction, operand/result type, ownership/memory/concurrency effect, capability requirement, trap or transfer function. AIR format 0 retains its meaning and feature headers are unchanged. Direct AIR inputs keep current effect suggestions and do not receive source edits from this RFC.
|
||||
|
||||
## Valid example
|
||||
|
||||
```aji
|
||||
module edits.valid
|
||||
fn echo(out: cap<io.write>, x: u64) -> u64 effects [io.write] {
|
||||
io.stdout_write(out, b"ok") or trap;
|
||||
return x;
|
||||
}
|
||||
fn main(out: cap<io.write>) -> u64 effects [io.write] {
|
||||
return echo(out, 42u64);
|
||||
}
|
||||
```
|
||||
|
||||
The effect list is explicit and the Copy return needs no move. This ordinary function remains accepted; the compiler applies no edits or grants.
|
||||
|
||||
## Rejected examples
|
||||
|
||||
```aji
|
||||
module edits.effects
|
||||
fn echo(out: cap<io.write>) -> void effects [] {
|
||||
io.stdout_write(out, b"ok") or trap;
|
||||
}
|
||||
fn main(out: cap<io.write>) -> void effects [io.write] { echo(out); }
|
||||
```
|
||||
|
||||
This remains E3101. An eligible `replace_effects` candidate replaces `[]` with `[io.write]`; it does not introduce `out`, grant authority or run the program. Applying that candidate explicitly and rechecking resolves this example's missing effect.
|
||||
|
||||
```aji
|
||||
module edits.copy
|
||||
fn identity(x: u64) -> u64 effects [] { return move x; }
|
||||
fn main() -> u64 effects [] { return identity(42u64); }
|
||||
```
|
||||
|
||||
This remains E7006. An eligible `remove_copy_move` candidate deletes only `move`. After explicit application and recheck, returning `x` is accepted. The generic version's permitted Copy transfer must not receive this candidate.
|
||||
|
||||
Proposed candidate for the exact UTF-8 effects example above, with LF line endings and its final newline. The hash and offsets must be computed again for any different file bytes; this is not current compiler output:
|
||||
|
||||
```json
|
||||
{"kind":"replace_effects","edits":[{"file":"effects.aji","source_hash":"sha256:fbd3a536e427c7d573a4508e9e0378d65d82b4a73394da0a9c433f3ddcd5569f","range":[65,67],"expected":"[]","replacement":"[io.write]"}]}
|
||||
```
|
||||
|
||||
## Diagnostics impact
|
||||
|
||||
No new codes/kinds in the error registry. Two new non-binding repair candidate kinds, each available only under its explicit source conditions. Existing `suggested_effects`, messages, fields, primary locations, ordering, counts and deduplication remain intact. Existing clients may ignore the extra member of a repair candidate.
|
||||
|
||||
The compiler must serialize typed edit objects in `src/diag.zig`; neither raw JSON strings in ordinary fields nor parsing `message` is an implementation of this contract. Source identity must be preserved across package files. A diagnostic about a compiler-pinned std module must never suggest editing the agent's similarly named local file.
|
||||
|
||||
## Spec integration
|
||||
|
||||
If resumed, revised and accepted, integrate spec 10 §3 (edit schema, stale-input protection, candidates never applied automatically), spec 15 §10 (the two eligibility sets and original-file provenance) and short references from spec 15 §9/§17 where relevant. `reference/error-codes.md` links existing codes to those conditions. Quick Reference receives one short note that candidates are optional and require an explicit patch and recheck. Keep schema/eligibility in a compact table with only necessary invariants and cross-references; RFC rationale and validation checklists must not become repeated normative prose.
|
||||
|
||||
Spec 10 §3 already enters the AIR bundle. It must also enter `diagnostics/errors.md` through `docs/agent/source-bundle.txt`, because the current source bundle includes spec 10 §2/§5 but not §3. Keep the source-specific eligibility rules in spec 15 §10, already included in that page. Do not add RFC rationale or every example to the bundle.
|
||||
|
||||
## Compatibility and migration
|
||||
|
||||
No accepted/rejected set or runtime outcome changes and no AIR/language format increment is required. Kind-only candidates and current diagnostics stay valid. Exact-JSON goldens must be updated for eligible source cases. File paths preserve existing source identity conventions rather than silently canonicalizing them differently. Hashes/offsets refer to original bytes, including CRLF and comments.
|
||||
|
||||
This extension does not expose a CLI flag that repairs programs or changes semantics. Whether an external editor offers explicit candidate application is outside scope; it must honor the stale-input and complete-candidate requirements if it does.
|
||||
|
||||
## Agent complexity impact
|
||||
|
||||
- New concepts: an optional, version-bound text edit candidate; no new Aji programming construct.
|
||||
- Verifier state: none; frontend retains exact token offsets and file/declaration identity, plus file hashes for diagnostics.
|
||||
- Syntax/instructions: none; source syntax and lowering semantics remain unchanged.
|
||||
- Interactions: effect propagation, Copy versus linear/borrow types, generic Copy-transfer exceptions, comments/UTF-8/CRLF, package paths, repeated diagnostics and compiler-pinned modules.
|
||||
- Repairability: reduces location/transcription work for two transformations; cannot establish programmer intent or prevent all follow-up errors.
|
||||
- Existing primitives: already sufficient for correct source; the richer diagnostic API makes existing facts actionable.
|
||||
- New diagnostics: no codes, two candidate kinds.
|
||||
- Current documentation baseline: AIR 46,300 cl100k tokens; following the floating-point clarification, Quick 8,688, other source 64,160, full source 72,848. Draft RFC text is outside the bundles. Measure before/after normative integration in all supported tokenizers, including adding spec 10 §3 to source diagnostics; no token estimate is claimed as measured growth.
|
||||
|
||||
As a diagnostic extension this needs no new `.aji` syntax. Delivery still covers spec, diagnostic API, frontend provenance, verifier attachment, Quick Reference and AIR/source CLI tests together. Neither this document nor its proposed convenience establishes MCC or lower economic cost.
|
||||
|
||||
## Validation plan
|
||||
|
||||
1. Check valid/rejected examples before and after explicit external application; the compiler must leave the rejected original unchanged. Validate original run/check exit codes and unchanged accepted records.
|
||||
2. E3101: multiple missing effects in one function, repeated diagnostics, unrelated declared effects, multiline lists, imported user functions, changed callee contracts, and no candidates for generic/static-policy functions, trusted/unsafe boundaries or compiler-pinned std.
|
||||
3. E7006: Copy scalars/aggregates/frame values, unknown names, borrows, linear/internal values, unrelated restrictions and generic Copy transfers. Only the specified error emits an edit; owners never get implicit move insertion.
|
||||
4. Validate hash, exact expected bytes, half-open offsets, UTF-8 boundaries, CRLF, comments and lexical separation; reject stale input and modified prefix/suffix bytes even when the range text still matches.
|
||||
5. Cover deterministic serialization, retained old fields, original package file identity, optional suppression under ambiguous/missing provenance, and duplicate candidates becoming stale after one application.
|
||||
6. Direct AIR diagnostics keep existing behavior; existing verifier conformance codes/counts and source/AIR ratios remain stable. Run unit/conformance/targeted CLI tests and bundle measurements before marking implemented.
|
||||
7. Measure repair success, retries, follow-up diagnostics, tool calls and total cost including failed attempts on independent public fixtures/tasks. M/C provide regression only and must not select or tune the eligible transformations.
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
- **Top-level ungrouped edits:** obscures whether edits belong to one alternative or several; use the existing `repair_candidates` API.
|
||||
- **Only suggestions as today:** smallest API, but repeats location/transcription work.
|
||||
- **Automatic application / inferred public effects:** violates the explicit proposal/verification boundary.
|
||||
- **Move insertion:** consumes an owner and can invalidate later uses; outside scope.
|
||||
- **Missing arms with `trap`:** selects failure behavior; outside scope.
|
||||
- **Generic template effect edits:** individual specialization feedback is insufficient to choose a universal public contract; outside scope.
|
||||
- **Context plus line/column:** supports ordinary contextual editing better than an isolated short `expected` string; uniqueness, multiline behavior and encoding conventions remain to be specified and tested.
|
||||
- **Explicit application command:** potentially avoids offset scripts without automatic checking-time repair; candidate storage/identity, source scope and stale-input behavior introduce additional tooling work. This alternative is unresolved, not rejected by the current narrow scope.
|
||||
|
||||
## Unresolved questions
|
||||
|
||||
Resumption requires the evidence and workflow review above; the owner must decide adoption. Contextual edit metadata or an explicit application command must be specified in a revised or separate proposal before implementation. Multi-edit candidates, edits for AIR, generic contracts and other diagnostic codes remain outside the retained design. No implicit expansion of eligibility is delegated to implementation.
|
||||
|
||||
## Draft validation
|
||||
|
||||
The three `.aji` blocks were extracted and checked against the current compiler: the valid example accepts, and the two negative examples reject with E3101 and E7006 respectively. Explicitly replacing the first effect list or deleting the Copy move in separate temporary files makes those examples accept. The compiler applied no edit, and the proposed edit schema/eligibility implementation remains pending.
|
||||
Reference in new issue
Block a user