SFO IST — Sandbox Walkthrough

Run the IST wizard on a project whose result is already known. IST Test Project in SFOBox has nine systems. Five Template Project ISTs apply, two systems are new, and one record is there to prove it is left out. Compare the screen with the tables below, then run the check script in the Developer Console. Reset puts the project back so you can do it again.

SFOBox only Log in to Sandbox (SFOBox) as a user with the permission set SFO IST Access. This walkthrough does not use Terminal 3 West, and it does not change the Template Project.
The project is already loaded Program IST Test Program, project IST Test Project. Nine records, names starting with IST-TEST. Run the reset script in step 6 if ISTs are already on it. Open the CitiriOS Command app. The project page there is SFO Project Record Page. Go to Work Management, then Activity Lists, then the ISTs sub-tab.
Run a script in Salesforce Log in to SFOBox. Click the gear, then Developer Console. In that window choose Debug, then Open Execute Anonymous Window. Paste the script, check Open Log, and click Execute. In the log, turn on Debug Only. The result is the line that starts with CHECK, RESET, or SEED.
Compare setup→ Recommended ISTs→ New system→ Create→ Check script→ Reset
Step 1

Confirm the nine records

On the project, open Systems. You should see only these records. The Template System column is the comparison. A blank Template System is a new system.

RecordTypeUnderTemplate SystemWhat it is for
IST-TEST BuildingParentBuilding SystemsHolds the others. No IST covers it.
IST-TEST Public AddressSystemIST-TEST BuildingPublic AddressDirect match.
IST-TEST Sharc UnitEquipmentIST-TEST BuildingSharc SystemDirect match.
IST-TEST SwitchgearEquipmentIST-TEST BuildingSwitchgearMatch through its parent, Electrical Power Distribution.
IST-TEST ElevatorEquipmentIST-TEST BuildingElevatorDirect match, and its parent Conveyance is on another IST.
IST-TEST Point of Use 400HzEquipmentIST-TEST Building400Hz (Point of Use)Has a template, and no IST covers that template. It must not be recommended or linked.
IST-TEST Heat RecoveryParentNew system. Generate uses this one.
IST-TEST Heat PumpEquipmentIST-TEST Heat RecoveryEquipment of the new system. It is not listed on its own as a new system.
IST-TEST WayfindingSystemSecond new system. Leave it, so you can see a system that gets no IST.

Checklists and Inspections on this project stay empty. Every list you create is an IST.

Step 2

Recommended ISTs

On the project CitiriOS Command → Work Management → Activity Lists → ISTs → Create ISTs.

The first step is 1. Recommended ISTs. Nothing is checked yet. Click Select all. You should see these five, in this order, and no others. IST 6.0 Ramp Operations is not here, because its template links were left unloaded.

ISTLine under the name
IST 1.0 Audio Notification2 project records · Template Systems: Electrical Power Distribution, Public Address
IST 2.0 Conveyance2 project records · Template Systems: Conveyance, Elevator, Public Address
IST 3.0 Electrical Metering, Monitoring and Control2 project records · Template Systems: Conveyance, Electrical Power Distribution
IST 4.0 Emergency Power1 project record · Template Systems: Electrical Power Distribution
IST 11.0 SHARC1 project record · Template Systems: Sharc System

None of them should say Already on this project. Click Next.

Step 3

Generate an IST for the new system

Step 2. New systems lists two records:

  • IST-TEST Heat Recovery — Parent · 1 equipment
  • IST-TEST Wayfinding — System · 0 equipment

Click Generate on IST-TEST Heat Recovery only. The wizard moves to 3. Review new ISTs. The badge says Drafted by the Citiri agent. If Einstein is unavailable it says Drafted from record links, and the test still works.

What stays the same every run

  • The first section is Prerequisites/Critical Events, with these lines: Integration Diagram Completed, SOO Review with Stakehoders, IST Script Completed, System Dependencies Completed, FPT Completed, Integration Completed, IST Scheduled.
  • Then four empty sections: SSR Rooms, AHJ Focused, Load Centers, Emergency Management.
  • IST-TEST Heat Recovery is selected. IST-TEST Heat Pump is offered and selected. Leave both selected.
  • IST-TEST Point of Use 400Hz, IST-TEST Building, and the template-linked equipment are not in this list.

