Skip to content

/al/editor: no jurisdiction or organization package picker #1022

Description

@nonprofittechy

Part of a /al/editor ↔ Weaver-wizard parity review. This is one of seven gaps that keep the graphical editor from being a full replacement for assembly_line.yml.

What happens

data/sources/configuration_capabilities.yml maps a jurisdiction or organization choice — MassAccess, Illinois Legal Aid Online, Louisiana Supreme Court — onto both an include: line and a package dependency. The wizard asks about it; /al/editor never reads the file.

The editor's only related control is a free-text Default state/province on the new-project form, and output.mako quietly special-cases MA to append MassAccess:

selected_includes = list(
get_yml_deps_from_choices(
interview.jurisdiction_choices.true_values() + interview.org_choices.true_values()
)
)
state_for_theme = str(getattr(interview, "state", "") or "").strip().upper()
massaccess_include = "docassemble.MassAccess:massaccess.yml"
if state_for_theme == "MA" and massaccess_include not in selected_includes:
selected_includes.append(massaccess_include)

So an author on a non-MA server has no graphical path to their organization's theme at all.

What makes it worse

The Metadata tab cannot add an include: document that isn't already present. update_metadata_documents_in_yaml refuses insertion by design:

def update_metadata_documents_in_yaml(full_yaml: str, edited_yaml: str) -> str:
"""Replace only safely identified metadata-related YAML document bodies.
Document separators and every non-metadata source byte remain untouched. The
submitted documents must correspond one-for-one, by type and order, with the
existing metadata-related documents. Insertion is intentionally refused until
the general lossless patch model can place a new document safely.
"""
current_documents: List[Tuple[int, int, str, str]] = []
for start, end, body in _source_document_bodies(full_yaml):
try:
block_type = _metadata_document_type(body)
except ValueError:
# Invalid or unsupported non-target source must not prevent an exact
# replacement of a separately identifiable metadata document.
continue
if block_type is not None:
current_documents.append((start, end, body, block_type))
if not current_documents:
raise ValueError(
"No metadata-related document could be identified safely. "
"Edit this interview in full source mode."
)

Insertion is intentionally refused until the general lossless patch model can place a new document safely.

That refusal is correct in itself, but it means there is no scoped-save path to adding an include either.

Suggested approach

Read configuration_capabilities.yml, plus whatever custom_values.py discovers on the server, into a picker exposed in both the new-project form and the AssemblyLine settings panel. Write the include: lines through the general patch path (POST /al/editor/api/file/patch) rather than the scoped metadata save, so insertion is safe.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions