Skip to content

[Interceptors/Threats] Add Legacy prefix to existing interceptor and threat class names - #121

Merged
tryuan99 merged 110 commits into
titan/hierarchicalfrom
titan/interceptors_threats_legacy
Dec 10, 2025
Merged

tryuan99 merged 110 commits into
titan/hierarchicalfrom
titan/interceptors_threats_legacy

Conversation

@tryuan99

Copy link
Copy Markdown
Member

As title. This PR is a simple rename in preparation for the implementation of the hierarchical interceptors and threats.

@daniellovell daniellovell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from titan/fix_accessor to titan/hierarchical December 10, 2025 01:07

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4595393 and a4205bc.

📒 Files selected for processing (15)
  • Assets/Scripts/Agents/Agent.cs (1 hunks)
  • Assets/Scripts/IADS/IADS.cs (1 hunks)
  • Assets/Scripts/IADS/Vessel.cs (0 hunks)
  • Assets/Scripts/IADS/Vessel.cs.meta (0 hunks)
  • Assets/Scripts/Interceptors/CarrierInterceptorLegacy.cs (1 hunks)
  • Assets/Scripts/Interceptors/MissileInterceptor.cs (0 hunks)
  • Assets/Scripts/Interceptors/MissileInterceptorLegacy.cs (1 hunks)
  • Assets/Scripts/Managers/SimManager.cs (1 hunks)
  • Assets/Scripts/Threats/FixedWingThreatLegacy.cs (1 hunks)
  • Assets/Scripts/Threats/RotaryWingThreatLegacy.cs (1 hunks)
  • Assets/Scripts/Threats/Threat.cs (1 hunks)
  • Assets/Tests/EditMode/IADSClusterCleanupTests.cs (1 hunks)
  • Assets/Tests/EditMode/ThreatAssignmentTests.cs (4 hunks)
  • Assets/Tests/EditMode/ThreatTests.cs (2 hunks)
  • Assets/Tests/EditMode/TransformationTests.cs (3 hunks)
💤 Files with no reviewable changes (3)
  • Assets/Scripts/IADS/Vessel.cs
  • Assets/Scripts/IADS/Vessel.cs.meta
  • Assets/Scripts/Interceptors/MissileInterceptor.cs
🧰 Additional context used
🧬 Code graph analysis (10)
Assets/Scripts/Threats/RotaryWingThreatLegacy.cs (2)
Assets/Scripts/Managers/SimManager.cs (1)
  • Threat (432-474)
Assets/Scripts/Threats/Threat.cs (1)
  • Threat (5-181)
Assets/Scripts/Interceptors/CarrierInterceptorLegacy.cs (1)
Assets/Scripts/Managers/SimManager.cs (1)
  • Interceptor (374-428)
Assets/Scripts/Interceptors/MissileInterceptorLegacy.cs (2)
Assets/Scripts/Managers/SimManager.cs (1)
  • Interceptor (374-428)
Assets/Scripts/Interceptors/MissileInterceptor.cs (1)
  • MissileInterceptor (5-5)
Assets/Scripts/IADS/IADS.cs (1)
Assets/Scripts/Interceptors/CarrierInterceptorLegacy.cs (1)
  • CarrierInterceptorLegacy (7-71)
Assets/Scripts/Threats/FixedWingThreatLegacy.cs (2)
Assets/Scripts/Managers/SimManager.cs (1)
  • Threat (432-474)
Assets/Scripts/Threats/Threat.cs (1)
  • Threat (5-181)
Assets/Scripts/Agents/Agent.cs (2)
Assets/Scripts/Managers/SimManager.cs (1)
  • Agent (356-370)
Assets/Scripts/Threats/Threat.cs (1)
  • Agent (85-102)
Assets/Scripts/Managers/SimManager.cs (1)
Assets/Scripts/Agents/Agent.cs (1)
  • DummyAgentLegacy (444-464)
Assets/Tests/EditMode/TransformationTests.cs (2)
Assets/Scripts/Agents/Agent.cs (1)
  • DummyAgentLegacy (444-464)
Assets/Tests/TestBase.cs (1)
  • InvokePrivateMethod (22-25)
Assets/Scripts/Threats/Threat.cs (1)
Assets/Scripts/Agents/Agent.cs (1)
  • DummyAgentLegacy (444-464)
Assets/Tests/EditMode/ThreatAssignmentTests.cs (2)
Assets/Scripts/Threats/RotaryWingThreatLegacy.cs (1)
  • RotaryWingThreatLegacy (5-74)
