id: 1c-designer-sql-decoding-policy
status: active
summary: "The adapter is a SQL codec only: it decodes and encodes strictly by the live-SQL-derived, versioned configuration-storage specification. In an explicitly authorised test base it may write only verified configuration saved-state overlays. It never invents 1C structure, BSL, or integrity atoms, and never writes active configuration or application data."

scope:
  default_base_id: upo_test
  allowed_base_class: disposable_test
  forbidden_base_class: [production, unclassified]
  platform_mutation_authority:
    application_data: 1c_enterprise_client
    active_configuration: 1c_designer
    metadata_saved_state: adapter_sql_only_with_verified_codec
  adapter_role: specification_bound_sql_decoder_and_controlled_saved_state_writer
  fundamental_rule: "Unknown, incomplete, or ambiguous structure returns explicit evidence and unsupported/partial/ambiguous; no guessed decoding or encoding is permitted."

credentials:
  persistence: forbidden_in_repository
  accepted_sources: [process_environment, operating_system_credential_store, interactive_session]
  rules:
    - "Do not put 1C user passwords, SQL passwords, tokens, or connection strings containing secrets in project files, reports, fixtures, or command examples."
    - "Redact credentials from process reports and captured command lines."

experiment:
  isolation: one_intended_change_per_run
  required_phases:
    - identify_public_1c_target
    - capture_sql_before
    - change_through_1c
    - save_in_1c
    - capture_sql_after
    - diff_sql
    - decode_semantic_rule
    - verify_with_second_value_or_object
    - rollback_through_1c
    - verify_rollback_in_sql
  target_selectors: [public_ref, kind_and_name, form_and_element_name, record_ref]
  forbidden_selectors_for_callers: [sql_number, physical_table, internal_guid_only]

sql_observation:
  adapter_access: sql_only
  allowed: [SELECT, metadata_schema_inspection, ConfigSave_read, ConfigCASSave_read, application_table_read]
  forbidden:
    - direct_application_data_write
    - direct_Config_write
    - direct_ConfigCAS_write
    - sql_identity_or_permission_change
    - trigger_or_profiler_installation
  rule: "For production and unclassified bases SQL is evidence only. In the explicitly authorised disposable base, SQL writes are limited to ConfigSave/ConfigCASSave after a proven lossless codec, exact preconditions, atomic paired-file update, backup, and readback verification."

saved_state_write:
  allowed_base_id: upo_test
  allowed_tables: [ConfigSave, ConfigCASSave]
  forbidden_tables: [Config, ConfigCAS]
  required:
    - "Resolve the target by live public-name evidence; do not require callers to supply a physical selector."
    - "Read and hash every target byte stream before writing."
    - "Use an exact, unique edit anchor or a proven offset/path selector; otherwise return an ambiguity error."
    - "For extension saved-state, update the changed payload and the matching __configinfo file-SHA1 reference atomically."
    - "Preserve unproven service atoms byte-for-byte; never generate a value by guesswork or randomness."
    - "Create rollback evidence and verify SQL readback after commit."
    - "Return Configurator refresh guidance based on whether the object existed in saved-state before the write."

metadata_layers:
  designer_save:
    observe: [ConfigSave, ConfigCASSave]
    apply_configuration: false
  applied_configuration:
    observe: [Config, ConfigCAS, physical_schema]
    gate: explicit_experiment_requirement
  extensions:
    rule: "Capture the base and every extension as separate layers and record load order and ownership."

xml:
  role: offline_schema_reference_only
  runtime_source: forbidden
  rule: "XML may name the intended property and validate a learned rule, but live before/after evidence must come from SQL."

promotion_gates:
  - "The SQL diff is isolated from pre-existing Designer and configuration-check noise."
  - "A stable public 1C property or value name is resolved without requiring callers to know GUIDs or SQL numbers."
  - "The rule is reproduced with a second value or a second object of the same shape."
  - "A regression fixture and decoder test are added."
  - "Rollback through 1C restores the SQL evidence or the experiment documents an irreversible schema migration."