What the agent may word differently

The IST name, the summary, and any sections after the four empty ones change from run to run. One sandbox run named it IST - Heat Recovery System and added a Heat Recovery System section and a Heat Pump Equipment section, with three lines each. That wording is not the answer key.

Closing throws the draft away If you close the panel before Create, the draft is discarded and Heat Recovery no longer says Drafted. Generate again. Wayfinding stays without an IST on purpose.
Step 4

Create the ISTs and compare the links

The button reads Create 6 ISTs (five from the Template Project, plus the draft). Click it. The Created list has six names. Template copies keep the template name. The new one uses the drafted name. Click each template copy and compare its IST Systems related list.

Copied ISTLinked recordsReason
IST 1.0 Audio Notification IST-TEST Public Address
IST-TEST Switchgear
Points at Template System Public Address.
Its Template System is under Electrical Power Distribution.
IST 2.0 Conveyance IST-TEST Elevator
IST-TEST Public Address
Points at Template System Elevator.
Points at Template System Public Address.
IST 3.0 Electrical Metering, Monitoring and Control IST-TEST Elevator
IST-TEST Switchgear
Its Template System is under Conveyance.
Its Template System is under Electrical Power Distribution.
IST 4.0 Emergency Power IST-TEST Switchgear Its Template System is under Electrical Power Distribution.
IST 11.0 SHARC IST-TEST Sharc Unit Points at Template System Sharc System.

Each copied list also has the same shell: one group, five sections, and seven lines in Prerequisites/Critical Events. The four other sections are empty.

These records are on none of the five copies: IST-TEST Building, IST-TEST Point of Use 400Hz, IST-TEST Heat Recovery, IST-TEST Heat Pump, IST-TEST Wayfinding. Heat Recovery and Heat Pump are on the generated IST only, with link source Generated.

On a system record

Open IST-TEST Switchgear from CitiriOS Command, or from the Activity Lists app. Both apps open System & Equipment Record Page. The tabs are Project Asset, Checklists, Projects & Library, and Images. On Checklists, the ISTs list shows only the IST name. You should see IST 1.0, IST 3.0, and IST 4.0.

Open the wizard again. The five template ISTs now say Already on this project and cannot be checked. Heat Recovery says Already in an IST. Wayfinding does not.

Step 5

Compare with the script

Paste this into the Developer Console Execute Anonymous window and execute it with the log open.

