skip to content

change management for a collector · lesson 2 of 6 · sources checked 2026-11-30

the blast radius of a change in shared code

This lesson maps each shared function, constant, and data file to the targets that use it, and counts the affected targets of one change.

purpose

One line of shared code can reach each target that uses it. Before a release, you must know which targets and which target classes a change reaches. Without that count, a small change can become a large failure.

objectives

  1. Build a dependency map from each shared function, constant, and data file to the targets that use it.
  2. Explain why a map of code imports alone misses some targets.
  3. Compute the impact count of one change for each target class.
  4. Find two copies of one fact, and map both of them.

new terms

dependency map
A map from each shared function, constant, and data file to the overrides and targets that use it.
impact count
The count of affected targets for each target class that a dependency map gives for one change.

how it works

The blast radius of a change is the set of targets and overrides that one change in shared code can affect. Shared code is the code that many targets use, for example a text cleaner or a date reader.

the dependency map

A dependency map goes from each shared item to the targets that use it. A shared item is a function, a constant, or a data file. The map has four levels:

  1. The shared item, for example the function parse_date.
  2. Each override that uses the item. An override is a special case in data for one scope.
  3. Each target that uses the item directly or through an override.
  4. The target class of each target, for example "article" or "listing".

imports alone miss the data files

A map of code imports shows which code calls which function. It does not read a data file. Some targets reach a shared item only through an override in a data file. For example, the file says that one target uses a special date format. The code of that target imports nothing new.

Thus an import map misses that target. Scan the data files of the overrides too, and add each link that they give to the map.

two copies of one fact are one fact

Sometimes one fact is in two places. For example, a list of failure forms is in the retry code and in the record code. A change updates one copy. The two copies now disagree. A failure form can then be terminal in one place and still get a retry in the other place.

Treat the two copies as one fact, and map both readers. A better correction is one shared constant that both readers import.

the impact count

The impact count of one change is the count of affected targets for each target class. Read it from the map:

  1. Find the changed item.
  2. Follow each link to the overrides and the targets.
  3. Count the targets in each target class.

For example, a change to the list of author names reaches 6 article targets, 1 event target, and no product target. This count is a synthetic example. The count shows which target classes the release must test first.

two kinds of count

A static count reads the code and the data files. It gives each target that can reach the item. A dynamic count records each target that really used the item on one day.

For example, a date reader has a path for a rare date form that no page used on that day. The static count holds the target of that path, and the dynamic count does not. Thus a static count can be larger, and a dynamic count can miss a path.

Say which count a statement uses. The count gives the reach of a change. It does not give the effect. A differential run runs the old code and the new code on the same input, and lists each difference. More detail is in The regression corpus and the differential run.

the view of a defender

A change in shared code reaches many targets at one time. A defender of one site sees only its own site. For example, a new retry wait shows on each target in the same hour.

But a defender with many sites can see the same change on each of them at the same time. That common change can link the sites to one operator.

the two sides

automation sidedetection side
An impact count shows the team which target classes a change touches before the release.A defender sees a change in shared code as a change on many targets at one time. The same change on many sites can link them to one operator.

design decisions

optiongaincostwhen it is correct
Map the code imports onlyA tool can make the map from the code.It misses each target that an override in a data file links.Only when no data file holds overrides
Map the imports and scan the data filesThe map holds each link of the code and the data.The scan must know the format of each data file.For a collector with overrides in data
Static countIt finds each path that can reach the item.It can count paths that no page uses.Before a release, as the upper limit
Dynamic countIt counts only the paths that pages really use.It misses a path that a page uses on other days.To find the targets to test first
One shared constant for one factA change reaches each reader at one time.The readers depend on one more shared item.Each time two places hold the same fact

diagram

the dependency map: shared items, overrides, targets, and target classes

The map has four levels. A link from a data file reaches a target with no new import in its code.source: My model of the dependency map of a collector

code example

The example builds a small map from a synthetic import graph and a synthetic data file of overrides. It gives the impact count of one changed item, first from the imports only, then with the data file. All names are synthetic.

m55-x02-dependency-map.tstypescript

Build a dependency map from code imports and an override data file, and print the impact count of one change.

type Target = { id: string; cls: string; imports: string[] };

// Synthetic code imports of each target.
const targets: Target[] = [
  { id: "a1", cls: "article", imports: ["clean_text", "parse_date"] },
  { id: "a2", cls: "article", imports: ["clean_text"] },
  { id: "e1", cls: "event", imports: ["clean_text"] },
  { id: "e2", cls: "event", imports: ["clean_text", "parse_date"] },
  { id: "p1", cls: "product", imports: ["clean_text", "read_price"] },
  { id: "l1", cls: "listing", imports: ["clean_text"] },
];

// Synthetic override data file: each override names a target and a shared item.
const overrides = [
  { id: "ov-1", target: "a2", uses: "DATE_FORMATS" },
  { id: "ov-2", target: "e1", uses: "DATE_FORMATS" },
  { id: "ov-3", target: "l1", uses: "DATE_FORMATS" },
];

