feat(import): index quadlet unit files and jinja templates (A9 revision)
Phase 47 (owner permission 2026-08-27, TODO.md L10–11, roadmap R1): the
full Podman quadlet family (.container, .network, .volume, .image,
.pod, .kube, .swap, .os, .endpoint) and .j2 Jinja templates join the
allowed + default A9 import formats, chunked as plain text (owner
decision — no TOML/Jinja-aware splitter). No env configuration needed:
a default import now indexes them.
- app/config.py: _ALLOWED_IMPORT_EXTENSIONS + the default
import_extensions CSV gain the ten names (the original seven first);
the never-widen BOR_IMPORT_EXTENSIONS validator is untouched and
still rejects truly unknown extensions.
- app/rag/chunker.py: ten _FORMAT_CHUNKERS entries -> chunk_text
(HARD_MAX_CHARS 1200 honored, unknown-suffix fallback unchanged);
docstring/comments cite the A9 revision 2026-08-27.
- tests/fixtures/docs/homelab/: quadlet/compose.container (realistic
quadlet TOML, >1500 chars, [Unit]/[Service]/[Container] sections,
RESE-QUADLET-SENTINEL-77aa), quadlet/lan.network,
quadlet/cache.volume, templates/deploy.j2 (for/set/if Jinja
constructs + RESE-JINJA-SENTINEL-33dd). Every suite that seeds the
fixture tree updates its 9 -> 13 document-count constants.
- tests/unit/test_config.py: allowed set carries all seventeen formats,
default CSV + dotted import_extension_set include the ten, the
validator accepts the new names and still rejects unknowns.
- tests/unit/test_chunker.py: dispatch parity with chunk_text for every
new suffix (parametrized), the .container fixture chunks >=2 under
the cap with the sentinel surviving, the .j2 fixture keeps {{ }}
verbatim, the unknown-suffix fallback is unchanged.
- tests/unit/test_importer.py: a default-extensions walk over a temp
tree indexes exactly the ten new files (unknown/hidden/excluded
filtered), the original seven still walk, stem-title fallback holds.
- tests/integration/test_import_quadlet_jinja.py (new): import_sources
over a temp tree with .container/.volume/.j2 -> documents + chunks
rows with stem titles; delta re-import updates only the changed .j2
doc; prune drops the deleted .volume doc with cascade.
- tests/e2e/test_quadlet_jinja_import.py (new, story suite, mock-only,
isolation): GET /api/docs (admin session) lists the four new-format
docs with non-zero chunk counts and stem titles; the Sources table
renders a row + .doc-link per file; the phase-26 modal shows the
.container TOML ([Container] section + sentinel) with stem title and
the container format badge; a RESE-JINJA-SENTINEL-33dd question
FTS-matches the .j2 chunk -> honest-positive (A8: LOW requires zero
FTS hits) — the bubble is not .is-deflected and a source chip names
templates/deploy.j2.
- README.md + .env.example: the extended default format set (A9
revised 2026-08-27, plain-text chunking, narrow-only rule intact).
- .agent/PLAN.md: the A9 revision (owner-locked R1) — A9 row status,
the revision note under the anchors table, and the §5 chunking-policy
+ §11 workflow lines. The only PLAN edit this phase.
Gates: uv run pytest 795 passed; app/ coverage TOTAL 99% (>90%);
ruff check + pyright clean; story E2E 4/4 in isolation (DB up);
regression E2E suites test_import_documents (3) / test_sync_button
(3) / test_git_sources_admin (6) green in isolation.
Also records the 47_quadlet_jinja_import task-file moves (01–03)
todo/ -> complete/.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
# Quadlet volume: backing storage for the shared cache (btrfs loop on
|
||||
# the app node — see the app-node playbook for the loop setup).
|
||||
# RESE-VOLUME-SENTINEL-22cc
|
||||
|
||||
[Unit]
|
||||
Description=Shared cache volume (btrfs loop, 32G)
|
||||
|
||||
[Volume]
|
||||
Driver=local
|
||||
Type=volume
|
||||
Device=/var/lib/quadlet-volumes/cache
|
||||
@@ -0,0 +1,51 @@
|
||||
# Quadlet unit for the homelab compose stack gateway (Podman >= 4.9,
|
||||
# quadlet >= 0.5). Kept in version control next to the playbook so a
|
||||
# fresh reinstall of the app node reproduces the exact stack — the unit
|
||||
# file is the source of truth, not the running container.
|
||||
# RESE-QUADLET-SENTINEL-77aa
|
||||
|
||||
[Unit]
|
||||
Description=Compose stack gateway (reverse proxy + metrics scrape)
|
||||
Wants=lan.network
|
||||
After=lan.network network-online.target
|
||||
Documentation=https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
TimeoutStartSec=300
|
||||
MemoryMax=4G
|
||||
CPUQuota=400%
|
||||
# The gateway must come up before the scrape jobs expect it.
|
||||
ExecStartPre=/usr/bin/test -f /etc/homelab/compose.env
|
||||
Environment=COMPOSE_PROJECT_NAME=homelab
|
||||
EnvironmentFile=/etc/homelab/compose.env
|
||||
|
||||
[Container]
|
||||
Image=docker.io/reese/compose-gateway:1.4.2
|
||||
ImageVolume=ignore
|
||||
ContainerName=homelab-compose-gateway
|
||||
Label=io.podman.quadlet.stack=homelab
|
||||
Label=io.reese.maintained-by=ansible
|
||||
PublishPort=127.0.0.1:8443:8443
|
||||
PublishPort=127.0.0.1:9100:9100
|
||||
Network=lan
|
||||
Environment=LOG_LEVEL=info
|
||||
Environment=METRICS_BIND=0.0.0.0:9100
|
||||
Environment=UPSTREAM_REGISTRY=10.89.0.10:5000
|
||||
Volume=/var/lib/compose-gateway/certs:/etc/certs:ro
|
||||
Volume=/var/lib/compose-gateway/data:/data
|
||||
Volume=/etc/homelab/compose.env:/etc/compose.env:ro
|
||||
Exec=serve
|
||||
# Health probe: the gateway answers /healthz on the metrics port.
|
||||
HealthCmd=CURL -fsS http://127.0.0.1:9100/healthz
|
||||
HealthInterval=30s
|
||||
HealthStartPeriod=15s
|
||||
HealthTimeout=5s
|
||||
HealthRetries=3
|
||||
StartTimeout=60s
|
||||
# Keep the gateway on the lab bridge — no public interface exposure.
|
||||
AdditionalCapabilities=CHOWN,SETGID,SETUID
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
# Quadlet network: the flat lab bridge for all homelab services.
|
||||
# RESE-NETWORK-SENTINEL-11bb
|
||||
|
||||
[Unit]
|
||||
Description=Homelab lab network (bridge, 10.89.0.0/24)
|
||||
|
||||
[Network]
|
||||
Driver=bridge
|
||||
NetworkName=labnet
|
||||
IPAMDriver=dhcp
|
||||
Subnets=10.89.0.0/24
|
||||
Gateway=10.89.0.1
|
||||
Options=mtu=1500
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
{# Service unit template — rendered by the deploy playbook, one file per
|
||||
host. The playbook loops the services dict from the group vars. #}
|
||||
{% set sentinel = "RESE-JINJA-SENTINEL-33dd" %}
|
||||
{% for svc in services %}
|
||||
[{{ svc.name }}]
|
||||
host = {{ svc.host }}
|
||||
port = {{ svc.port }}
|
||||
enabled = {{ svc.enabled | default(true) }}
|
||||
{% if svc.env is defined %}
|
||||
{% for key, value in svc.env.items() %}
|
||||
{{ key }} = {{ value }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
# rendered by ansible on {{ inventory_hostname }} at {{ deployment_stamp }}
|
||||
Reference in New Issue
Block a user