The oracle's package translator accepts a local operand that names a guard step

Open
#377 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
backend

Research direction

Read crates/ambyte-oracle/src/package/translate.rs and its operand lookup, then find the package translation tests. Start by adding the two-requirement case where the second compares local "" with an input field; verify it currently translates successfully. Pin the edge cases for read bindings and comparison results as the issue requests, and confirm the retained package still has the same events and bound, 1,048,584.

Written by the indexing model from the issue text.

Description

enhancement release:target-ir
.dag: issue-dag/2
.id: ambyte-lang/ambyte#377
.kind: task
.type: bug
.blocked_by: []
.size_hours: 1

Bug

You are the engineer for this issue. Read all sections of this issue.
Write tests from section 2c (Test Plan) first. Make sure that they fail before you write the code.
Write the code from section 2b. Make sure that all tests pass.
Make sure that each item under Acceptance is true.
Do not change anything that Out of scope names.
Read AGENTS.md and the project's code conventions before you change code.
Run the project's checks as AGENTS.md or the README gives them. Do not use --no-verify.
Open a draft pull request. Link this issue. Write progress comments on the pull request.
Make the pull request ready only when every item under Acceptance and in the Definition of Done is true and CI passes.

Outcome

The reference oracle's package translator refuses a local operand that does not name a value.

Scope

  • In crates/ambyte-oracle/src/package/translate.rs, operand lookup accepts a local operand only when it names an earlier step that produces a value.
  • A test that fails first: a package with two requirements, the second comparing the local "" with an input field. Today translation succeeds; it must be refused.

Out of scope

  • Any change to a tariff price, to the bound recurrence or to the observation of an accepted plan.
  • Widening or narrowing the translator's accepted program forms in any other way.
  • The package's bound fields: flyingrobots/amblicit#376.

Prerequisites

None.

Safe intermediate state

The translator refuses one malformed shape it accepted before. The retained package is unaffected: it has one requirement and no such operand.

Acceptance

  • local_operand_naming_a_guard_step_is_refused fails before the change and passes after; the pull request quotes both runs.
  • The retained package still translates to the same events and the same bound, 1,048,584.
  • Whether an operand may name an earlier requirement's generated <id>/predicate result is stated in the translator's documentation, with a test either way.

1. Background Context

At f04228df, every translated guard is appended as Op::Require with an empty name (translate.rs:335-339). Operand lookup accepts a local operand that matches the name of any earlier plan step (translate.rs:350-358), and the artifact reader accepts empty text (artifact.rs:55-59).

2. Problem Description

A second requirement whose operand is {"kind":"local","ref":{"id":""}} passes the lookup by matching the preceding guard, which yields no value. This was observed by reading the source during the review of Echo's ruling on the bound U (flyingrobots/echo#1051); it was not run. What plan admission or evaluation then does with such a plan was not traced.

2a. Reproduction

Not run. Expected reproduction: translate a package whose intent has two requirements, the second with the operand above; translation returns a plan.

2b. Proposed Solution

Look operands up among value-producing steps only, or refuse empty names for locals. Rejected: leaving it and relying on later stages, because the translator is the oracle's reader and its refusals define the domain Echo's is compared with.

2c. Test Plan

Golden: the test above.
Edges: a local naming a read binding (accepted); a local naming a comparison result (decide and pin); a local naming nothing (refused today).
Known failure modes: a fix that also refuses the retained package; the second acceptance item guards against it.
Fuzz and stress: not applicable, because the cases are enumerated.

3. Why now

Low urgency. It does not affect witness W9's retained program. It is recorded so the oracle's accepted domain is what its documentation says.

4. Risks

None for the retained program.

5. Definition of Done

Acceptance true.

6. Stakeholders

flyingrobots (owner); Ambyte maintainers.

7. Related Issues

flyingrobots/echo#1051, flyingrobots/amblicit#376.

Dominant language
Rust
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from flyingrobots/edict

All issues in flyingrobots/edict

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.