feat(acms): add PostgreSQL and Docker Compose domain analyzers #611
Merged
hamza.khyari
merged 3 commits from 2026-03-06 23:07:26 +00:00
feature/m6-acms-domain-specific-analyzers into master
Labels
Clear labels
auto/needs-reevaluation
controller-managed
overdue
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Needs Feedback
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
Controller deferred this PR; awaiting Phase 6+ scope-evaluator or operator re-enablement.
Auto-agents controller manages this PR/issue (see tools/controller/deploy/RUNBOOK.md). Remove this label to abandon controller management.
PR blocked by an open issue dependency. Operator must close the dep (or remove the dependency link) before the merge driver can act. Auto-cleared by merge_drive when no open deps remain.
Most recent merge cycle hit CI timeout. Driver excludes this PR while last merge_cycle row is < 30 min old; label persists thereafter as visible history.
Currently being processed by an implementer worker.
Currently being processed by the merge driver.
Currently being processed by a reviewer worker.
Merge driver heartbeat stale; pipeline halted. Closed automatically on next clean tick.
Detected master commit violating the strict merge invariant. Tracked as an issue (not a PR label); kept here for label completeness.
In-cycle escalation: most recent attempt ran at the Tier 0 slot (`tier-0`). Slot's model defined in .opencode/models/tiers.yaml.
In-cycle escalation: most recent attempt ran at the Tier 1 slot (`tier-1`). Slot's model defined in .opencode/models/tiers.yaml.
In-cycle escalation: most recent attempt ran at the Tier 2 slot (`tier-2`). Slot's model defined in .opencode/models/tiers.yaml. Gated behind IMPLEMENTER_ESCALATION_TIER2_ENABLED.
In-cycle escalation: most recent attempt ran at the Tier -1 slot (`tier-min`). Slot's model defined in .opencode/models/tiers.yaml. Suffix is ``-min`` (not ``--1``) so the Forgejo UI reads naturally.
Tracking issues used by the AI Automation system for agents to communicate and report.
Rebase conflict needs LLM conflict-resolver.
Failing CI needs implementer attention.
Documenting a driver incident or rollback.
Reviewer has APPROVED this PR and no later REQUEST_CHANGES is outstanding. The merge driver requires this label to even consider a PR for merging. Set by the reviewer worker on APPROVE; cleared on REQUEST_CHANGES.
Train repeatedly lost master-tempo races. Driver excludes via merge_cycle until cooldown elapses; label persists as visible history.
Revert PR backing out an invariant violation. Fast-tracked through the merge driver.
Sentinel PR duplicated from upstream into a personal fork by tools/duplicate_prs_to_fork.py for pipeline testing. Lives only in the fork; the canonical pipeline never sees it.
No implementer activity for N days. Flagged for human review. Auto-cleared on next push to head branch.
Repeatedly fails on current master (>= 3 ci-fail-on-rebased-sha releases in 12 h). Excluded from driver until human triage.
A ticket in a blocked state and unable to complete until some other task is completed first.
Bounty
$100
A bounty of $100 for any open-source contributor who provides a MR that solves this issue
Bounty
$1000
A bounty of $1000 for any open-source contributor who provides a MR that solves this issue
Bounty
$10000
A bounty of $10000 for any open-source contributor who provides a MR that solves this issue
Bounty
$20
A bounty of $20 for any open-source contributor who provides a MR that solves this issue
Bounty
$2000
A bounty of $2000 for any open-source contributor who provides a MR that solves this issue
Bounty
$250
A bounty of $250 for any open-source contributor who provides a MR that solves this issue
Bounty
$50
A bounty of $50 for any open-source contributor who provides a MR that solves this issue
Bounty
$500
A bounty of $500 for any open-source contributor who provides a MR that solves this issue
Bounty
$5000
A bounty of $5000 for any open-source contributor who provides a MR that solves this issue
Bounty
$750
A bounty of $750 for any open-source contributor who provides a MR that solves this issue
MoSCoW
Could have
Could have feature in order to satisfy the epic/legendary.
MoSCoW
Must have
Must have feature in order to satisfy the epic/legendary.
MoSCoW
Should have
Should have feature in order to satisfy the epic/legendary.
There are questions in the ticket that can not be completed until the project owner provides clarity.
Points
1
1 man-hours worth of work for an expert with no learning curve.
Points
13
13 man-hours worth of work for an expert with no learning curve.
Points
2
2 man-hours worth of work for an expert with no learning curve.
Points
21
21 man-hours worth of work for an expert with no learning curve.
Points
3
3 man-hours worth of work for an expert with no learning curve.
Points
34
34 man-hours worth of work for an expert with no learning curve.
Points
5
5 man-hours worth of work for an expert with no learning curve.
Points
55
55 man-hours worth of work for an expert with no learning curve.
Points
8
8 man-hours worth of work for an expert with no learning curve.
Points
88
88 man-hours worth of work for an expert with no learning curve.
Priority
Backlog
This ticket has backlogged priority and is not to be worked on yet
Priority
CI Blocker
Critical priority issue that blocks CI/CD pipeline and prevents PR merges
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
A ticket for learning a tool or technology that is needed to be able to do future planning and design.
State
Completed
The ticket has been fully implemented, completed, and merged with the source code. This label should only be applied once a ticket is closed.
State
Duplicate
A ticket that represents the same content as an existing ticket.
State
In Progress
A ticket that is actively being developed.
State
In Review
A ticket that has had some code completed to implement but is waiting to pass peer review and is not yet merged in.
State
Paused
This ticket's work started but wasn't finished. It's on hold (likely in a feature branch) and will be resumed later, either due to a blocker or a delay.
State
Unverified
All new tickets start in this state. A developer may set it to show the ticket is unverified. This means we haven't agreed to work on it. It will either move to a verified state or be closed as wontdo.
State
Verified
The issue has been verified by a developer as legitimate. It will be worked on and verified tickets are now considered part of the backlog.
State
Wont Do
This ticket has been decided it wont be done. This may mean the bug has been determined to not be real (cant verify) or the feature is one we have decided we dont want to adopt.
Type
Automation
Any edits or discussion about the AI automated coding system.
Type
Bug
Something that doesnt work as intended.
Type
Discussion
Anytime a ticket represents a discussion about a subject and doesnt fall into one of the other categories.
Type
Documentation
An error or improvement needed in the documentation.
Type
Epic
Any first tier epic. That is, an epic which contains only issues as children and will not have sub-epics.
Type
Feature
Some new functionality not present.
Type
Legendary
A type of Epic which will contain other Epics.
Type
Refactor
A code change that restructures existing code without changing its external behavior.
Type
Support
Someone needs help using the project.
Type
Task
A generic task that doesnt fit into the other type categories.
Type
Testing
Work exclusively focusing on fixing or expanding testing.
Projects
Clear projects
No project
Assignees
aditya (Aditya Chhabra)
aleenaumair (Aleena Umair)
brent.edwards (Brent Edwards)
CoreRasurae (Luis Mendes)
drew (Drew Morris)
eugen.thaci (Eugen Thaci)
freemo (Jeffrey Phillips Freeman)
HAL9000 (HAL 9000)
HAL9001 (HAL9001)
hamza.khyari (Hamza Khyari)
hurui200320 (Rui Hu)
justin.morris
khird (Kyle Hird)
org.cleveragents
Clear assignees
No Assignees
hamza.khyari
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cleveragents/cleveragents-core#611
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "feature/m6-acms-domain-specific-analyzers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements Phase 2 of issue #588:
PostgreSQLAnalyzerandDockerComposeAnalyzerdomain-specific analyzers for the ACMS UKO indexing pipeline.Closes #588 (Phase 2 scope — PostgreSQL + Docker Compose).
Changes
New Source Files
postgresql_analyzer.py(~594 lines) — Regex-based DDL parser extractinguko-data:Table,uko-data:Column,uko-data:ForeignKey,uko-data:View, anduko-data:Schematriples. Handles column metadata (data type, nullability, primary key),CREATE TABLE/VIEWwith optional schema qualification, and inline/out-of-lineFOREIGN KEYconstraints. RaisesValueErroron empty content; returns empty list on unparsable DDL.docker_compose_analyzer.py(~393 lines) — YAML-based parser usingyaml.safe_loadextractinguko-infra:DeploymentUnit,uko-infra:Service,uko-infra:Port,uko-infra:EnvironmentVariable, anduko-infra:connectsTotriples. Validates Docker Compose format viaservices/versionkey detection. Returns empty list on empty, unparsable, or non-Compose YAML.Test Files
features/domain_analyzers.feature— 34 BDD scenarios across 7 groups: protocol conformance (4), registry operations (6), PythonAnalyzer (5), MarkdownAnalyzer (5), PostgreSQLAnalyzer (6), DockerComposeAnalyzer (6), cross-analyzer (2).features/steps/domain_analyzer_steps.py— Step definitions usinguse_step_matcher("re")for triple-assertion steps to avoidparse-format ambiguity with existinguko_analyzers_steps.py.robot/domain_analyzers.robot+robot/helper_domain_analyzers.py— 6 Robot Framework integration smoke tests with realistic multi-object sample content.Modified Files
acms/__init__.py— AddedDockerComposeAnalyzerandPostgreSQLAnalyzerimports and__all__entries.vulture_whitelist.py— Added 2 entries for new analyzer classes.CHANGELOG.md— Added unreleased entry.Spec Compliance
Per
docs/specification.md§44210-44261 (Domain-Specific Analyzers), §42151-42272 (uko-datavocabulary), §42285-42331 (uko-infravocabulary):AnalyzerProtocol(runtime-checkable)AnalyzerRegistryby file extensionUKOTripleinstances withuko://URI scheme and confidence=1.0UKOIndexer._add_provenance())Verification
c0f22397b6to4d2aad1b254d2aad1b25tod3fef49050Review — PR #611
feature/m6-acms-domain-specific-analyzersReviewer: brent.edwards | Round: 1 | Commit:
4d2aad1bQuality Gates
nox -s lintnox -s typecheckFindings Summary
postgresql_analyzer.pydomain_analyzers.featurepostgresql_analyzer.py:335-347, 422-443_extract_bodyand_split_entriescount parentheses without respecting SQL string literals — silent data truncationdomain_analyzer_steps.py:124# type: ignore[arg-type]suppression — CONTRIBUTING prohibits inline suppressionsdocker_compose_analyzer.py:138yaml.safe_loadis safe against arbitrary code exec but still vulnerable to billion-laughs alias expansion (quadratic memory). Consider rejecting alias nodes or adding a size guard.postgresql_analyzer.py:388-393"primary" INTEGERis stripped of quotes then matched against_NON_COLUMN_KEYWORDS, so a column literally namedprimarywould be skippedrepositories_uncovered_branches_steps.py(scoped_session removal),helper_m4_e2e_verification.pyandm4_e2e_verification.robot(3 M4 CLI E2E tests removed). These changes also appear in PR #610 and should be in their own commit or excluded from this PR.Verdict
REQUEST_CHANGES — 3 P1 findings require resolution. The two 500+ line files (F1, F2) need splitting or restructuring. The parenthesis-in-string-literal bug (F3) silently produces wrong results for real-world DDL containing
DEFAULT,CHECK, or string constants with parentheses. The out-of-scope changes (F7) should be removed from this PR.What Went Well
@@ -0,0 +520,4 @@@docker_compose_analyzerScenario: Analyze dict-form volume mappingGiven a DockerComposeAnalyzer analyzerWhen I analyze the Docker Compose content:F2 [P1 · Policy] — This feature file is 523 lines, exceeding the 500-line limit. Consider splitting into separate feature files per analyzer domain (e.g.,
postgresql_analyzer.feature,docker_compose_analyzer.feature).@@ -0,0 +121,4 @@def analyze(self, content: str, resource_uri: str) -> list[UKOTriple]:return [] # pragma: no covercontext.registry.register(_DuplicatePyAnalyzer()) # type: ignore[arg-type]F4 [P2 · Policy] — CONTRIBUTING.md prohibits
# type: ignoreinline suppressions. Please fix the type mismatch at the call site instead of suppressing it. If theregister()method accepts aProtocoltype, ensure_DuplicatePyAnalyzerfully satisfies it.F7 [P2 · Process] — Removing 3 M4 CLI E2E tests (
cli-plan-use,cli-plan-execute,cli-plan-tree) is out of scope for issue #588 (domain-specific analyzers). These same changes also appear in PR #610. Please remove this file from the PR or move these changes to a separate commit/PR that references the appropriate issue.@@ -0,0 +135,4 @@"""if not content or not content.strip():raise ValueError("content must not be empty.")if not resource_uri or not resource_uri.strip():F5 [P2 · Security] — While
yaml.safe_loadblocks arbitrary code execution, it is still vulnerable to billion-laughs-style alias expansion that can cause quadratic memory usage with crafted YAML input (e.g., nested anchors/aliases). Since this processes user-provided Docker Compose files, consider either:if len(content) > MAX_COMPOSE_SIZE), oryaml.safe_loadthrough a wrapper that rejects alias nodes@@ -0,0 +337,4 @@subject_uri=t_uri,predicate="rdf:type",object_uri="uko-data:Table",)F3 [P1 · Bug] —
_extract_bodycounts raw(and)characters without respecting SQL string literals. ADEFAULTvalue like'func(x)'or aCHECKconstraint containing'a)'will cause the depth counter to hit 0 prematurely, silently truncating the table body. The same bug affects_split_entries(line 422-443).Example that breaks:
The
'hello(world)'contains an unmatched(inside a string literal, which increments depth. The)afterworlddecrements it. Then the actual closing)on the last line sets depth to 0 too early, producing a truncated body that missescol2.Fix: track whether you're inside a single-quoted string (
'...') and skip paren counting while inside it. PostgreSQL uses''for escaping quotes inside strings.@@ -0,0 +387,4 @@return content[paren_start + 1 : i]return ""def _parse_table_body(F6 [P2 · Bug] — The
first_wordextraction strips double quotes then checks against_NON_COLUMN_KEYWORDS. This means a column legitimately named"primary"or"check"(which PostgreSQL allows via quoting) will be silently skipped.Fix: only check unquoted first words against
_NON_COLUMN_KEYWORDS. If the original first token starts with", it's a quoted identifier and should never be treated as a keyword.@@ -0,0 +615,4 @@subject_uri=source_col_uri,predicate="uko-data:foreignKeyTo",object_uri=target_col_uri,)F1 [P1 · Policy] — This file is 618 lines, exceeding the 500-line limit per CONTRIBUTING.md. Consider extracting helper methods (e.g.,
_extract_body,_split_entries,_parse_table_body, foreign-key extraction) into a separate_postgresql_helpers.pymodule, or splitting table-level vs. function/view parsing into separate classes.d3fef49050to13618fb8d5Supplementary Findings — PR #611 (Second Pass)
Following review #2018, a thorough second pass uncovered one additional P1 finding:
F8 [P1 · Process] — CHANGELOG deletes pre-existing #495 entry
The CHANGELOG diff removes the
(#495)entry (M4 acceptance criteria validation) from the## Unreleasedsection and replaces it with the new(#588)entry. The #588 entry correctly prepends to the top of the section, but the deletion of #495 is wrong — that entry belongs to a different merged PR and must be preserved.This is the same pattern found in PR #610 (F5). The correct behavior is to prepend the new entry above the existing ones, not replace the first entry.
File:
CHANGELOG.md(diff lines 5-11 show the deletion)Updated totals: 3 P1 + 5 P2 = 8 findings (F1-F8).
F8 addressed in commit
fb96d791.The
(#495)entry was never actually deleted — it was present in the branch at line 30, identical to master. Thegit diff origin/master..HEAD -- CHANGELOG.mdshowed a pure 12-line addition with zero deletions of existing entries.However, the entry ordering was wrong:
(#588)was appended after(#203)instead of prepended to the top of## Unreleased. Fixed by moving the(#588)entry to the first position under## Unreleased, per convention that newest entries go first.All pre-existing entries preserved and unchanged:
(#473),(#495),(#203),(#494).Quality gates: lint ✓, typecheck ✓, security_scan ✓, behave 57/57 scenarios ✓.
Verification Review — Round 2 (Post-Fix)
Reviewed at HEAD:
fb96d791(3 commits:77db78d7feat,13618fb8fix F1-F7,fb96d791fix F8)All 8 findings from Review #2018 and Comment #55331 are verified fixed. No new bugs found. Quality gates pass clean.
Finding Disposition
postgresql_analyzer.pywas 618 lines (500 limit)_postgresql_helpers.py(440 lines). Both under limit.domain_analyzers.featurewas 523 lines (500 limit)domain_analyzers.feature(217),postgresql_analyzer.feature(201),docker_compose_analyzer.feature(199). All under limit.extract_body()extract_body()andsplit_entries()in_postgresql_helpers.pynow trackin_stringstate, handle''escape sequences. Two regression BDD scenarios added: "DEFAULT with parentheses in string literal" and "CHECK constraint with string containing parentheses". Both pass.# type: ignore[arg-type]indomain_analyzer_steps.py:124_dup: type[AnalyzerProtocol] = _DuplicatePyAnalyzer; del _dup. Notype: ignoreanywhere in the file.yaml.safe_load_MAX_COMPOSE_BYTES = 1_048_576(1 MiB) guard added indocker_compose_analyzer.pybeforeyaml.safe_load()call. Returns[]with warning log if content exceeds limit."primary") incorrectly filteredparse_table_body()now checksnot raw_first.startswith('"')before keyword matching, so quoted identifiers bypass the filter. Regression BDD scenario "Quoted keyword column names are not silently dropped" tests"primary","check", andnormal_col. Passes.23803f14). PR now contains exactly 12 files, all in-scope: 5 new source/helper files, 3 feature files, 1 step file, 2 robot files, and expected modifications to__init__.py,vulture_whitelist.py,CHANGELOG.md.#588entry placed at top of Unreleased section.#495entry and all other pre-existing entries intact.Quality Gates
nox -s lintnox -s typecheckNew Bug Scan
Reviewed all code changes introduced by fix commits
13618fb8andfb96d791:extract_body()/split_entries()string tracking: Forward-progress guaranteed byi += 1at loop end;''escape handled withi += 2+continue; unterminated strings gracefully return empty. Clean.parse_table_body()keyword filter:startswith('"')check correctly short-circuits for quoted identifiers before keyword comparison. No false positives or negatives in edge cases.len(content)measures characters (not bytes), but the naming_MAX_COMPOSE_BYTESis slightly imprecise. Functionally correct since byte count ≥ char count for UTF-8, making the guard conservative. Non-blocking observation._dup: type[AnalyzerProtocol] = _DuplicatePyAnalyzer; del _dupis idiomatic and has zero runtime cost. Clean.No new bugs found.
Verdict
All P1 and P2 findings from Round 1 are resolved. Code is clean, well-structured, and fully tested. Approved for merge.
Approved for merge!