Skip to content

fix(cli): carry sdk.discovery-divergent into the text channel, and give tan run a --confirm - #833

Merged
alpCaner merged 6 commits into
devfrom
fix/799-809-envelope-run
Aug 17, 2026
Merged

fix(cli): carry sdk.discovery-divergent into the text channel, and give tan run a --confirm#833
alpCaner merged 6 commits into
devfrom
fix/799-809-envelope-run

Conversation

@alpCaner

Copy link
Copy Markdown
Contributor

Summary

#799sdk.discovery-divergent never reached the text channel.

The warning is appended inside Envelope.__init__ (via _with_sdk_divergence), but size, image, clean, run and validate each construct the Envelope only inside their if json_mode: branch and render text from a pre-envelope issues local. So a user running any of those five without --format json was never told that two alp-sdk checkouts resolve from their directory and both report sourceTier "discovery" — the exact condition the warning exists to surface.

pinmux_cmd.py was already correct: it builds the Envelope once, unconditionally, and renders text from envelope.issues. The five commands now follow that pattern.

#809 — the README quickstart's tan run --flash could not arm the confirm gate.

The quickstart, the walkthrough step and the Common-commands table all document tan run --flash, and grep -n -i confirm README.md returned zero hits. But run had no --confirm option and never passed confirm_flag, so on an E1M-AEN801 Flow D target every slice came back planned, flash.nothing-flashed fired, and the command exited 1 — while printing a remedy whose first suggestion is --confirm on the command line, a flag tan run rejects. The only working command-line route was the separate tan flash --confirm subcommand.

run now accepts --confirm and threads it through as confirm_flag, so the printed remedy is self-consistent, and the README documents the gate at all three places. The gate itself is unchanged and still closed by default — this only gives run a way to arm it explicitly, plus honest docs. --flash's own help now names the second opt-in too, rather than promising a write it cannot perform alone.

Test plan

  • python -m pytest tests/gates -q from python/: 465 passed, 9 skipped.
  • Full suite FAILED-set diffed against origin/dev under identical conditions: 22 vs 22, difference empty in both directions. Collect-only diff: +10 tests, 0 removed.
  • Red-green verified by reverting each production file and confirming the matching test fails: reverting run_cmd.py reddens the four new run tests plus the [run] divergence case; reverting clean_cmd/image_cmd/size_cmd/validate_cmd reddens [clean] [image] [size] [validate].
  • python python/scripts/assemble_changelog.py --check now lists both fragments (7 pending).

Two defects caught in review, recorded because they were nearly shipped

Both were tests that could not fail — worth knowing about, since one was on a flash-path flag:

  1. The first revision's "warning:" assertion shipped red for the validate parametrization: the other four commands print f"{issue.severity}: {issue.message}" but validate_cmd wrote a bare f"{issue.message}". Fixed by giving validate's seam-added sdk.* lines the severity prefix, so all five commands are consistent.
  2. The --confirm-on-help assertion was vacuous — deleting the entire typer.Option(False, "--confirm", …) block and the call-site forward left it green, because the amended --flash help text itself contains the literal string --confirm. It now asserts against the real parser, verified red-green by removing the option and watching it fail.

Closes #799.
Closes #809.

@alpCaner alpCaner added this to the v0.6.0 milestone Aug 16, 2026
@alpCaner alpCaner added bug Something isn't working documentation Improvements or additions to documentation flash-path Touches a code path that writes real hardware envelope-contract The {command,ok,exitCode,project,data,issues} contract consumed by alp-sdk-vscode labels Aug 16, 2026
@alpCaner
alpCaner added this pull request to the merge queue Aug 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Aug 16, 2026
@alpCaner
alpCaner force-pushed the fix/799-809-envelope-run branch from fe83560 to 1e12c1e Compare August 17, 2026 00:25
@alpCaner
alpCaner added this pull request to the merge queue Aug 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Aug 17, 2026
Caner Alp added 6 commits August 17, 2026 01:12
… give run --confirm

Fixes #799: size/image/clean/run/validate each constructed their Envelope
only inside `if json_mode:` and rendered text from a local issues/text list
built strictly before that -- so the sdk.discovery-divergent warning
Envelope.__init__ appends at its one shared seam reached --format json and
stayed silent on the default text channel. pinmux_cmd.py was already correct
(builds the envelope once, unconditionally, renders text from
envelope.issues); this applies the same pattern to the other five, diffing
each command's pre-envelope issues against envelope.issues so only what the
seam actually added is rendered.

Fixes #809: `run` had no way to arm the flash confirm gate, so a hardware
target (e.g. E1M-AEN801 Flow D) always landed every slice as `planned` and
exited 1 with flash.nothing-flashed -- whose own remedy names --confirm, a
flag `run` rejected. Adds --confirm to `run` and threads it into
flash_cmd._run as confirm_flag, and updates the README quickstart,
walkthrough step, and Common-commands table to show and explain the gate.
The gate itself stays gate-by-default, unchanged.
… close the help gap, scope the envelope build, pin the divergence text

Adds the missing tests for #809's --confirm plumbing (run --flash --confirm
reaches flash_cmd._run with confirm_flag=True, defaults to False when
omitted, and --confirm is on run's --help), amends --flash's own help text
to name the second opt-in it gates, scopes validate_cmd's now-unconditional
Envelope/data construction to the TEXT/JSON branches so sarif/diagnostic-v1
stop paying for _with_sdk_divergence's filesystem walk, and pins the
narrow-text-channel divergence assertion to a stable phrase plus the
warning: severity prefix instead of just the two checkout paths.
…ious rebase pass

The previous rebase's merge-resync entry double-counted growth in
clean_cmd.py/size_cmd.py/validate_cmd.py that is already fully
accounted for by this branch's own three tan-cli#799 ledger entries
directly above it. origin/dev never touches those three modules, so
there was no genuine merge growth left to resync; the line was a
stale artifact of the earlier rebase pass, not a real regen event.
@alpCaner
alpCaner force-pushed the fix/799-809-envelope-run branch from 1e12c1e to c8bfddf Compare August 17, 2026 01:15
@alpCaner
alpCaner added this pull request to the merge queue Aug 17, 2026
Merged via the queue into dev with commit 2244a66 Aug 17, 2026
33 checks passed
@alpCaner
alpCaner deleted the fix/799-809-envelope-run branch August 17, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation envelope-contract The {command,ok,exitCode,project,data,issues} contract consumed by alp-sdk-vscode flash-path Touches a code path that writes real hardware

Projects

None yet

1 participant