Skip to content

ConstructorCallAdmission: refuse cross-module calls not listed in admit_callers - #7860

Merged
briansrls merged 3 commits into
mainfrom
session/royal-crab-235-horn-constructor-admission
Aug 5, 2026
Merged

briansrls merged 3 commits into
mainfrom
session/royal-crab-235-horn-constructor-admission

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds infer-time ConstructorCallAdmissionRefused when a callee with admit_callers is invoked from a module/decl not in the permitted decl_ref list.
  • Checks run post callee resolution via func_decl_binding_for_call (imported and census paths), with caller identity carried on InferScope.caller_decl_name.
  • Includes enrolled witness constructor_call_admission_refuses_unlisted_cross_module_caller and stage0 regen at fixed point.

Split from the mixed Lane 4 behavioral-qualification work (#7838 / #7792) per operator disposition: horn construction wall only.

Test plan

  • regen_stage0 --verify (fixed point)
  • cargo check -p v1-compiler-tests --tests
  • CI floor (pending)

Made with Cursor

Brian Searls and others added 3 commits August 5, 2026 17:21
…ed calls.

Post-resolution check via func_decl_binding_for_call and decl_ref caller
coords on InferScope; witnesses and stage0 regen at fixed point.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ngs.

Imported callees resolve defining-module path via func_decl_owner_module
when the name is not in str_bindings; local_binding_for_item preserves
item.properties on fn census nodes so fn_admit_callers can read admit_callers.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Response to review 48870 (composer-2.5 REQUEST_CHANGES)

Verified and fixed in 890828f42:

1. Wrong owner for imported callees — func_decl_binding_for_call now derives owner_module_path from str_bindings (local decl → caller module) vs func_decl_owner_module / census fallback when the name is only in ancestry_str_bindings. Cross-module admission no longer treats imported mint as same-module.

2. admit_callers stripped from census nodes — local_binding_for_item now copies item.properties onto fn census stub nodes (was properties: []). fn_admit_callers can read parsed admit_callers on symbol-index / ancestry bindings.

regen_stage0 --verify at fixed point; cargo check -p v1-compiler-tests --tests green locally.

Opus non-blocking (review 48868): caller_decl_name: "" sentinel / "<unknown>" arm deferred — agree String? is cleaner; follow-up after this wall lands.

— sent from royal-crab-235

@briansrls
briansrls merged commit 339bf59 into main Aug 5, 2026
5 checks passed
@briansrls
briansrls deleted the session/royal-crab-235-horn-constructor-admission branch August 5, 2026 21:07
gunbai-bot Bot pushed a commit that referenced this pull request Aug 5, 2026
PR #7838 had an empty diff after #7860 landed constructor admission on
main, which made per-head modeling-coherence unavailable (fail-closed).
Update the infer frontier note and direct-door behavioral-probe note so
the PR carries reviewable .dag modeling receipts.

Co-authored-by: Cursor <cursoragent@cursor.com>
gunbai-bot Bot pushed a commit that referenced this pull request Aug 5, 2026
Resolve merge conflicts by taking main's ConstructorCallAdmissionRefused
surface (#7860), updating lookup fn_admit_callers to decl_ref API, adding
FuncSigCallerNotAdmitted infer match arms, and regen stage0 emit.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Aug 6, 2026
… constructor (#7859)

* WIP: ConstructorReferenceAdmission: refuse unlisted call edges to a sealed co

* WIP: ConstructorReferenceAdmission: refuse unlisted call edges to a sealed co

* Rebase on main and regen stage0 for ConstructorReferenceAdmission.

Resolve SourceAnnotationRefused merge in 00_core and restore infer import
list after rebase; run regen to fixed point so CI regen_verify_gate passes.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Import fn_admit_callers in infer_lookup and regen stage0.

Fixes build failure: emitted lookup calls fn_admit_callers without importing it.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix compile after ConstructorReferenceAdmissionViolation diagnostic.

Add cli_run histogram match arms for the new variant and align the
compiler_tests witness with ConstructorReferenceAdmissionViolation.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Register constructor admission witness in compiler_tests_rust.dag.

The hand-maintained compiler_tests.rs already carried
constructor_call_admission_refuses_unlisted_cross_module_caller but
compiler_tests_rust.dag did not emit it, so regen_verify_gate redded
with a stale compiler_tests.rs diff. Add ct_constructor_call_admission_test
so stage0 regen and the committed witness stay aligned.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Rebase on main (#7860) and align lookup admission with infer authority

Resolve merge conflicts by taking main's ConstructorCallAdmissionRefused
surface (#7860), updating lookup fn_admit_callers to decl_ref API, adding
FuncSigCallerNotAdmitted infer match arms, and regen stage0 emit.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Brian Searls <briansearls1@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Aug 7, 2026
main is red. Two legitimate module-owned declarations share one spelling:

  gunbc.build_cache_ensure   ensure_is_converged(EnsureBuildCacheAdmission)
  gunbc.compile_pool_ensure  ensure_is_converged(EnsureCompilePoolAdmission)

Both consumers called the name bare, so no import selected an identity, and
once the second declaration entered the pool NEITHER resolved — including
build_cache_ensure_test.dag, untouched for 34 hours. That asymmetry is the
tell: the file that breaks and the file that changed are different files, so
this is a pool-membership resolution defect, not a defect in either module.

A semantic merge conflict, which is why both sides merged green with no
textual conflict: #7860 (339bf59, Aug 5) and #7937 (523a6d3, Aug 7) share no
file, no line, no directory below dag/. Each was correct alone — one candidate
for the bare name. Only the union is invalid.

Repair is the two missing imports. NOT a rename: build_cache_ensure_is_converged
/ compile_pool_ensure_is_converged would buy accidental global uniqueness at the
cost of every declaration carrying its module name lexically, against
DistinctSameSpelledDeclarationsPreserved. The module path already carries the
namespace; the importer chooses the identity. Production declarations unchanged.

Verified by execution: whole-tree compile-clean at the gate's modeled invocation
(--source-root dag --source-root src/v2 --source-root src/v1
--dependency-pool-index primary-precedence --target dag) exits 0 with zero
"not found in scope" diagnostics. Explicit declaration identity therefore does
dominate the ambient dependency pool — no resolver defect underneath.


Claude-Session: https://claude.ai/code/session_012DrzU3z7PJzhN5mxvZAfAs

Co-authored-by: Claude <noreply@anthropic.com>
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