Check script
Integer passed = 0;
Integer failed = 0;
Integer skipped = 0;
List<CitiriOS__Project__c> projects = [SELECT Id FROM CitiriOS__Project__c WHERE Name = 'IST Test Project' LIMIT 1];
if (projects.isEmpty()) {
    System.debug('CHECK FAIL project IST Test Project does not exist. Run the seed script.');
    failed++;
} else {
    Id projectId = projects[0].Id;
    Map<String, String> expectedTemplate = new Map<String, String>{
        'IST-TEST Building' => 'Building Systems', 'IST-TEST Public Address' => 'Public Address',
        'IST-TEST Sharc Unit' => 'Sharc System', 'IST-TEST Switchgear' => 'Switchgear',
        'IST-TEST Elevator' => 'Elevator', 'IST-TEST Point of Use 400Hz' => '400Hz (Point of Use)',
        'IST-TEST Heat Recovery' => null, 'IST-TEST Heat Pump' => null, 'IST-TEST Wayfinding' => null
    };
    Map<String, String> actualTemplate = new Map<String, String>();
    Integer recordCount = 0;
    for (CitiriOS__System_Equipment__c row : [
        SELECT CitiriOS__Display_Name__c, SFO_Template_System__r.CitiriOS__Display_Name__c
        FROM CitiriOS__System_Equipment__c WHERE CitiriOS__Project__c = :projectId
    ]) {
        recordCount++;
        actualTemplate.put(row.CitiriOS__Display_Name__c, row.SFO_Template_System__r.CitiriOS__Display_Name__c);
    }
    if (recordCount == 9 && actualTemplate.keySet() == expectedTemplate.keySet()) {
        System.debug('CHECK PASS nine IST-TEST records');
        passed++;
    } else {
        System.debug('CHECK FAIL expected 9 IST-TEST records, found ' + recordCount);
        failed++;
    }
    for (String name : expectedTemplate.keySet()) {
        if (actualTemplate.get(name) == expectedTemplate.get(name)) {
            System.debug('CHECK PASS template ' + name);
            passed++;
        } else {
            System.debug('CHECK FAIL template ' + name + ' expected ' + expectedTemplate.get(name) + ' found ' + actualTemplate.get(name));
            failed++;
        }
    }

    Map<String, Integer> expectedCount = new Map<String, Integer>{
        'IST 1.0 Audio Notification' => 2, 'IST 2.0 Conveyance' => 2,
        'IST 3.0 Electrical Metering, Monitoring and Control' => 2, 'IST 4.0 Emergency Power' => 1, 'IST 11.0 SHARC' => 1
    };
    Map<String, Set<String>> expectedVia = new Map<String, Set<String>>{
        'IST 1.0 Audio Notification' => new Set<String>{ 'Electrical Power Distribution', 'Public Address' },
        'IST 2.0 Conveyance' => new Set<String>{ 'Conveyance', 'Elevator', 'Public Address' },
        'IST 3.0 Electrical Metering, Monitoring and Control' => new Set<String>{ 'Conveyance', 'Electrical Power Distribution' },
        'IST 4.0 Emergency Power' => new Set<String>{ 'Electrical Power Distribution' },
        'IST 11.0 SHARC' => new Set<String>{ 'Sharc System' }
    };
    Set<String> seen = new Set<String>();
    for (SFO_IstService.Recommendation rec : SFO_IstService.recommend(projectId)) {
        seen.add(rec.name);
        Boolean countOk = rec.projectRecordCount == expectedCount.get(rec.name);
        Boolean viaOk = new Set<String>(rec.templateSystems) == expectedVia.get(rec.name);
        if (countOk && viaOk) {
            System.debug('CHECK PASS recommend ' + rec.name + ' ' + rec.projectRecordCount);
            passed++;
        } else {
            System.debug('CHECK FAIL recommend ' + rec.name + ' count=' + rec.projectRecordCount + ' via=' + rec.templateSystems);
            failed++;
        }
    }
    if (seen == expectedCount.keySet()) {
        System.debug('CHECK PASS recommendation names');
        passed++;
    } else {
        System.debug('CHECK FAIL recommendation names ' + seen);
        failed++;
    }
    Set<String> novelNames = new Set<String>();
    for (SFO_IstService.NovelSystem novel : SFO_IstService.novelSystems(projectId)) {
        novelNames.add(novel.name + ' equipment=' + novel.equipmentCount + ' hasIst=' + novel.hasIst);
    }
    System.debug('CHECK INFO novels ' + novelNames);

    Map<String, Set<String>> expectedLinks = new Map<String, Set<String>>{
        'IST 1.0 Audio Notification' => new Set<String>{ 'IST-TEST Public Address', 'IST-TEST Switchgear' },
        'IST 2.0 Conveyance' => new Set<String>{ 'IST-TEST Elevator', 'IST-TEST Public Address' },
        'IST 3.0 Electrical Metering, Monitoring and Control' => new Set<String>{ 'IST-TEST Elevator', 'IST-TEST Switchgear' },
        'IST 4.0 Emergency Power' => new Set<String>{ 'IST-TEST Switchgear' },
        'IST 11.0 SHARC' => new Set<String>{ 'IST-TEST Sharc Unit' }
    };
    Map<String, String> expectedReason = new Map<String, String>{
        'IST 1.0 Audio Notification|IST-TEST Public Address' => 'Points at Template System Public Address.',
        'IST 1.0 Audio Notification|IST-TEST Switchgear' => 'Its Template System is under Electrical Power Distribution.',
        'IST 2.0 Conveyance|IST-TEST Elevator' => 'Points at Template System Elevator.',
        'IST 2.0 Conveyance|IST-TEST Public Address' => 'Points at Template System Public Address.',
        'IST 3.0 Electrical Metering, Monitoring and Control|IST-TEST Elevator' => 'Its Template System is under Conveyance.',
        'IST 3.0 Electrical Metering, Monitoring and Control|IST-TEST Switchgear' => 'Its Template System is under Electrical Power Distribution.',
        'IST 4.0 Emergency Power|IST-TEST Switchgear' => 'Its Template System is under Electrical Power Distribution.',
        'IST 11.0 SHARC|IST-TEST Sharc Unit' => 'Points at Template System Sharc System.'
    };
    List<CitiriOS__Activity_List__c> copies = [
        SELECT Id, Name FROM CitiriOS__Activity_List__c
        WHERE CitiriOS__Project__c = :projectId AND CitiriOS__Category__c = 'IST' AND Name IN :expectedLinks.keySet()
    ];
    if (copies.isEmpty()) {
        System.debug('CHECK SKIP copied ISTs. Create them in the wizard, then run this again.');
        skipped++;
    } else {
        Map<String, Id> copyIdByName = new Map<String, Id>();
        for (CitiriOS__Activity_List__c copy : copies) {
            copyIdByName.put(copy.Name, copy.Id);
        }
        if (copyIdByName.keySet() == expectedLinks.keySet()) {
            System.debug('CHECK PASS five copied ISTs');
            passed++;
        } else {
            System.debug('CHECK FAIL copied ISTs found ' + copyIdByName.keySet());
            failed++;
        }
        for (CitiriOS__Activity_List__c copy : [
            SELECT Name, SFO_List_Type__c, SFO_Source_Activity_List__r.Name,
                (SELECT System_Equipment__r.CitiriOS__Display_Name__c, Reason__c, Link_Source__c FROM IST_Systems__r)
            FROM CitiriOS__Activity_List__c WHERE Id IN :copyIdByName.values()
        ]) {
            Set<String> linked = new Set<String>();
            Boolean reasonsOk = true;
            for (SFO_IST_System__c link : copy.IST_Systems__r) {
                String systemName = link.System_Equipment__r.CitiriOS__Display_Name__c;
                linked.add(systemName);
                String reason = expectedReason.get(copy.Name + '|' + systemName);
                if (link.Link_Source__c != 'Copied' || link.Reason__c != reason) {
                    reasonsOk = false;
                    System.debug('CHECK FAIL link ' + copy.Name + ' ' + systemName + ' source=' + link.Link_Source__c + ' reason=' + link.Reason__c);
                }
            }
            Integer sections = [SELECT COUNT() FROM CitiriOS__Activity_List_Node__c WHERE CitiriOS__Parent_Node__r.CitiriOS__Activity_List__c = :copy.Id];
            Integer items = [SELECT COUNT() FROM CitiriOS__Activity_List_Item__c WHERE CitiriOS__Activity_List_Node__r.CitiriOS__Parent_Node__r.CitiriOS__Activity_List__c = :copy.Id];
            if (linked == expectedLinks.get(copy.Name) && reasonsOk && copy.SFO_List_Type__c == 'IST' && copy.SFO_Source_Activity_List__r.Name == copy.Name && sections == 5 && items == 7) {
                System.debug('CHECK PASS copy ' + copy.Name);
                passed++;
            } else if (!reasonsOk) {
                failed++;
            } else {
                System.debug('CHECK FAIL copy ' + copy.Name + ' links=' + linked + ' type=' + copy.SFO_List_Type__c + ' sections=' + sections + ' items=' + items);
                failed++;
            }
        }
        List<CitiriOS__Activity_List__c> generated = [
            SELECT Name, (SELECT System_Equipment__r.CitiriOS__Display_Name__c, Link_Source__c FROM IST_Systems__r)
            FROM CitiriOS__Activity_List__c
            WHERE CitiriOS__Project__c = :projectId AND CitiriOS__Category__c = 'IST' AND Name NOT IN :expectedLinks.keySet()
        ];
        for (CitiriOS__Activity_List__c gen : generated) {
            List<String> names = new List<String>();
            for (SFO_IST_System__c link : gen.IST_Systems__r) {
                names.add(link.System_Equipment__r.CitiriOS__Display_Name__c + ':' + link.Link_Source__c);
            }
            System.debug('CHECK INFO generated ' + gen.Name + ' ' + names);
        }
    }
}
System.debug('CHECK done pass=' + passed + ' fail=' + failed + ' skip=' + skipped);

