Skip to content

fix(terraform): tf notify-plan says it posts a comment and posts nothing #3644

Closed

Description

@dan-petty

Problem

devops tf notify-plan says that it posts a plan comment to a pull request. It posts nothing.

Evidence

  • The docstring of tf_notify_plan in src/devops_cli/commands/tf.py says "Format and post structured, collapsible OpenTofu/Terraform plan diffs to PR comments."
  • The help of --pr says "Pull Request number to post plan comment to."
  • The command sends no request. It puts pr_number in the JSON payload and prints the comment.
  • The command counts a plan by a fixed text match ("2 to add" in raw_text), and it uses a fixed plan text when the plan file is missing.
  • The MCP tool tf_notify_plan copies these words, so a reader of its schema, such as the review of fix(mcp): pr_check_readiness is read-only in the exposure table but can resolve threads #3235, believes that the tool writes to GitHub.

Expected

The words of the command say what it does, or the command does what its words say.

Acceptance criteria

  1. The docstring, the help of --pr and docs/MCP_TOOLS.md match what the command does.
  2. A test fails when the help says "post" and the command makes no request.

Existing tool considered

None. The change edits the text of one command.

Related

Related: #3235.

Source: #3235

Proposed design

Problem statement

The devops tf notify-plan command says that it posts a plan comment to a pull request. It prints the comment and sends no request. The MCP tool and the catalog repeat the claim. The change makes the docstring, the --pr help and docs/MCP_TOOLS.md say what the command does, and adds a guard test.

Acceptance criteria

Requirement: Docstring says the command prints only

The docstring of tf_notify_plan SHALL say that the command formats and prints the plan comment and sends no request.

Scenario: Docstring holds no write

  • WHEN A test reads the docstring of tf_notify_plan.
  • THEN The docstring names no write verb and says that the command prints the comment.

Requirement: --pr help says no comment is posted

The help of --pr SHALL say that the pull request number appears in the printed output and that the command posts no comment.

Scenario: Rendered help of --pr

  • WHEN A test renders devops tf notify-plan --help.
  • THEN The help of --pr names no write verb and says that the command posts nothing.

Requirement: Catalog describes a printed comment

docs/MCP_TOOLS.md SHALL describe tf_notify_plan as formatting and printing the comment and MUST NOT say that it posts.

Scenario: Catalog row and section

  • WHEN A test reads the tf_notify_plan row and section of docs/MCP_TOOLS.md.
  • THEN Both describe a printed comment and hold no write verb.

Requirement: --plan-file help names the sample

The help of --plan-file SHALL say that the command prints a fixed sample plan when the file is absent.

Scenario: Help of --plan-file

  • WHEN A test renders devops tf notify-plan --help.
  • THEN The help of --plan-file says that the command prints a fixed sample plan when the file is absent.

Requirement: Guard test rejects a write word without a request

A test SHALL fail when the docstring, the help or the catalog row of tf notify-plan names a write and tf_notify_plan sends no request.

Scenario: Guard reads the word post

  • WHEN The guard helper receives the text Post the plan comment to the pull request. and a flag that says the command sends no request.
  • THEN The helper raises an error that names the word post and the text that holds it.

Existing Tool Considered

No check has run. The nearest maintained tools are typer.testing.CliRunner, which renders the help text offline, and pytest, which runs the guard; neither knows what the command does, so neither covers the need. The project writes its own guard helper and one test file, about 60 lines in all. Cost: about 2,000 tokens to write, about 500 tokens for each later fix, and under one hour elapsed.

