Skip to content

refactor(planning): simplify the interview surface server - #14782

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14693-42645297255-1
Nov 9, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14693-42645297255-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #14693

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Simplified plugins/planning/surface/interview_server.py without changing its behavior. Hub.record now builds its responses entry with the existing decision_view helper instead of an inline copy of it. A new history_line helper replaces three hand-built copies of the user history line (record, the accept-audit loop, rebuild_responses). A Hub._setting helper reads one resolved setting for lease_timeout, reading_window and frontier_lock. setting_error merges its int and num branches and builds the expected-value text without the dict of conditional f-strings. plugins/planning/surface/question_shape.py is left unchanged: it is 33 lines with no duplicated logic, and none of the four /simplify checks found an edit that would make it shorter or clearer. Each chosen edit dedupes code inside one file, so the out-of-scope cross-file dedupe stays for the restructuring pass.

Not verified

  • Python test suites for plugins/planning/surface (test_interview_server.py, test_exporters.py) were not executed: this lane runs no interpreter. Left to the PR's CI.
  • ci-status green is a PR CI check, left to the PR's CI.
  • tidy pass 5 (/ai-slop:audit fix on the changelog fragment) skipped: its detect.sh and digest-guard.sh are not among the wrappers this lane may run. A manual read of the one mandated line found no AI-writing tell.
  • Reviewer note, malformed data only: Hub.record now reads the previous response's text for every decision kind, not only for a blank reopen. With a hand-corrupted responses.json holding a non-object at responses[qid], a reopen with non-blank text would now raise instead of succeeding. The server…