Read the debug lines that start with CHECK. The last one is the score.

When you run itLast line
Before CreateCHECK done pass=16 fail=0 skip=1
After Create, whether or not you generatedCHECK done pass=22 fail=0 skip=0

A generated IST is reported as CHECK INFO generated. It is not part of the pass count, because the agent names it. Any CHECK FAIL means the project no longer matches this page. The seed script in the next step repairs the nine records. It does not delete ISTs you already created.

Step 6

Put the project back

Reset deletes the IST Activity Lists on IST Test Project, their sections, lines, and links, and any generate drafts. The nine IST-TEST records stay. The Template Project stays. Paste this into the same Execute Anonymous window.

Reset script
List<CitiriOS__Project__c> projects = [SELECT Id FROM CitiriOS__Project__c WHERE Name = 'IST Test Project' LIMIT 1];
if (projects.isEmpty()) {
    System.debug('RESET missing project. Run the seed script first.');
} else {
    Id projectId = projects[0].Id;
    List<SFO_IST_Draft__c> drafts = [SELECT Id FROM SFO_IST_Draft__c WHERE Project__c = :projectId];
    delete drafts;
    List<CitiriOS__Activity_List__c> lists = [
        SELECT Id FROM CitiriOS__Activity_List__c WHERE CitiriOS__Project__c = :projectId AND CitiriOS__Category__c = 'IST'
    ];
    Set<Id> listIds = new Map<Id, CitiriOS__Activity_List__c>(lists).keySet();
    Integer items = 0;
    Integer nodes = 0;
    if (!listIds.isEmpty()) {
        List<CitiriOS__Activity_List_Item__c> itemRows = [
            SELECT Id FROM CitiriOS__Activity_List_Item__c
            WHERE CitiriOS__Activity_List_Node__r.CitiriOS__Activity_List__c IN :listIds
            OR CitiriOS__Activity_List_Node__r.CitiriOS__Parent_Node__r.CitiriOS__Activity_List__c IN :listIds
        ];
        items = itemRows.size();
        delete itemRows;
        List<CitiriOS__Activity_List_Node__c> sectionRows = [
            SELECT Id FROM CitiriOS__Activity_List_Node__c WHERE CitiriOS__Parent_Node__r.CitiriOS__Activity_List__c IN :listIds
        ];
        nodes = sectionRows.size();
        delete sectionRows;
        List<CitiriOS__Activity_List_Node__c> groupRows = [
            SELECT Id FROM CitiriOS__Activity_List_Node__c WHERE CitiriOS__Activity_List__c IN :listIds
        ];
        nodes += groupRows.size();
        delete groupRows;
        delete lists;
    }
    System.debug('RESET drafts=' + drafts.size() + ' lists=' + lists.size() + ' nodes=' + nodes + ' items=' + items);
}

