Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2.8 KiB
2.8 KiB
Learnings — macros-and-labels-import
[2026-05-03] Session ses_210cd1557ffeGs4SEGrt7hnvyS — Plan Created
Parser Library
- Source at
/Users/thorsten/AI/propresenter/src/(NOT/Users/thorsten/AI/propresenter-work/php/per stale AGENTS.md) - VCS repo:
https://git.stadtmission-butzbach.de/public/propresenter-php.git(dev-master) - New classes (NOT yet in vendor/):
MacrosFileReader,LabelsFileReader,Macro,MacroLibrary,MacroCollection,Label,LabelLibrary MacrosFileReader::read(string $filePath): MacroLibrary— raw protobuf binary, no extensionLabelsFileReader::read(string $filePath): LabelLibrary— sameLabel::getName()returns protobuftextfield — name is the identity (no UUID for labels)Macro::getColor()returns?array{r,g,b,a}floats 0..1 — needMacroColorConverterto get hexLabel::getColorHex()already returns#RRGGBB— mirror its formula for macros- PHP 8.4 required by parser. App currently requires
^8.2— BLOCKER for T0.1
DB Schema Key Facts
slides.typeenum is[information, moderation, sermon]ONLY — noagenda_itemagenda_itempart_type = slide whereservice_agenda_item_id IS NOT NULLat runtimesong_groups.coloris NOT NULLABLE (migration says so) — newlabels.colorIS nullableservice_songs.song_idiscascadeOnDelete— wipingsongsauto-cascades toservice_songs
Export Flow
ProExportService::buildGroups()lines 38-69 — macro injection pointProExportService::buildMacroData()lines 71-86 — reads 4 legacy settings keys- Currently injects macro ONLY when group name is "COPYRIGHT" (case-insensitive)
ProImportService::import(UploadedFile $file): array— method signature (NOTimportFromFile)
Settings Pattern
Setting::get($key, $default)/Setting::set($key, $value)— simple key/valuesettingstable:key UNIQUE, value TEXT
Critical Decisions
- song_groups → labels: global table, "drop all data" migration (no backwards compat)
- Hybrid macro scope: global defaults in Settings; per-(service, part_type) override via "Anpassen"
- Override = snapshot of globals at creation time; future global changes don't propagate
- Stacking: all matching assignments fire, ordered by
macro_assignments.order ASC - Hidden macros/labels: skip at export, warning badge in editor
- Label colors: read-only in UI; Labels file import is sole authority; .pro auto-discovery only sets color on CREATE
- FK rules:
restrictOnDeleteon macro/label refs (usehidden_at);cascadeOnDeleteon service-scoped rows
Migration/Test Notes
tests/Pest.phpalready appliesRefreshDatabaseto allFeaturetests; no extra setup needed forFeature/Migrations- SQLite unique constraint errors can be asserted with
->toThrow(\Exception::class)in migration tests