Scaling a Data Packet Generator: Governance of the Candidate Value Pipeline

    This article describes a large-scale refactoring of a data packet generator covering 147 files, with 24 new page types and 13 variant entries consolidated. It presents four engineering practices—thin-shell pages built on shared templates, a centralized entry catalog, directory-relative value semantics, and complete cache-key isolation—plus a layered verification strategy, showing how to keep a data-driven editor extensible and behaviorally trustworthy as resource types grow.

    1. From Page Expansion to Data Pipeline Governance

    A data packet generator typically has two responsibilities: converting structured definitions into an editable form or tree view, and converting user selections into resource data that conforms to a target specification. As the number of resource types grows, the pressure on the system usually does not come from “adding one more page,” but from whether the shared pipeline behind the pages is stable enough.

    This refactoring touched 147 files, adding 5,254 lines and deleting 1,047, covering generator pages, the structure-description value pipeline, shared control templates, and criterion probes. A total of 24 new page types were added, and 13 variant entries were consolidated into one organized location. Following the build procedure described in the project documentation, and with an auxiliary build configuration introduced to skip the component interop stage, the build completed with 0 errors.

    These numbers show the refactoring had real scale, but one point must be clear: a passing build only proves the compilation chain works under the current build configuration. It cannot replace validation of page interaction, version switching, and candidate correctness.

    Technically, the refactoring can be summarized in four main threads:

    • Supporting page expansion through shared templates and common view models;
    • Managing entries, ordering, and command registration through a centralized catalog;
    • Correcting field candidates and serialized values with directory-relative semantics;
    • Isolating different value contexts with complete cache keys.

    2. Adding Pages in Bulk: Let Differences Live in Descriptive Data

    2.1 Why Thin-Shell Pages

    If every new resource type required copying an entire form layout, version selector, document tree builder, and output logic, delivery might be faster in the short term, but maintenance costs would grow rapidly.

    For example, after adjusting a shared validation rule, every page would need to be modified individually; after fixing a control’s null-value behavior, every other page would need to be checked for the same issue. The more pages there are, the harder behavioral drift is to detect.

    The thin-shell approach keeps only the essential identity information in each concrete page, such as:

    • The current resource category;
    • The corresponding structure-description entry;
    • Title and icon;
    • The selectable version range;
    • Local behavior that genuinely cannot be shared.

    Generic capabilities—document tree loading, field editing, error display, and output—are handled by common base classes or shared services, while the unified UI frame is provided by shared templates.

    In this way, adding 24 page types does not mean maintaining 24 independent editor implementations; it means adding a set of resource descriptions that plug into the same runtime mechanism.

    2.2 Page Expansion Must Cover the Complete Integration Chain

    A page being instantiable does not mean users can actually use it. Complete integration usually includes:

    1. View declaration and view model;
    2. Icons and other UI resources;
    3. The project resource manifest;
    4. The main panel entry;
    5. Startup command registration;
    6. Mapping between the resource category and its structure description;
    7. Version range and default selection.

    These steps depend on one another. A missing resource manifest can cause resource loading failures; a missing startup command can produce an entry that is visible but cannot be opened; an incorrect mapping can load an editing tree that is structurally valid but belongs to the wrong category.

    Therefore, one of the most effective engineering measures for bulk expansion is building a “resource integration matrix”: each row is a resource, and each column is an integration step. It serves both as a review checklist and as input for future automated checks.

    2.3 Shared Templates Should Not Eliminate Legitimate Differences

    Thin-shell pages do not mean every page must be identical. Shared templates should absorb stable commonality, not force all resources into the same complex interaction.

    For the few resources with genuinely special behavior, explicit extension points are preferable to accumulating resource-name-based conditional branches in the common base class. Otherwise, page code appears reduced on the surface, while complexity is actually concentrated into a single hard-to-maintain shared class.

    3. Centralized Entry Management: Separating the Display Catalog from Execution Capability

    3.1 The Main Panel Catalog Should Be the Single Source of Truth

    As resource types multiply, main panel ordering, command registration, and version availability tend to scatter across multiple files. The same entry may be added in one place but not synchronized in another.

    The value of a centralized catalog is giving entries a unified identity. The catalog should at least define resource type, display name, grouping, and ordering; if the existing architecture allows, it can also associate launch capability and version constraints.

    Note that a centralized catalog does not mean stuffing all business logic into one file. A more reasonable boundary is: the catalog owns “what exists and how it is displayed,” while execution components own “how to open and how to load.”

    3.2 Consolidating 13 Variant Entries into One Resource Page

    For variant resources that are structurally similar and differ mainly in their description entry, a unified page with an entry dropdown is a viable organization. It reduces main panel noise and makes shared behavior easier to maintain.

    Grouping and ordering matter as well. Grouping by the resource’s owning object, placing base variants first and audio-type variants later, lets users understand the primary resources before dealing with extended attributes, instead of searching through an unordered list.

    However, switching the entry is not simply changing the page title. It means at least the following contexts may change:

    • The current structure description;
    • The shape of the document tree;
    • The available version range;
    • The field candidate sets;
    • Validation results;
    • Unsaved editing state.

    Therefore, the switch operation must be coordinated in dependency order, rather than letting multiple bindings fire independently and compete with each other.

    4. Version Switching: Establish the Valid Context First, Then Rebuild the Editing Tree

    4.1 The Version List Must Be Recomputed per Entry

    Different resources may have different minimum supported versions, so all entries cannot share an unfiltered version list.

    A more robust sequence is:

    1. The user selects a new resource entry;
    2. Recompute the available versions for that entry;
    3. Check whether the current version is still within the valid range;
    4. If invalid, select an available version according to a defined policy;
    5. Once both entry and version are determined, reload the structure description;
    6. Rebuild the document tree and refresh validation state.

    Here, “how to choose the replacement version” should be an explicit product rule, not an accident of collection ordering. The current version should be preserved if still valid; if an adjustment is necessary, the user should be told why.

    For editors with unsaved content, consider confirming before switching, keeping drafts per entry, or explicitly clearing them. The specific policy may vary, but data from the old entry must never silently leak into the new one.

    4.2 Initialization Order Affects Whether Dropdown Candidates Are Complete

    The refactoring exposed a typical problem: the converter from enum to dropdown items returned a snapshot collection. After the binding was first evaluated, appending data to the original candidate list did not cause the converter to re-run.

    This shows that whether source collection changes reach the UI depends on the complete notification chain, not merely on whether “the data is already in the collection.”

    For fixed candidates, initialization should be completed before the first binding evaluation whenever possible. If candidates genuinely need to change dynamically, an explicit notification mechanism must be designed—for example, re-setting the bound property, using an observable collection, or explicitly triggering re-conversion.

    Initialization timing is part of the UI data contract and should not be treated as an insignificant implementation detail.

    5. Directory-Relative Values: Solving Filtering and Value Mapping Together

    5.1 Path Constraints Are More Than Filter Conditions

    Certain fields take values from a registry with an attached directory restriction. Here, the directory should be understood as “where the field value starts from,” not merely “which items the candidates display.”

    Consider the following illustrative data:

    1. Registry member: sample:visual/emblem/plain
    2. Restricted directory: visual/emblem
    3. Field value: sample:plain

    This means processing involves two steps:

    First, determine whether the member is inside the restricted directory; second, strip the directory prefix from in-directory members to obtain the relative identifier the field actually uses.

    If only the first step is done, values written to the document may remain too long; if the directory restriction is ignored entirely, the entire registry may be exposed to the field, producing large numbers of invalid candidates.

    5.2 Path Matching Must Respect Directory Boundaries

    Path stripping cannot rely on unconstrained string replacement.

    For example, when the restricted directory is visual/emblem, visual/emblem_extra/item must not be treated as a member of that directory. A correct implementation recognizes separator boundaries—it matches the directory followed by a separator, not any identical prefix.

    Illustrative logic:

    1. Normalize the directory expression
    2. Parse the member's namespace and path
    3. If the directory explicitly includes a namespace:
    4. Check membership by full-identifier prefix
    5. Otherwise:
    6. Check directory membership by member path
    7. If not in the target directory:
    8. Skip the member
    9. If in the target directory:
    10. Strip the directory prefix
    11. Preserve the necessary namespace
    12. Generate the field candidate value

    Normalization here must also have clear boundaries. Case or invalid separators must not be changed arbitrarily, otherwise data errors that should be reported may be masked as “acceptable input.”

    5.3 Candidates and Existing Values Must Use the Same Representation

    In the reference case, before the fix, one field placed all 3,964 texture records into the dropdown; a relative identifier that should have been valid was treated as an out-of-candidate value and added separately because its representation differed from the candidates. After the fix, directory filtering narrowed the candidates to 44 entries.

    This is not simple UI decluttering—it is a semantic consistency fix:

    • Dropdown candidates use relative identifiers;
    • Existing documents are read back in the same form;
    • Validity checks compare the same form;
    • Final output follows the same rule.

    Otherwise, even if the dropdown looks correct, duplicate candidates, false invalid-value reports, or unstable round-tripping can still occur.

    In addition, a reduced candidate count shows that irrelevant data was excluded, but it cannot be used to infer an unmeasured performance improvement ratio.

    6. Cache Key Design: Every Condition That Affects the Result Must Participate

    6.1 Why Caching Only by Registry Causes Candidate Bleeding

    The same registry may serve multiple fields, and different fields have different directory and tag constraints.

    For example, field A only allows members under directory A, while field B only allows members under directory B. If the cache key contains only the registry name, then after field A is accessed first, field B may directly reuse the wrong candidate set.

    This kind of problem is especially hard to diagnose because it often depends on access order: a page works fine when opened alone, but fails after another page is opened first.

    6.2 Cache Keys Should Describe the Complete Query Semantics

    For candidate queries, the registry, directory, and tag constraints can all affect the result, so they must all be distinguished in the cache key. If the data source also varies by version, the version must participate in isolation as well, or isolation must be guaranteed by a clearly defined upper-level cache lifecycle.

    The general principle is:

    Any input that changes the returned result must enter the cache identity, or be isolated by a provable lifecycle boundary.

    If the tag set is order-insensitive, it should be stably normalized before generating the cache key; if the directory has multiple equivalent representations, those should be unified too, to avoid the same query occupying duplicate cache entries.

    Also, mutable objects used as the basis of a key must not be modified after the cache is established, otherwise the key and the actual query semantics can diverge.

    7. Verification Strategy: From Compilation Success to Behavioral Trust

    7.1 Integration Completeness Verification

    For newly added pages, verify that the view, view model, icon, resource manifest, main panel entry, and command registration are all present. Mapping relationships that can be checked automatically should be verified programmatically, reducing omissions from manual item-by-item comparison.

    7.2 Path Semantics Verification

    Directory stripping should cover at least:

    • In-directory members convert correctly;
    • Out-of-directory members are excluded;
    • Similar directory-name prefixes do not falsely match;
    • Explicit namespaces are handled correctly;
    • Boundary inputs follow the defined rules;
    • Valid existing values are not redundantly added as extra candidates.

    7.3 Cache Isolation Verification

    Run consecutive queries with combinations such as “same registry, different directory” and “same directory, different tags,” and swap the access order. When necessary, repeatedly switch pages within the same process to confirm the cache introduces no order dependency.

    7.4 Interaction and Probe Verification

    Criterion probes are well suited for verifying repeatable, observable behavior—candidate counts, version ranges, entry mappings, and directory conversion results.

    But probes should also declare their assertion scope: they prove which conditions hold, rather than vaguely claiming the entire system is correct. Interaction issues such as unsaved-content handling, switch prompts, and focus behavior still require supplementary UI verification.

    8. Conclusion: Extensibility Depends on the Reliability of the Shared Pipeline

    The core of this generator expansion is not how many UI files were added, but that more resources can now stably reuse the same mechanism.

    Thin-shell pages reduce duplicated implementations, the centralized catalog reduces entry drift, version recomputation maintains a valid context, directory-relative semantics unify candidates and output, complete cache keys prevent cross-field contamination, and layered verification provides a repeatable basis for checking these constraints.

    For a continuously growing data-driven editor, the truly sustainable way to extend is to let new resources mostly add descriptions and necessary differences, rather than endlessly copying interaction flows. At the same time, establishing explicit contracts for seemingly minor conditions—directories, versions, tags, and initialization order—is what prevents hard-to-reproduce hidden errors as the system scales.