The debug line looks like RESET drafts=1 lists=6 nodes=... items=.... The counts depend on whether you generated. Then run the check script again. It should end with pass=16 fail=0 skip=1.

Only if the project itself was deleted

Paste the seed script the same way. It rebuilds the nine records and checks the five recommendations before it finishes. If those no longer match, it stops and the log names the IST that changed.

Seed script
Id programId;
List<CitiriOS__Program__c> programs = [SELECT Id FROM CitiriOS__Program__c WHERE Name = 'IST Test Program' LIMIT 1];
if (programs.isEmpty()) {
    CitiriOS__Program__c program = new CitiriOS__Program__c(Name = 'IST Test Program');
    insert program;
    programId = program.Id;
} else {
    programId = programs[0].Id;
}
Id projectId;
List<CitiriOS__Project__c> projects = [SELECT Id FROM CitiriOS__Project__c WHERE Name = 'IST Test Project' LIMIT 1];
if (projects.isEmpty()) {
    CitiriOS__Project__c project = new CitiriOS__Project__c(
        Name = 'IST Test Project', CitiriOS__Program__c = programId, CitiriOS__Deadline__c = Date.newInstance(2030, 2, 27)
    );
    insert project;
    projectId = project.Id;
} else {
    projectId = projects[0].Id;
}