// The code link between shared items: parse_date reads DATE_FORMATS.
const codeUses: Record<string, string[]> = { parse_date: ["DATE_FORMATS"] };

function reaches(t: Target, item: string, withData: boolean): boolean {
  const direct = t.imports.some((i) => i === item || (codeUses[i] ?? []).includes(item));
  const viaData = withData && overrides.some((o) => o.target === t.id && o.uses === item);
  return direct || viaData;
}

function impactCount(item: string, withData: boolean): Record<string, number> {
  const count: Record<string, number> = {};
  for (const t of targets) count[t.cls] = count[t.cls] ?? 0;
  for (const t of targets) if (reaches(t, item, withData)) count[t.cls] += 1;
  return count;
}

const changed = process.argv[2] ?? "DATE_FORMATS";
console.log(`changed item: ${changed}`);
console.log("imports only:", JSON.stringify(impactCount(changed, false)));
console.log("with data file:", JSON.stringify(impactCount(changed, true)));

output

The impact count of the changed item for each target class, from the imports only and with the data file.

changed item: DATE_FORMATS
imports only: {"article":1,"event":1,"product":0,"listing":0}
with data file: {"article":2,"event":2,"product":0,"listing":1}

The output shows that the import map finds two targets, and the scan of the data file finds three more. The listing class has no import link to the item, so only the scan finds it.

data

targets that a change to each shared item of a lab collector reaches

status of this figure: measured by me

targets that a change to each shared item of a lab collector reachesDATE_FMT_MAPDATE_FORMATSEU_PRICEITEMPROPKEYWORDSNEGATIVEadapt_articleadapt_eventadapt_listingadapt_productbespoke_extractclass_matchclean_textfind_by_classfind_rawgeneric_extractparse_availparse_dateparse_date_fmtparse_priceparse_price_fmtpick_titleread_jsonld252513252513252522252525252214142514251422252525252525212525212525202525925251125122511252592525unit: targets1. product2. article3. event4. listing
  1. product: DATE_FMT_MAP 0; DATE_FORMATS 25; EU_PRICE 25; ITEMPROP 13; KEYWORDS 4; NEGATIVE 4; adapt_article 0; adapt_event 0; adapt_listing 0; adapt_product 25; bespoke_extract 2; class_match 4; clean_text 25; find_by_class 4; find_raw 13; generic_extract 25; parse_avail 25; parse_date 0; parse_date_fmt 0; parse_price 22; parse_price_fmt 5; pick_title 25; read_jsonld 25
  2. article: DATE_FMT_MAP 3; DATE_FORMATS 25; EU_PRICE 25; ITEMPROP 22; KEYWORDS 14; NEGATIVE 14; adapt_article 25; adapt_event 0; adapt_listing 0; adapt_product 0; bespoke_extract 7; class_match 14; clean_text 25; find_by_class 14; find_raw 22; generic_extract 25; parse_avail 0; parse_date 25; parse_date_fmt 3; parse_price 0; parse_price_fmt 0; pick_title 25; read_jsonld 25
  3. event: DATE_FMT_MAP 4; DATE_FORMATS 25; EU_PRICE 25; ITEMPROP 21; KEYWORDS 7; NEGATIVE 7; adapt_article 0; adapt_event 25; adapt_listing 0; adapt_product 0; bespoke_extract 4; class_match 7; clean_text 25; find_by_class 7; find_raw 21; generic_extract 25; parse_avail 0; parse_date 25; parse_date_fmt 4; parse_price 20; parse_price_fmt 6; pick_title 25; read_jsonld 25
  4. listing: DATE_FMT_MAP 9; DATE_FORMATS 25; EU_PRICE 25; ITEMPROP 11; KEYWORDS 4; NEGATIVE 4; adapt_article 0; adapt_event 0; adapt_listing 25; adapt_product 0; bespoke_extract 12; class_match 4; clean_text 25; find_by_class 4; find_raw 11; generic_extract 25; parse_avail 0; parse_date 25; parse_date_fmt 9; parse_price 0; parse_price_fmt 0; pick_title 25; read_jsonld 25

source: Lab result of this course: dynamic trace of one lab collector on 100 lab targets; date 2026-11-13; condition: One small lab code base, one seed, one host. A trace shows only the paths that the pages of one lab day use. Lab teaching values, not values for a real service.

data table
targets that a change to each shared item of a lab collector reaches
seriesshared itemtargets
productDATE_FMT_MAP0
productDATE_FORMATS25
productEU_PRICE25
productITEMPROP13
productKEYWORDS4
productNEGATIVE4
productadapt_article0
productadapt_event0
productadapt_listing0
productadapt_product25
productbespoke_extract2
productclass_match4
productclean_text25
productfind_by_class4
productfind_raw13
productgeneric_extract25
productparse_avail25
productparse_date0
productparse_date_fmt0
productparse_price22
productparse_price_fmt5
productpick_title25
productread_jsonld25
articleDATE_FMT_MAP3
articleDATE_FORMATS25
articleEU_PRICE25
articleITEMPROP22
articleKEYWORDS14
articleNEGATIVE14
articleadapt_article25
articleadapt_event0
articleadapt_listing0
articleadapt_product0
articlebespoke_extract7
articleclass_match14
articleclean_text25
articlefind_by_class14
articlefind_raw22
articlegeneric_extract25
articleparse_avail0
articleparse_date25
articleparse_date_fmt3
articleparse_price0
articleparse_price_fmt0
articlepick_title25
articleread_jsonld25
eventDATE_FMT_MAP4
eventDATE_FORMATS25
eventEU_PRICE25
eventITEMPROP21
eventKEYWORDS7
eventNEGATIVE7
eventadapt_article0
eventadapt_event25
eventadapt_listing0
eventadapt_product0
eventbespoke_extract4
eventclass_match7
eventclean_text25
eventfind_by_class7
eventfind_raw21
eventgeneric_extract25
eventparse_avail0
eventparse_date25
eventparse_date_fmt4
eventparse_price20
eventparse_price_fmt6
eventpick_title25
eventread_jsonld25
listingDATE_FMT_MAP9
listingDATE_FORMATS25
listingEU_PRICE25
listingITEMPROP11
listingKEYWORDS4
listingNEGATIVE4
listingadapt_article0
listingadapt_event0
listingadapt_listing25
listingadapt_product0
listingbespoke_extract12
listingclass_match4
listingclean_text25
listingfind_by_class4
listingfind_raw11
listinggeneric_extract25
listingparse_avail0
listingparse_date25
listingparse_date_fmt9
listingparse_price0
listingparse_price_fmt0
listingpick_title25
listingread_jsonld25
Targets that used each shared function or constant in a dynamic trace of 100 lab targets, stacked by target class. A call graph of the code gives other counts, and it misses links through a data file.

The chart is a lab result of this course on one small lab code base. It is not a value for a real service.

Some items reach each target class, and other items reach only some classes.

failure modes

problemcausecorrection
A change to a shared format table breaks targets that the review did not expect.The map read the code imports only, and an override in a data file linked those targets.Scan the data files of the overrides, and add each link to the map.
A failure form is terminal in one place and still gets a retry in a different place.Two copies of one list drifted, because a change updated one copy only.Map both readers, and use one shared constant in place of the two copies.
The team tests the wrong target class first.The impact count was not made, or it was made for all targets with no class.Count the affected targets for each target class before the release.
A statement gives a count of affected targets, and a reader cannot check it.The statement does not say if the count is static or dynamic.Say which count each statement uses.

check questions

  1. Which levels does a dependency map hold, from the start to the end?

    1. Shared item, override, target, target class
    2. Target class, release, test, way back
    3. Shared item, target class, release, defender
    answer

    a. Shared item, override, target, target class

    The map goes from each shared item to the overrides and the targets. Then it goes to the target class of each target.

  2. Explain why a map of code imports alone misses some targets.

    sample answer

    Some targets reach a shared item only through an override in a data file. The code of such a target imports nothing new. An import map does not read the data file, so it misses that target. A scan of the data files finds the link.

  3. A change reaches 2 article targets and 1 listing target, and no product target. What is this result?

    1. The blast radius in one number
    2. The impact count of the change for each target class
    3. The effect of the change on the records
    answer

    b. The impact count of the change for each target class

    The impact count is the count of affected targets for each target class. It gives the reach of a change, not its effect. A differential run measures the effect.

  4. A list of failure forms is in the retry code and in the record code. A change updates one copy only. What is the better correction?

    1. Update the second copy by hand at each release.
    2. Remove the list from the record code.
    3. Use one shared constant that both readers import, in place of the two copies.
    answer

    c. Use one shared constant that both readers import, in place of the two copies.

    Two copies of one fact are one fact. One shared constant lets a change reach each reader at one time.

exercise

exercise Do this task on paper. Use the synthetic records of a lab collector below. The changed item is the constant UNIT_TABLE.

Code imports of each target:

  • Target a1 (article): clean_text.
  • Target a2 (article): clean_text, read_size.
  • Target p1 (product): clean_text, read_size.
  • Target p2 (product): clean_text.
  • Target l1 (listing): clean_text.

Code links: the function read_size reads UNIT_TABLE.

Override data file:

  • Override ov-7: target p2 uses UNIT_TABLE.
  • Override ov-8: target l1 uses UNIT_TABLE.
  1. Draw the dependency map from UNIT_TABLE to the targets.
  2. Write the impact count for each target class from the imports only.
  3. Write the impact count for each target class with the data file.
  4. Write the target class that only the scan of the data file finds.
sample answer

The answer uses the synthetic records of the task.

UNIT_TABLE goes to read_size, and read_size goes to a2 and p1. It also goes to the overrides ov-7 and ov-8, and they go to p2 and l1.

From the imports only, the count is article 1, product 1, and listing 0. With the data file, the count is article 1, product 2, and listing 1. Only the scan of the data file finds the listing class.

sources

  1. My model of the dependency map, the impact count, and the two kinds of count, 2026-11 (not public).