Fixes static container admin edit flow by preserving id in hiddenFields and adding route-id fallback during save. Adds regression tests for edit/create id behavior, updates release docs (changelog/testing/CLAUDE), and appends SonarQube open issues to docs/TODO. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
109 lines
3.5 KiB
Markdown
109 lines
3.5 KiB
Markdown
---
|
|
phase: 15-scontainers-edit-save-fix
|
|
plan: 01
|
|
subsystem: admin
|
|
tags: [scontainers, form-edit, hidden-fields, regression-fix]
|
|
|
|
requires: []
|
|
provides:
|
|
- Fix edycji scontainers (update zamiast insert)
|
|
- Regresyjne testy kontrolera dla mapowania id
|
|
affects: []
|
|
|
|
tech-stack:
|
|
added: []
|
|
patterns: [hiddenFields for stable id transfer in tabbed form-edit]
|
|
|
|
key-files:
|
|
created: []
|
|
modified:
|
|
- autoload/admin/Controllers/ScontainersController.php
|
|
- tests/Unit/admin/Controllers/ScontainersControllerTest.php
|
|
|
|
key-decisions:
|
|
- "Przeniesienie id z FormField::hidden do hiddenFields w FormEditViewModel"
|
|
- "Fallback id z route parametru przy zapisie edycji"
|
|
|
|
patterns-established:
|
|
- "W formularzach z zakladkami id encji przekazujemy przez hiddenFields, nie przez pola przypisane do taba"
|
|
|
|
duration: ~20min
|
|
completed: 2026-04-18
|
|
---
|
|
|
|
# Phase 15 Plan 01: Scontainers edit save fix - Summary
|
|
|
|
**Naprawiono regresje, przez ktora edycja kontenera statycznego tworzyla nowy rekord zamiast aktualizacji istniejacego ID.**
|
|
|
|
## Performance
|
|
|
|
| Metric | Value |
|
|
|--------|-------|
|
|
| Duration | ~20min |
|
|
| Completed | 2026-04-18 |
|
|
| Tasks | 3 completed |
|
|
| Files modified | 2 |
|
|
|
|
## Acceptance Criteria Results
|
|
|
|
| Criterion | Status | Notes |
|
|
|-----------|--------|-------|
|
|
| AC-1: Edycja nie tworzy nowego kontenera | Pass | `id` jest zawsze przenoszone przez hiddenFields + fallback z URL przy braku w POST |
|
|
| AC-2: Tworzenie nowego kontenera nadal dziala | Pass | Dla create `id=0`, action pozostaje `/admin/scontainers/save/` |
|
|
| AC-3: API legacy JSON pozostaje bez zmian | Pass | Sciezka `values` (legacy) nie byla modyfikowana |
|
|
|
|
## Accomplishments
|
|
|
|
- Przeniesiono `id` do `hiddenFields` w `ScontainersController::buildFormViewModel()`, co eliminuje gubienie `id` w formularzu tabowanym.
|
|
- Dodano defensywny fallback na `id` z parametru trasy w `ScontainersController::save()`.
|
|
- Dodano 2 testy regresyjne dla mapowania `id` i create-flow.
|
|
|
|
## Files Created/Modified
|
|
|
|
| File | Change | Purpose |
|
|
|------|--------|---------|
|
|
| `autoload/admin/Controllers/ScontainersController.php` | Modified | Stabilne przekazywanie `id` dla update oraz fallback route `id` |
|
|
| `tests/Unit/admin/Controllers/ScontainersControllerTest.php` | Modified | Testy regresyjne dla hiddenFields i create flow |
|
|
|
|
## Decisions Made
|
|
|
|
| Decision | Rationale | Impact |
|
|
|----------|-----------|--------|
|
|
| Uzyc `hiddenFields` zamiast `FormField::hidden('id')` | Hidden field w tabbed form moze nie byc renderowany w aktywnej strukturze pol | Brak tworzenia duplikatow przy edycji |
|
|
| Dodac fallback `id` z URL w `save()` | Dodatkowa odpornosc na brak `id` w payloadzie | Bezpieczny update dla `/admin/scontainers/save/id={id}` |
|
|
|
|
## Deviations from Plan
|
|
|
|
Brak istotnych odchylen implementacyjnych.
|
|
|
|
Skill audit:
|
|
- `/feature-dev` - pominiety na prosbe uzytkownika (override zapisany w STATE.md)
|
|
- `/koniec-pracy` - wymaganie zmapowane na `.claude/commands/koniec-pracy.md`
|
|
|
|
## Issues Encountered
|
|
|
|
| Issue | Resolution |
|
|
|-------|------------|
|
|
| Brak `test.ps1` w workspace | Test uruchomiony bezposrednio przez `php phpunit.phar ...` |
|
|
|
|
## Verification Results
|
|
|
|
- `php phpunit.phar tests/Unit/admin/Controllers/ScontainersControllerTest.php`
|
|
- Wynik: `OK (6 tests, 20 assertions)`
|
|
|
|
## Next Phase Readiness
|
|
|
|
**Ready:**
|
|
- Problem zapisu scontainers naprawiony na poziomie kontrolera.
|
|
- Testy regresyjne zabezpieczaja krytyczny przypadek.
|
|
|
|
**Concerns:**
|
|
- Manualna weryfikacja UI edycji/create nadal wskazana po stronie panelu admin.
|
|
|
|
**Blockers:**
|
|
- None.
|
|
|
|
---
|
|
*Phase: 15-scontainers-edit-save-fix, Plan: 01*
|
|
*Completed: 2026-04-18*
|