Map<String, Id> recordTypes = new Map<String, Id>();
for (RecordType rt : [SELECT Id, DeveloperName FROM RecordType WHERE SObjectType = 'CitiriOS__System_Equipment__c' AND DeveloperName IN ('Parent', 'System', 'Equipment')]) {
    recordTypes.put(rt.DeveloperName, rt.Id);
}
Map<String, Id> templateIdByNumber = new Map<String, Id>();
for (CitiriOS__System_Equipment__c template : [
    SELECT Id, Name FROM CitiriOS__System_Equipment__c
    WHERE CitiriOS__Project__r.Name = 'Template Project' AND Name IN ('SE-04837', 'SE-04880', 'SE-05018', 'SE-05032', 'SE-04941', 'SE-04884')
]) {
    templateIdByNumber.put(template.Name, template.Id);
}
System.assertEquals(6, templateIdByNumber.size(), 'Template Project is missing one of the six template records this test uses.');

List<String> names = new List<String>{
    'IST-TEST Building', 'IST-TEST Heat Recovery', 'IST-TEST Wayfinding',
    'IST-TEST Public Address', 'IST-TEST Sharc Unit', 'IST-TEST Switchgear',
    'IST-TEST Elevator', 'IST-TEST Point of Use 400Hz', 'IST-TEST Heat Pump'
};
Map<String, String> typeByName = new Map<String, String>{
    'IST-TEST Building' => 'Parent', 'IST-TEST Heat Recovery' => 'Parent', 'IST-TEST Wayfinding' => 'System',
    'IST-TEST Public Address' => 'System', 'IST-TEST Sharc Unit' => 'Equipment', 'IST-TEST Switchgear' => 'Equipment',
    'IST-TEST Elevator' => 'Equipment', 'IST-TEST Point of Use 400Hz' => 'Equipment', 'IST-TEST Heat Pump' => 'Equipment'
};
Map<String, String> templateNumberByName = new Map<String, String>{
    'IST-TEST Building' => 'SE-04837', 'IST-TEST Public Address' => 'SE-04880', 'IST-TEST Sharc Unit' => 'SE-05018',
    'IST-TEST Switchgear' => 'SE-05032', 'IST-TEST Elevator' => 'SE-04941', 'IST-TEST Point of Use 400Hz' => 'SE-04884'
};
Map<String, String> parentNameByName = new Map<String, String>{
    'IST-TEST Public Address' => 'IST-TEST Building', 'IST-TEST Sharc Unit' => 'IST-TEST Building',
    'IST-TEST Switchgear' => 'IST-TEST Building', 'IST-TEST Elevator' => 'IST-TEST Building',
    'IST-TEST Point of Use 400Hz' => 'IST-TEST Building', 'IST-TEST Heat Pump' => 'IST-TEST Heat Recovery'
};

