Skip to content

fix(phala): consume normalized CLI inventory - #51

Merged
2xburnt merged 1 commit into
mainfrom
work/burntbot/fix-phala-cli-schema-20261026T153229Z
Oct 26, 2026
Merged

2xburnt merged 1 commit into
mainfrom
work/burntbot/fix-phala-cli-schema-20261026T153229Z

Conversation

@2xburnt

@2xburnt 2xburnt commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem and confirmed cause

Part of DO-513.

The first TeeLS release attempt stopped before deployment: run 40218564159. Both its preflight and this reusable workflow treated phala@1.1.20 cvms list --json as raw CVM API {name,id} records. That CLI actually normalizes rows to {cvmName,appId,status,uptime}. The exact-name selector therefore reports zero even for a visible, correctly named CVM; simply repairing the caller would leave this deployment step broken too.

Published package provenance: phala@1.1.20, gitHead 502a06186f27f36eda2b85c9d97f19ce73648755; normalizer source. Its deploy --cvm-id accepts application identifiers, not only CVM UUIDs.

Change

  • Count exact cvmName matches and obtain the normalized appId.
  • Validate the entire application ID as 40 lowercase hex characters, then update via --cvm-id app_<id>.
  • Preserve release no-create, duplicate-name rejection and candidate-only creation.
  • Correct the existing shell-execution fixtures to the real CLI schema; cover missing/duplicate/malformed IDs and names, including multiline IDs. No new dependencies or schema knobs.

The old tests passed because their fabricated raw-API shape matched the broken jq selectors; the corrected fixture fails on the old workflow.

Verification

  • node --test --test-name-pattern='Phala never creates' tests/workflows.test.mjs: RED on old selectors, GREEN after fix, RED again with selectors reverted, GREEN restored.
  • pnpm run check: formatting, 87 tests and actionlint pass.
  • pnpm run build: succeeds, generated bundle unchanged.
  • Independent diff/security review: no significant finding; its malformed multiline-ID edge case was reproduced RED and fixed with a whole-string Bash validation.

Floor exceptions

The mechanical guard reports three removed assertions in tests/workflows.test.mjs. Each is replaced, not dropped: has no id becomes has no valid app id; the error assertion covers missing, duplicate and invalid-ID failures; existing.id becomes the actual app_<existing.appId> update argument. New negative cases strengthen these gates. No ignore-file or checker suppression added.

Integration and limits

The paired caller fix is teels-internal#118; it deliberately remains a draft until this fix is released and the consumer pin advances. This draft does not deploy or change credentials. A separately approved central release and consumer pin advance are required before TeeLS can execute it; do not point consumers at an unpublished SHA or weaken either no-create guard. Existing policy-tool and internal quality pins are unchanged because neither dependency changed. CI-key workspace visibility is still a separate read-only preflight, not a proven credential failure. No production dispatch/rerun is authorized by this PR.

Phala 1.1.20 emits cvmName/appId, not raw name/id. Both exact-name matching and update identity were reading absent fields. Use the normalized application id for in-place updates and keep release no-create fail-closed. Exercise the actual deployment shell with the CLI schema and malformed-ID cases.
Copilot AI balanced review requested due to automatic review settings October 26, 2026 15:47

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@burnt-tribunal burnt-tribunal 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.

Tribunal Summary

No findings survived review, and nothing in the diff warrants holding this PR. You correct the Phala deployment workflow to consume normalized CLI inventory, validate application IDs, and update existing CVMs while preserving candidate-only creation. The updated shell-execution tests cover the corrected schema and rejection paths for duplicate names, missing or malformed IDs, and raw-API records.

Confidence Score: 5/5

The workflow change is narrowly scoped, preserves duplicate-name rejection and candidate-only creation, and has shell-execution coverage for successful updates and invalid inventory. No surviving findings or additional merge blockers were identified in the supplied diff.

Changes:

  • Select existing CVMs by normalized cvmName and deploy updates using app_ identifiers
  • Validate application IDs as 40 lowercase hexadecimal characters before deployment
  • Update inventory fixtures and extend failure-path coverage while retaining release no-create assertions

Reviewed changes

Tribunal reviewed 2 of 2 changed files.

Important Files Changed
File Overview
.github/workflows/phala-deploy.yml Use normalized cvmName/appId inventory and validate application IDs before targeting existing CVMs for updates
Other Files Changed
File Overview
tests/workflows.test.mjs Align shell-execution fixtures with normalized CLI inventory and test duplicate names, invalid IDs, and release no-create behavior
🗺️ Phala deployment selects normalized inventory, validates app IDs, and preserves candidate-only creation.
flowchart TD
    A["phala cvms list"] --> B["jq: exact cvmName matches (changed)"]
    B --> C{"Match count?"}
    C -->|"Multiple"| X["Error and exit"]
    C -->|"One"| D["jq: read appId (changed)"]
    D --> E{"40 lowercase hex characters? (new)"}
    E -->|"No"| X
    E -->|"Yes"| F["target: --cvm-id app_ID (changed)"]
    C -->|"Zero"| G{"TARGET_ROLE is candidate?"}
    G -->|"No, never create release"| X
    G -->|"Yes"| H["target: -n CVM_NAME"]
    F --> I["phala deploy --wait"]
    H --> I
Loading

What you do with these findings feeds back into how this reviewer behaves — committing a suggestion makes it bolder, rejecting noise makes it quieter. Reply to any finding with a reason to teach it faster.

@2xburnt

2xburnt commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Replied: this reports review availability, not a code finding. Copilot has not reviewed this head; no billing or quota settings changed.

No findings survived review, and nothing in the diff warrants holding this PR.

Replied: checked the reviewed diff at f2277294d7474861c9df92b99085ab5ef0cb55fc; Tribunal requests no code changes and there are no unresolved inline threads. Policy and Quality checks passed on that same head. Keeping this PR in draft under the existing integration plan; merge, shared-flow release, caller pin advancement and production cutover remain separate steps. No deployment or rerun performed.

@2xburnt
2xburnt marked this pull request as ready for review October 26, 2026 16:39
@2xburnt
2xburnt requested a review from a team October 26, 2026 16:39
@2xburnt
2xburnt merged commit 04956fd into main Oct 26, 2026
2 of 3 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T16:40:51.623425Z f227729 Draft marked ready
🔒 Security Review 🔄 Running since 2026-10-26T16:39:55.811146Z f227729 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

2 participants