feat(smoke): add gpd:smoke pre-commit sniff-test command - #253
feat(smoke): add gpd:smoke pre-commit sniff-test command#253ayushchopra96 wants to merge 1 commit into
Conversation
`gpd:smoke` is a pre-commit gate that reproduces the smallest viable version
of a published quantitative claim, or verifies an in-project assumption from
PLAN.md, before committing to gpd:new-project, gpd:plan-phase, or
gpd:execute-phase.
Three invocation forms:
- gpd:smoke "<claim>" anchor mode (reproduce a published number)
- gpd:smoke --assumption "<text>" assumption mode
- gpd:smoke --from-plan read an assumption from GPD/phases/*/PLAN.md
with a tolerant parser that accepts both
flat `## Assumptions` and hierarchical
`## My Assumptions for Phase X` + `### <category>`
shapes (the latter is what gpd:plan-phase
emits today).
No existing command requires modification for either mode to work.
Adds:
- src/gpd/commands/smoke.md command surface (Validation and analysis, order 290)
- src/gpd/specs/workflows/smoke.md workflow with 8 steps + a tolerant from-plan parser
- tests/core/test_smoke_command.py 3 tests: command frontmatter, workflow steps,
from-plan parser fixture
- docs/smoke-tutorial.md worked example: butterfly effect -> chaos project
|
Ayush Chopra seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
📝 WalkthroughWalkthroughThis PR introduces ChangesSmoke Command Implementation
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/core/test_smoke_command.py (1)
78-142: ⚡ Quick winConsider adding test coverage for flat-form assumptions.
The test validates hierarchical assumptions (H2 + H3 + bullets), which matches the canonical
gpd:plan-phaseoutput. However, the workflow specification at lines 39-40 insrc/gpd/specs/workflows/smoke.mdexplicitly requires the parser to tolerate flat form (H2 + bullets directly, without H3 subheadings). The current test helper_extract_assumption_bullets_with_categoriesonly extracts bullets whencurrent_category is not None(line 140), which means it would skip flat-form bullets.🧪 Suggested additional test case
def test_smoke_from_plan_assumption_parser_extracts_flat_bullets() -> None: """The --from-plan parser must also tolerate flat form: H2 + bullets.""" fixture = """# PLAN ## Assumptions - The system is ergodic. - Burn-in of 1000 steps suffices. ## Next section Some content. """ extracted = _extract_assumption_bullets_with_categories(fixture) # For flat form, use empty string as category or "(uncategorized)" assert len(extracted) == 2 assert extracted[0][1] == "The system is ergodic." assert extracted[1][1] == "Burn-in of 1000 steps suffices."And update the helper to handle flat form:
for line in section.splitlines(): h3 = h3_re.match(line) if h3: current_category = h3.group(1).strip() continue b = bullet_re.match(line) - if b and current_category is not None: + if b: + # Use empty string for flat-form bullets without a category + category = current_category if current_category is not None else "" - out.append((current_category, b.group(1).strip())) + out.append((category, b.group(1).strip())) return out🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/core/test_smoke_command.py` around lines 78 - 142, The helper _extract_assumption_bullets_with_categories currently ignores flat-form bullets because it only appends a bullet when current_category is not None; update it to treat bullets seen before any H3 as unclassified (e.g., use "" or "(uncategorized)") and append them regardless of current_category, and add a new unit test test_smoke_from_plan_assumption_parser_extracts_flat_bullets that supplies an H2 "Assumptions" section with bullets (no H3) and asserts both bullets are returned with the chosen unclassified category; ensure the change still preserves existing hierarchical behavior for H3-tagged bullets in the same function.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/core/test_smoke_command.py`:
- Around line 78-142: The helper _extract_assumption_bullets_with_categories
currently ignores flat-form bullets because it only appends a bullet when
current_category is not None; update it to treat bullets seen before any H3 as
unclassified (e.g., use "" or "(uncategorized)") and append them regardless of
current_category, and add a new unit test
test_smoke_from_plan_assumption_parser_extracts_flat_bullets that supplies an H2
"Assumptions" section with bullets (no H3) and asserts both bullets are returned
with the chosen unclassified category; ensure the change still preserves
existing hierarchical behavior for H3-tagged bullets in the same function.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 323054b3-1e53-47a4-8a45-54c94046a935
📒 Files selected for processing (5)
CHANGELOG.mddocs/smoke-tutorial.mdsrc/gpd/commands/smoke.mdsrc/gpd/specs/workflows/smoke.mdtests/core/test_smoke_command.py
|
🤖 RoastBot: A sniff test. For a physics research tool. That is exactly where we are as a field. |
Summary
Adds
gpd:smoke, a pre-commit gate that reproduces the smallest viable version of a published quantitative claim, orverifies an in-project assumption from
PLAN.md, before committing togpd:new-project,gpd:plan-phase, orgpd:execute-phase.Three invocation forms, no existing command needs modification:
gpd:smoke "<claim>"— anchor modegpd:smoke --assumption "<text>"— assumption modegpd:smoke --from-plan— read an assumption fromPLAN.md(parser tolerant of both flat## Assumptionsand thehierarchical
## My Assumptions for Phase X+### <category>shapegpd:plan-phaseemits today)Verdict is PASS / FAIL / INCONCLUSIVE; smoke refuses to fabricate, auto-route, or rewrite
PLAN.md.Worked example
See
docs/smoke-tutorial.md— verifies the Lyapunov exponent of the logistic map at r=4 (butterfly effect, λ = ln(2)),then scaffolds a real project to measure Feigenbaum's universal constant δ ≈ 4.6692.
Test plan
pytest tests/core/test_smoke_command.py— 3 tests, passpytest tests/core/test_command_*.py— all 90 existing command-surface tests still pass/gpd:smoke "..."in Claude Code after install, confirm verdict block emits/gpd:smoke --from-planagainst a realPLAN.mdproduced bygpd:plan-phaseSummary by CodeRabbit
Release Notes
New Features
gpd:smokecommand as a pre-commit sniff-test for validating quantitative claims and assumptions with three operation modes (claim anchor,--assumption,--from-plan) producing PASS/FAIL/INCONCLUSIVE verdicts.Documentation
Tests