P247 · Context management

Protected content through an editable projection

Keep protected content in an authoritative store while the editing view contains explicit opaque references.

Editorially reviewed

These examples and illustrative results are independently authored teaching materials, not measured model results.

Use case

Refactor your own code in a file while preserving a vendor block byte for byte. The teaching task only permits renaming an outside variable. Keep the working file runnable; a separate editing projection may reference [[VENDOR_BLOCK_1]], but that projection is not compilable source.

Mechanism

Save original bytes and protected-block identity/digest, then create an editing-only projection. Define this task’s requirement to retain one reference at its agreed position. Reconstruct the real file after editing, validate references and protected bytes, inspect outside changes, then apply and test. Missing/unknown references or a violated retention contract stop reconstruction rather than triggering fuzzy guesses.

Bad example

Rewrite the whole file with a vague reminder not to change vendor code. Alternatively replace vendor logic with a comment in the working file and compile that projection as proof of preservation.

Good example

Back up the original and preserve exact vendor bytes and digest for the outside-refactor task. Edit a separate view retaining [[VENDOR_BLOCK_1]] once at the agreed position; do not execute it as source. Validate reference identity, restore original bytes, compare the protected block and permitted outside changes, then apply and run relevant checks. Missing, duplicated or unknown references fail this task; do not guess recovery.

Why the change matters

A vague warning does not verify bytes, and running a placeholder projection changes program semantics. A separate view limits the editable surface while reconstruction/comparison provide evidence for preservation.

Observable expectation

Compare reconstructed protected bytes with the backup, inspect the permitted variable rename and ensure checks run on reconstructed source. Removing/duplicating the reference in a teaching fault case should stop reconstruction and preserve the original.

A digest only supports its byte check. Missing backups/identity checks or tests of the projection alone fail this contract.

Limits

This is not a security boundary; originals and mappings need reliable storage. The source hook edits in place with short identifiers. This example’s separate projection and stricter reference checks are teaching improvements, not claims of guaranteed collision-free upstream recovery.

Sources and evidence

Read the editorial criteria