-
Notifications
You must be signed in to change notification settings - Fork 4
Property portfolio: requireInvariant discipline, 6-lens coverage checklist, multi-call techniques #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shellygr
wants to merge
6
commits into
master
Choose a base branch
from
shelly/ap-property-portfolio
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Property portfolio: requireInvariant discipline, 6-lens coverage checklist, multi-call techniques #43
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
54676e6
Property portfolio: requireInvariant discipline, 6-lens checklist, te…
shellygr e989a5e
Clarify expression-summary caveats in ghost-counter advice
shellygr 8ec7d12
Use a valid Sort value in template render tests
shellygr 146663f
Note persistent-ghost requirement in ghost-counter advice
shellygr af8c618
Carve out capacity bounds, map companion rules, judge-visible ghost d…
shellygr e585b7d
Apply suggestion from @shellygr
shellygr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this test. does nothing |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| """Render smoke tests for prompt templates. | ||
|
|
||
| These templates are plain-jinja prompt fragments consumed by the property analysis / | ||
| generation / judge agents. The tests render them with minimal stand-in objects (jinja | ||
| only does attribute lookups, so `SimpleNamespace` suffices) and assert the load-bearing | ||
| content is present — a missing template variable or a broken include fails fast here | ||
| instead of mid-agent-run. | ||
| """ | ||
| from types import SimpleNamespace | ||
|
|
||
| from composer.templates.loader import load_jinja_template | ||
|
|
||
|
|
||
| def test_cvl_guidelines_render(): | ||
| out = load_jinja_template("cvl_guidelines.j2") | ||
| # Guideline 24: requireInvariant discipline over bare state requires. | ||
| assert "requireInvariant" in out | ||
| assert "spec smell" in out | ||
| # Guideline 24 carve-out: solver-capacity bounds need no invariant attempt. | ||
| assert "keep the solver tractable" in out | ||
| # Guideline 24 defers preserved blocks to the stricter (judge Criteria 4) standard. | ||
| assert "stricter standard" in out | ||
| # Guideline 20 carve-out: persistent counter ghosts are legitimate (judge-visible | ||
| # counterpart of the ghost-counter advice in cvl_additions.j2). | ||
| assert "never stored in contract state" in out | ||
| # Guideline 23 carve-out: hooks/ghosts for information never stored in contract state. | ||
| assert "not stored in" in out | ||
| assert out.strip().endswith("</cvl_guidelines>") | ||
|
|
||
|
|
||
| def test_cvl_additions_render(): | ||
| out = load_jinja_template("cvl_additions.j2") | ||
| # Storage snapshot / additivity idiom. | ||
| assert "lastStorage" in out | ||
| assert "at init" in out | ||
| # satisfy-witness companion rules, mapped under their parent property. | ||
| assert "satisfy" in out | ||
| assert "property_rules" in out | ||
| # Ghost counters via expression summaries. | ||
| assert "countDeposit() expect void" in out | ||
| assert out.strip().endswith("</cvl_advice>") | ||
|
|
||
|
|
||
| def _fake_component_context() -> SimpleNamespace: | ||
| """Minimal stand-in for ContractComponentInstance as accessed by the template.""" | ||
| contract = SimpleNamespace(name="Vault", solidity_identifier="Vault") | ||
| component = SimpleNamespace( | ||
| name="Deposits", | ||
| description="Handles user deposits", | ||
| requirements=["Users receive shares proportional to deposits"], | ||
| interactions=[], | ||
| ) | ||
| app = SimpleNamespace(application_type="an ERC4626 vault") | ||
| return SimpleNamespace(component=component, contract=contract, app=app, | ||
| ommer_contracts=[]) | ||
|
|
||
|
|
||
| def test_property_analysis_prompt_render(): | ||
| out = load_jinja_template( | ||
| "property_analysis_prompt.j2", | ||
| context=_fake_component_context(), | ||
| backend_guidance="BACKEND_GUIDANCE_SENTINEL", | ||
| # A valid Sort value (see composer/spec/service_host.py) exercising the | ||
| # non-greenfield template branch. | ||
| sort="existing", | ||
| prior_properties=[], | ||
| ) | ||
| # The context and backend guidance are threaded through. | ||
| assert "Deposits" in out | ||
| assert "BACKEND_GUIDANCE_SENTINEL" in out | ||
| # 6-lens coverage checklist, framed as brainstorming discipline, not a quota. | ||
| assert "Unit behavior" in out | ||
| assert "Variable transition" in out | ||
| assert "Multi-call / high-level" in out | ||
| assert "NOT a quota" in out | ||
| # Task steps ask for a record of swept lenses. | ||
| assert "which of the six coverage" in out | ||
|
|
||
|
|
||
| def test_property_analysis_prompt_render_with_prior_rounds(): | ||
| prior = [SimpleNamespace( | ||
| items=[SimpleNamespace(sort="invariant", title="solvency", | ||
| description="assets cover shares")], | ||
| reasoning="looked at deposit accounting", | ||
| )] | ||
| out = load_jinja_template( | ||
| "property_analysis_prompt.j2", | ||
| context=_fake_component_context(), | ||
| backend_guidance="", | ||
| sort="existing", | ||
| prior_properties=prior, | ||
| ) | ||
| assert "solvency" in out | ||
| assert "looked at deposit accounting" in out |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we discussed this on zoom, but we already have guidance for both the judge and author to not use
requireas a "make the rule pass" magic. Repeating it a third time will not fix the problem imo. The instructions you provide here are almost verbatim in the author prompt. It would be useful if we could find the run where this happened and see what reasoning/thinking tricks the agent used to talk itself out of the rules it already knew about, rather than just repeating the rule one more time and hoping that one makes it stick.