Skip to main content

Update Detection & Visual Diffing

Update detection and visual diffing is one of JCBโ€™s most powerful safety features โ€” enabling intelligent, traceable compilation

What Is Update Detection?

When a reusable code block (e.g. from a Custom Code entity, Layout, or Template) is injected into a compiled file, JCB wraps that block with special comment markers known as insert/replace tags. On future rebuilds, JCB uses those tags to:

  • Compare the original code vs. the code currently in the file
  • Identify any differences between versions
  • Warn you if a manual edit was made to an injected block
  • Decide whether to update, skip, or log the conflict

This mechanism ensures safe โ€œround-tripโ€ workflows โ€” you can edit compiled files (for example, via IDE sync), and JCB will detect if somethingโ€™s been changed and react accordingly.

How It Works

  1. You define and inject a reusable Custom Code block (e.g. validation.php).
  2. On compile, JCB adds that block with identifiable comment tags (e.g. // [CODE: my_block]).
  3. You edit the compiled file manually (or fetch from IDE).
  4. Next compile: JCB reads both the new version and original block.
  5. If a mismatch is found, it presents a diff and logs the override.

Key Features

  • ๐Ÿ” Visual Diff Comparison: Side-by-side detection of modified vs. original blocks, showing additions, deletions, and changes.
  • ๐Ÿ” Round-Trip Safety: Changes in compiled files are not blindly overwritten โ€” JCB flags them for inspection.
  • ๐Ÿ“‘ Central Diff Logging: Changes are logged to the compiler logs for inspection and tracking.
  • ๐Ÿง  Smart Context Recognition: Diffing is aware of comment-style, language syntax, and block context (HTML, PHP, etc.).
  • ๐Ÿ›‘ Warning System: Displays alerts in the compile summary when it finds mismatches or injected code that was edited.
  • ๐Ÿ’พ Override Preservation: You can choose to preserve manual edits and skip automatic replacement, depending on your development strategy.

Use Cases

  • You edited compiled logic in your IDE and want to preserve it during JCB rebuild.
  • Youโ€™re collaborating and want to see what changed in a shared code block.
  • You manage version-controlled blueprints and want to avoid unintended regressions.

Why It Matters

  • โœ… Prevents Accidental Overwrites: Manual changes are never lost without warning.
  • โœ… Enables Round-Trip Coding: Fetch > Edit > Compile again โ€” all with safety nets.
  • โœ… Facilitates Collaboration: See who made what changes when working in teams.

Conclusion

Update detection and visual diffing is one of JCBโ€™s most powerful safety features โ€” enabling intelligent, traceable compilation. You keep full control of your overrides and code changes, and JCB makes sure nothing is lost along the way. Whether youโ€™re working alone or with a team, it gives you peace of mind and protects your logic.

Summary

JCB tracks injected and reused code with a visual diff system, allowing you to detect changes between the original and compiled code โ€” preserving overrides, alerting you to differences, and helping prevent accidental loss of edits during rebuilds.