Skip to content

feat(awk): add restricted awk builtin - #599

Draft
matt-dz wants to merge 137 commits into
mainfrom
matthew.deguzman/awk
Draft

feat(awk): add restricted awk builtin#599
matt-dz wants to merge 137 commits into
mainfrom
matthew.deguzman/awk

Conversation

@matt-dz

@matt-dz matt-dz commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

matt-dz commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 72fce59a7a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread builtins/awk/eval.go
Comment thread tests/scenarios_test.go

matt-dz commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0277fc43c0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread builtins/awk/eval.go Outdated
Comment thread builtins/awk/eval.go Outdated

matt-dz commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8be3d36aab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread builtins/awk/parser.go

matt-dz commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ebeecaa8dd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread builtins/awk/awk.go
Comment thread builtins/awk/eval.go Outdated
Comment thread builtins/awk/printf.go Outdated

matt-dz commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd21ece8bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread builtins/awk/eval.go Outdated
Comment thread interp/runner_exec.go Outdated

matt-dz commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc8d45e657

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread interp/runner_exec.go
Comment thread builtins/awk/runtime.go Outdated
Comment thread builtins/awk/runtime.go Outdated

matt-dz commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@matt-dz

matt-dz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

[GPT-5.6] Addressed both findings from the latest Codex review in 27fb75d: negative runtime NF assignments now use the fatal classification and exit 2, and lone/incomplete trailing printf conversions are emitted literally without consuming an argument. Compact scenarios cover both; AWK packages, all AWK scenarios, analysis, formatting, and the Bash comparison pass.

@matt-dz

matt-dz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

1 similar comment
@matt-dz

matt-dz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 27fb75d1c0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread builtins/awk/awk.go Outdated
@matt-dz

matt-dz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

rshell/builtins/awk/eval.go

Lines 868 to 869 in 27fb75d

if len(args) > len(fn.params) {
return value{}, fmt.Errorf("function %q called with too many arguments", fn.name)

P2 Badge Accept surplus user-function arguments

When a call supplies more arguments than the function declares, such as function f(a) { print a } BEGIN { x=0; f(++x, ++x); print x }, GNU awk warns but evaluates both arguments and prints 1 then 2; this precheck instead aborts with status 1 before evaluating either argument. Evaluate all supplied arguments for their side effects, bind only the declared parameters, and allow the function body to run.

AGENTS.md reference: AGENTS.md:L59-L62


if arg >= len(args) {
return "", fmt.Errorf("not enough arguments for printf")

P2 Badge Classify exhausted printf arguments as fatal

When a runtime format requests more values than were supplied, for example BEGIN { printf "%s" } or sprintf("%s"), GNU awk treats the error as fatal and exits 2. This unprefixed error is classified by errorResult as an ordinary failure and exits 1, so callers that distinguish fatal AWK execution errors receive the wrong status.

AGENTS.md reference: AGENTS.md:L59-L62

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@matt-dz

matt-dz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

[GPT-5.6] Addressed both findings in bf3f936b: surplus user-function arguments are now evaluated left-to-right for side effects while only declared parameters are bound, and exhausted printf/sprintf arguments now produce a fatal status 2 error. Added compact scenario regressions for both. Formatting, focused AWK tests, AWK scenarios, analysis tests, and the required Bash-comparison command all pass.

@matt-dz

matt-dz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@matt-dz

matt-dz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf3f936b00

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread builtins/awk/printf.go Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

if sc.SkipAssertAgainstBash || strings.Contains(filepath.ToSlash(path), "scenarios/cmd/awk/") {

P1 Badge Restore reference checks for awk scenarios

When RSHELL_BASH_TEST=1 is enabled, this path check silently excludes every newly added awk scenario, including the compatibility scenarios that do not declare skip_assert_against_bash; therefore the new interpreter's output is never compared with a reference implementation and broad awk regressions can pass CI. Restore the reference-awk oracle or otherwise compare each compatible scenario individually, reserving the per-scenario skip field for intentional divergences.

AGENTS.md reference: AGENTS.md:L70-L74

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@matt-dz

matt-dz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

1 similar comment

matt-dz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9516f811f6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/scenarios_test.go
Comment thread tests/scenarios/cmd/awk/stdin/dash.yaml Outdated

matt-dz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23b579d63e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread builtins/awk/runtime.go Outdated
@matt-dz

matt-dz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6af840cf77

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread builtins/awk/parser.go
@matt-dz

matt-dz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce7724dd3d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread builtins/awk/parser.go
Comment thread builtins/awk/parser.go
@matt-dz

matt-dz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c4fb17a049

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/scenarios_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant