Skip to content

86eyt37xx/the traffic light - #763

Merged
AhedALbarhi merged 4 commits into
mainfrom
86eyt37xx/TheTraffic
Sep 1, 2026
Merged

86eyt37xx/the traffic light#763
AhedALbarhi merged 4 commits into
mainfrom
86eyt37xx/TheTraffic

Conversation

@AhedALbarhi

Copy link
Copy Markdown
Collaborator

The Traffic Light That Never Sleeps:
Implemented a database-driven traffic signal system using Oracle PL/SQL

  • Created a traffic_signals table to store signal ID, name, current state, and last change time.
  • Created check_and_update_signal_status precedure to manage the signal cycle:
    • RED → YELLOW after 10 seconds
    • YELLOW → GREEN after 5 seconds
    • GREEN → RED after 10 seconds
  • Created start_signal_watch precedure to create schedule job
  • Each Scheduler job runs every 5 seconds.
  • Added an AFTER INSERT trigger to automatically start the Scheduler when a new signal is created.

@github-actions

Copy link
Copy Markdown

Here's a summary of the Code Review Comments based on the provided pull request.

Code Review Comments

  1. Title Format:

    • The title should start with a ClickUp ticket ID followed by a colon. Current format: 86eyt37xx/the traffic. Suggested format: 86eyt37xx: The Traffic.
  2. Description Clarity:

    • The description header ("The Traffic Light That Never Sleeps") could be removed or simplified to focus purely on technical details.
    • Ensure the description reflects all significant changes made.
  3. Indentation Consistency:

    • Line 2: Ensure indentation is consistent with 4 spaces for all aligned elements.
    • Lines 15, 62, and 85: Maintain consistent indentation across procedures and blocks.
  4. Unnecessary Blank Lines:

    • Lines 14, 55, and 58: Remove any unnecessary blank lines to keep the code clean.
  5. Procedure Naming:

    • Line 16 & 63: Consider standardizing procedure name prefixes (like proc_ or sp_) for clearer identification.
  6. Logical Errors:

    • Line 49: Make sure to account for potential race conditions where signal states are updated too quickly between procedure calls. Consider using a locking mechanism if concurrent modifications are possible.
  7. Security & Privileges:

    • Line 103: Confirm that granting privileges to a specific user (like SYSTEM) adheres to your security policies. Limiting privileges may reduce potential security risks.

Suggestions for Improvement

  • Consider enhancing the error handling in both procedures to manage unexpected conditions gracefully.
  • Implement logging for procedure executions and errors to assist in debugging and monitoring.

The comments are intended to streamline necessary adjustments while maintaining clarity. If there’s anything specific you’d like to delve deeper into, please let me know!

New%20session%20-%202026-08-31T10%3A29%3A26.702Z
opencode session  |  github run

@AhedALbarhi AhedALbarhi changed the title 86eyt37xx/the traffic 86eyt37xx/the traffic light Aug 31, 2026
signal_id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
signal_name VARCHAR2(100) NOT NULL,
state VARCHAR2(10) DEFAULT 'RED' NOT NULL
CONSTRAINT ck_signal_state CHECK (state IN ('RED','YELLOW','GREEN')),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

any specific reason for adding a constraint here ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

sure, add this CONSTRAINT to prevent invalid status like blue, black just that's mention RED and YELLOW, GREEN

--privilege
SELECT USER FROM dual;

GRANT CREATE JOB TO SYSTEM;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

is there a reson for this statement ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, prevent me when do create procedure that's create scheduler job so SELECT USER FROM dual; to check which user then create "GRANT CREATE JOB TO SYSTEM" for that user

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Here's a summary of the Code Review Comments based on the provided pull request:

Code Review Comments

  1. Title Format:

    • The title should start with a ClickUp ticket ID followed by a colon. Current format: 86eyt37xx/the traffic light. Suggested format: 86eyt37xx: The Traffic Light.
  2. Description Clarity:

    • The description header ("The Traffic Light That Never Sleeps") should be simplified or removed, focusing on the technical description of the implemented changes.
    • Ensure the description reflects all significant changes made, including trigger functionalities and constraints.
  3. Indentation Consistency:

    • Lines 2-8: Ensure consistent indentation of 4 spaces throughout the entire SQL script to enhance readability.
    • Lines 16, 63: Maintain uniform indentation across procedure blocks.
  4. Unnecessary Blank Lines:

    • Lines 14, 55, and 98: Remove unnecessary blank lines for a cleaner code appearance.
  5. Procedure Naming:

    • Lines 16 & 63: Consider prefixing procedure names (e.g., proc_ or sp_) for clearer identification and easier navigation.
  6. Logical Errors:

    • Line 49: Ensure consideration for potential race conditions in signal state updates. A locking mechanism is recommended if concurrent modifications may occur.
  7. Security & Privileges:

    • Line 103: Confirm that granting privileges (e.g., GRANT CREATE JOB TO SYSTEM) aligns with your organization's security policies. Limiting permissions can enhance data safety.

Suggestions for Improvement

  • Implement enhanced error handling within both procedures to gracefully manage unexpected conditions.
  • Add logging for troubleshooting during procedure executions to aid monitoring and debugging.

These comments aim to facilitate necessary revisions while maintaining code clarity and quality. If there's anything specific you'd like to explore further, just let me know!

New%20session%20-%202026-09-01T07%3A53%3A47.620Z
opencode session  |  github run

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Code Review Comments

  1. Title Format:

    • The title should be formatted with a ClickUp ticket ID followed by a colon. The current format is: 86eyt37xx/the traffic light. Suggested format: 86eyt37xx: The Traffic Light.
  2. Description Clarity:

    • The description should focus on technical changes. Consider removing or simplifying the heading "The Traffic Light That Never Sleeps".
    • Ensure the description accurately summarizes all significant changes made, including the trigger functionalities and constraints.
  3. Indentation Consistency:

    • Lines 2-8: Ensure consistent indentation of 4 spaces throughout the SQL script for readability.
    • Lines 16, 63: Maintain uniform indentation across procedure blocks.
  4. Unnecessary Blank Lines:

    • Lines 14, 55, and 98: Remove unnecessary blank lines to enhance code clarity.
  5. Procedure Naming:

    • Lines 16 & 63: It might be beneficial to standardize the naming convention of procedures (e.g., using prefixes like proc_) for clearer identification.
  6. Logical Errors:

    • Line 49: Consider potential race conditions in signal state updates. It's advisable to implement a locking mechanism if concurrent modifications can happen.
  7. Security & Privileges:

    • Line 103: Confirm that granting privileges (e.g., GRANT CREATE JOB TO SYSTEM) complies with security best practices. Limiting permissions can enhance data safety.

Suggestions for Improvement

  • Implement improved error handling within both procedures to gracefully manage unexpected situations.
  • Consider adding logging capabilities for procedure executions and errors to assist with monitoring and debugging.

These comments aim to facilitate necessary revisions while maintaining clarity and quality in the code. If you'd like to discuss anything further, just let me know!

New%20session%20-%202026-09-01T07%3A59%3A08.395Z
opencode session  |  github run

@AhedALbarhi
AhedALbarhi merged commit 597563e into main Sep 1, 2026
2 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.

5 participants