Skip to content

Harden clarification provenance validation#679

Merged
SoundBlaster merged 1 commit into
mainfrom
codex/0210-clarification-contract-hardening
Jul 9, 2026
Merged

Harden clarification provenance validation#679
SoundBlaster merged 1 commit into
mainfrom
codex/0210-clarification-contract-hardening

Conversation

@SoundBlaster

Copy link
Copy Markdown
Member

Summary

Motivation

  • Why is this change needed? Late review identified stale source reuse and readiness edge cases after Add fallback-free real intake clarification templates #678 merged.
  • What problem, gap, or user need does it address? It prevents a stale answer template or intake session from authorizing continuation and keeps closed clarification rows from becoming false answer requirements.

Goals

  • What should this PR achieve? Bind templates to the current clarification request digest, verify the current intake session before no-answer continuation, validate suggested browser answer shapes, and preserve explicit clarification outcomes.
  • What is intentionally out of scope? No new clarification policy, authority expansion, canonical spec mutation, or UI redesign.

Changes

  • Validate template request refs, digests, workspace identity, and supported answer shapes in authoring and SpecSpace import preview.
  • Verify current intake-session provenance for no-answer continuation and ignore already-closed request rows when building answer targets.

Spec Evidence

For SpecGraph logic/tooling changes, cite at least one existing SG-SPEC-####
or proposal ####. PR body is preferred; commit trailers with the same fields
are accepted. For a true no-impact change, use Spec-ID: NO-SPEC-IMPACT and
provide a rationale.

Spec-ID: SG-SPEC-0057
Proposal-ID: 0210
Spec-Impact: lifecycle
Spec-Rationale: Hardens the provenance and readiness invariants introduced by the fallback-free real-idea clarification contract.

Validation

  • Tests added/updated for changed behavior
  • Local checks passed

Commands run:

.venv/bin/python -m pytest -q tests/test_real_idea_answer_authoring.py tests/test_idea_to_spec_clarification_requests.py tests/test_specspace_real_idea_answer_handoff.py tests/test_idea_intake_clarification_rerun.py
make test
.venv/bin/python tools/python_quality.py
make proposal-tracking-gate
make docc-sync
make publish-bundle

Results:

  • Targeted: 68 passed.
  • Full suite: 1839 passed.
  • Python quality, proposal tracking, DocC sync, and public bundle safety passed; bundle contained 1337 files.

Risks / Notes

  • Backward compatibility impact: Existing valid templates remain accepted; stale or under-specified templates now block continuation.
  • Migration/config changes required: None.
  • Known limitations: No changes to the visual clarification authoring layout.

Checklist

  • PR title clearly describes the change
  • Scope is focused and minimal
  • Documentation updated (or N/A)
  • Workflow/artifact changes distinguish presence from readiness/status
  • Consumers prefer authoritative repaired/promoted/latest artifacts where relevant
  • Temporary or intermediate paths are scoped to the current run/task where relevant
  • No secrets or sensitive data added

@SoundBlaster SoundBlaster merged commit 67be811 into main Jul 9, 2026
6 checks passed

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

if _list(requests.get("clarification_requests")):
findings.append("clarification_requests.requests")

P2 Badge Ignore closed rows during no-answer verification

When the current clarification report has no open requests but still retains closed rows such as preview_applied (the new closed-row behavior exercised by test_closed_clarification_rows_are_not_required), build_template now produces a ready clarification_not_required template with no answer targets, but verify-no-clarification still fails solely because the request list is non-empty. This blocks real-idea-intake-continue-without-answers for the closed-only report shape this change now treats as 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (
"answer_question" in supported_actions
and shape
and not any(token in shape for token in SUPPORTED_BROWSER_ANSWER_SHAPE_TOKENS)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Treat text answer shapes as browser-answerable

When idea_to_spec_clarification_requests._question_answer_shape emits the existing active-frame shapes like "text" or "text | structured_context" (for example the subsystem clarification covered in tests/test_idea_to_spec_clarification_requests.py), this new token check rejects the otherwise supported answer_question request because the token set only includes "plain text" / "structured context". That makes build_template mark those intake/event-storming clarification requests as clarification_blocked, so operators cannot answer valid browser-renderable text questions.

Useful? React with 👍 / 👎.

Comment on lines +689 to +693
real_idea_answer_authoring.template_request_binding_findings(
template=template,
clarification_requests=clarification_requests,
requests_path=requests_path,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bind SpecSpace imports to the intake session workspace

When the selected SpecSpace answer state and rows match intake session B but their recorded refs point at template/requests from workspace A, _validate_refs passes because those refs match the selected A files, and this new binding only checks that the A template matches the A requests. The preview can therefore become ready and later apply A's clarification answers to B's raw intake session; include the intake session/workspace in this binding so cross-workspace artifacts cannot be selected as current intake evidence.

Useful? React with 👍 / 👎.

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