Key questions

  • Does the fix change the words, or make the command post the comment?: Change the words. The design of fix(mcp): pr_check_readiness is read-only in the exposure table but can resolve threads #3235 records that the command posts nothing and that this issue fixes the help text, and the MCP tool is readOnlyHint: true. (best practice) [sources: openspec/changes/archive/2026-11-05-3235-read-only-mcp-tools-have-no-write-option/design.md:15, docs/MCP_TOOLS.md:141, src/devops_cli/commands/tf.py]
  • Where does the --pr help text live?: HELP.tf.pr in src/devops_cli/lang/en/help.py holds the text, and tf_notify_plan in src/devops_cli/commands/tf.py reads it. [sources: src/devops_cli/lang/en/help.py, src/devops_cli/commands/tf.py]
  • Does the catalog repeat the docstring?: The row at docs/MCP_TOOLS.md:141 and the section at docs/MCP_TOOLS.md:2272 hold the docstring words, so all three change together. [sources: docs/MCP_TOOLS.md:141, docs/MCP_TOOLS.md:2272, src/devops_cli/commands/tf.py]
  • What does the command do when the plan file is absent or missing?: It reads the file when it exists. It prints a fixed sample plan and the fixed counts +2 ~1 -0 when the file is absent or missing. [sources: src/devops_cli/commands/tf.py, tests/commands/test_tf_dry_run.py]
  • Do the words name the sample plan, or does the command refuse a missing file?: Name the sample plan in the help of --plan-file and in the docstring, and keep the behavior. (best practice) [sources: src/devops_cli/commands/tf.py, openspec/changes/archive/2026-11-05-3235-read-only-mcp-tools-have-no-write-option/design.md:15]
    • Chosen: Name the sample plan in the words. The issue asks for the words to match what the command does, and this keeps the behavior that callers use.
    • Rejected: Refuse a missing plan file with an error. It changes behavior that the issue does not ask for, and it can break a caller of the MCP tool.
    • Rejected: Parse the counts from the plan text. It is a separate change with its own tests, and the issue does not ask for it.
  • Where does the guard test live?: Add tests/commands/test_tf_notify_plan_text.py. It checks the docstring, the rendered help and the catalog row in one offline test. (best practice) [sources: tests/commands/test_tf_dry_run.py, tests/ai/mcp/test_fastmcp_contracts.py]
    • Chosen: Add tests/commands/test_tf_notify_plan_text.py. It checks the command text, the rendered help and the catalog in one place, offline.
    • Rejected: Extend tests/ai/mcp/test_fastmcp_contracts.py. It checks the tool schema and does not render the CLI help, so it cannot hold the guard of the --pr help.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-07: none.
Tool: none found.

Activity

  1. added
    source/agent
    on Nov 5, 2026
  2. added
    type/bug
    status/new
    value/medium
    effort/low
    on Nov 5, 2026
  3. dan-petty commented on Nov 5, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: none. The title has the scope tf, and .github/labels.yml declares no scope/tf label. Add the label to the file to give the scope to this item.
    • Priority: P2-Medium. It misleads users and MCP readers but does not break a working feature.
    • Value: Medium. It removes a false promise from help text and the MCP schema that misleads operators.
    • Effort: Low. The change edits the text of one command and adds one test.
    • Related: feat(tf): tf commands list their requests in a dry run and make none #2249, which asks for a different change. Both touch tf commands, but #2249 adds dry-run request plans while the candidate fixes misleading help text and adds a text-behavior test.
  4. added
    priority/p2-medium
    on Nov 5, 2026
  5. added
    status/ready
    and removed
    status/new
    on Nov 6, 2026
  6. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at cda72c7 (see proposed design in issue body).

  7. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The web searches returned no results (no search provider answered), and the only facts I could read are the CLI/test frameworks pytest and typer, which render help text and run assertions but know nothing about whether a command actually sends a request. The need is to make one repository's docstring, --pr/--plan-file help and docs/MCP_TOOLS.md row say that the command prints and posts nothing, plus a local guard test; no open tool or library performs that check, and the issue itself asks for a text edit with an in-tree test.

    Tool: none found

    Lacks:

    • No tool checks that a command's docstring or --help text matches whether the command performs the write it claims
    • No tool keeps the MCP tool catalog row in docs/MCP_TOOLS.md in step with the command docstring
    • The guard helper and its test file are specific to this repository's tf notify-plan command and must be written in-tree
    • Frameworks such as pytest and typer only run assertions and render help offline; they carry no knowledge of what the command does

    Tools considered:

    Searches run:

    • pytest plugin verify docstring documents side effects that code performs, results: 0
    • library that checks CLI help text matches command behavior test, results: 0
    • tool to verify documentation claims match implementation behavior, results: 0
    • typer CliRunner test help text documentation, results: 0
    • pytest CLI documentation test, results: 0
    • click CliRunner help text test, results: 0
    • assert CLI help text does not lie about side effects, results: 0

    Sources:

    Checked on 2026-11-07. A person decides what this means for the item. The check changes no label and closes no issue.

  8. added
    owner/agent
    on Nov 12, 2026
  9. changed the title [-]fix(tf): tf notify-plan says it posts a comment and posts nothing[/-] [+]fix(terraform): tf notify-plan says it posts a comment and posts nothing[/+] on Nov 12, 2026
  10. added
    status/in-progress
    and removed
    status/ready
    on Nov 12, 2026
  11. removed
    status/in-progress
    owner/agent
    on Nov 12, 2026
  12. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor
  13. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-12 08:07 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions