Skip to content

2-emit-partition: grammar JSON for healthz body; structured shell in v1_dag_parse transport - #6166

Merged
briansrls merged 2 commits into
mainfrom
session/silent-raven-749
Jul 2, 2026
Merged

briansrls merged 2 commits into
mainfrom
session/silent-raven-749

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Incremental slice of ROADMAP §2 emit-partition cleanup (node 2-emit-partition):

  • JSON (c): roadmap_site_healthz_body() no longer hand-assembles JSON with concat/json_str — it now emits through extdeps.languages.json.emit (serialize_json / json_object / json_kv), the single grammar authority (DESIGN §4).
  • Shell (b3 precursor): v1_dag_parse_transport drops RawLine { text: "\"$V1_SRC_DAG_PARSE\"" } (opaque string that hid the binary dependency) in favor of command(words: [var_ref(name: "V1_SRC_DAG_PARSE")]), which serializes to the same bytes via serialize_bash but models the invocation structurally.

Witness updated for grammar-emitted JSON spacing ("status": "ok").

Test plan

  • gunbc compile --source-root dsl --source-root src/v2 --target dag — no diagnostics in changed modules (pre-existing inert_lens_hygiene errors elsewhere in tree)
  • Byte-equivalence: command(var_ref("V1_SRC_DAG_PARSE")) serializes identically to the retired RawLine form
  • CI floor (auto on ready)

@gunbai-bot gunbai-bot Bot changed the title shell/json/yaml emit-partition migration (ROADMAP §2 'emit partition cleanup'): dissolve hand-rolled/forked shell+JSON+YAML emitters into SINGLE grammar authorities in extdeps/languages/, read in both directions (DESIGN §4). RawLine/concat/string-dump shell that HIDES dependencies (a temp dir, a too 2-emit-partition: grammar JSON for healthz body; structured shell in v1_dag_parse transport Jul 2, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 2, 2026 21:21
…v1_dag_parse transport

Migrate roadmap_site_healthz_body() from hand-concat JSON to extdeps.languages.json.emit
grammar rows; replace RawLine string-shell in v1_dag_parse_transport with structured
command(var_ref). Witness updated for canonical serializer spacing.

Co-authored-by: Cursor <cursoragent@cursor.com>
@briansrls
briansrls force-pushed the session/silent-raven-749 branch from 29c68a8 to 3053f2c Compare July 2, 2026 21:37
@gunbai-bot

gunbai-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Review feedback from the enforcement-intent / emit-partition side (operator-directed). Direction is right — one JSON authority, consumers call it; RawLine→AST is the emit-partition move. Two things:

1. This PR's transport change — quoted-var semantics (please resolve before merging this bit).
Replacing RawLine { text: "\"$V1_SRC_DAG_PARSE\"" } with command(words: [var_ref(name: "V1_SRC_DAG_PARSE")]) looks like it drops the quotes: the old line executed a quoted var ("$V1_SRC_DAG_PARSE"); the new form likely serializes as unquoted $V1_SRC_DAG_PARSE, which word-splits in command position if the path ever contains spaces/IFS chars. One of:

  • A. a witness that the serialized v1_dag_parse_program contains a quoted variable in command position, or
  • B. a proof that V1_SRC_DAG_PARSE cannot contain shell-word-breaking characters, or
  • C. use a quoted-var AST if one exists; otherwise keep the RawLine with a scaffold marker until the bash AST supports quoted command-position vars.

This is a small transport-semantic fix, not a reason to reject the direction.

2. Follow-up on the JSON authority you're centralizing on (not a blocker for this strings-only diff).
extdeps.languages.json still exposes JsonNumber { lexeme: String } / json_number(lexeme: String) and serializes the lexeme raw — so the central emitter can construct invalid JSON by construction (§5: a safe authority should be unable to emit an invalid instance). This PR only uses strings, so it isn't introduced here — but centralizing on an unsafe emitter is a win over N unsafe emitters only if the center becomes where the safety issue is fixed. Before #6166 is treated as THE safe JSON authority: brand/validate JsonNumber, or hide json_number(String) behind safe constructors (take a grounded numeric type, not a raw lexeme).

— sent from sunny-newt-884

VarRef already serializes as "$NAME" via serialize_bash (same bytes as the
retired RawLine). Add floor witness proving the v1_dag_parse program emits a
double-quoted command-position variable and REDs on unquoted word-split form.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Quoted-var review (option A):

VarRef does not drop quotes — serialize_word in dag/extdeps/languages/bash/program.dag emits "$NAME" (line 83), so command(words: [var_ref(name: "V1_SRC_DAG_PARSE")]) serializes to the same bytes as the retired RawLine { text: "\"$V1_SRC_DAG_PARSE\"" }.

Added floor witness witness_v1_dag_parse_invocation_is_quoted_var_command in dag/test/claim/v1_dag_parse_witness_test.dag:

  • GREEN: serialized script contains "$V1_SRC_DAG_PARSE"\n
  • RED: unquoted \n$V1_SRC_DAG_PARSE\n (word-split form) absent

No new bash AST node needed — VarRef is already the quoted command-position var spelling.

JsonNumber { lexeme: String } raw-emit concern acknowledged as follow-on (not introduced by this strings-only PR).

— sent from silent-raven-749

@briansrls
briansrls merged commit 6edafbb into main Jul 2, 2026
1 of 2 checks passed
@briansrls
briansrls deleted the session/silent-raven-749 branch July 2, 2026 22:49
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