Fix

  • plugins/planning/surface/interview_server.py: reuse decision_view in Hub.record; add history_line and use it in record, the accept-audit loop and rebuild_responses; add Hub._setting for lease_timeout, reading_window and frontier_lock; merge setting_error's int and num branches. Net about 70 lines…
  • .changes/planning/work-resolve-issue-issue-14693-42645297255-1-4c26454b.md: new planning patch fragment, created with new-changelog-fragment planning patch, body '### Changed' and 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against d790a7c:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: All 1 changelog fragment(s) under .changes/ are valid (run before and after tidy).
  • check-changed-skills: no changed skills under plugins/*/skills/, nothing to gate (run before and after tidy).
  • check-affected: 13 passed, 6 skipped over 2 changed files (run before and after tidy).
  • fresh-context review subagent over the whole diff: no behavior difference for any well-formed input; dict key order of the responses entry and history lines unchanged; no test in plugins/planning (test_interview_server.py, test_exporters.py) asserts in a way the change breaks.
  • tidy-diff over 13 hunk rows: passes 1-4 found nothing to edit; pass 5 skipped (see not_done).
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42645297255

Left out: the items under Not verified.

Related

#14693

Merge-Risk: max=MEDIUM demote=false head=d790a7c6657607242363a0460514b14a93d7ad38 rubric=8.1.6 rater=claude-opus-5-5 checker=claude-opus-5-5

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed d790a7c6657607242363a0460514b14a93d7ad38: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14782 (refactor(planning): simplify the interview surface server)

I found no security issues.

I read every hunk of both changed files. Neither file matches a trusted path.

  • .changes/planning/work-resolve-issue-issue-14693-42645297255-1-4c26454b.md: a changelog fragment that is prose only.
  • plugins/planning/surface/interview_server.py: an in-file refactor of the loopback interview server.
    • setting_error merges its int and num branches. The type checks (bool is still rejected) and the range bounds are the same as before, so settings validation is no looser.
    • The new history_line helper and the reuse of decision_view in Hub.record copy the same fields from an event that record has already validated (
      qid, kind = msg.get("id"), msg.get("kind")
      if not isinstance(kind, str) or not isinstance(qid, (str, type(None))):
      raise ValueError("id and kind must be strings")
      if not isinstance(msg.get("text"), (str, type(None))):
      raise ValueError("text must be a string")
      for key in ("contentRev", "undoSeq"):
      v = msg.get(key)
      if v is not None and (not isinstance(v, int) or isinstance(v, bool)):
      raise ValueError(f"{key} must be an integer")
      text = msg.get("text") or ""
      alt = msg.get("alt")
      if kind not in DECISIONS | REQUESTS | FREE | WITH_ALT | {"undo"}:
      raise ValueError("unknown kind")
      doc = load_json(self.questions, {"questions": []})
      qs = {q.get("id"): q for q in doc.get("questions", [])}
      if kind in FREE:
      qid = None
      elif kind != "undo" and qid not in qs:
      raise ValueError("unknown question")
      if kind in ("own", "ask", "note", "hedged") and not text.strip():
      raise ValueError(
      "text required: say the condition"
      if kind == "hedged"
      else "text required"
      )
      if kind == "hedged" and len(text) > LINE_CAP:
      raise ValueError(f"text too long: at most {LINE_CAP} characters")
      items = check_accept_audit(msg) if kind == "accept-audit" else None
      ahead = check_out_of_order(msg)
      now = now_iso()
      extra = {}
      with self.cond:
      if kind == "confirm-understanding":
      check_understanding(
      load_json(self.questions, {}), alt, text, msg.get("contentRev")
      )
      r = load_json(self.responses, EMPTY_RESPONSES)
      for k, v in EMPTY_RESPONSES.items():
      r.setdefault(k, json.loads(json.dumps(v)))
      if kind == "proposal":
      check_proposal(qs[qid], alt, text, r["events"])
      elif kind in DECISIONS and proposal_answer(qs[qid], r["events"]) in (
      "pending",
      "decline",
      ):
      raise ValueError(
      "a proposed question takes no decision: accept or edit the proposal first"
      )
      elif (
      kind in ("accept", "hedged")
      and qs[qid].get("proposed")
      and not qs[qid].get("recommendation")
      ):
      raise ValueError(
      "no recommendation to accept yet: Claude writes it after the proposal's "
      "accept or edit"
      )
      if kind in DECISIONS:
      check_retired(qs, qs[qid])
      event = {
      "seq": r["seq"] + 1,
      "id": qid,
      "kind": kind,
      "alt": alt if kind in WITH_ALT else None,
      "text": text,
      "at": now,
      }
      ). alt now comes from event["alt"], which is only set when kind in WITH_ALT, so the request's raw alt is not passed through more widely than before.
    • Hub._setting only factors out the lookup for lease_timeout, reading_window and frontier_lock. The frontierLock value that decides the hard-block check is resolved the same way as before.
    • The change adds no input path, no shell, file or path use, and no network exposure.

Nothing in the diff touches a trust control, a merge hold, a plugin manifest, a workflow or an instruction surface. The PR context contains no embedded directives aimed at the review.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed d790a7c6657607242363a0460514b14a93d7ad38: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

I read the full diff (both changed files) and checked each refactor against the head code in plugins/planning/surface/interview_server.py. I did not run any tests, because this lane has no interpreter. The test results quoted in the PR body are the author's claims and I have not verified them.

Equivalence checks

  • setting_error (int/num merge): For both kinds, the type check, the bool exclusion and the range check work as before. For an unknown kind, the old code raised KeyError in the dict lookup that builds the expected-value text, and the new code raises the same KeyError from its else dict. The message text is unchanged for all five kinds.
  • Hub.record → decision_view(event, prev.get("text", "")):
    • event["alt"] is alt for kind alt, because alt is in WITH_ALT.
    • event["at"] is now and event["seq"] is seq.
    • The text fallback for a reopen is unchanged.
    • Key order is the same.
  • prev.get side effect: prev.get is now evaluated for every decision, not only for a blank reopen. The only effect is on a hand-corrupted responses.json that holds a non-object at responses[qid], which the author already flags. I am not counting it as a finding.
  • history_line: The output is identical in record, where event["text"] is the local text, event["alt"] was the value read before, and the kind stays undo after _undo. It is also identical in the accept-audit loop (text is "", alt is None) and in rebuild_responses, where kind was e.get("kind") before as well. Key order is the same, and undoSeq is still added last.
  • Hub._setting: lease_timeout, reading_window and frontier_lock read the same resolved value as before.

Closing issue #14693 acceptance criteria

  • Behavior unchanged: Met, per the checks above. Existing tests in test_interview_server.py cover settings validation (for example L4100–4106 and L3428) and the record / undo / accept-audit paths.
  • Diff edits only the listed files plus a fragment: Met. question_shape.py is left unchanged, and the PR explains why.
  • Within 400 changed lines and 15 hand-edited files: Met.
  • ci-status green: CI decides this. I can't verify it from here.
  • Fragment: Met. .changes/planning/... has bump: patch, ### Changed, and the line "Internal simplification, no behavior change."

Neither changed file matches a trusted-path glob. Nothing in the PR context reads as an instruction to this lane.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head d790a7c6657607242363a0460514b14a93d7ad38, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for d790a7c

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-14782-d790a7c6657607242363a0460514b14a93d7ad38, expires on 2026-12-09.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 5ca6283 Nov 9, 2026
69 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14693-42645297255-1 branch November 9, 2026 20:57
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.

Simplify the surface planning plugin code

0 participants