Skip to content

Add --strict convention checker for dual-mode composability#19

Merged
typeless merged 11 commits intomainfrom
feature/strict-checker
Mar 30, 2026
Merged

Add --strict convention checker for dual-mode composability#19
typeless merged 11 commits intomainfrom
feature/strict-checker

Conversation

@typeless
Copy link
Copy Markdown
Owner

Summary

  • Add putup parse --strict that verifies Tupfiles follow conventions guaranteeing a project can be built both standalone and as a component of a larger project
  • Pure stateless check functions inspect AST nodes during evaluation via on_statement callback
  • Phase 1: 2 error checks (S/B anchor ?=) + 2 warning checks (toolchain ?=, missing Tupfile.ini)

Checks

Check Severity What it catches
S must use ?= in component Tuprules.tup Error = overwrites parent's root anchor
B must use ?= in component Tuprules.tup Error = overwrites parent's build anchor
Toolchain vars (CC, CXX, AR...) should use ?= Warning = overrides parent's toolchain choice
Component dir should have Tupfile.ini Warning Without it, can't build standalone

Test plan

  • 6 unit tests covering all check paths (S/B anchors, toolchain, exemptions)
  • 1 E2E test with fixture that violates conventions
  • Manual test: putup parse --strict on putup itself (passes — root exempt)
  • CI green on all platforms

🤖 Generated with Claude Code

typeless and others added 11 commits March 29, 2026 17:12
Phase 1: 2 error checks (S/B anchor ?=) + 2 warning checks (toolchain
?=, Tupfile.ini). Pure stateless check functions, callback integration
during evaluation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6-task plan: check functions, unit tests, on_statement callback,
cmd_parse wiring, E2E test, bootstrap + docs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implements the strict convention checking system (Tasks 1-4):

- Diagnostic type and check_assignment/check_component_dirs functions
  that verify dual-mode composability conventions in Tuprules.tup files
- Unit tests for all check functions (6 test cases, 20 assertions)
- on_statement callback on EvalContext, fired in builder.cpp's
  process_statement for each AST statement during evaluation
- --strict flag wired into putup parse via Options, BuildContextOptions,
  and the statement callback in cmd_parse.cpp

Checks: E1/E2 (S/B must use ?= in components), W1 (toolchain vars
should use ?=), W2 (component dirs should have Tupfile.ini).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds strict_check fixture with a root Tuprules.tup (exempt) and a
component libfoo/Tuprules.tup that uses hard assignment for S and CC.
The E2E test verifies parse --strict detects the violations and fails,
while parse without --strict succeeds normally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds strict_checks.o compile/link/ar entries to all three bootstrap
scripts (linux, macos, mingw). Documents --strict in the parse
subcommand section of docs/reference.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
libc++ emits __libcpp_verbose_abort for std::variant valueless state.
Guard with _LIBCPP_VERSION so it only compiles on libc++ platforms.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
_LIBCPP_VERSION is only defined after including a libc++ header.
Use __APPLE__ as the platform guard instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The symbol is mangled as std::__1::__libcpp_verbose_abort, not
std::__libcpp_verbose_abort. Define in the matching inline namespace.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@typeless typeless merged commit 192a00c into main Mar 30, 2026
4 checks passed
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