Skip to content

test(di): prove injector hardener S1–S10 - #3420

Merged
bpamiri merged 1 commit into
developfrom
cursor/injector-hardener-s1-s10-9243
Aug 25, 2026
Merged

test(di): prove injector hardener S1–S10#3420
bpamiri merged 1 commit into
developfrom
cursor/injector-hardener-s1-s10-9243

Conversation

@bpamiri

@bpamiri bpamiri commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Why

Injector desk IDs S1–S10 were locked. HOLD pins stay unflipped. This PR only proves current behavior so a flipped conditional, empty catch, or greet-only equality would fail.

S4 stays dotted-path fallback. It is not Wheels.ServiceNotFound and it does not throw for a valid unmapped component path. Production still uses createObject("component", path) after resolveMapping() returns the name as-is.

Scope

  • vendor/wheels/tests/specs/injector/InjectorHardenerSpec.cfc so wheels test --core --ci --filter=injector discovers a directory
  • vendor/wheels/tests/specs/di/InjectorSpec.cfc — S1 distinct identity, S5 circular throw in the recovery catch
  • vendor/wheels/tests/specs/interfaces/InjectorInterfaceSpec.cfc — S6 skip-missing
  • vendor/wheels/tests/_assets/di/LifecycleHookService.cfc — S8 hook probe

No production change in Injector.cfc or the interface. Spec-only. No changelog fragment.

Out: CLI Application.cfc injector, SQL-injection specs, docs/blog, inject() in controller/services.cfc, $snapshotBindings/$restoreBindings, application.wheelsdi self-register.

Desk S1–S10

ID Status Note
S1 PROVEN Two transient getInstance calls of the same mapping get distinct instances. Marker on the first does not appear on the second.
S2 HOLD Rebind overwrites the path, keeps singleton and request flags, and never drops request.$wheelsDICache.
S3 HOLD asSingleton/asRequestScoped are silent no-ops when lastMappedName is empty. map(b).asSingleton().to(...) flags the previous key, not b.
S4 PROVEN Unmapped getInstance treats the name as a dotted component path. Does not throw Wheels.DI.ServiceNotFound. Unknown path still fails as createObject, not ServiceNotFound.
S5 PROVEN Circular-recovery catch(any) asserts Wheels.DI.CircularDependency, then the resolving stack is empty and a later resolve works.
S6 PROVEN Interface resolve-all skips missing keys. Present bindings still resolve.
S7 HOLD getMappings() returns the live struct. Mutating it, or mapping later, is visible on the same reference.
S8 PROVEN onDIcomplete runs once on the constructed instance. A singleton cache hit does not run it again. Each transient runs it once on that instance.
S9 PROVEN map("") then to() throws Wheels.Injector, same type as to() without map(). map(" ") accepts.
S10 PROVEN Both flags set, singleton wins. Request cache is not written. Order of asSingleton/asRequestScoped does not change the winner.

Verification

Command actually run:

wheels test --core --ci --filter=injector
Running core tests (sqlite)...
Scope: wheels.tests.specs.injector
24 passed (0.13s)

JSON from the same filter (directory=wheels.tests.specs.injector):

totalPass=24
totalFail=0
totalError=0
totalSkipped=0
totalSpecs=24
bundlesDiscovered=1
directoryRejected=false
directoryResolved=wheels.tests.specs.injector

Also ran, not the driver:

wheels test --core --ci --filter=di
39 passed (0.13s)

wheels test --core --ci --filter=interfaces
58 passed (0.27s)

Wheels CLI 4.0.6. Lucee 7.0.0.395. sqlite.

Adobe and BoxLang were not run here.

HEAD 25fe6e2eeaa382074560eaabadd93851b43cceb3

Base bb9fa68347a06fac8ebfe4959d8b5d7607bba9ba (develop after the database-adapter hardener).

No closer keywords. Do not merge.

Open in Web Open in Cursor 

Pin HOLD S2/S3/S7 and add branch-killing specs for S1/S4/S5/S6/S8/S9/S10.
S4 stays dotted-path fallback. No production flip.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Peter Amiri <peter@alurium.com>
@bpamiri
bpamiri marked this pull request as ready for review August 25, 2026 14:36
@bpamiri
bpamiri merged commit 32aa267 into develop Aug 25, 2026
12 checks passed
@bpamiri
bpamiri deleted the cursor/injector-hardener-s1-s10-9243 branch August 25, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants