Repository navigation
Conversation
`schemas/defaults.schema.json` gained a `bindings` section, so `./bindings` and `*.binding.yaml` are canonical defaults rather than literals each SDK keeps privately inside its own binding loader. `_DEFAULTS` gains both keys; `config_key_governance.json` (regenerated upstream to 65 allowed keys / 20 canonical defaults) pins the table against the schema in both directions, so omitting them is now a failing conformance test. `BindingLoader.load_binding_dir` keeps a last tier of its own, deliberately rather than as belt-and-braces: `config` is optional on that entry point and an in-memory `Config(data=...)` never merges `_DEFAULTS`, so on both of those paths the loader is the only place a default can come from. What changes is where the value comes from — `Config.get_default(...)` instead of a module literal — so the loader tier and the config tier cannot drift apart. `test_default_dir_and_pattern_when_nothing_configured` asserted the opposite, that `bindings.dir` had no default at all. That assertion pinned the state this commit corrects; it now asserts the canonical values. Refs aiperceivable/apcore#114 Signed-off-by: tercel <[email protected]>
…nt 5) An empty string is not a path. §9.2 counts a variable that is SET as an override whatever it holds, so `export APCORE_ACL_ROOT=` replaced a directory the configuration file declared with "" — and "" is a legal relative path to the filesystem API, so nothing failed: resolution landed on the process working directory. That is the silent shape §9.2.1 requirement 5 was written to close, and the same shape already recorded for APCORE_CONFIG_FILE, where an empty value injected a phantom `config.file` key. The guard sits at each TIER, not on the merged document, because "fall through to the next tier" is the required outcome and deleting the key from a merged document produces a different one — absent rather than defaulted. So: `_apply_env_overrides` skips a set-but-empty path-typed variable, leaving the file value or the default standing; `_load_legacy_mode` and `_load_namespace_mode` strip an empty path-typed value out of the file data before the default table is merged under it. Applied to the whole §9.2.1 set rather than to `acl.root`, which is merely where it surfaced. `extensions.roots[]` has no tier to fall through to — it is list-valued and requirement 3 gives it no environment tier at all — so an empty element is dropped from the list instead, which is the same "never use it as a directory" outcome in the form a list admits. `bindings.pattern` is deliberately unaffected: it sits in the same section as `bindings.dir` and requirement 4 states it is not path-typed, so an implementation guarding by section rather than by the declared set fails `test_a_non_path_typed_key_may_still_be_set_empty`. Reversal check: neutering `_is_empty_path_value` turns 21 of the new cases red. Refs aiperceivable/apcore#113 Signed-off-by: tercel <[email protected]>
`schemas/defaults.schema.json` gained a `bindings` section: `bindings.dir`
(`./bindings`) and `bindings.pattern` (`*.binding.yaml`) are canonical
defaults for the first time. `conformance/fixtures/config_key_governance.json`
pins this SDK's default table against that schema, so the two keys are now
required of `CONFIG_DEFAULTS` — three cases in
`test_config_key_governance_conformance` were red without them.
With the entries in place `Config::get("bindings.dir")` resolves the default
through the ordinary precedence chain, which is the tier PROTOCOL_SPEC 5.12.6
clause 1 names. The loader's `DEFAULT_BINDING_DIR` / `DEFAULT_BINDING_PATTERN`
constants are KEPT rather than deleted, and their doc comments now say why:
`load_binding_dir_with_config(None, None, None)` is a supported public
invocation that supplies no `Config` at all, so there is nothing for
`Config::get` to answer from, and synthesising a `Config::from_defaults()`
inside the loader would make that path apply `APCORE_*` overrides its caller
never asked for. The duplication is pinned instead of trusted:
`the_loader_default_matches_the_canonical_default_table` asserts both constants
equal `Config::default_for` for their keys.
`default_applies_when_the_config_declares_no_bindings_section` asserted
`Config::default_for("bindings.dir").is_none()`, a guard that existed to stop
the loader's hardcoded default from being quietly deleted while nothing else
supplied one. v1.36.0 supplies one, so it is inverted rather than dropped: the
key MUST now resolve through the canonical table, to the same value.
Two further tests moved because `bindings.dir` is path-typed AND now defaulted,
so an undeclared key leaves a RELATIVE path-typed value standing in the merged
configuration where it previously left none:
- `path_base_deprecation_tests::write_config` spells `bindings.dir` like its
three siblings, so `stays_silent_when_every_path_typed_value_is_absolute`
is about absolute values rather than about an absent key.
- `absent_sections_are_not_invented` swaps "must be None" for "must differ
from the file's value" on the two keys that now have a default underneath,
which is the discriminator `test_config_load_sections.rs` already uses. The
fixture's `bindings.pattern` was `*.binding.yaml` — identical to the new
canonical default, so every assertion about it would have passed on a
reader that ignored the file; it is now `*.bind.yaml`.
Refs aiperceivable/apcore#114
Refs aiperceivable/apcore#115
Signed-off-by: tercel <[email protected]>
… site
§9.2.2 now fixes the cadence: every load satisfying both conditions emits,
and implementations MUST NOT suppress the warning with process-global state.
Determined empirically rather than assumed. This SDK never wrote a
once-per-process flag; `warnings.warn` supplied one. Under the "default"
filter action the machinery records (message text, category, lineno) in the
calling frame's `__warningregistry__` and drops a repeat.
The obvious test does not detect it. Two DIFFERENT affected configurations
produce two different message texts — the message embeds the project root and
the working directory — so they land on different registry keys and both warn,
before and after this change. `test_two_different_configurations_both_warn` is
kept because §9.2.2 asks for it, and it passes on the unfixed code.
What WAS suppressed is the case §9.2.2 names in the same breath: the same
document loaded again from the same source line — "a reload that re-reads an
edited file", which SHOULD re-evaluate — and its production form, every caller
after the first of an application's own `load_config()` wrapper, since the
registry key is the wrapper's line rather than the caller's. Both are new
tests, and both run under `simplefilter("default")`; the file's existing
`_deprecation_warnings` helper uses "always", under which there is nothing to
detect, which is why the defect survived the first driver.
Fixed with `warnings.warn_explicit` and no registry: the machinery allocates a
throwaway dict for the call, so no de-duplication state survives it, while
every filter the host set still applies — `-W error` raises, `-W ignore`
silences, `catch_warnings(record=True)` records. `simplefilter` inside a
`catch_warnings` block was rejected: it would override the operator's own
choice for the duration of a load. Nothing is mutated at import time, and a
subprocess probe pins that.
Reversal check: restoring the frame registry turns 2 of the new cases red.
Refs aiperceivable/apcore#113
Signed-off-by: tercel <[email protected]>
….6 cl. 5) Clause 5 is new in spec v1.36.0: a resolved binding directory that does not exist MUST raise, naming that directory, and MUST NOT return an empty result. This SDK already raised, and already named the directory, so the requirement was met — but the reason read "Directory does not exist" inside a message whose template is "Invalid binding file '<path>'", which described a directory as a file. Now "Resolved binding directory does not exist". The error code, the file_path detail and the raise itself are unchanged. Verified on all three provenances the clause names rather than on the one that had a test. The existence check sits after resolution and cannot see which tier won, so the property holds structurally; the tests pin it anyway, because the `./bindings` default is the branch that fires for a project which configured nothing, and that is the population an implementation checking only inside the config branch would hand a silent empty result. Since v1.36.0 that default arrives by two routes — the loader's own last tier and the merged default table — and both are covered. Refs aiperceivable/apcore#114 Signed-off-by: tercel <[email protected]>
…rides
Two spec v1.36.0 changes to the configuration merge, both apcore#115.
`schemas/defaults.schema.json` gained the `bindings` section it never had, so
`DEFAULTS` gains `bindings.dir: './bindings'` and
`bindings.pattern: '*.binding.yaml'` — twenty canonical defaults, pinned key
for key against the canonical schema by config_key_governance.json. Until now
the `./bindings` default was unreachable from the mechanism meant to serve it:
`config.get('bindings.dir')` answered undefined for a key the spec gives a
canonical value.
`loadBindingDir` keeps its own `'./bindings'` / `'*.binding.yaml'` literals
deliberately. Its `config` parameter is optional and structurally typed
(`BindingConfigLike`), so a loader invoked with no configuration has nothing to
read the default from; the literals are its last-resort tier, not a duplicate
of the table, and both no-Config paths are already pinned by test.
§9.2.1 requirement 5: an empty string is not a path. `export APCORE_ACL_ROOT=`
and a variable inherited empty from a container spec are both *set* to the
tooling, so `''` won the top precedence tier and silently blanked a directory
the configuration file correctly declared — then resolved to the working
directory, `''` being a legal relative path every filesystem API accepts. The
value is now discarded in `applyEnvOverrides`, where the override is applied,
and resolution falls through as if the variable were unset. Driven by
`Config.pathTypedKeys()` so it covers the whole closed set at once rather than
the `bindings.dir`-only defence `src/bindings.ts` carried; a key added to
§9.2.1 later needs no consumer to remember it. `bindings.pattern` is the
deliberate near-miss and is untouched: it is explicitly not path-typed.
Refs aiperceivable/apcore#115
Signed-off-by: tercel <[email protected]>
PROTOCOL_SPEC §9.2.2 requirement 2 (spec v1.36.0) fixes the cadence of the project-root deprecation notice at once per configuration load and states that implementations MUST NOT suppress it with process-global state. v1.35.0 required the warning but not its cadence, and the three SDKs invented three. This SDK's `_projectRootDeprecationWarned` was exactly the forbidden global. It made emission order-dependent: in a process that loads several configurations, whichever load ran first consumed the warning, so a later affected document was silent and the operator could not tell which one triggered it. The same global was a test-isolation hazard — one test consuming the warning another test needed — which is why it needed a reset hook at all. The flag and `_resetProjectRootDeprecationWarned()` are both removed; neither was ever released. The notice is a property of the document being loaded, so every load satisfying both narrowing conditions emits it and a load that does not is silent. A `reload()` that re-reads an edited file re-evaluates and may legitimately warn again. De-duplication for log volume is the host logging layer's job. Three test suites called the hook in setup or teardown and no longer do. The new coverage is the case the flag made impossible: two DIFFERENT affected configurations loaded in one process, each producing its own notice naming its own relative key and its own directory. `acl.root` is unusable as the discriminator there — the notice's own prose names it when explaining today's inconsistent bases — so the two documents differ on `schema.root` and `extensions.root`. Refs aiperceivable/apcore#113 Signed-off-by: tercel <[email protected]>
… it.fails bindings_dir_resolution.json is now nine cases. The root `binding_file` singular is replaced by `binding_files`, a NAME -> descriptor map whose entries carry DISTINCT module ids, so the driver no longer has to derive a module id from the file stem to keep the precedence cases discriminating — that reading, and the `target_id` -> `target` rewrite shim, are both deleted. The field is `target`, per §5.12.2 as corrected. One rewrite remains and is reported in the header: `fixture_targets:greet` is a placeholder module path and this SDK resolves targets by dynamic import, so the driver writes a real ESM module for it — one PER BINDING FILE, whose `greet` returns that file's own layout path. The pattern cases need that: both `greet.bind.yaml` and `decoy.binding.yaml` name the `greet` descriptor, so module id alone cannot separate a configured pattern from the default one, and the loaded module's behaviour now names the file it came from. New case `env_var_must_not_be_read_directly_at_the_loader` covers §5.12.6 clause 2, which had no case at all. Its `env_set_after_config_load` variables are stubbed AFTER `Config.discover()` returns and BEFORE the loader runs, per the driver_contract. Verified discriminating: reintroducing a raw `process.env.APCORE_BINDINGS_DIR` read at the loader turns this case red and leaves the other eight green, which is exactly the fixture's claim about it. `missing_configured_dir_is_not_an_error` became `missing_configured_dir_raises` under clause 5, which is this SDK's behaviour, so the it.fails and the pinned divergence beside it are both gone. Clause 5 also requires the message to NAME the resolved directory for all three provenances; the fixture case covers `bindings.dir` only, so tests/test-bindings-config-dir.test.ts gains the explicit-argument and no-op-return legs beside its existing default-provenance test. All three go red when the message stops naming the directory. config_project_root.json's tier 6/7 cases now use `<tier6_config>` / `<tier7_config>` in fs and `<tier6_dir>` / `<tier7_dir>` in expected, with `layout.home` naming the directory HOME is redirected to; the hardcoded POSIX XDG spelling that broke every driver on macOS is gone. The driver resolves the tokens to the running platform's §9.14 locations, still spelled out locally rather than imported from `userLevelConfigPaths()` so the assertion cannot agree with the code by construction. `no_warning_when_all_path_values_absolute` now spells every §9.2.1 key absolutely and is satisfiable, so its it.fails is deleted along with the green-beside-it duplicate that carried the case's intent; the case is driven verbatim, with an added check that every key in the closed set really is absolute in the MERGED view. Neither driver resets warning state any more — §9.2.2 forbids the process-global flag that made that necessary. Both drivers now assert their fixture's case count, so an upstream addition cannot be silently ignored. Refs aiperceivable/apcore#113 Refs aiperceivable/apcore#114 Signed-off-by: tercel <[email protected]>
Spec v1.36.0 repaired four defects the first drivers found. Every one is closed on the FIXTURE side; no SDK behaviour changed to make an xfail pass. bindings_dir_resolution.json (8 -> 9 cases): * the root `binding_file` singular is now `binding_files`, a NAME -> descriptor map, and each `fs` value names a descriptor. The descriptors carry DISTINCT module ids, so a case planting files in two candidate directories can tell which one was enumerated; with one shared id such a case passed whichever directory won. The driver's filename-stem convention, which existed only to manufacture that distinctness, is deleted, and `test_descriptors_carry_distinct_module_ids` pins the property directly for every multi-directory case. * the descriptor field is `target`, per the corrected §5.12.2, so the `target_id` -> `target` rewrite shim and its xfail are gone. Only the placeholder target MODULE is still substituted — the spec repo ships no `fixture_targets` — and a new case loads every descriptor through the loader to prove that substitution is the only difference. * `missing_configured_dir_is_not_an_error` is now `missing_configured_dir_raises`, expecting BINDING_FILE_INVALID and a message naming the resolved directory. §5.12.6 stated no outcome before, which is why the divergence was an xfail rather than a bug; clause 5 states one and it is what this SDK already did. Driven as an ordinary case, asserting both halves. * NEW case `env_var_must_not_be_read_directly_at_the_loader`, the only coverage clause 2 has ever had. Its `env_set_after_config_load` variables are applied between the Config construction and the loader call, so the merged Config holds the file value while the raw environment holds another — the one shape that distinguishes a loader reading §9.2's merged view from one reading os.environ itself. config_project_root.json (14 cases, tiers 6/7 repaired): * tier 6/7 now use `<tier6_config>` / `<tier7_config>` in `fs` and `<tier6_dir>` / `<tier7_dir>` in `expected`, with `layout.home` naming the directory HOME is redirected to. The driver already did the platform mapping, so its prefix-translation special case collapses into two token tables. §9.14 tier 6 is XDG on Linux and ~/Library/Application Support on macOS; the fixture's old literal POSIX path failed every driver on macOS while asserting nothing extra on Linux. * `no_warning_when_all_path_values_absolute` now spells every §9.2.1 key absolutely and is satisfiable, so its xfail and the companion test recording the divergence's shape are both deleted. The case had pinned only schema.root and acl.root while §9.2.2's condition counts the §9.1.1 defaults too, so extensions.root stayed relative and this SDK correctly warned. The driver now also asserts that NO path-typed value is relative in the merged view, so the absent warning is the second condition failing rather than a coincidence. All three drivers now assert the canonical case count (9 / 14 / 7), so an upstream addition is a named failure and not a quietly smaller run. `conformance/check_driver_coverage.py --strict` in the spec repo still reports 72 fixtures, 0 gaps. Refs aiperceivable/apcore#113 Refs aiperceivable/apcore#114 Refs aiperceivable/apcore#115 Signed-off-by: tercel <[email protected]>
….2.1 r5) PROTOCOL_SPEC 9.2 counts a *set but empty* `APCORE_*` variable as an override, so `export APCORE_ACL_ROOT=` — and a variable inherited empty from a container spec, which is the same thing to the tooling — blanked out a directory the configuration file correctly declared. The `""` that replaced it is a legal relative path to every filesystem API and resolves to the working directory, so nothing errored and nothing reported a difference: the config said `./acl` and the process looked in `.`. The same shape is on record for `APCORE_CONFIG_FILE` (apcore#88), where an empty value injected a phantom `config.file` key; the path-typed keys are the population where it fails silently rather than loudly. Spec v1.36.0 adds 9.2.1 requirement 5: an empty path-typed value MUST be discarded and resolution MUST fall through to the next tier, exactly as if the variable had been unset, and MAY log a warning naming the key. Both are now done. Applied at the ONE point an environment tier becomes a configuration value: `Config::apply_one_env_override`, which every `set()` in both `apply_env_overrides` (legacy) and `apply_namespace_env_overrides` (global env_map, namespace env_map, prefix dispatch and the unmatched-prefix fallback) now routes through. Applying it per consumer is the arrangement that produced the defect — `ACL::discover` and `SchemaLoader` each decide what to do with an empty root, and a consumer added tomorrow decides again. The guard is scoped to `Config::path_typed_keys()` and nothing wider. An empty `APCORE_LOGGING_LEVEL` is a value an operator can mean, and 9.2.1 confines the requirement to the closed path-typed set precisely because `""` is meaningless only there. `bindings.pattern` is the sharpest case: same config section as `bindings.dir`, reads like a path, and 9.2.1 requirement 4 says outright that it is not one — an implementation guarding by section, or by "looks like a path", fails the test that pins it. Six tests in `tests/config_discovery.rs`, which already serialises `APCORE_*` mutation in its own `[[test]]` binary: fall-through to the file tier, to the canonical default tier, across EVERY key in `path_typed_keys()`, the two not-path-typed negatives, and the warning naming both the key and the variable. Reversing the guard turns 4 of the 6 red. Refs aiperceivable/apcore#114 Signed-off-by: tercel <[email protected]>
… test
This SDK already emits the 9.2.2 deprecation warning once per configuration
load. That was a local judgement call when it was written — v1.35.0 required
the warning and its two narrowing conditions but said nothing about cadence,
and the three SDKs promptly invented three (Python deduplicating through the
`warnings` filter, TypeScript holding a module-global once-flag, Rust warning
per load).
Spec v1.36.0 adopts this SDK's reading and makes it normative: ONCE PER
CONFIGURATION LOAD, never once per process, and implementations MUST NOT
suppress the warning with process-global state. The doc comment on
`warn_if_path_resolution_will_change` now cites that clause as the source
rather than arguing the point locally, and keeps the two reasons the spec gives:
a once-per-process flag makes emission order-dependent, so a later affected
document is silent and the operator cannot tell which one triggered it, and the
same global is a test-isolation hazard. De-duplication for log volume belongs
to the host logging layer.
The behaviour was unpinned in the direction that matters. A once-per-process
flag passes every existing single-load assertion in this module — the first
load warns, which is all any of them observe; it is the SECOND affected
document that goes silent. Two tests close that:
- `two_affected_configurations_in_one_process_both_warn` loads two DIFFERENT
affected documents and requires each warning to name its own project root,
so a second warning that were a replay of the first fails too.
- `an_unaffected_configuration_between_two_affected_ones_stays_silent` pins
the same cadence from the other side: a document meeting neither condition
emits nothing and disturbs neither neighbour, and re-reading the affected
document warns again, which is 9.2.2's "a reload SHOULD re-evaluate".
Introducing a process-global once-flag turns 3 of this module's 6 tests red.
Refs aiperceivable/apcore#113
Signed-off-by: tercel <[email protected]>
Spec v1.36.0 rebuilt this fixture around the defects the first drivers found (apcore#114, #115). Eight cases became nine and every structural assumption the driver made about it moved: - `binding_file` (one shared descriptor) is now `binding_files`, a NAME -> descriptor map, and each `fs` value NAMES one of them. The descriptors carry DISTINCT `module_id`s, which is what `env_overrides_config_file_dir` needed: with one shared id it reported `["greet"]` whichever directory was scanned, so the case that exists to pin env-over-file precedence could not detect an implementation ignoring the env tier. The driver reads each descriptor's declared `module_id` instead of deriving one from the file name. - The descriptor's target field is `target`, not `target_id`. Section 5.12.2 declared `target_id` a MUST while the canonical schema, both fixtures and all three SDK loaders used `target`; v1.36.0 corrected the spec. The driver's key-rewriting step is gone — descriptors are written verbatim, so a regression in this SDK's own parser can no longer be hidden by the driver repairing the file on its way to disk. - NEW case `env_var_must_not_be_read_directly_at_the_loader` covers 5.12.6 clause 2, which had no case at all: an implementation reading the raw `APCORE_BINDINGS_DIR` satisfied every other case in the fixture. Its `env_set_after_config_load` variables are set AFTER `Config::load` returns and before the loader runs, which is what separates a loader reading the merged Config from one reading the environment. Patching the loader to read the variable directly turns this case red, so it discriminates. - `missing_configured_dir_is_not_an_error` is now `missing_configured_dir_raises`, expecting `BINDING_FILE_INVALID` and `error_message_names_resolved_dir`. 5.12.6 clause 5 settled the divergence in this SDK's favour, so the `#[ignore]`d case and the companion test that pinned the divergence both go, and the case is driven in the main loop. DIVERGENT is now empty. This SDK has no remaining divergence from this fixture. Clause 5 says the raise holds for all THREE provenances and the fixture can state only one, so `clause_5_raises_and_names_the_directory_for_every_provenance` covers the other two: an explicit argument, `bindings.dir`, and the `./bindings` default reached both with and without a `Config`. Each must raise `BINDING_FILE_INVALID` AND name the resolved directory, so the tier that supplied it is readable from the error alone. Removing the directory name from the loader's message turns that test and the fixture case red. Added an unknown-`expected`-key guard matching the one the sibling driver has for `fs` kinds, so a fixture that grows an expectation fails loudly instead of passing on the subset this driver happens to assert. Refs aiperceivable/apcore#114 Refs aiperceivable/apcore#115 Signed-off-by: tercel <[email protected]>
…te case
Spec v1.36.0 repaired two things this driver worked around (apcore#113).
Tier 6 and tier 7 are no longer spelled literally. Section 9.14 states tier 6 is
platform-varying — `~/.config/apcore` on Linux, `~/Library/Application Support`
on macOS — so the fixture's hardcoded POSIX path made every driver fail on macOS
while asserting nothing extra on Linux. The cases now carry `<tier6_config>` /
`<tier7_config>` in `fs` and `<tier6_dir>` / `<tier7_dir>` in `expected`, with
`layout.home` naming the directory to redirect HOME to, and the driver
materialises each at the RUNNING platform's location. The one-way `translate()`
that patched the fixture's tier-6 spelling on macOS is replaced by a
`layout_path` resolver every path in the fixture goes through — `fs` keys,
`expected` values, `layout.dirs`, the case `cwd` and the `APCORE_CONFIG_FILE`
selector alike. An unrecognised `<...>` token is a hard failure rather than a
fall-through to `root.join("<token>")`, which would silently create a directory
named after the token and pass.
`the_tier_tokens_resolve_where_discovery_looks` pins the resolution against the
SDK rather than against the driver's own arithmetic. Both tier cases assert
`project_root == cwd`, which is ALSO what a driver bug produces: a config file
written where nobody looks is not found, discovery falls back to
`from_defaults()`, and the project root is CWD. The new test writes each tier
file at the resolved location and requires `Config::discover()` to select it.
`no_warning_when_all_path_values_absolute` is satisfiable now. As first
published it spelled only `schema.root` and `acl.root` absolutely and left
`extensions.root` and `bindings.dir` at their relative 9.1.1 defaults, which
9.2.2's target semantics count — so the case's own precondition
(`relative_path_typed_values_present: false`) was not established by the config
it wrote and the warning correctly fired. The case now spells every 9.2.1 key
absolutely, so the `#[ignore]`d case is driven in the main loop and DIVERGENT is
empty. This SDK has no remaining divergence from this fixture.
The hand-written `no_warning_when_every_path_typed_value_is_genuinely_absolute`
stand-in is removed with it: it existed solely because the divergence left
requirement 2's second negative unasserted, and the repaired fixture case now
asserts exactly what it did.
Refs aiperceivable/apcore#113
Signed-off-by: tercel <[email protected]>
Three user-visible changes and one that is not. The `bindings` default table is Added, with the consequence spelled out: `bindings.dir` is path-typed, so a configuration that leaves it undeclared now carries a relative path-typed value where it previously carried none, and can newly emit the 9.2.2 deprecation warning. The empty-path-typed environment override is Fixed. The 9.2.2 warning cadence and the three conformance drivers are Changed — the cadence entry notes that behaviour did not move, only its status from local choice to normative. Signed-off-by: tercel <[email protected]>
… and action fields Signed-off-by: tercel <[email protected]>
…mance Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
…ency Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
PROTOCOL_SPEC v1.37.0 §9.2.3. Four sites reached for whichever matcher Python happened to offer, and each inherited that library's dialect (#116, #117): - bindings.py used Path.glob — which expands character classes A25 does not have, and whose `*` does not cross a separator, though the pattern is matched against a FILENAME. - sensitive_keys used fnmatch and treated `[` as a glob trigger, so `[!p]assword` was read as a negated class. Under §10.6.1 it contains no `*` or `?` and is therefore a plain substring. - event patterns and path_filter used fnmatch, where `[em]` is a class. New apcore.utils.pattern.match_glob (A25), verified exhaustively against a reference implementation over the `*`/`?` alphabet. It is deliberately separate from match_pattern (A08): §9.2.3 requirement 5 gives the reason, and §6.2.2 closes the one place they could be confused — an ACL pattern containing `?` can never match a module ID, so ACL.load() now warns and validate_rules() reports it, with the decision unchanged. Also: an uncompilable obs.redaction.regex_patterns entry was swallowed by a bare `except re.error: continue` that re-failed on every log line and said nothing, leaving an operator-authored redaction rule that redacts nothing — indistinguishable, from the outside, from one that works. It is now compiled once and reported once (§9.2.3 req 6d). Drivers for the new glob_matching.json fixture and for the discriminating cases added to four existing fixtures. 5483 passed, 37 skipped, 5 xfailed; ruff clean. Refs aiperceivable/apcore#116, aiperceivable/apcore#117 Signed-off-by: tercel <[email protected]>
PROTOCOL_SPEC v1.37.0 §9.2.3. Four sites each answered "what is a glob?" locally, and each answered differently from the other two SDKs (#116, #117): - bindings.ts collapsed the pattern with `replace('*','')` and compared suffixes. That deletes the star WHEREVER it sits, so `a*b.yaml` became `ab.yaml` and `endsWith` accepted `zab.yaml` — a file an anchored pattern cannot reach and one the other two SDKs correctly ignore. The failure loaded a file nobody asked for, which is the worse direction. - context-logger.ts translated a sensitive_keys entry into a RegExp and passed `[...]` through VERBATIM, so `[!p]` meant "`!` or `p`" instead of "not `p`": `[!p]assword` redacted `password` — the one field the other two deliberately exclude — and leaked `bassword`, which they catch. Inverted, not weakened. - retry.ts had its own glob-to-RegExp translation for event types. It happened to agree with A25, but "happened to" is not a contract. - control.ts matched path_filter with A08, where `?` is a literal, so `executor.?mail.*` reloaded nothing while Python and Rust reloaded two modules — silent, because a zero-match filter is a no-op. New matchGlob (A25) in utils/pattern, checked against all 30 cases of the canonical glob_matching.json fixture. Kept separate from matchPattern (A08) per §9.2.3 requirement 5; §6.2.2's diagnostic for a `?` in an ACL pattern is implemented in acl.ts, load-time warning and validateRules() finding, with no decision changed. An uncompilable obs.redaction.regex_patterns entry no longer becomes `/(?!)/` in silence — a regex that can never match, indistinguishable from a rule that works, on the surface where the consequence is plaintext credentials. It warns once and is dropped (§9.2.3 req 6d). Programmatically supplied string patterns now compile through the same path, so the `i` flag no longer depends on which door they arrived by. 197 test files, 4736 passed, 43 skipped; tsc, build and typecheck:examples clean. biome output is byte-identical to main. Refs aiperceivable/apcore#116, aiperceivable/apcore#117 Signed-off-by: tercel <[email protected]>
…atterns entry PROTOCOL_SPEC 9.2.3 requirement 6d: a redaction pattern the engine cannot compile MUST be reported, not skipped at the first log record. The diagnostic added in the previous commit fires at use; this is the deploy-time half, so a rule that redacts nothing is visible before it matters rather than never. Note the asymmetry the requirement is written around: Python's engine accepts lookaround and backreferences, so this check reports almost nothing here — it is the Rust and JavaScript engines that reject the portable-looking patterns, and each SDK reports what ITS engine cannot compile. Requirement 6c (the portable subset) is the author-facing half. Refs aiperceivable/apcore#117 Signed-off-by: tercel <[email protected]>
…atterns entry PROTOCOL_SPEC 9.2.3 requirement 6d — the deploy-time half of the diagnostic. JavaScript is the engine that rejects the inline (?i) flag the other two accept, so a configuration that redacts correctly in Python and Rust and does nothing here is now named at validate() rather than never. Refs aiperceivable/apcore#117 Signed-off-by: tercel <[email protected]>
PROTOCOL_SPEC v1.37.0 §9.2.3. Four sites reached for whichever matcher was locally at hand, and each inherited that library's dialect (#116, #117): - bindings.rs stripped a LEADING `*` and compared with `ends_with`, so `data*.yaml` — an ordinary glob — matched nothing here while apcore-python matched one file. - redaction.rs compiled sensitive_keys entries to `glob::Pattern` and lower-cased only the KEY, never the pattern. `"*Token*"`, or any capitalised spelling, was therefore a valid pattern that matched nothing: redaction in Python and TypeScript, PLAINTEXT here, with no warning. Note the shape — `*key*` DOES match `API_KEY` in all three, since the lowered key is also tried, so only an uppercase pattern exposes it. `glob::Pattern` also read `[!p]` as a negated class, which A25 does not have. - events/subscribers.rs and events/emitter.rs each had a local `*`-only matcher. exclude_events FAILS OPEN, so a subscriber excluding `secret.?vent` received it here and discarded it elsewhere. - sys_modules/control.rs matched path_filter with `glob::Pattern`, which REJECTS `a[b` and `a**b` — so a control-plane request the other two SDKs served was refused here. New utils::helpers::match_glob (A25), char-based so `?` matches one character rather than one UTF-8 byte, checked against all 30 cases of the canonical glob_matching.json fixture. Kept separate from match_pattern (A08) per §9.2.3 requirement 5; §6.2.2's diagnostic for a `?` in an ACL pattern is added in acl.rs, load-time warning and validate_rules() finding, with no decision changed. `RedactionConfigError::InvalidFieldPattern` is removed: §9.2.3 requirement 2 makes every string a valid pattern, so a field pattern has no failure mode left. Config::validate() now reports an uncompilable obs.redaction.regex_patterns entry (§9.2.3 req 6d) — the `regex` crate is the engine that refuses lookaround and backreferences, so this fires on exactly the configuration that redacts in the other two SDKs and silently does nothing here. The event conformance driver looked cases up by name, so the three new fixture cases would have run nowhere and nothing would have gone red. It gains a guard that fails by name when the fixture grows. 2746 tests passed; clippy --all-targets --all-features -D warnings clean; cargo fmt clean. Refs aiperceivable/apcore#116, aiperceivable/apcore#117 Signed-off-by: tercel <[email protected]>
`schemas/sys-modules.schema.json` declares them key by key — "Whether system.health.summary and system.health.module are registered", and so on — and PROTOCOL_SPEC 9.15.3 (v1.17.0) states the split: the master switch activates the section, the per-group flags select which modules register once activation has happened. All four default to true, so a flag narrows and never widens. None of them was read by any code path (apcore#118). Measured before the fix: all four false and all four true both registered the same six system.* modules, while the master switch worked — a half-alive section, which is why a smoke test of it passes and why this survived. `control.enabled` is the consequential one. It gates the Level 2 WRITE plane (PROTOCOL_SPEC 6.7): the three approval-gated `system.control.*` modules. An operator writing `control.enabled: false` to keep that surface off a deployment had expressed exactly the intent the key exists for, and got all three modules anyway. Measured after: 9 modules with everything on, 6 with control off and zero `system.control.*`, and exactly the two health modules with manifest, usage and control off. Refs aiperceivable/apcore#118 Signed-off-by: tercel <[email protected]>
`schemas/sys-modules.schema.json` declares them key by key — "Whether system.health.summary and system.health.module are registered", and so on — and PROTOCOL_SPEC 9.15.3 (v1.17.0) states the split: the master switch activates the section, the per-group flags select which modules register once activation has happened. All four default to true, so a flag narrows and never widens. None of them was read by any code path (apcore#118). Measured before the fix: all four false and all four true both registered the same six system.* modules, while the master switch worked — a half-alive section, which is why a smoke test of it passes and why this survived. `control.enabled` is the consequential one. It gates the Level 2 WRITE plane (PROTOCOL_SPEC 6.7): the three approval-gated `system.control.*` modules. An operator writing `control.enabled: false` to keep that surface off a deployment had expressed exactly the intent the key exists for, and got all three modules anyway. Measured after: 9 modules with everything on, 6 with control off and zero `system.control.*`, and exactly the two health modules with manifest, usage and control off. Refs aiperceivable/apcore#118 Signed-off-by: tercel <[email protected]>
`schemas/sys-modules.schema.json` declares them key by key — "Whether system.health.summary and system.health.module are registered", and so on — and PROTOCOL_SPEC 9.15.3 (v1.17.0) states the split: the master switch activates the section, the per-group flags select which modules register once activation has happened. All four default to true, so a flag narrows and never widens. None of them was read by any code path (apcore#118). Measured before the fix: all four false and all four true both registered the same six system.* modules, while the master switch worked — a half-alive section, which is why a smoke test of it passes and why this survived. `control.enabled` is the consequential one. It gates the Level 2 WRITE plane (PROTOCOL_SPEC 6.7): the three approval-gated `system.control.*` modules. An operator writing `control.enabled: false` to keep that surface off a deployment had expressed exactly the intent the key exists for, and got all three modules anyway. Measured after: 9 modules with everything on, 6 with control off and zero `system.control.*`, and exactly the two health modules with manifest, usage and control off. Refs aiperceivable/apcore#118 Signed-off-by: tercel <[email protected]>
PROTOCOL_SPEC 5 requires the streaming deep-merge depth to be capped and calls 32 "the canonical default" — wording that implies an override. There was none. `stream.max_merge_depth` is declared in all three key surfaces and carries a canonical default of 32 in defaults.schema.json, and no code path read it (apcore#118): the module constant WAS the contract. Measured before the fix: with the key set to 4, a depth-10 merge still recursed and only depth-33 reached the cap. A non-positive or non-integer value falls back to 32 rather than disabling the cap. The cap exists to prevent stack exhaustion from adversarial chunk shapes, so a misconfiguration must not remove it — which is the one direction this change must not open. Resolved ONCE per stream, not per chunk, so a configuration mutated mid-stream cannot change the cap of a stream already in flight. Existing public entry points keep their signatures and the canonical default, so every current caller — tests and the conformance driver included — is unaffected. Refs aiperceivable/apcore#118 Signed-off-by: tercel <[email protected]>
…ncurrency tests Signed-off-by: tercel <[email protected]>
…delay and deadlock protection Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
…nges Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
Add binding `resources` support and make MODULE_TIMEOUT retryable only for idempotent modules. Refresh Cargo.lock dependencies.
- Add a first-class `resources` block (timeout in ms) to `APCore.module()`, `FunctionModule`, and binding files so declared budgets reach the executor. - Only mark MODULE_TIMEOUT retryable when the module declares `annotations.idempotent`. - Regenerate `uv.lock` against the current dependency graph. Signed-off-by: tercel <[email protected]>
Declare resources.timeout (ms) on modules and bindings, and read it from annotations.extra.resources too, so a declared budget no longer silently falls back to default_timeout. MODULE_TIMEOUT is retryable only for idempotent modules. Bump runtime deps, move to vitest 5.1, and release 0.33.0.
Release the async registry read guard before falling back to the sync registry, preventing lock-order deadlocks during async condition evaluation. Add a regression test with the sync registry write-locked.
Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
Signed-off-by: tercel <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Python, Rust, and TypeScript runtime SDKs currently live in separate repositories. Import their existing histories into the protocol repository and make the SDK test jobs exercise the schemas and conformance cases in the same checkout.
The package names, versions, runtime sources, dependency declarations, and public entry points are preserved. The import commits retain the original source heads. Old repository and release links are listed in
migration/sources.tsv.Validation includes the core fixture inventory, standalone wheel/crate/npm packaging, all 15 release tag dry-runs, and downstream smoke tests from the candidate distributions. The original apflow tests passed with all five Python wheels, apexe passed its OpenAPI suites with all five crates, and Hono passed the Edge checks with the core and toolkit npm tarballs.
The companion repository is
aiperceivable/apcore-surfaces. Registry publication, documentation cutover, and old repository retirement are separate steps.Downstream compatibility
The original adapter test suites ran in isolated checkouts against the migration distributions. Package resolution was verified before running the tests.
Cargo also built a minimal Toolkit consumer against both the legacy Git URL and the corresponding source in
apcore-surfaces. The contribution guide now directs SDK changes and their conformance tests to the same pull request.