Assets/Scripts/Interceptors/MissileInterceptorLegacy.cs (1)
  • MissileInterceptorLegacy (1-1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build plugins for windows-latest
  • GitHub Check: Test plugins on ubuntu-latest
  • GitHub Check: Test plugins on windows-latest
  • GitHub Check: Build plugins for macos-latest
  • GitHub Check: Test plugins on macos-latest
🔇 Additional comments (12)
Assets/Scripts/IADS/IADS.cs (1)

400-400: LGTM! Type check updated consistently.

The type check correctly references CarrierInterceptorLegacy to exclude carrier interceptors from automatic reassignment when a threat is hit.

Assets/Scripts/Managers/SimManager.cs (1)

363-363: LGTM! Component type updated correctly.

The component addition now references DummyAgentLegacy, consistent with the class rename in Agent.cs.

Assets/Scripts/Threats/Threat.cs (1)

176-176: LGTM! Component retrieval updated correctly.

The type parameter for GetComponentInParent<DummyAgentLegacy>() correctly references the renamed class.

Assets/Scripts/Interceptors/MissileInterceptorLegacy.cs (1)

1-1: LGTM! Legacy variant introduced.

The empty MissileInterceptorLegacy class is introduced as part of the migration to hierarchical interceptors. This allows both Legacy and new implementations to coexist during the transition.

Assets/Scripts/Agents/Agent.cs (1)

444-444: LGTM! Class renamed to Legacy variant.

The class name update from DummyAgent to DummyAgentLegacy is consistent with the broader refactoring, and all references in other files (SimManager.cs, Threat.cs) have been updated accordingly.

Assets/Tests/EditMode/IADSClusterCleanupTests.cs (1)

101-101: LGTM! Test updated to reference Legacy type.

The cast to CarrierInterceptorLegacy correctly reflects the renamed class, maintaining test coverage for carrier interceptor behavior.

Assets/Scripts/Interceptors/CarrierInterceptorLegacy.cs (1)

7-7: LGTM! Class renamed consistently.

The class name update to CarrierInterceptorLegacy is correctly applied, with all references in IADS.cs and test files updated accordingly. The submunition-spawning behavior remains unchanged.

Assets/Scripts/Threats/RotaryWingThreatLegacy.cs (1)

5-5: LGTM! Threat class renamed consistently.

The class name update to RotaryWingThreatLegacy aligns with the broader migration pattern. The waypoint navigation and evasion logic remain unchanged.

Assets/Tests/EditMode/TransformationTests.cs (1)

11-11: LGTM! Consistent type renames.

All references to DummyAgent have been correctly updated to DummyAgentLegacy across all three test methods.

Also applies to: 18-18, 43-43, 49-49, 73-73, 80-80

Assets/Tests/EditMode/ThreatTests.cs (1)

9-10: LGTM! Consistent Legacy type migration.

All references to FixedWingThreat and RotaryWingThreat have been correctly updated to their Legacy counterparts, including field declarations, type checks, and casts. The refactoring is complete and consistent throughout the test file.

Also applies to: 85-86, 91-92

Assets/Tests/EditMode/ThreatAssignmentTests.cs (1)

18-18: LGTM! Complete Legacy type migration.

All threat and interceptor type references have been consistently updated to their Legacy counterparts (RotaryWingThreatLegacy and MissileInterceptorLegacy) across all four test methods. The refactoring is thorough and maintains test integrity.

Also applies to: 33-35, 54-62, 122-129

Assets/Scripts/Threats/FixedWingThreatLegacy.cs (1)

5-5: LGTM! Clean class rename with all references properly updated.

The rename from FixedWingThreat to FixedWingThreatLegacy is complete and consistent. The prefab GUIDs have been correctly updated, the AgentTypePrefabMap mapping is intact (using the prefab name "FixedWingThreat" which doesn't require changes), and tests have been updated accordingly. No remaining references to the old class name exist in the codebase.

Rigidbody agentRb = agent.gameObject.AddComponent<Rigidbody>();
agent.transform.position = new Vector3(0, 0, 0);
agentRb.linearVelocity = new Vector3(0, 0, 0);
InvokePrivateMethod(agent, "Start");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent test initialization across test methods.

The Target_At_Boresight (lines 15, 22) and Target_At_Elevation (lines 77, 84) tests both call InvokePrivateMethod to invoke Start() on both agent and target, but Target_At_Starboard (lines 40-53) has no Start() invocations at all. This inconsistency could lead to different initialization states and potentially affect test reliability.

Apply this diff to add the missing Start() invocations to Target_At_Starboard:

   var agent = new GameObject("Agent").AddComponent<DummyAgentLegacy>();
   Rigidbody agentRb = agent.gameObject.AddComponent<Rigidbody>();
   agent.transform.position = new Vector3(0, 0, 0);
   agentRb.linearVelocity = new Vector3(0, 0, 0);
+  InvokePrivateMethod(agent, "Start");
 
   // Create target
   var target = new GameObject("Target").AddComponent<DummyAgentLegacy>();
   target.SetPosition(new Vector3(20, 0, 0));
   Rigidbody targetRb = target.gameObject.AddComponent<Rigidbody>();
   targetRb.linearVelocity = new Vector3(0, 0, 20);
+  InvokePrivateMethod(target, "Start");

Also applies to: 22-22, 40-53, 77-77, 84-84

🤖 Prompt for AI Agents
In Assets/Tests/EditMode/TransformationTests.cs around lines 15-15, 22-22,
40-53, 77-77 and 84-84, the Start() invocations for the agent and target are
inconsistent across tests; add the missing InvokePrivateMethod(agent, "Start");
and InvokePrivateMethod(target, "Start"); calls into the Target_At_Starboard
test (and ensure both Start() calls exist in the same relative locations as in
Target_At_Boresight and Target_At_Elevation) so each test performs identical
initialization before assertions.

@tryuan99
tryuan99 merged commit b2df41b into titan/hierarchical Dec 10, 2025
18 checks passed
@tryuan99
tryuan99 deleted the titan/interceptors_threats_legacy branch December 10, 2025 01:44
tryuan99 added a commit that referenced this pull request Dec 18, 2025
[All] Implement fully hierarchical defense strategy

* [Agent] Add agent-related interfaces and base implementations (#95)
* [Interceptor/Threat] Add interceptor and threat interfaces (#96)
* [Algorithm] Add algorithm interfaces and base implementations (#97)
* [Movements] Implement all aerial and ground-based movements (#99)
* [Gemini] Disable Gemini pull request summary (#142)
* [Sensor] Add sensor interface and ideal sensor implementation (#100)
* [Chore] Clean up private properties (#101)
* [Evasion] Implement evasion behaviors (#102)
* [Agent] Add agent-related interfaces and base implementations (#95)
* [Interceptor/Threat] Add interceptor and threat interfaces (#96)
* [Algorithm] Add algorithm interfaces and base implementations (#97)
* [Movements] Implement all aerial and ground-based movements (#99)
* [Sensor] Add sensor interface and ideal sensor implementation (#100)
* [Chore] Clean up private properties (#101)
* [Evasion] Implement evasion behaviors (#102)
* [Attack Behavior] Implement direct attack behavior (#103)
* [Controller] Add controller interface and implementations (#105)
* [Predictor/Planner] Clean up predictor and planner classes (#108)
* [Clustering] Change clustering algorithms to act on hierarchical objects (#111)
* [Utils] Clean up coordinates classes and tests (#112)
* [Assignment] Refactor assignment algorithms (#113)
* [Accessor] Use init accessor for read-only fields (#116)
* [Interceptors/Threats] Add Legacy prefix to existing interceptor and threat class names (#121)
* [Interceptors/Threats] Implement all interceptor and threat types (#122)
* [Proto/Configs] Add launcher types to proto definition and simulation configs (#123)
* [IADS] Clean up IADS and simulation manager (#124)
* [UI] Remove swarm status dialog and tactical panel (#125)
* [All] Remove all legacy code (#127)
* [Prefabs] Add prefabs for launchers (#128)
* [Release] Adjust minimum distance in proximity release (#129)
* [Configs] Add simulation configuration with 2 launchers (#130)
* [Simulation] Destroy terminated game objects (#132)
* [UI] Draw gizmos for agents (#133)
* [UI] Fix summary text label sizes (#134)
* [Clustering] Implement recursive clustering within hierarchy (#139)
* [UI] Clean up UI scripts (#140)
* [Reassignment] Assign new targets to excess interceptors (#141)
* [Evasion] Fix threat evasion of interceptors (#143)
* [Reassignment] Use capacity remaining to reassign interceptors (#144)
* [Agent] Add IsPursuable property (#145)
* [Reassignment] Implement threat reassignment (#146)
* [Escape] Add escape detectors (#147)
* [Escape] Check for escaping targets (#148)
* [Movement] Fix missile movement to avoid the ground (#149)
* [Reassignment] Fix relaunching multiple carrier interceptors (#150)
* [Unity] Fix serializable fields and references (#152)
* [Docs] Update docs with hierarchical strategy (#153)
* [Utils] Sample from normal distribution (#154)
* [Proto] Add run configuration proto (#155)
* [Visualization] Fix visualizing simulation monitor logs (#157)
* [Tools] Build standalone player (#158)
* [Manager] Add run manager to handle run configurations (#159)
* [Tools] Refactor common simulation-related constants and utilities (#160)
* [Tools] Add metric and aggregator classes (#161)
* [Tools] Process the aggregated logs of a simulation run (#162)
* [Docs] Update documentation with run configuration and logging (#163)
* [Tests] Remove unused Rigidbody variables from unit tests (#166)
* [Agent] Add target model API in Agent interface (#167)
* [Logging] Emit more detailed events (#168)
* [Metrics] Consider only missile interceptors in metrics (#169)
* [Logging] Remove logging from CP-SAT solver (#171)
* [Tools] Add script to animate telemetry log (#172)
* [Docs] Remove unnecessary docs image files (#174)
* [Interceptor] Rename IsPursuable to IsPursuer (#175)
* [UI] Reimplement tactical panel (#176)
* [UI] Add camera to follow and rotate around interceptors or threats (#177)
* [Configs] Add configuration for 5 swarms and 1000 UCAVs (#179)
* [Agent] Cache the agent transform (#180)
* [Agent] Clean up finding relative transformations (#181)
* [Configs] Exclude 5_swarms_1000_ucav configuration from CI (#182)
* [Agents] Fix collisions with terminated agents (#184)
* [Controls] Implement vector proportional navigation (#186)
* [Reassignment] Find subhierarchicals with at least one active target (#187)
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.

2 participants