Repository navigation
Phase1 implementation - #1
Merged
Merged
Conversation
… attribute-level authority, and pre-plan guards
…ROR, live E2E tests, guard bypass tests
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Critical security and integrity findings remain unresolved, along with moderate correctness and test-coverage issues.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 8
Open (14)
Editor Team validation accepts trailing newlines · New Non-dict verdicts bypass gate validation · New Canonical and verdict artifacts are not bound to the plan hash · New Pre-existing .terraform directories allow untrusted plugins · New Arbitrary tf.json files bypass Terraform resource scanning · New Poisoned default bypasses live intent attribute checks · New Team validation accepts trailing newlines · New Confirmed integrity hash omits persisted intent · New Repeated homeState renders leak observers and frame callbacks · New Optional tag introducer captures incorrect values · New Ollama connection failures are misclassified as ambiguous requests · New Non-object JSON model responses cause HTTP 500 · New Broad TypeError fallback can overwrite requested edits · New Evidence report incorrectly claims backend and tests were untouched · New
What changed in this PR
Phase 1 adds validated intent handling, guarded Terraform execution, structured errors, tests, and a standalone PlanBound browser demonstration.
Changes:
- Adds Lambda memory and S3 tag intent parsing and validation.
- Strengthens workspace, evaluation, contract, and apply safeguards.
- Adds browser routes, lifecycle/accessibility tooling, verification scripts, and evidence artifacts.
| File | Change / final review notes |
|---|---|
tests/test_phase1.py |
Phase 1 tests. Moderate (1 vote): live interpretation E2E is skipped without Ollama. Moderate (1 vote): live S3-tag E2E is similarly skipped. |
tests/test_chaos.py |
Updated Cedar failure expectations. |
engine/types/__init__.py |
Adds EVALUATION_ERROR. |
engine/pipeline.py |
Integrates intent, modes, guards, and evaluation. Critical (2 votes): intent is excluded from the confirmation integrity hash. Moderate (3 votes): broad TypeError fallback can retry editing without intent. |
engine/intent/__init__.py |
Intent extraction and validation. Includes the reported critical trailing-newline validation issue (1 vote), moderate missing-value, case-preservation, compound-operation, JSON-shape, optional-import, transport-error, and numeric-prefix issues, plus the nit production test-prompt shortcut. |
engine/guard.py |
Workspace and Terraform checks. Critical (1 vote): arbitrary .terraform directories are accepted. Critical (1 vote): .tf.json files can bypass checks. Critical (2 votes): live runs use the poisoned bypass and skip exact attribute comparison. |
engine/gate.py |
Apply-gate checks. Critical (2 votes): non-dict verdicts can allow apply. Critical (1 vote): canonical and verdict data are not bound to the hashed plan. |
engine/exceptions.py |
Structured domain exceptions. |
engine/evaluator/__init__.py |
Typed Cedar failure handling. |
engine/contract/__init__.py |
Intent-scoped contract drafting. |
engine/api.py |
Structured API errors and intent endpoint. |
engine/agent.py |
Intent-scoped live editing tools. Critical (1 vote): Team validation admits trailing newlines. |
docs/evidence/local-apply.json |
Refreshed apply evidence. |
design/site-evidence/verification.json |
Browser verification evidence. |
design/site-evidence/keyboard.json |
Keyboard evidence. |
design/site-evidence/index.html |
Evidence gallery. |
design/site-evidence/final-regression.json |
Regression evidence. |
design/site-evidence/download.json |
Exported evidence. |
design/SITE_SELF_REVIEW.md |
Site review documentation. Nit (3 votes): the untouched-backend statement contradicts the pull request changes. |
design/SITE_README.md |
Site usage documentation. |
design/planbound/site.css |
Site styling and responsive rules. |
design/planbound/site-views.js |
Browser routes and views. |
design/planbound/site-ui.js |
UI and accessibility helpers. |
design/planbound/site-support.js |
Lifecycle and event management. |
design/planbound/site-engine.js |
Sample-plan engine. |
design/planbound/site-app.js |
Site integration and routing. Moderate (2 votes): repeated homeState renders accumulate observers and frame callbacks. |
design/planbound/site_verify.py |
Browser verification runner. |
design/planbound/site_smoke.py |
Browser smoke checks. |
design/planbound/site_regression.py |
Browser regression checks. |
design/planbound/site_keyboard.py |
Keyboard checks. |
design/planbound/build_site.py |
Standalone site builder. |
Files not reviewed (6)
- design/planbound/site-app.js: Generated file
- design/planbound/site-engine.js: Generated file
- design/planbound/site-support.js: Generated file
- design/planbound/site-ui.js: Generated file
- design/planbound/site-views.js: Generated file
- design/planbound/site.css: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| """Set only the Team tag on aws_s3_bucket.assets to the confirmed value.""" | ||
| if team != target_team: | ||
| raise ValueError(f"The confirmed contract permits only Team={target_team!r}, got {team!r}") | ||
| if not re.match(r"^[a-zA-Z0-9_-]{1,32}$", team): |
Comment on lines
+20
to
+24
| # Evaluation error verification: Cedar failures cannot become approvable REVIEWs | ||
| eval_errors = [ | ||
| v | ||
| for v in verdicts | ||
| if isinstance(v, dict) |
|
|
||
| def apply_saved(contract, run, resolutions): | ||
| reason = gate_reason(contract, run.get("verdicts"), resolutions) | ||
| reason = gate_reason(contract, run.get("verdicts"), resolutions, canonical=run.get("canonical")) |
Comment on lines
+40
to
+44
| if entry.is_dir(): | ||
| if entry.name != ".terraform": | ||
| raise ValueError( | ||
| f"Unexpected directory in workspace: {entry.name}. Arbitrary directory structures are rejected." | ||
| ) |
Comment on lines
+46
to
+48
| if entry.name.endswith(".tfplan") or entry.name.endswith(".json"): | ||
| # Generated plan artifacts | ||
| continue |
Comment on lines
+213
to
+221
| match = re.search( | ||
| r"(?:team\s*tag\s*(?:to|=)?\s*|team\s*=\s*|tag\s+team\s+to\s+)([a-zA-Z0-9_-]+)", | ||
| lower, | ||
| ) | ||
| if not match: | ||
| match = re.search( | ||
| r"(?:add|set|update)\s+team\s+tag\s+([a-zA-Z0-9_-]+)", lower | ||
| ) | ||
| team_val = match.group(1) if match else "core" |
Comment on lines
+333
to
+337
| except Exception as exc: | ||
| if isinstance(exc, ModelUnavailableError): | ||
| raise | ||
| raise AmbiguousRequestError( | ||
| f"Failed to parse model intent output: {exc}", |
Comment on lines
+341
to
+346
| op = data.get("operation", "unsupported") | ||
| if op == "unsupported": | ||
| raise UnsupportedOperationError( | ||
| f"The AI model identified this request as outside supported capabilities: {task}", | ||
| details={"task": task, "model_response": data}, | ||
| ) |
Comment on lines
+100
to
+102
| log = live_edit(t["contract"]["task"], workspace, intent=t.get("intent"), adversarial=False) | ||
| except TypeError: | ||
| log = live_edit(t["contract"]["task"], workspace) |
|
|
||
| Final SHA-256: `af58e20e2482cef6bb832672d33bdc61e5cffec299af266fcc80b1c08357c352`. | ||
|
|
||
| The existing Part 1 artifact and its source modules were not edited. `build_site.py` wraps their output with scoped lifecycle hooks, singleton-canvas sizing, live tree/robot state, routing and the new views. No application backend, Cedar policy, canonicalizer, apply-gate implementation or existing test was changed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



No description provided.