test(compiler): pin that a file edit moves no server-function id - #3121
test(compiler): pin that a file edit moves no server-function id#3121frenzzy wants to merge 1 commit into
Conversation
Ids are the addresses deployed clients already hold, so keying them on identity rather than position (7c551ae) is a wire contract. The fixture suite cannot express it: every fixture is a single fixed source, so it pins the id FORMAT and has no second version to compare against — the positional scheme passed an identically shaped suite, and the fix regenerated 137 files. Reintroducing position would go green after exactly the regeneration a developer performs when snapshots fail. This is the differential half: compile two versions of one file — append, insert, delete, reorder, edit a body — and require every surviving name to keep its address. Also pins the two consequences worth being explicit about: a rename is a new address (a clean 404, not another function), and among functions sharing a descriptive name position still decides. Checked by reverting create_id to `<hash>-<count>`: 4 of the 7 fail.
|
Merging this PR will not alter performance
Comparing Footnotes
|
|
Superseded by d6a4a52 — closing. Your Deriving the ids from an independent implementation catches a change to the hash, the path derivation or the format, where my differential version only notices when an edit happens to move something — and three of my cases pass under both schemes, since inserting at the top, deleting the first function and editing a body never moved an id even positionally. That is a weaker signal for the same regression. The README line is the part I would not have thought to write, and it is probably the most durable of the three: a fixture regeneration that changes an id is a protocol change, not churn. That is the sentence that stops the next person waving it through. |
Server-function ids are the addresses deployed clients already hold, so keying them on identity rather than position (7c551ae, #3109) is a wire contract — and nothing currently guards it.
The fixture suite cannot: every fixture in
__tests__/directives/is a single fixed source with frozen expected output, so it pins the id format and has no second version to compare against. The positional scheme passed an identically shaped suite; the fix regenerated 137 files. Reintroducing position goes green after exactly the regeneration a developer performs reflexively when snapshots fail — and the failure it lets through is the silent one: an old tab callinggetUserreachingdeleteUserwith a 200.This is the differential half. Compile two versions of one file and require every surviving name to keep its address:
Plus the two consequences worth stating rather than discovering:
<name>-<hash>-<n>), which no fixture covers today.Checked by mutation
Reverting
create_idtoformat!("{}-{}", self.hash, self.count - 1)fails 4 of the 7:The other three pass under both schemes — inserting at the top, deleting the first function, and editing a body never moved an id even positionally. Worth keeping for exactly that reason: most edits look safe, which is why the bug survived. Deleting the first function is the surprising member of that set, and it is surprising only because the old numbering ran in reverse.
Compiler suite green: 29 files, 4325 passed. Tests only, no changeset.
Raised as a gap in #3120.