Map<String, CitiriOS__System_Equipment__c> have = new Map<String, CitiriOS__System_Equipment__c>();
for (CitiriOS__System_Equipment__c row : [
    SELECT Id, CitiriOS__Display_Name__c, RecordTypeId, SFO_Template_System__c, CitiriOS__Group__c
    FROM CitiriOS__System_Equipment__c WHERE CitiriOS__Project__c = :projectId AND CitiriOS__Display_Name__c LIKE 'IST-TEST %'
]) {
    have.put(row.CitiriOS__Display_Name__c, row);
}
for (Integer pass = 0; pass < 2; pass++) {
    List<CitiriOS__System_Equipment__c> pending = new List<CitiriOS__System_Equipment__c>();
    for (String name : names) {
        if (have.containsKey(name)) {
            continue;
        }
        Boolean hasParent = parentNameByName.containsKey(name);
        if (pass == 0 && hasParent) {
            continue;
        }
        if (pass == 1 && !hasParent) {
            continue;
        }
        pending.add(new CitiriOS__System_Equipment__c(
            RecordTypeId = recordTypes.get(typeByName.get(name)),
            CitiriOS__Project__c = projectId,
            CitiriOS__Display_Name__c = name,
            SFO_Template_System__c = templateIdByNumber.get(templateNumberByName.get(name)),
            CitiriOS__Group__c = hasParent ? have.get(parentNameByName.get(name)).Id : null
        ));
    }
    insert pending;
    for (CitiriOS__System_Equipment__c row : pending) {
        have.put(row.CitiriOS__Display_Name__c, row);
    }
}
List<CitiriOS__System_Equipment__c> fixes = new List<CitiriOS__System_Equipment__c>();
for (String name : names) {
    CitiriOS__System_Equipment__c row = have.get(name);
    Id templateId = templateIdByNumber.get(templateNumberByName.get(name));
    Id parentId = parentNameByName.containsKey(name) ? have.get(parentNameByName.get(name)).Id : null;
    Id recordTypeId = recordTypes.get(typeByName.get(name));
    if (row.SFO_Template_System__c != templateId || row.CitiriOS__Group__c != parentId || row.RecordTypeId != recordTypeId) {
        row.SFO_Template_System__c = templateId;
        row.CitiriOS__Group__c = parentId;
        row.RecordTypeId = recordTypeId;
        fixes.add(row);
    }
}
if (!fixes.isEmpty()) {
    update fixes;
}

System.assertEquals(9, [SELECT COUNT() FROM CitiriOS__System_Equipment__c WHERE CitiriOS__Project__c = :projectId], 'IST Test Project should contain only the nine IST-TEST records.');
Map<String, Integer> expectedCount = new Map<String, Integer>{
    'IST 1.0 Audio Notification' => 2, 'IST 2.0 Conveyance' => 2,
    'IST 3.0 Electrical Metering, Monitoring and Control' => 2, 'IST 4.0 Emergency Power' => 1, 'IST 11.0 SHARC' => 1
};
Map<String, Set<String>> expectedVia = new Map<String, Set<String>>{
    'IST 1.0 Audio Notification' => new Set<String>{ 'Electrical Power Distribution', 'Public Address' },
    'IST 2.0 Conveyance' => new Set<String>{ 'Conveyance', 'Elevator', 'Public Address' },
    'IST 3.0 Electrical Metering, Monitoring and Control' => new Set<String>{ 'Conveyance', 'Electrical Power Distribution' },
    'IST 4.0 Emergency Power' => new Set<String>{ 'Electrical Power Distribution' },
    'IST 11.0 SHARC' => new Set<String>{ 'Sharc System' }
};
List<SFO_IstService.Recommendation> recommendations = SFO_IstService.recommend(projectId);
System.assertEquals(expectedCount.size(), recommendations.size(), 'Recommendation count changed. The answer key in the walkthrough is out of date.');
for (SFO_IstService.Recommendation rec : recommendations) {
    System.assertEquals(expectedCount.get(rec.name), rec.projectRecordCount, rec.name);
    System.assertEquals(expectedVia.get(rec.name), new Set<String>(rec.templateSystems), rec.name);
}
Set<String> novelNames = new Set<String>();
for (SFO_IstService.NovelSystem novel : SFO_IstService.novelSystems(projectId)) {
    novelNames.add(novel.name);
}
System.assertEquals(new Set<String>{ 'IST-TEST Heat Recovery', 'IST-TEST Wayfinding' }, novelNames);
System.debug('SEED project=' + projectId + ' records=9 recommendations=5');
System.debug('SEED url=' + URL.getOrgDomainUrl().toExternalForm() + '/lightning/r/CitiriOS__Project__c/' + projectId + '/view');