Problem/Motivation

The decision taken for this module is that hand edits do not live in generated files at all, and that losing one to a regeneration must be impossible rather than unlikely. That guarantee rests entirely on a marker and a content hash written into every generated file.

Proposed resolution

  • Emit the @myrestGenerated docblock with the generator version, the blueprint id, the timestamp and the content hash.
  • Compute the hash over the file without the hash line itself, so that writing it does not invalidate it.
  • Implement the full decision table: no file — write; hash matches and nothing changed — skip; hash matches and the model changed — overwrite; hash does not match — do not write, raise a conflict; no marker at all — never touch.
  • A test per row of that table, including the case that matters most: a file edited by hand is not overwritten.

Remaining tasks

Everything.

Issue fork myrest-3621721

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sergeydruua created an issue. See original summary.

  • sergeydruua committed 19b62be0 on 1.0.x
    Issue #3621721: Mark generated files and detect edits by hash
    
sergeydruua’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

sergeydruua’s picture

Status: Fixed » Closed (fixed)